linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH RFC] block: use discard if possible in blkdev_issue_discard()
Date: Fri, 14 Feb 2014 09:57:21 -0500	[thread overview]
Message-ID: <20140214145721.GA1748@thunk.org> (raw)
In-Reply-To: <20140214130513.GA6127@infradead.org>

On Fri, Feb 14, 2014 at 05:05:13AM -0800, Christoph Hellwig wrote:
>  (4): add a new flag to blkdev_issue_zeroout to say if deallocating the
>       blocks is okay, and if yes proceed like (1).
> 
> Requiring blocks to be zeroed, but not wanting to remove the
> provisioning seems like a perfectly valid request, especially from
> userspace (e.g. databases)

That seems reasonable.  Should the default be to try to use discard if
it is available, or to keep the current behavior?  I'm leaning towards
defining BLKDEV_ZEROOUT_DISCARD, and changing all of the existing
calls to blkdev_issue_zeroout() to pass in 0 for the flags.  This
implies that if any file system does want to use discard for things
like fallocate(), they have to explicitly request it.

Which brings up a few additional questions, for which I'd appreciate
suggestions/opinons: 

Should we try to have some kind of informal naming scheme for a mount
option so that file systems can explicitly request this behavior,
i.e. "mount -o zeroout_discard"?  Of course, if we do this, very few
people will probably end up using it.

So should we try to set up some standard hueristics so that for
certain class of devices (such as flash) we default to using zeroout
_discard, and for certain other classes of devices (maybe thinp) we
don't?  Perhaps we should make it be tunable based on the number of
blocks that are being discarded, i.e., "mount -o zeroout_discard=128k"
means to use the zeroout_discard flag if we are trying to zeroout more
than 128k?

Also, is it worth creating a new ioctl, BLKZZEROOUT, or perhaps
BLKZEROOUTF, which takes a flags argument, so we can expose this to
userspace?  I'm not sure it is worth it, since at least for e2fsprogs,
I won't want to depend on the user using a new enough kernel to
support the new ioctl, and while it is a bit painful to query the
/sys/block/sdXX/queue/discard_* files, I'm doing it already for other
reasons.

Cheers,

						- Ted

  reply	other threads:[~2014-02-14 14:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  4:32 [PATCH RFC] block: use discard if possible in blkdev_issue_discard() Theodore Ts'o
2014-02-14 13:05 ` Christoph Hellwig
2014-02-14 14:57   ` Theodore Ts'o [this message]
2014-02-14 17:14 ` Martin K. Petersen
2014-02-15  1:29   ` Theodore Ts'o
2014-02-17 16:44     ` Martin K. Petersen
2014-02-17 19:19       ` Theodore Ts'o
2014-02-18  1:31         ` Martin K. Petersen
2014-02-18  2:17           ` Theodore Ts'o
2014-02-18  3:44             ` Martin K. Petersen
2014-02-18  5:47               ` Theodore Ts'o
2014-02-19  2:20                 ` Martin K. Petersen
2014-02-17 16:41   ` Lukáš Czerner

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=20140214145721.GA1748@thunk.org \
    --to=tytso@mit.edu \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).