From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p7KA9FjS079468 for ; Sat, 20 Aug 2011 05:09:15 -0500 Received: from mail-ww0-f51.google.com (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 93963F8717 for ; Sat, 20 Aug 2011 03:09:14 -0700 (PDT) Received: from mail-ww0-f51.google.com (mail-ww0-f51.google.com [74.125.82.51]) by cuda.sgi.com with ESMTP id 26Xsl6Gz6stqEVA2 for ; Sat, 20 Aug 2011 03:09:14 -0700 (PDT) Received: by wwi18 with SMTP id 18so2737650wwi.32 for ; Sat, 20 Aug 2011 03:09:13 -0700 (PDT) Message-ID: <4E4F865B.2010608@gmail.com> Date: Sat, 20 Aug 2011 12:03:07 +0200 From: Marco Stornelli MIME-Version: 1.0 Subject: Re: [PATCH 1/4] fs: add SEEK_HOLE and SEEK_DATA flags References: <1309275199-10801-1-git-send-email-josef@redhat.com> <4E4F814B.5070202@gmail.com> In-Reply-To: <4E4F814B.5070202@gmail.com> List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: xfs-bounces@oss.sgi.com Errors-To: xfs-bounces@oss.sgi.com To: Josef Bacik Cc: linux-fsdevel@vger.kernel.org, viro@ZenIV.linux.org.uk, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, xfs@oss.sgi.com 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 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs