Commit 39ae1835 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] pass elevator type by reference, not value

Ingo spotted this one too, it's a leftover from when the elevator type
wasn't a variable. Also don't pass in &q->elevator, it can always be
deduced from queue itself of course.
parent c2bf9f44
...@@ -217,9 +217,11 @@ struct request *elevator_noop_next_request(request_queue_t *q) ...@@ -217,9 +217,11 @@ struct request *elevator_noop_next_request(request_queue_t *q)
/* /*
* general block -> elevator interface starts here * general block -> elevator interface starts here
*/ */
int elevator_init(request_queue_t *q, elevator_t *e, elevator_t type) int elevator_init(request_queue_t *q, elevator_t *type)
{ {
*e = type; elevator_t *e = &q->elevator;
memcpy(e, type, sizeof(*e));
INIT_LIST_HEAD(&q->queue_head); INIT_LIST_HEAD(&q->queue_head);
q->last_merge = NULL; q->last_merge = NULL;
...@@ -230,8 +232,10 @@ int elevator_init(request_queue_t *q, elevator_t *e, elevator_t type) ...@@ -230,8 +232,10 @@ int elevator_init(request_queue_t *q, elevator_t *e, elevator_t type)
return 0; return 0;
} }
void elevator_exit(request_queue_t *q, elevator_t *e) void elevator_exit(request_queue_t *q)
{ {
elevator_t *e = &q->elevator;
if (e->elevator_exit_fn) if (e->elevator_exit_fn)
e->elevator_exit_fn(q, e); e->elevator_exit_fn(q, e);
} }
......
...@@ -1145,7 +1145,7 @@ void blk_cleanup_queue(request_queue_t * q) ...@@ -1145,7 +1145,7 @@ void blk_cleanup_queue(request_queue_t * q)
if (blk_queue_tagged(q)) if (blk_queue_tagged(q))
blk_queue_free_tags(q); blk_queue_free_tags(q);
elevator_exit(q, &q->elevator); elevator_exit(q);
memset(q, 0, sizeof(*q)); memset(q, 0, sizeof(*q));
} }
...@@ -1227,7 +1227,7 @@ int blk_init_queue(request_queue_t *q, request_fn_proc *rfn, spinlock_t *lock) ...@@ -1227,7 +1227,7 @@ int blk_init_queue(request_queue_t *q, request_fn_proc *rfn, spinlock_t *lock)
if (blk_init_free_list(q)) if (blk_init_free_list(q))
return -ENOMEM; return -ENOMEM;
if ((ret = elevator_init(q, &q->elevator, iosched_deadline))) { if ((ret = elevator_init(q, &iosched_deadline))) {
blk_cleanup_queue(q); blk_cleanup_queue(q);
return ret; return ret;
} }
......
...@@ -2046,10 +2046,8 @@ dasd_setup_blkdev(dasd_device_t * device) ...@@ -2046,10 +2046,8 @@ dasd_setup_blkdev(dasd_device_t * device)
&device->request_queue_lock); &device->request_queue_lock);
if (rc) if (rc)
return rc; return rc;
elevator_exit(device->request_queue, &device->request_queue->elevator); elevator_exit(device->request_queue);
rc = elevator_init(device->request_queue, rc = elevator_init(device->request_queue, &elevator_noop);
&device->request_queue->elevator,
elevator_noop);
if (rc) { if (rc) {
blk_cleanup_queue(device->request_queue); blk_cleanup_queue(device->request_queue);
return rc; return rc;
......
...@@ -73,8 +73,8 @@ typedef struct blkelv_ioctl_arg_s { ...@@ -73,8 +73,8 @@ typedef struct blkelv_ioctl_arg_s {
#define BLKELVGET _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t)) #define BLKELVGET _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t))
#define BLKELVSET _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t)) #define BLKELVSET _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t))
extern int elevator_init(request_queue_t *, elevator_t *, elevator_t); extern int elevator_init(request_queue_t *, elevator_t *);
extern void elevator_exit(request_queue_t *, elevator_t *); extern void elevator_exit(request_queue_t *);
extern inline int bio_rq_in_between(struct bio *, struct request *, struct list_head *); extern inline int bio_rq_in_between(struct bio *, struct request *, struct list_head *);
extern inline int elv_rq_merge_ok(struct request *, struct bio *); extern inline int elv_rq_merge_ok(struct request *, struct bio *);
extern inline int elv_try_merge(struct request *, struct bio *); extern inline int elv_try_merge(struct request *, struct bio *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment