*/
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))
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);
elevator_attach(q, eq, data);
return ret;
}
-
EXPORT_SYMBOL(elevator_init);
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)
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)
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)
return NULL;
}
-
EXPORT_SYMBOL(elv_rb_find);
/*
{
sector_t boundary;
struct list_head *entry;
+ int stop_flags;
if (q->last_merge == rq)
q->last_merge = NULL;
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)
list_add(&rq->queuelist, entry);
}
-
EXPORT_SYMBOL(elv_dispatch_sort);
/*
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)
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)
elv_insert(q, rq, where);
}
-
EXPORT_SYMBOL(__elv_add_request);
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)
return rq;
}
-
EXPORT_SYMBOL(elv_next_request);
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)
return 1;
}
-
EXPORT_SYMBOL(elv_queue_empty);
struct request *elv_latter_request(struct request_queue *q, struct request *rq)
!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);
}
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;
}
return NULL;
}
-
EXPORT_SYMBOL(elv_rb_former_request);
struct request *elv_rb_latter_request(struct request_queue *q,
return NULL;
}
-
EXPORT_SYMBOL(elv_rb_latter_request);