diff mbox series

[v2,3/5] mtd: blk_devs: make discard work on FTLs

Message ID 20210807214538.14484-4-sean@mess.org
State Accepted
Headers show
Series Fix various issues with RFD and FTLs | expand

Commit Message

Sean Young Aug. 7, 2021, 9:45 p.m. UTC
If the discard_granularity is not set, discard will not work and the
following error is logged:

rfda: Error: discard_granularity is 0.

Since all the FTLs use a sector size of 512, this can be hardcoded.

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

Comments

Miquel Raynal Aug. 16, 2021, 2:26 p.m. UTC | #1
On Sat, 2021-08-07 at 21:45:36 UTC, Sean Young wrote:
> If the discard_granularity is not set, discard will not work and the
> following error is logged:
> 
> rfda: Error: discard_granularity is 0.
> 
> Since all the FTLs use a sector size of 512, this can be hardcoded.
> 
> Signed-off-by: Sean Young <sean@mess.org>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

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