linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	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 07:10:57 +0100	[thread overview]
Message-ID: <20220125061057.GA26444@lst.de> (raw)
In-Reply-To: <20220125044005.211943-1-ming.lei@redhat.com>

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.


  reply	other threads:[~2022-01-25  6:19 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 [this message]
2022-01-25  9:27   ` Ming Lei
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=20220125061057.GA26444@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).