All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Pei Zhang <pezhang@redhat.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	linux-unionfs@vger.kernel.org
Subject: Re: [PATCH] block: loop: set discard_granularity as PAGE_SIZE if sb->s_blocksize is 0
Date: Mon, 24 Jan 2022 10:22:01 -0500	[thread overview]
Message-ID: <Ye7EGS2eYzhJX/e0@redhat.com> (raw)
In-Reply-To: <Ye6yE2Ephyv+WBYY@infradead.org>

On Mon, Jan 24, 2022 at 06:05:07AM -0800, Christoph Hellwig wrote:
> On Mon, Jan 24, 2022 at 06:06:28PM +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.
> > 
> > Fix the issue by setting discard_granularity as PAGE_SIZE in this case
> > since PAGE_SIZE is the most common data unit for FS.
> 
> sb->s_blocksize really does not mean anything.  kstat.blksize might
> be a better choice, even if it someimes errs on the too large side.

[ CC linux-unionfs, Miklos ]

This should work well for overlayfs too. I see it just passes the query
to underlying filesystem and that should report optimal I/O size.

On my overlayfs instance, I see.

# stat -c '%o' foo.txt
4096

Vivek


      reply	other threads:[~2022-01-24 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 10:06 [PATCH] block: loop: set discard_granularity as PAGE_SIZE if sb->s_blocksize is 0 Ming Lei
2022-01-24 13:36 ` Vivek Goyal
2022-01-24 14:05 ` Christoph Hellwig
2022-01-24 15:22   ` Vivek Goyal [this message]

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=Ye7EGS2eYzhJX/e0@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=ming.lei@redhat.com \
    --cc=pezhang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.