xfs
[Top] [All Lists]

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

To: Josef Bacik <josef@xxxxxxxxxx>
Subject: Re: [PATCH 1/4] fs: add SEEK_HOLE and SEEK_DATA flags
From: Marco Stornelli <marco.stornelli@xxxxxxxxx>
Date: Sat, 20 Aug 2011 12:03:07 +0200
Cc: linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-btrfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, viro@xxxxxxxxxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=sUw7fIg6TsgaoPtbbt+rDMdnF/hQ+rt9iexwqKA5AoY=; b=IJ2z4MEuYZ8zJiIgCXYvhC1PlaSw89ZQxruaCbyZzApEsvaLgG7vE2jThS6YSh8Z2/ nQP/gkxABPhXTSjeTJJDErwpid2xgNVJfGcvaJj09tmbBYc/F+Wl6aA8hUUed+fUBUIK lr1EyV3ZZj8lhvPKG8LiQ4qyxHFvK5RiHopFQ=
In-reply-to: <4E4F814B.5070202@xxxxxxxxx>
References: <1309275199-10801-1-git-send-email-josef@xxxxxxxxxx> <4E4F814B.5070202@xxxxxxxxx>
User-agent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11
Il 20/08/2011 11:41, Marco Stornelli ha scritto:
Hi,

Il 28/06/2011 17:33, Josef Bacik ha scritto:
This just gets us ready to support the SEEK_HOLE and SEEK_DATA flags.
Turns out
using fiemap in things like cp cause more problems than it solves, so
lets try
and give userspace an interface that doesn't suck. We need to match
solaris
here, and the definitions are

*o* If /whence/ is SEEK_HOLE, the offset of the start of the
next hole greater than or equal to the supplied offset
is returned. The definition of a hole is provided near
the end of the DESCRIPTION.

*o* If /whence/ is SEEK_DATA, the file pointer is set to the
start of the next non-hole file region greater than or
equal to the supplied offset.


I'm implementing the SEEK_DATA/SEEK_HOLE management for pramfs and I've
got some doubts about the right behavior:

1) when we use SEEK_DATA/SEEK_HOLE, the offset used in lseek means
always the offset from the start of the file, right?

2) in case of a file with hole at the beginning and data at the end, if
I do lseek(fd, 0, SEEK_HOLE) I should receive the end of the file
because the idea is to search the *next* hole and we have always a
virtual hole at the end of the file, right?

Just to be precise about this question: the alternative here, it's to return the same position because we are already in a hole.

Marco

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