[Devel] [PATCH] ploop: Fix discard BIOs mis accounting

Kirill Tkhai ktkhai at virtuozzo.com
Mon Jan 28 17:58:35 MSK 2019


Discard requests submitted in non-maintaince mode
never decremented. So, their number grows endlessly
in file:

  $cat /sys/block/ploopXXX/pstate/discard_bios

Fix that.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index a82988c1f538..c398026ff602 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -593,7 +593,7 @@ ploop_bio_queue(struct ploop_device * plo, struct bio * bio,
 
 	__TRACE("A %p %u\n", preq, preq->req_cluster);
 
-	if (unlikely(preq->state & (1 << PLOOP_REQ_DISCARD)))
+	if (unlikely(bio->bi_rw & REQ_DISCARD))
 		plo->bio_discard_qlen--;
 	else
 		plo->bio_qlen--;



More information about the Devel mailing list