Badari Pulavarty wrote:

BTW, what is the interface for finding out what is the size of the
pre-allocated file ?

With XFS at least, "du," "stat," etc tell you a little:

[EMAIL PROTECTED] test]# touch resvsp
[EMAIL PROTECTED] test]# xfs_io resvsp
xfs_io> resvsp 0 10g

The file is 0 length, but is using 10g of blocks:
(with posix_fallocate this would move the size out to 10g as well)

[EMAIL PROTECTED] test]# ls -lh resvsp
-rw-r--r--  1 root root 0 Nov 28 14:11 resvsp
[EMAIL PROTECTED] test]# du -hc resvsp
10G     resvsp
10G     total
[EMAIL PROTECTED] test]# stat resvsp
  File: `resvsp'
Size: 0 Blocks: 20971520 IO Block: 4096 regular empty file
Device: 81eh/2078d      Inode: 186         Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

xfs also has an interface to find out what allocations are where:

if you reserve some ranges not starting at 0...

[EMAIL PROTECTED] test]# xfs_io resvsp
xfs_io> resvsp 1g 1g
xfs_io> resvsp 3g 1g
xfs_io> resvsp 5g 1g
xfs_io> quit

[EMAIL PROTECTED] test]# xfs_bmap -v resvsp
resvsp:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL FLAGS 0: [0..2097151]: hole 2097152 1: [2097152..4194303]: 42392..2139543 0 (42392..2139543) 2097152 10000 2: [4194304..6291455]: hole 2097152 3: [6291456..8388607]: 4236696..6333847 0 (4236696..6333847) 2097152 10000 4: [8388608..10485759]: hole 2097152 5: [10485760..12582911]: 8431000..10528151 0 (8431000..10528151) 2097152 10000

The flags of 10000 mean that these extents is preallocated/unwritten.

I suppose outside of XFS, FIBMAP is your best bet, but that won't tell you what is preallocated vs. allocated/written....

-Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to