ploop: Fix discard BIOs mis accounting

Submitted by Kirill Tkhai on Jan. 28, 2019, 2:58 p.m.

Details

Message ID 154868749914.19900.17311730184424544403.stgit@localhost.localdomain
State New
Series "ploop: Fix discard BIOs mis accounting"
Headers show

Commit Message

Kirill Tkhai Jan. 28, 2019, 2:58 p.m.
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@virtuozzo.com>
---
 drivers/block/ploop/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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--;