From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Vivek Goyal <vgoyal@redhat.com>,
Pei Zhang <pezhang@redhat.com>
Subject: Re: [PATCH V2] block: loop:use kstatfs.f_bsize of backing file to set discard granularity
Date: Tue, 25 Jan 2022 17:27:36 +0800 [thread overview]
Message-ID: <Ye/CiFZSHmHQ3Pfu@T590> (raw)
In-Reply-To: <20220125061057.GA26444@lst.de>
On Tue, Jan 25, 2022 at 07:10:57AM +0100, Christoph Hellwig wrote:
> On Tue, Jan 25, 2022 at 12:40:05PM +0800, Ming Lei wrote:
> > } else {
> > + struct kstatfs sbuf;
> > +
> > max_discard_sectors = UINT_MAX >> 9;
> > - granularity = inode->i_sb->s_blocksize;
> > + if (!vfs_statfs(&file->f_path, &sbuf))
> > + granularity = sbuf.f_bsize;
> > + else
> > + granularity = PAGE_SIZE;
>
> If vfs_statfs fails we're pretty much toast and there isn't really any
> point in continuing here.
But it is configure code path, even though vfs_statfs() fails,
loop_config_discard() still need to keep discard setting consistent.
Setting granularity as PAGE_SIZE is just for making discard granularity
matched with max_discard_sectors. Or you have better/simpler handling?
Thanks,
Ming
next prev parent reply other threads:[~2022-01-25 9:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 4:40 [PATCH V2] block: loop:use kstatfs.f_bsize of backing file to set discard granularity Ming Lei
2022-01-25 6:10 ` Christoph Hellwig
2022-01-25 9:27 ` Ming Lei [this message]
2022-01-25 15:40 ` Christoph Hellwig
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=Ye/CiFZSHmHQ3Pfu@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