Re: [PATCH v2] mtd: mtd_blkdevs: Initialize rq.limits.discard_granularity
From: Miquel Raynal
Date: Thu Jul 15 2021 - 18:50:54 EST
On Tue, 2021-06-15 at 09:39:05 UTC, Zhihao Cheng wrote:
> Since commit b35fd7422c2f8("block: check queue's limits.discard_granularity
> in __blkdev_issue_discard()") checks rq.limits.discard_granularity in
> __blkdev_issue_discard(), we may get following warnings on formatted ftl:
>
> WARNING: CPU: 2 PID: 7313 at block/blk-lib.c:51
> __blkdev_issue_discard+0x2a7/0x390
>
> Reproducer:
> 1. ftl_format /dev/mtd0
> 2. modprobe ftl
> 3. mkfs.vfat /dev/ftla
> 4. mount -odiscard /dev/ftla temp
> 5. dd if=/dev/zero of=temp/tst bs=1M count=10 oflag=direct
> 6. dd if=/dev/zero of=temp/tst bs=1M count=10 oflag=direct
>
> Fix it by initializing rq.limits.discard_granularity if device supports
> discard operation.
>
> Signed-off-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.
Miquel