Skip to content

Commit 74018dc

Browse files
neilbrownaxboe
authored andcommitted
blk: pass from_schedule to non-request unplug functions.
This will allow md/raid to know why the unplug was called, and will be able to act according - if !from_schedule it is safe to perform tasks which could themselves schedule. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2a7d555 commit 74018dc

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎block/blk-core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2909,7 +2909,7 @@ static void queue_unplugged(struct request_queue *q, unsigned int depth,
29092909

29102910
}
29112911

2912-
static void flush_plug_callbacks(struct blk_plug *plug)
2912+
static void flush_plug_callbacks(struct blk_plug *plug, bool from_schedule)
29132913
{
29142914
LIST_HEAD(callbacks);
29152915

@@ -2921,7 +2921,7 @@ static void flush_plug_callbacks(struct blk_plug *plug)
29212921
struct blk_plug_cb,
29222922
list);
29232923
list_del(&cb->list);
2924-
cb->callback(cb);
2924+
cb->callback(cb, from_schedule);
29252925
}
29262926
}
29272927
}
@@ -2961,7 +2961,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
29612961

29622962
BUG_ON(plug->magic != PLUG_MAGIC);
29632963

2964-
flush_plug_callbacks(plug);
2964+
flush_plug_callbacks(plug, from_schedule);
29652965
if (list_empty(&plug->list))
29662966
return;
29672967

‎drivers/block/umem.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static void process_page(unsigned long data)
513513
}
514514
}
515515

516-
static void mm_unplug(struct blk_plug_cb *cb)
516+
static void mm_unplug(struct blk_plug_cb *cb, bool from_schedule)
517517
{
518518
struct cardinfo *card = cb->data;
519519

‎drivers/md/md.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ void md_flush_request(struct mddev *mddev, struct bio *bio)
498498
}
499499
EXPORT_SYMBOL(md_flush_request);
500500

501-
void md_unplug(struct blk_plug_cb *cb)
501+
void md_unplug(struct blk_plug_cb *cb, bool from_schedule)
502502
{
503503
struct mddev *mddev = cb->data;
504504
md_wakeup_thread(mddev->thread);

‎drivers/md/md.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs,
629629
struct mddev *mddev);
630630
extern void md_trim_bio(struct bio *bio, int offset, int size);
631631

632-
extern void md_unplug(struct blk_plug_cb *cb);
632+
extern void md_unplug(struct blk_plug_cb *cb, bool from_schedule);
633633
static inline int mddev_check_plugged(struct mddev *mddev)
634634
{
635635
return !!blk_check_plugged(md_unplug, mddev,

‎include/linux/blkdev.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ struct blk_plug {
923923
#define BLK_MAX_REQUEST_COUNT 16
924924

925925
struct blk_plug_cb;
926-
typedef void (*blk_plug_cb_fn)(struct blk_plug_cb *);
926+
typedef void (*blk_plug_cb_fn)(struct blk_plug_cb *, bool);
927927
struct blk_plug_cb {
928928
struct list_head list;
929929
blk_plug_cb_fn callback;

0 commit comments

Comments
 (0)