From: Cyril Hrubis <chrubis@suse.cz>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Jan Kara <jack@suse.cz>
Subject: Re: [PATCH] loop: Disable fallocate() zero and discard if not supported
Date: Mon, 10 Jun 2024 16:13:23 +0200 [thread overview]
Message-ID: <ZmcKA3zHsOYlyaiq@yuki> (raw)
In-Reply-To: <ZmPvNu-YijbtJkeR@infradead.org>
Hi!
> > How to reproduce:
> >
> > 1. make sure /tmp is mounted as tmpfs
> > 2. dd if=/dev/zero of=/tmp/disk.img bs=1M count=100
> > 3. losetup /dev/loop0 /tmp/disk.img
> > 4. mkfs.ext2 /dev/loop0
> > 5. dmesg |tail
>
> Can you wire this up for blktests?
Will try.
> > + if (ret == -EOPNOTSUPP) {
> > + struct queue_limits lim = queue_limits_start_update(lo->lo_queue);
> > +
> > + if (mode & FALLOC_FL_ZERO_RANGE)
> > + lim.max_write_zeroes_sectors = 0;
> > +
> > + if (mode & FALLOC_FL_PUNCH_HOLE) {
> > + lim.max_hw_discard_sectors = 0;
> > + lim.discard_granularity = 0;
> > + }
> > +
> > + queue_limits_commit_update(lo->lo_queue, &lim);
>
> Please split this out into a separate helper to keep it out of the
> main fast path I/O handling. A little comment that we are
> optimistically trying these if ->fallocate is support and might have
> to paddle back here would also be useful.
Will do.
Do we need noinline attribute for the function as well or unlikely() in
the if condition?
> (and maybe one day we figure out a way for the file system to
> advertise what fallocate modes it actually supports..)
One of my ideas was to try fallocate() with zero size in the
loop_reconfigure_limits() to see if we get EOPNOTSUPP but for that to
work we would have to make sure that we do not bail early on zero size
in the vfs layer...
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2024-06-10 14:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 9:15 [PATCH] loop: Disable fallocate() zero and discard if not supported Cyril Hrubis
2024-06-07 15:06 ` Petr Vorel
2024-06-08 5:42 ` Christoph Hellwig
2024-06-10 2:47 ` Chaitanya Kulkarni
2024-06-10 14:13 ` Cyril Hrubis [this message]
2024-06-10 14:14 ` 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=ZmcKA3zHsOYlyaiq@yuki \
--to=chrubis@suse.cz \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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