Merge branch 'for-3.6/drivers' of git://git.kernel.dk/linux-block
Pull block driver changes from Jens Axboe: - Making the plugging support for drivers a bit more sane from Neil. This supersedes the plugging change from Shaohua as well. - The usual round of drbd updates. - Using a tail add instead of a head add in the request completion for ndb, making us find the most completed request more quickly. - A few floppy changes, getting rid of a duplicated flag and also running the floppy init async (since it takes forever in boot terms) from Andi. * 'for-3.6/drivers' of git://git.kernel.dk/linux-block: floppy: remove duplicated flag FD_RAW_NEED_DISK blk: pass from_schedule to non-request unplug functions. block: stack unplug blk: centralize non-request unplug handling. md: remove plug_cnt feature of plugging. block/nbd: micro-optimization in nbd request completion drbd: announce FLUSH/FUA capability to upper layers drbd: fix max_bio_size to be unsigned drbd: flush drbd work queue before invalidate/invalidate remote drbd: fix potential access after free drbd: call local-io-error handler early drbd: do not reset rs_pending_cnt too early drbd: reset congestion information before reporting it in /proc/drbd drbd: report congestion if we are waiting for some userland callback drbd: differentiate between normal and forced detach drbd: cleanup, remove two unused global flags floppy: Run floppy initialization asynchronous
This commit is contained in:
+34
-10
@@ -2909,24 +2909,48 @@ static void queue_unplugged(struct request_queue *q, unsigned int depth,
|
||||
|
||||
}
|
||||
|
||||
static void flush_plug_callbacks(struct blk_plug *plug)
|
||||
static void flush_plug_callbacks(struct blk_plug *plug, bool from_schedule)
|
||||
{
|
||||
LIST_HEAD(callbacks);
|
||||
|
||||
if (list_empty(&plug->cb_list))
|
||||
return;
|
||||
while (!list_empty(&plug->cb_list)) {
|
||||
list_splice_init(&plug->cb_list, &callbacks);
|
||||
|
||||
list_splice_init(&plug->cb_list, &callbacks);
|
||||
|
||||
while (!list_empty(&callbacks)) {
|
||||
struct blk_plug_cb *cb = list_first_entry(&callbacks,
|
||||
while (!list_empty(&callbacks)) {
|
||||
struct blk_plug_cb *cb = list_first_entry(&callbacks,
|
||||
struct blk_plug_cb,
|
||||
list);
|
||||
list_del(&cb->list);
|
||||
cb->callback(cb);
|
||||
list_del(&cb->list);
|
||||
cb->callback(cb, from_schedule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct blk_plug_cb *blk_check_plugged(blk_plug_cb_fn unplug, void *data,
|
||||
int size)
|
||||
{
|
||||
struct blk_plug *plug = current->plug;
|
||||
struct blk_plug_cb *cb;
|
||||
|
||||
if (!plug)
|
||||
return NULL;
|
||||
|
||||
list_for_each_entry(cb, &plug->cb_list, list)
|
||||
if (cb->callback == unplug && cb->data == data)
|
||||
return cb;
|
||||
|
||||
/* Not currently on the callback list */
|
||||
BUG_ON(size < sizeof(*cb));
|
||||
cb = kzalloc(size, GFP_ATOMIC);
|
||||
if (cb) {
|
||||
cb->data = data;
|
||||
cb->callback = unplug;
|
||||
list_add(&cb->list, &plug->cb_list);
|
||||
}
|
||||
return cb;
|
||||
}
|
||||
EXPORT_SYMBOL(blk_check_plugged);
|
||||
|
||||
void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
|
||||
{
|
||||
struct request_queue *q;
|
||||
@@ -2937,7 +2961,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
|
||||
|
||||
BUG_ON(plug->magic != PLUG_MAGIC);
|
||||
|
||||
flush_plug_callbacks(plug);
|
||||
flush_plug_callbacks(plug, from_schedule);
|
||||
if (list_empty(&plug->list))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user