linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: linux-fsdevel@vger.kernel.org,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH RFC] fs: add FIEMAP_FLAG_DISCARD support
Date: Mon, 4 Nov 2013 10:14:42 +1100	[thread overview]
Message-ID: <20131103231442.GM6188@dastard> (raw)
In-Reply-To: <1383435930-29295-1-git-send-email-tytso@mit.edu>

On Sat, Nov 02, 2013 at 07:45:30PM -0400, Theodore Ts'o wrote:
> Add the ability for a user who has write access to a file to issue a
> discard request for blocks belonging to a file.  This can be done via
> a new flag to the FIEMAP ioctl, or via the BLKDISCARD ioctl (which
> previously only worked on block devices).
> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

FIEMAP is not the correct interface for data modifying operations.
It is an interface that returns information about file metadata (i.e
the layout of a file) - it is not an interface for modifying the
contents of the file.

fallocate() is the interface used to modify file layout and
manipulate the data within it and hence, IMO, is much better aligned
to this operation. And to tell the truth, I'd much prefer such an
interface is guaranteed to return zeros to users rather than rely on
whether the underlying device supports discard or whatever they
return after a discard. i.e. if the user is asking to destroy the
data in the file, we better be able to ensure the data in the file
is in a known state at the filesystem level regardless of the
underlying storage capabilities....

For example, XFS already has a XFS_IOC_ZERO operation which is used
to return allocated blocks to unwritten state (i.e. always return
zeros) and could easily be extended to issue discards on the blocks
if the underlying device supports discards-to-zero or WRITE_SAME.
I've previously proposed this interface for fallocate() - old patch
here:

http://permalink.gmane.org/gmane.linux.file-systems/62449

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2013-11-03 23:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-02 23:45 [PATCH RFC] fs: add FIEMAP_FLAG_DISCARD support Theodore Ts'o
2013-11-03 23:14 ` Dave Chinner [this message]
2013-11-03 23:42   ` Theodore Ts'o
2013-11-04 21:57     ` Dave Chinner
2013-11-05  0:35       ` [PATCH RFC] " Andreas Dilger
2013-11-04 10:03 ` [PATCH RFC] fs: " Christoph Hellwig
2013-11-05  0:51   ` Theodore Ts'o
2013-11-05  1:17     ` Christoph Hellwig
2013-11-05  4:36     ` Dave Chinner

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=20131103231442.GM6188@dastard \
    --to=david@fromorbit.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).