summaryrefslogtreecommitdiffstats
path: root/block/blk-flush.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2014-09-25 23:23:39 +0800
committerJens Axboe <axboe@fb.com>2014-09-25 15:22:34 -0600
commit1bcb1eada4f11a713cbe586d1b5a5d93a48277cb (patch)
tree89e14d77cb1e95f7742ee7395ed5ff7e84afc057 /block/blk-flush.c
parent08e98fc6016c890c2f4ffba6decc0ca9d2d5d7f8 (diff)
downloadlinux-0-day-1bcb1eada4f11a713cbe586d1b5a5d93a48277cb.tar.gz
blk-mq: allocate flush_rq in blk_mq_init_flush()
It is reasonable to allocate flush req in blk_mq_init_flush(). Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-flush.c')
-rw-r--r--block/blk-flush.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c
index c8e2576..55028a7 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -472,7 +472,16 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
}
EXPORT_SYMBOL(blkdev_issue_flush);
-void blk_mq_init_flush(struct request_queue *q)
+int blk_mq_init_flush(struct request_queue *q)
{
+ struct blk_mq_tag_set *set = q->tag_set;
+
spin_lock_init(&q->mq_flush_lock);
+
+ q->flush_rq = kzalloc(round_up(sizeof(struct request) +
+ set->cmd_size, cache_line_size()),
+ GFP_KERNEL);
+ if (!q->flush_rq)
+ return -ENOMEM;
+ return 0;
}