[SRU,B,v2,6/7] blk-wbt: abstract out end IO completion handler

Message ID 20190111110757.17936-7-mfo@canonical.com
State New
Headers show
Series
  • blk-wbt: fix for LP#1810998
Related show

Commit Message

Mauricio Faria de Oliveira Jan. 11, 2019, 11:07 a.m.
From: Jens Axboe <axboe@kernel.dk>

BugLink: https://bugs.launchpad.net/bugs/1810998

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

Tested-by: Agarwal, Anchal <anchalag@amazon.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(backported from commit 061a5427530633de93ace4ef001b99961984af62)
[mfo: backport: __wbt_done():
 - keep signature (not static; parameters; no 'rqos')
 - remove the cast to 'rwb' from 'rqos' (it doesn't exist).]
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
---
 block/blk-wbt.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Patch

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index b2fe2682b3f9..d891b4f80c2f 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -122,15 +122,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);
 	inflight = atomic_dec_return(&rqw->inflight);
 
 	/*
@@ -165,6 +161,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_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.