linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: linux@horizon.com
To: linux-fsdevel@vger.kernel.org
Subject: SEEK_HOLE and SEEK_DATA
Date: 2 Feb 2006 04:03:49 -0500	[thread overview]
Message-ID: <20060202090349.31898.qmail@science.horizon.com> (raw)

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.

             reply	other threads:[~2006-02-02  9:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02  9:03 linux [this message]
2006-02-03 18:08 ` SEEK_HOLE and SEEK_DATA 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

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=20060202090349.31898.qmail@science.horizon.com \
    --to=linux@horizon.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).