block: move flush initialization to blk_flush_init
authorMing Lei <ming.lei@canonical.com>
Thu, 25 Sep 2014 15:23:41 +0000 (23:23 +0800)
committerJens Axboe <axboe@fb.com>
Thu, 25 Sep 2014 21:22:37 +0000 (15:22 -0600)
These fields are always used with the flush request, so
initialize them together.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-core.c
block/blk-flush.c

index 0a9d17269957cf4004243ea2723a4926fbd626af..222fe84d6ac4b5bdae76b3d9bcb746a1a65717ca 100644 (file)
@@ -600,9 +600,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
 #ifdef CONFIG_BLK_CGROUP
        INIT_LIST_HEAD(&q->blkg_list);
 #endif
-       INIT_LIST_HEAD(&q->flush_queue[0]);
-       INIT_LIST_HEAD(&q->flush_queue[1]);
-       INIT_LIST_HEAD(&q->flush_data_in_flight);
        INIT_DELAYED_WORK(&q->delay_work, blk_delay_work);
 
        kobject_init(&q->kobj, &blk_queue_ktype);
index c72ab32fd8eb8ed95f184850bdeda21572930331..a49ffbdcfcdc1408f70273a517f07726ee40e99b 100644 (file)
@@ -488,6 +488,10 @@ static int blk_mq_init_flush(struct request_queue *q)
 
 int blk_init_flush(struct request_queue *q)
 {
+       INIT_LIST_HEAD(&q->flush_queue[0]);
+       INIT_LIST_HEAD(&q->flush_queue[1]);
+       INIT_LIST_HEAD(&q->flush_data_in_flight);
+
        if (q->mq_ops)
                return blk_mq_init_flush(q);