From: Frank Mayhar Subject: Re: Question on fallocate/ftruncate sequence (and flags) Date: Thu, 23 Jul 2009 12:48:37 -0700 Message-ID: <1248378517.8421.4.camel@bobble.smo.corp.google.com> References: <6601abe90907200936w61ebda92reae368a2b9efac66@mail.gmail.com> <4A64F37D.7020803@redhat.com> <1248211771.20743.2.camel@bobble.smo.corp.google.com> <20090721215421.GM4231@webber.adilger.int> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Eric Sandeen , Curt Wohlgemuth , ext4 development To: Andreas Dilger Return-path: Received: from smtp-out.google.com ([216.239.33.17]:23439 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751658AbZGWTs7 (ORCPT ); Thu, 23 Jul 2009 15:48:59 -0400 In-Reply-To: <20090721215421.GM4231@webber.adilger.int> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Tue, 2009-07-21 at 15:54 -0600, Andreas Dilger wrote: > That said, we might need to have some kind of flag in the on-disk > inode to indicate that it was preallocated beyond EOF. Otherwise, > e2fsck will try and extend the file size to match the block count, > which isn't correct. We could also use this flag to determine if > truncate needs to be run on the inode even if the new size is the > same. As it happens there's already a flag, FS_FALLOC_FL, set by ext2 in fallocate(). Unfortunately ext4 is using that bit (0x00040000) for EXT4_HUGE_FILE_FL. (Ext4 is using another bit as well, 0x00100000, for EXT4_EXT_MIGRATE_FL when fs.h defines it as FS_DIRECTIO_FL.) I really want to use the FS_FALLOC_FL bit for this purpose but that means reallocating HUGE_FILE_FL to some other big. Objections? -- Frank Mayhar Google, Inc.