Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309194
b: refs/heads/master
c: b2fab5a
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Mar 6, 2012
1 parent db4e9e1 commit 8acf212
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5a5bafdc396b1da7570f84fb96a0f8a288970c5e
refs/heads/master: b2fab5acd28ead6f0dd6c3996ba23f0ef1772f15
9 changes: 5 additions & 4 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3656,7 +3656,7 @@ static void cfq_exit_queue(struct elevator_queue *e)
kfree(cfqd);
}

static void *cfq_init_queue(struct request_queue *q)
static int cfq_init_queue(struct request_queue *q)
{
struct cfq_data *cfqd;
int i, j;
Expand All @@ -3665,7 +3665,7 @@ static void *cfq_init_queue(struct request_queue *q)

cfqd = kmalloc_node(sizeof(*cfqd), GFP_KERNEL | __GFP_ZERO, q->node);
if (!cfqd)
return NULL;
return -ENOMEM;

/* Init root service tree */
cfqd->grp_service_tree = CFQ_RB_ROOT;
Expand All @@ -3692,7 +3692,7 @@ static void *cfq_init_queue(struct request_queue *q)
if (blkio_alloc_blkg_stats(&cfqg->blkg)) {
kfree(cfqg);
kfree(cfqd);
return NULL;
return -ENOMEM;
}

rcu_read_lock();
Expand Down Expand Up @@ -3723,6 +3723,7 @@ static void *cfq_init_queue(struct request_queue *q)
cfq_link_cfqq_cfqg(&cfqd->oom_cfqq, &cfqd->root_group);

cfqd->queue = q;
q->elevator->elevator_data = cfqd;

init_timer(&cfqd->idle_slice_timer);
cfqd->idle_slice_timer.function = cfq_idle_slice_timer;
Expand All @@ -3747,7 +3748,7 @@ static void *cfq_init_queue(struct request_queue *q)
* second, in order to have larger depth for async operations.
*/
cfqd->last_delayed_sync = jiffies - HZ;
return cfqd;
return 0;
}

/*
Expand Down
8 changes: 5 additions & 3 deletions trunk/block/deadline-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ static void deadline_exit_queue(struct elevator_queue *e)
/*
* initialize elevator private data (deadline_data).
*/
static void *deadline_init_queue(struct request_queue *q)
static int deadline_init_queue(struct request_queue *q)
{
struct deadline_data *dd;

dd = kmalloc_node(sizeof(*dd), GFP_KERNEL | __GFP_ZERO, q->node);
if (!dd)
return NULL;
return -ENOMEM;

INIT_LIST_HEAD(&dd->fifo_list[READ]);
INIT_LIST_HEAD(&dd->fifo_list[WRITE]);
Expand All @@ -354,7 +354,9 @@ static void *deadline_init_queue(struct request_queue *q)
dd->writes_starved = writes_starved;
dd->front_merges = 1;
dd->fifo_batch = fifo_batch;
return dd;

q->elevator->elevator_data = dd;
return 0;
}

/*
Expand Down
12 changes: 2 additions & 10 deletions trunk/block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ static struct elevator_type *elevator_get(const char *name)
return e;
}

static int elevator_init_queue(struct request_queue *q)
{
q->elevator->elevator_data = q->elevator->type->ops.elevator_init_fn(q);
if (q->elevator->elevator_data)
return 0;
return -ENOMEM;
}

static char chosen_elevator[ELV_NAME_MAX];

static int __init elevator_setup(char *str)
Expand Down Expand Up @@ -224,7 +216,7 @@ int elevator_init(struct request_queue *q, char *name)
if (!q->elevator)
return -ENOMEM;

err = elevator_init_queue(q);
err = e->ops.elevator_init_fn(q);
if (err) {
kobject_put(&q->elevator->kobj);
return err;
Expand Down Expand Up @@ -927,7 +919,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)
if (!q->elevator)
goto fail_init;

err = elevator_init_queue(q);
err = new_e->ops.elevator_init_fn(q);
if (err) {
kobject_put(&q->elevator->kobj);
goto fail_init;
Expand Down
8 changes: 5 additions & 3 deletions trunk/block/noop-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ noop_latter_request(struct request_queue *q, struct request *rq)
return list_entry(rq->queuelist.next, struct request, queuelist);
}

static void *noop_init_queue(struct request_queue *q)
static int noop_init_queue(struct request_queue *q)
{
struct noop_data *nd;

nd = kmalloc_node(sizeof(*nd), GFP_KERNEL, q->node);
if (!nd)
return NULL;
return -ENOMEM;

INIT_LIST_HEAD(&nd->queue);
return nd;
q->elevator->elevator_data = nd;
return 0;
}

static void noop_exit_queue(struct elevator_queue *e)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/elevator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef void (elevator_put_req_fn) (struct request *);
typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);

typedef void *(elevator_init_fn) (struct request_queue *);
typedef int (elevator_init_fn) (struct request_queue *);
typedef void (elevator_exit_fn) (struct elevator_queue *);

struct elevator_ops
Expand Down

0 comments on commit 8acf212

Please sign in to comment.