Re: [PATCH 4/7][TAKE5] support new modes in fallocate
From: Andreas Dilger <hidden>
Date: 2007-06-27 03:49:17
Also in:
linux-fsdevel, linux-xfs
From: Andreas Dilger <hidden>
Date: 2007-06-27 03:49:17
Also in:
linux-fsdevel, linux-xfs
On Jun 27, 2007 09:14 +1000, David Chinner wrote:
Someone on the XFs list had an interesting request - preallocated swap files. You can't use unwritten extents for this because of sys_swapon()s use of bmap() (XFS returns holes for reading unwritten extents), so we need a method of preallocating that does not zero or mark the extent unread. i.e. FA_MKSWAP.
Is there a reason why unwritten extents return 0 to bmap()? This would seem to be the only impediment from using fallocated files for swap files. Maybe if FIEMAP was used by mkswap to get an "UNWRITTEN" flag back instead of "HOLE" it wouldn't be a problem.
That way we can allocate large swap files that don't need zeroing in a single, fast operation, and hence potentially bring new swap space online without needed very much memory at all (i.e. should succeed in most near-OOM conditions).
Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc.