summaryrefslogtreecommitdiffstats
path: root/block/blk-flush.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2014-09-25 23:23:40 +0800
committerJens Axboe <axboe@fb.com>2014-09-25 15:22:35 -0600
commitf355265571440a7db16e784b6edf4e7d26971a03 (patch)
tree79b20c37c734b5932dcecc9e85850847b0a69855 /block/blk-flush.c
parent1bcb1eada4f11a713cbe586d1b5a5d93a48277cb (diff)
downloadlinux-f355265571440a7db16e784b6edf4e7d26971a03.tar.gz
linux-f355265571440a7db16e784b6edf4e7d26971a03.tar.bz2
linux-f355265571440a7db16e784b6edf4e7d26971a03.zip
block: introduce blk_init_flush and its pair
These two temporary functions are introduced for holding flush initialization and de-initialization, so that we can introduce 'flush queue' easier in the following patch. And once 'flush queue' and its allocation/free functions are ready, they will be removed for sake of code readability. 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.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 55028a707927..c72ab32fd8eb 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -472,7 +472,7 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
}
EXPORT_SYMBOL(blkdev_issue_flush);
-int blk_mq_init_flush(struct request_queue *q)
+static int blk_mq_init_flush(struct request_queue *q)
{
struct blk_mq_tag_set *set = q->tag_set;
@@ -485,3 +485,20 @@ int blk_mq_init_flush(struct request_queue *q)
return -ENOMEM;
return 0;
}
+
+int blk_init_flush(struct request_queue *q)
+{
+ if (q->mq_ops)
+ return blk_mq_init_flush(q);
+
+ q->flush_rq = kzalloc(sizeof(struct request), GFP_KERNEL);
+ if (!q->flush_rq)
+ return -ENOMEM;
+
+ return 0;
+}
+
+void blk_exit_flush(struct request_queue *q)
+{
+ kfree(q->flush_rq);
+}