aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-08-01 12:06:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-08-01 12:06:47 -0400
commiteff0d13f3823f35d70228cd151d2a2c89288ff32 (patch)
tree55bff4dbcc43c4b0f38509ac4de585c0c457980c /block
parent8cf1a3fce0b95050b63d451c9d561da0da2aa4d6 (diff)
parent10af8138eb6d09d6a768e43ef1aa9b2f16b8c7be (diff)
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
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index dd134d834d5..4b4dbdfbca8 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2909,23 +2909,47 @@ static void queue_unplugged(struct request_queue *q, unsigned int depth,
2909 2909
2910} 2910}
2911 2911
2912static void flush_plug_callbacks(struct blk_plug *plug) 2912static void flush_plug_callbacks(struct blk_plug *plug, bool from_schedule)
2913{ 2913{
2914 LIST_HEAD(callbacks); 2914 LIST_HEAD(callbacks);
2915 2915
2916 if (list_empty(&plug->cb_list)) 2916 while (!list_empty(&plug->cb_list)) {
2917 return; 2917 list_splice_init(&plug->cb_list, &callbacks);
2918
2919 list_splice_init(&plug->cb_list, &callbacks);
2920 2918
2921 while (!list_empty(&callbacks)) { 2919 while (!list_empty(&callbacks)) {
2922 struct blk_plug_cb *cb = list_first_entry(&callbacks, 2920 struct blk_plug_cb *cb = list_first_entry(&callbacks,
2923 struct blk_plug_cb, 2921 struct blk_plug_cb,
2924 list); 2922 list);
2925 list_del(&cb->list); 2923 list_del(&cb->list);
2926 cb->callback(cb); 2924 cb->callback(cb, from_schedule);
2925 }
2926 }
2927}
2928
2929struct blk_plug_cb *blk_check_plugged(blk_plug_cb_fn unplug, void *data,
2930 int size)
2931{
2932 struct blk_plug *plug = current->plug;
2933 struct blk_plug_cb *cb;
2934
2935 if (!plug)
2936 return NULL;
2937
2938 list_for_each_entry(cb, &plug->cb_list, list)
2939 if (cb->callback == unplug && cb->data == data)
2940 return cb;
2941
2942 /* Not currently on the callback list */
2943 BUG_ON(size < sizeof(*cb));
2944 cb = kzalloc(size, GFP_ATOMIC);
2945 if (cb) {
2946 cb->data = data;
2947 cb->callback = unplug;
2948 list_add(&cb->list, &plug->cb_list);
2927 } 2949 }
2950 return cb;
2928} 2951}
2952EXPORT_SYMBOL(blk_check_plugged);
2929 2953
2930void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule) 2954void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
2931{ 2955{
@@ -2937,7 +2961,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
2937 2961
2938 BUG_ON(plug->magic != PLUG_MAGIC); 2962 BUG_ON(plug->magic != PLUG_MAGIC);
2939 2963
2940 flush_plug_callbacks(plug); 2964 flush_plug_callbacks(plug, from_schedule);
2941 if (list_empty(&plug->list)) 2965 if (list_empty(&plug->list))
2942 return; 2966 return;
2943 2967