From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Vivek Goyal <vgoyal@redhat.com>, Pei Zhang <pezhang@redhat.com>
Subject: Re: [PATCH V3] block: loop:use kstatfs.f_bsize of backing file to set discard granularity
Date: Tue, 8 Feb 2022 11:22:28 +0800 [thread overview]
Message-ID: <YgHh9C9jq++Wzk+j@T590> (raw)
In-Reply-To: <20220126035830.296465-1-ming.lei@redhat.com>
On Wed, Jan 26, 2022 at 11:58:30AM +0800, Ming Lei wrote:
> If backing file's filesystem has implemented ->fallocate(), we think the
> loop device can support discard, then pass sb->s_blocksize as
> discard_granularity. However, some underlying FS, such as overlayfs,
> doesn't set sb->s_blocksize, and causes discard_granularity to be set as
> zero, then the warning in __blkdev_issue_discard() is triggered.
>
> Christoph suggested to pass kstatfs.f_bsize as discard granularity, and
> this way is fine because kstatfs.f_bsize means 'Optimal transfer block
> size', which still matches with definition of discard granularity.
>
> So fix the issue by setting discard_granularity as kstatfs.f_bsize if it
> is available, otherwise claims discard isn't supported.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> Reported-by: Pei Zhang <pezhang@redhat.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> V3:
> - following Christoph's suggestion to not claim discard support if
> vfs_statfs() fails
Hi Jens,
Any chance to merge it to v5.17?
Thanks,
Ming
next prev parent reply other threads:[~2022-02-08 3:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 3:58 [PATCH V3] block: loop:use kstatfs.f_bsize of backing file to set discard granularity Ming Lei
2022-01-26 5:15 ` Christoph Hellwig
2022-02-08 3:22 ` Ming Lei [this message]
2022-02-11 22:11 ` Jens Axboe
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=YgHh9C9jq++Wzk+j@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=pezhang@redhat.com \
--cc=vgoyal@redhat.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