diff options
author | NeilBrown <neilb@suse.de> | 2011-04-18 03:52:22 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-04-18 03:52:22 -0400 |
commit | 048c9374a749a27f16493cea033fa4a8ff492356 (patch) | |
tree | 64f520a1a2d2e1a9c30b45e306ce6f901f8f8d49 /include/linux | |
parent | a1b49cb7e2a7961ec3aa8b64860bf480d4ec9077 (diff) |
block: Enhance new plugging support to support general callbacks
md/raid requires an unplug callback, but as it does not uses
requests the current code cannot provide one.
So allow arbitrary callbacks to be attached to the blk_plug.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/blkdev.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ec0357d8c4a5..f3f7879391a7 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -860,8 +860,13 @@ extern void blk_put_queue(struct request_queue *); | |||
860 | struct blk_plug { | 860 | struct blk_plug { |
861 | unsigned long magic; | 861 | unsigned long magic; |
862 | struct list_head list; | 862 | struct list_head list; |
863 | struct list_head cb_list; | ||
863 | unsigned int should_sort; | 864 | unsigned int should_sort; |
864 | }; | 865 | }; |
866 | struct blk_plug_cb { | ||
867 | struct list_head list; | ||
868 | void (*callback)(struct blk_plug_cb *); | ||
869 | }; | ||
865 | 870 | ||
866 | extern void blk_start_plug(struct blk_plug *); | 871 | extern void blk_start_plug(struct blk_plug *); |
867 | extern void blk_finish_plug(struct blk_plug *); | 872 | extern void blk_finish_plug(struct blk_plug *); |
@@ -887,7 +892,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) | |||
887 | { | 892 | { |
888 | struct blk_plug *plug = tsk->plug; | 893 | struct blk_plug *plug = tsk->plug; |
889 | 894 | ||
890 | return plug && !list_empty(&plug->list); | 895 | return plug && (!list_empty(&plug->list) || !list_empty(&plug->cb_list)); |
891 | } | 896 | } |
892 | 897 | ||
893 | /* | 898 | /* |