diff mbox series

[3/4] mtd: blk_devs: make discard work on FTLs

Message ID c69e717ef1c31b8b41bc07cd80c5d1ac191a7424.1626169090.git.sean@mess.org
State Changes Requested
Headers show
Series Fix various issues with RFD and FTLs | expand

Commit Message

Sean Young July 13, 2021, 9:44 a.m. UTC
Without this change, any discard ioctl fails with -ENOTSUPP and the
following logged:

rfda: Error: discard_granularity is 0.
rfda: Error: discard_granularity is 0.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/mtd/mtd_blkdevs.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 6ce4bc57f919..486251e058a6 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -419,6 +419,7 @@  int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 	if (tr->discard) {
 		blk_queue_flag_set(QUEUE_FLAG_DISCARD, new->rq);
 		blk_queue_max_discard_sectors(new->rq, UINT_MAX);
+		new->rq->limits.discard_granularity = 512;
 	}
 
 	gd->queue = new->rq;