Skip to content

Commit df41565

Browse files
pebolleJens Axboe
authored andcommitted
block: rename the return of two functions
If we rename the return of alloc_io_context() and get_io_context() from "ret" to "ioc" the code get's (a bit) more readable and (a lot) more grepable. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent 8aea454 commit df41565

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

‎block/blk-ioc.c‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,26 @@ void exit_io_context(struct task_struct *task)
8282

8383
struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
8484
{
85-
struct io_context *ret;
85+
struct io_context *ioc;
8686

87-
ret = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node);
88-
if (ret) {
89-
atomic_long_set(&ret->refcount, 1);
90-
atomic_set(&ret->nr_tasks, 1);
91-
spin_lock_init(&ret->lock);
92-
ret->ioprio_changed = 0;
93-
ret->ioprio = 0;
94-
ret->last_waited = 0; /* doesn't matter... */
95-
ret->nr_batch_requests = 0; /* because this is 0 */
96-
INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH);
97-
INIT_HLIST_HEAD(&ret->cic_list);
98-
ret->ioc_data = NULL;
87+
ioc = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node);
88+
if (ioc) {
89+
atomic_long_set(&ioc->refcount, 1);
90+
atomic_set(&ioc->nr_tasks, 1);
91+
spin_lock_init(&ioc->lock);
92+
ioc->ioprio_changed = 0;
93+
ioc->ioprio = 0;
94+
ioc->last_waited = 0; /* doesn't matter... */
95+
ioc->nr_batch_requests = 0; /* because this is 0 */
96+
INIT_RADIX_TREE(&ioc->radix_root, GFP_ATOMIC | __GFP_HIGH);
97+
INIT_HLIST_HEAD(&ioc->cic_list);
98+
ioc->ioc_data = NULL;
9999
#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
100-
ret->cgroup_changed = 0;
100+
ioc->cgroup_changed = 0;
101101
#endif
102102
}
103103

104-
return ret;
104+
return ioc;
105105
}
106106

107107
/*
@@ -139,19 +139,19 @@ struct io_context *current_io_context(gfp_t gfp_flags, int node)
139139
*/
140140
struct io_context *get_io_context(gfp_t gfp_flags, int node)
141141
{
142-
struct io_context *ret = NULL;
142+
struct io_context *ioc = NULL;
143143

144144
/*
145145
* Check for unlikely race with exiting task. ioc ref count is
146146
* zero when ioc is being detached.
147147
*/
148148
do {
149-
ret = current_io_context(gfp_flags, node);
150-
if (unlikely(!ret))
149+
ioc = current_io_context(gfp_flags, node);
150+
if (unlikely(!ioc))
151151
break;
152-
} while (!atomic_long_inc_not_zero(&ret->refcount));
152+
} while (!atomic_long_inc_not_zero(&ioc->refcount));
153153

154-
return ret;
154+
return ioc;
155155
}
156156
EXPORT_SYMBOL(get_io_context);
157157

0 commit comments

Comments
 (0)