From: Valdis.Kletnieks@vt.edu
To: Josef Bacik <josef@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2 v2] fs: add SEEK_HOLE and SEEK_DATA flags
Date: Wed, 04 May 2011 15:04:47 -0400 [thread overview]
Message-ID: <15392.1304535887@localhost> (raw)
In-Reply-To: Your message of "Wed, 04 May 2011 13:58:39 EDT." <1304531920-2890-1-git-send-email-josef@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
On Wed, 04 May 2011 13:58:39 EDT, Josef Bacik said:
> -SEEK_HOLE: this moves the file pos to the nearest hole in the file from the
> given position.
Nearest, or next? Solaris defines it as "next", for a good reason - otherwise
you can get stuck in a case where the "nearest" hole is back towards the
start of the file - and "seek data" will bounce back to the next byte at
the other end of the hole.
Consider a file with this layout:
< 40K of data> A < 32K hole> B < 32K data> C < 8K hole> D <32K data> E ....
If you're in the range between "8K-1 before C" and "8K-1 after D", there's no
application of seeks to "nearest" data/hole that doesn't leave you oscillating
between C and D, and unable to reach B or E. If youre at C, "nearest hole" is
where you are, and "nearest data" is at D, not B. Similarly for D - nearest
data is C, not E.
However, this is easily dealt with if you define it as "next", as then it is
simple to discover exactly where A/B/C/D/E are.
[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]
next prev parent reply other threads:[~2011-05-04 19:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 17:58 [PATCH 1/2 v2] fs: add SEEK_HOLE and SEEK_DATA flags Josef Bacik
2011-05-04 17:58 ` [PATCH 2/2 v2] Btrfs: implement our own ->llseek Josef Bacik
2011-05-04 19:04 ` Valdis.Kletnieks [this message]
2011-05-04 19:10 ` [PATCH 1/2 v2] fs: add SEEK_HOLE and SEEK_DATA flags Josef Bacik
2011-05-04 19:20 ` Valdis.Kletnieks
2011-05-04 19:22 ` Josef Bacik
2011-05-04 21:54 ` Dave Kleikamp
2011-05-04 21:55 ` Dave Kleikamp
2011-05-04 19:31 ` Valdis.Kletnieks
2011-05-04 19:33 ` Josef Bacik
2011-05-05 18:54 ` Marco Stornelli
2011-05-05 19:01 ` Josef Bacik
2011-05-05 18:58 ` Marco Stornelli
2011-05-05 19:19 ` Marco Stornelli
2011-05-05 19:35 ` Josef Bacik
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=15392.1304535887@localhost \
--to=valdis.kletnieks@vt.edu \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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).