[Devel] [PATCH RH7 06/12] blk-wbt: abstract out end IO completion handler

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Sep 29 14:30:06 MSK 2022


From: Jens Axboe <axboe at kernel.dk>

Prep patch for calling the handler from a different context,
no functional changes in this patch.

Tested-by: Agarwal, Anchal <anchalag at amazon.com>
Signed-off-by: Jens Axboe <axboe at kernel.dk>

Changes when porting to vz7:
- second argument of get_rq_wait is a 'is_kswapd' boolean

https://jira.sw.ru/browse/PSBM-141883
(cherry picked from commit 061a5427530633de93ace4ef001b99961984af62)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 block/blk-wbt.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 97adb724df09..8719a820bfb7 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -124,15 +124,11 @@ static void rwb_wake_all(struct rq_wb *rwb)
 	}
 }
 
-void __wbt_done(struct rq_wb *rwb, enum wbt_flags wb_acct)
+static void wbt_rqw_done(struct rq_wb *rwb, struct rq_wait *rqw,
+			 enum wbt_flags wb_acct)
 {
-	struct rq_wait *rqw;
 	int inflight, limit;
 
-	if (!(wb_acct & WBT_TRACKED))
-		return;
-
-	rqw = get_rq_wait(rwb, wb_acct & WBT_KSWAPD);
 	inflight = atomic_dec_return(&rqw->inflight);
 
 	/*
@@ -167,6 +163,17 @@ void __wbt_done(struct rq_wb *rwb, enum wbt_flags wb_acct)
 	}
 }
 
+void __wbt_done(struct rq_wb *rwb, enum wbt_flags wb_acct)
+{
+	struct rq_wait *rqw;
+
+	if (!(wb_acct & WBT_TRACKED))
+		return;
+
+	rqw = get_rq_wait(rwb, wb_acct & WBT_KSWAPD);
+	wbt_rqw_done(rwb, rqw, wb_acct);
+}
+
 /*
  * Called on completion of a request. Note that it's also called when
  * a request is merged, when the request gets freed.
-- 
2.37.1



More information about the Devel mailing list