diff mbox series

[V2,02/13] block: move initialization of q->blkg_list into blkcg_init_queue

Message ID 20220122111054.1126146-3-ming.lei@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series block: don't drain file system I/O on del_gendisk | expand

Commit Message

Ming Lei Jan. 22, 2022, 11:10 a.m. UTC
q->blkg_list is only used by blkcg code, so move it into
blkcg_init_queue.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-cgroup.c | 2 ++
 block/blk-core.c   | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Christoph Hellwig Jan. 24, 2022, 1 p.m. UTC | #1
On Sat, Jan 22, 2022 at 07:10:43PM +0800, Ming Lei wrote:
> q->blkg_list is only used by blkcg code, so move it into
> blkcg_init_queue.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Bart Van Assche Jan. 24, 2022, 6:32 p.m. UTC | #2
On 1/22/22 03:10, Ming Lei wrote:
> q->blkg_list is only used by blkcg code, so move it into
> blkcg_init_queue.

Should Tejun be Cc-ed for this patch?

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
diff mbox series

Patch

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 650f7e27989f..498753e2bb73 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1176,6 +1176,8 @@  int blkcg_init_queue(struct request_queue *q)
 	bool preloaded;
 	int ret;
 
+	INIT_LIST_HEAD(&q->blkg_list);
+
 	new_blkg = blkg_alloc(&blkcg_root, q, GFP_KERNEL);
 	if (!new_blkg)
 		return -ENOMEM;
diff --git a/block/blk-core.c b/block/blk-core.c
index 97f8bc8d3a79..2a400fa8cabd 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -475,9 +475,6 @@  struct request_queue *blk_alloc_queue(int node_id, bool alloc_srcu)
 	timer_setup(&q->timeout, blk_rq_timed_out_timer, 0);
 	INIT_WORK(&q->timeout_work, blk_timeout_work);
 	INIT_LIST_HEAD(&q->icq_list);
-#ifdef CONFIG_BLK_CGROUP
-	INIT_LIST_HEAD(&q->blkg_list);
-#endif
 
 	kobject_init(&q->kobj, &blk_queue_ktype);