linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SEEK_HOLE and SEEK_DATA
@ 2006-02-02  9:03 linux
  2006-02-03 18:08 ` Chris Wedgwood
  0 siblings, 1 reply; 7+ messages in thread
From: linux @ 2006-02-02  9:03 UTC (permalink / raw)
  To: linux-fsdevel

Solaris 10 has added a moderately useful new feature...  lseek now
supports whence = 3 (SEEK_DATA) and 4 (SEEK_HOLE).  What these do is
advance the file pointer to the start of the next run of the appropriate
kind past the given (absolute) offset.

This is, of course, to make backing up and copying sparse files more
efficient.

I'm still figuring out the fine details of semantics.  EOF is considered
the start of a hole.  If the seek position is past EOF, they return ENXIO.

I'm still trying to figure out if they search > the given offset or >=.
Reading the code, it actually looks like lseek(fd, 13, SEEK_DATA) will
return 0 on a non-sparse file, because they round down to blocks and
then search by blocks.

Not that this affects the usual case where you start at offset 0 and
alternate SEEK_DATA/SEEK_HOLE to find ranges to copy.


I was just wondering if it's an extension worth adopting.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-02-03 23:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-02  9:03 SEEK_HOLE and SEEK_DATA linux
2006-02-03 18:08 ` Chris Wedgwood
2006-02-03 18:23   ` Szakacsits Szabolcs
2006-02-03 19:37     ` Chris Wedgwood
2006-02-03 22:00     ` Bryan Henderson
2006-02-03 23:41       ` Szakacsits Szabolcs
2006-02-03 23:53       ` Chris Wedgwood

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).