public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org
Subject: [PATCH v2 3/5] mtd: blk_devs: make discard work on FTLs
Date: Sat,  7 Aug 2021 22:45:36 +0100	[thread overview]
Message-ID: <20210807214538.14484-4-sean@mess.org> (raw)
In-Reply-To: <20210807214538.14484-1-sean@mess.org>

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(+)

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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2021-08-07 21:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07 21:45 [PATCH v2 0/5] Fix various issues with RFD and FTLs Sean Young
2021-08-07 21:45 ` [PATCH v2 1/5] mtd: rfd_ftl: allow use of MTD_RAM for testing purposes Sean Young
2021-08-16 14:27   ` Miquel Raynal
2021-08-07 21:45 ` [PATCH v2 2/5] mtd: rfd_ftl: add discard support Sean Young
2021-08-16 14:27   ` Miquel Raynal
2021-08-07 21:45 ` Sean Young [this message]
2021-08-16 14:26   ` [PATCH v2 3/5] mtd: blk_devs: make discard work on FTLs Miquel Raynal
2021-08-07 21:45 ` [PATCH v2 4/5] mtd: rfd_ftl: fix use-after-free Sean Young
2021-08-16 14:26   ` Miquel Raynal
2021-08-07 21:45 ` [PATCH v2 5/5] mtd: rfd_ftl: use container_of() rather than cast Sean Young
2021-08-16 14:26   ` Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210807214538.14484-4-sean@mess.org \
    --to=sean@mess.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox