Skip to content

Commit

Permalink
block: make elevator lib checkpatch compliant
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Feb 1, 2008
1 parent fe094d9 commit 4eb166d
Showing 1 changed file with 30 additions and 27 deletions.
57 changes: 30 additions & 27 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ static LIST_HEAD(elv_list);
*/
static const int elv_hash_shift = 6;
#define ELV_HASH_BLOCK(sec) ((sec) >> 3)
#define ELV_HASH_FN(sec) (hash_long(ELV_HASH_BLOCK((sec)), elv_hash_shift))
#define ELV_HASH_FN(sec) \
(hash_long(ELV_HASH_BLOCK((sec)), elv_hash_shift))
#define ELV_HASH_ENTRIES (1 << elv_hash_shift)
#define rq_hash_key(rq) ((rq)->sector + (rq)->nr_sectors)
#define ELV_ON_HASH(rq) (!hlist_unhashed(&(rq)->hash))
Expand Down Expand Up @@ -224,15 +225,27 @@ int elevator_init(struct request_queue *q, char *name)
q->end_sector = 0;
q->boundary_rq = NULL;

if (name && !(e = elevator_get(name)))
return -EINVAL;
if (name) {
e = elevator_get(name);
if (!e)
return -EINVAL;
}

if (!e && *chosen_elevator && !(e = elevator_get(chosen_elevator)))
printk("I/O scheduler %s not found\n", chosen_elevator);
if (!e && *chosen_elevator) {
e = elevator_get(chosen_elevator);
if (!e)
printk(KERN_ERR "I/O scheduler %s not found\n",
chosen_elevator);
}

if (!e && !(e = elevator_get(CONFIG_DEFAULT_IOSCHED))) {
printk("Default I/O scheduler not found, using no-op\n");
e = elevator_get("noop");
if (!e) {
e = elevator_get(CONFIG_DEFAULT_IOSCHED);
if (!e) {
printk(KERN_ERR
"Default I/O scheduler not found. " \
"Using noop.\n");
e = elevator_get("noop");
}
}

eq = elevator_alloc(q, e);
Expand All @@ -248,7 +261,6 @@ int elevator_init(struct request_queue *q, char *name)
elevator_attach(q, eq, data);
return ret;
}

EXPORT_SYMBOL(elevator_init);

void elevator_exit(elevator_t *e)
Expand All @@ -261,7 +273,6 @@ void elevator_exit(elevator_t *e)

kobject_put(&e->kobj);
}

EXPORT_SYMBOL(elevator_exit);

static void elv_activate_rq(struct request_queue *q, struct request *rq)
Expand Down Expand Up @@ -353,7 +364,6 @@ struct request *elv_rb_add(struct rb_root *root, struct request *rq)
rb_insert_color(&rq->rb_node, root);
return NULL;
}

EXPORT_SYMBOL(elv_rb_add);

void elv_rb_del(struct rb_root *root, struct request *rq)
Expand All @@ -362,7 +372,6 @@ void elv_rb_del(struct rb_root *root, struct request *rq)
rb_erase(&rq->rb_node, root);
RB_CLEAR_NODE(&rq->rb_node);
}

EXPORT_SYMBOL(elv_rb_del);

struct request *elv_rb_find(struct rb_root *root, sector_t sector)
Expand All @@ -383,7 +392,6 @@ struct request *elv_rb_find(struct rb_root *root, sector_t sector)

return NULL;
}

EXPORT_SYMBOL(elv_rb_find);

/*
Expand All @@ -395,6 +403,7 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
{
sector_t boundary;
struct list_head *entry;
int stop_flags;

if (q->last_merge == rq)
q->last_merge = NULL;
Expand All @@ -404,13 +413,13 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)
q->nr_sorted--;

boundary = q->end_sector;

stop_flags = REQ_SOFTBARRIER | REQ_HARDBARRIER | REQ_STARTED;
list_for_each_prev(entry, &q->queue_head) {
struct request *pos = list_entry_rq(entry);

if (rq_data_dir(rq) != rq_data_dir(pos))
break;
if (pos->cmd_flags & (REQ_SOFTBARRIER|REQ_HARDBARRIER|REQ_STARTED))
if (pos->cmd_flags & stop_flags)
break;
if (rq->sector >= boundary) {
if (pos->sector < boundary)
Expand All @@ -425,7 +434,6 @@ void elv_dispatch_sort(struct request_queue *q, struct request *rq)

list_add(&rq->queuelist, entry);
}

EXPORT_SYMBOL(elv_dispatch_sort);

/*
Expand All @@ -446,7 +454,6 @@ void elv_dispatch_add_tail(struct request_queue *q, struct request *rq)
q->boundary_rq = rq;
list_add_tail(&rq->queuelist, &q->queue_head);
}

EXPORT_SYMBOL(elv_dispatch_add_tail);

int elv_merge(struct request_queue *q, struct request **req, struct bio *bio)
Expand Down Expand Up @@ -665,15 +672,15 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where,
q->end_sector = rq_end_sector(rq);
q->boundary_rq = rq;
}
} else if (!(rq->cmd_flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
} else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
where == ELEVATOR_INSERT_SORT)
where = ELEVATOR_INSERT_BACK;

if (plug)
blk_plug_device(q);

elv_insert(q, rq, where);
}

EXPORT_SYMBOL(__elv_add_request);

void elv_add_request(struct request_queue *q, struct request *rq, int where,
Expand All @@ -685,7 +692,6 @@ void elv_add_request(struct request_queue *q, struct request *rq, int where,
__elv_add_request(q, rq, where, plug);
spin_unlock_irqrestore(q->queue_lock, flags);
}

EXPORT_SYMBOL(elv_add_request);

static inline struct request *__elv_next_request(struct request_queue *q)
Expand Down Expand Up @@ -792,7 +798,6 @@ struct request *elv_next_request(struct request_queue *q)

return rq;
}

EXPORT_SYMBOL(elv_next_request);

void elv_dequeue_request(struct request_queue *q, struct request *rq)
Expand All @@ -810,7 +815,6 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq)
if (blk_account_rq(rq))
q->in_flight++;
}

EXPORT_SYMBOL(elv_dequeue_request);

int elv_queue_empty(struct request_queue *q)
Expand All @@ -825,7 +829,6 @@ int elv_queue_empty(struct request_queue *q)

return 1;
}

EXPORT_SYMBOL(elv_queue_empty);

struct request *elv_latter_request(struct request_queue *q, struct request *rq)
Expand Down Expand Up @@ -994,7 +997,8 @@ void elv_register(struct elevator_type *e)
!strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED)))
def = " (default)";

printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name,
def);
}
EXPORT_SYMBOL_GPL(elv_register);

Expand Down Expand Up @@ -1126,7 +1130,8 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name,
}

if (!elevator_switch(q, e))
printk(KERN_ERR "elevator: switch to %s failed\n",elevator_name);
printk(KERN_ERR "elevator: switch to %s failed\n",
elevator_name);
return count;
}

Expand Down Expand Up @@ -1160,7 +1165,6 @@ struct request *elv_rb_former_request(struct request_queue *q,

return NULL;
}

EXPORT_SYMBOL(elv_rb_former_request);

struct request *elv_rb_latter_request(struct request_queue *q,
Expand All @@ -1173,5 +1177,4 @@ struct request *elv_rb_latter_request(struct request_queue *q,

return NULL;
}

EXPORT_SYMBOL(elv_rb_latter_request);

0 comments on commit 4eb166d

Please sign in to comment.