[Top] [All Lists]

Re: [PATCH 1/4] fs: add SEEK_HOLE and SEEK_DATA flags

To: Marco Stornelli <marco.stornelli@xxxxxxxxx>
Subject: Re: [PATCH 1/4] fs: add SEEK_HOLE and SEEK_DATA flags
From: Sunil Mushran <sunil.mushran@xxxxxxxxxx>
Date: Mon, 22 Aug 2011 08:57:51 -0700
Cc: Josef Bacik <josef@xxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx
In-reply-to: <CANGUGtCi85Sgrr5R0E8iuN75ubbMX9txZMwnsvp4Wv3Xh+938g@xxxxxxxxxxxxxx>
References: <1309275199-10801-1-git-send-email-josef@xxxxxxxxxx> <4E4F814B.5070202@xxxxxxxxx> <4E4F865B.2010608@xxxxxxxxx> <4E4FD48B.8030101@xxxxxxxxxx> <4E4FE1B1.7010601@xxxxxxxxx> <4E51F24F.1050503@xxxxxxxxxx> <CANGUGtCi85Sgrr5R0E8iuN75ubbMX9txZMwnsvp4Wv3Xh+938g@xxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20110617 Thunderbird/3.1.11
On 08/22/2011 03:56 AM, Marco Stornelli wrote:
2011/8/22 Sunil Mushran<sunil.mushran@xxxxxxxxxx>:
On 08/20/2011 09:32 AM, Marco Stornelli wrote:
Thank. Yes the word "next" is not very clear. I re-read the proposal for
the standard, actually it's seems to me that if we are in the last hole we
should return the file size, if we are not in the last hole than it's ok the
same offset - "....except that
if offset falls beyond the last byte not within a hole, then the file
offset may be set to the file size instead".
Any proposal that differentiates between holes is wrong. It should not
matter where the hole is.

Think of it from the usage-pov.

doff = 0;
while ((doff = lseek(SEEK_DATA, doff)) != -ENXIO) {
    hoff = lseek(SEEK_HOLE, doff);
    read_offset = doff;
    read_len = hoff -doff;
    doff = hoff;

The goal is to make this as efficient as follows. Treating the last
hole differently adds more code for no benefit.

Mmmm.....It seems that Josef has to be clear in this point. However I
looked for the seek hole test in xfs test suite, but I didn't find
anything. Btrfs guys, how have you got tested the implementation? What
do you think about this corner case? Al, what do you think about it?

The following test was used to test the early implementations.

<Prev in Thread] Current Thread [Next in Thread>