linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Miell <nmiell@comcast.net>
To: Josef Bacik <jbacik@redhat.com>
Cc: linux-fsdevel@vger.kernel.org,
	Andreas Dilger <adilger@clusterfs.com>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA
Date: Wed, 28 Nov 2007 15:50:40 -0800	[thread overview]
Message-ID: <1196293840.18231.24.camel@entropy> (raw)
In-Reply-To: <20071128233327.GF3977@dhcp243-37.rdu.redhat.com>


On Wed, 2007-11-28 at 18:33 -0500, Josef Bacik wrote:
> On Wed, Nov 28, 2007 at 02:56:54PM -0800, Nicholas Miell wrote:
> > 
> > On Wed, 2007-11-28 at 15:02 -0500, Josef Bacik wrote:
> > > Hello,
> > > 
> > > This is my first pass at implementing SEEK_HOLE/SEEK_DATA.  This has been in
> > > solaris for about a year now, and is described here
> > > 
> > > http://docs.sun.com/app/docs/doc/819-2241/lseek-2?l=en&a=view&q=SEEK_HOLE
> > > http://blogs.sun.com/roller/page/bonwick?entry=seek_hole_and_seek_data
> > > 
> > > I've added a file operation to allow filesystems to override the default
> > > seek_hole_data function, which just loops through bmap looking for either a hole
> > > or data.  I've tested this and it seems to work well.  I ran my testcase on a
> > > solaris box to make sure I got consistent results (I just ran my test script on
> > > the solaris box, I haven't looked at any of their code in case thats a concern).
> > > All comments welcome.  Thank you,
> > > 
> > > Josef
> > 
> > I stand by my belief that SEEK_HOLE/SEEK_DATA is a lousy interface.
> > 
> > It abuses the seek operation to become a query operation, it requires a
> > total number of system calls proportional to the number holes+data and
> > it isn't general enough for other similar uses (e.g. total number of
> > contiguous extents, compressed extents, offline extents, extents
> > currently shared with other inodes, extents embedded in the inode
> > (tails), etc.)
> > 
> > Something like the following would be much better:
> > 
> > int getfilextents(int fd, off_t offset, int type, size_t *length, struct
> > extent *extents)
> > 
> > with
> > 
> > int fd: open file
> > 
> > offset: offset in file to start reporting extents
> > 
> > type: one of EXTENT_TYPE_HOLE, EXTENT_TYPE_DATA, EXTENT_TYPE_EXTENTS,
> > EXTENT_TYPE_COMPRESSED, EXTENT_TYPE_UNCOMPRESSED etc.
> > 
> > length: in/out parameter, on entry contains length of extents array, on
> > exit contains number of valid entries in the extents array or total
> > number of extents remaining in the file, whichever is larger
> > 
> > extents: array of struct extent { off_t offset; off_t length }, only
> > updated if non-NULL
> > 
> > Making the type parameter a bitmask and adding a type member to struct
> > extent could be useful so that multiple types of extents could be
> > reported at once could be useful, too. (But you end up with weird cases
> > like data extents overlapping with compressed extents.)
> > 
> > Actually, now that I've searched my mailbox, Andreas Dilger's FIEMAP
> > proposal is pretty much what I suggest here and is certainly superior to
> > Sun's SEEK_HOLE/SEEK_DATA.
> >
> 
> Agreed, however in speaking hch and others the consensus was FIEMAP was good,
> however there was no reason why SEEK_HOLE/SEEK_DATA shouldn't also be
> implemented, and then at some point down the road when a generic FIEMAP is in
> place either change the SEEK_HOLE/SEEK_DATA implementation to try to use FIEMAP
> by default and then fall back on bmap if it has to, or some other such
> operation.  I'm cool with passing on this implementation in preference for
> FIEMAP, but given the discussion I had earlier this week with some of the other
> fs people the general thought was go ahead and do this for now.
> 

Well, there's no demand specifically for SEEK_HOLE/SEEK_DATA[1] and the
interface is ugly, so killing it before it spreads beyond Solaris seems
like a good idea to me. OTOH, if you implement SEEK_HOLE/SEEK_DATA,
nobody is going to bother using the good interface if SEEK_HOLE/
SEEK_DATA is the only portable interface.



[1] The only user appears to be Joerg Schilling.
http://www.google.com/codesearch?hl=en&q=+%5CWSEEK_(DATA%7CHOLE)&sa=N&as_case=y

-- 
Nicholas Miell <nmiell@comcast.net>


  reply	other threads:[~2007-11-28 23:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-28 20:02 [RFC][PATCH] Implement SEEK_HOLE/SEEK_DATA Josef Bacik
2007-11-28 21:56 ` Brad Boyer
2007-11-28 23:38   ` Josef Bacik
2007-11-28 22:56 ` Nicholas Miell
2007-11-28 23:33   ` Josef Bacik
2007-11-28 23:50     ` Nicholas Miell [this message]
2007-11-28 23:39   ` Andreas Dilger
2007-11-28 23:48     ` Jörn Engel
2007-11-29  0:06       ` Nicholas Miell
2007-11-29  3:07         ` Jörn Engel
2007-11-29  3:27       ` Andreas Dilger
2007-11-29  4:14         ` Jörn Engel
2007-11-28 23:49 ` Andreas Dilger

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=1196293840.18231.24.camel@entropy \
    --to=nmiell@comcast.net \
    --cc=adilger@clusterfs.com \
    --cc=hch@infradead.org \
    --cc=jbacik@redhat.com \
    --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).