Re: Question on fallocate/ftruncate sequence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2009-07-21 at 15:54 -0600, Andreas Dilger wrote:
> On Jul 21, 2009  14:29 -0700, Frank Mayhar wrote:
> > I've spent a little while today digging into this.  My guess (only a
> > guess at this point until I have a chance to prove it) is that
> > i_disksize should be updated by fallocate() even when KEEP_SIZE is
> > specified.  It's currently not updated in that case.
> 
> No, that isn't correct.  The intent of KEEP_SIZE is to allow fallocate
> to preallocate blocks beyond the EOF, so that it doesn't affect the
> file data visible to userspace, but can avoid fragmentation from e.g.
> log files or mbox files.
> 
> The i_disksize variable is just to handle the lag in updating the on-disk
> file size during truncate, because the VFS updates i_size to indicate a
> truncate, but in order to handle the truncation of files within finite
> transaction sizes the on-disk file size needs to be shrunk incrementally.

Okay, thanks, this makes this much more clear.

It does sound like there needs to be a flag somewhere (probably in the
on-disk inode) that indicates that there are allocated blocks beyond
EOF, as you say.  Then use that in ftruncate().

We would really like to avoid your workaround for performance reasons.
-- 
Frank Mayhar <fmayhar@xxxxxxxxxx>
Google, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux