lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 02 Mar 2007 11:19:15 -0600
From:	Eric Sandeen <sandeen@...hat.com>
To:	Badari Pulavarty <pbadari@...ibm.com>
CC:	"Amit K. Arora" <aarora@...ux.vnet.ibm.com>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	ext4 <linux-ext4@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>, suparna@...ibm.com,
	cmm@...ibm.com, alex@...sterfs.com, suzuki@...ibm.com
Subject: Re: [RFC] Heads up on sys_fallocate()

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:

[root@...nesium test]# touch resvsp
[root@...nesium 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)

[root@...nesium test]# ls -lh resvsp
-rw-r--r--  1 root root 0 Nov 28 14:11 resvsp
[root@...nesium test]# du -hc resvsp
10G     resvsp
10G     total
[root@...nesium 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...

[root@...nesium test]# xfs_io resvsp
xfs_io> resvsp 1g 1g
xfs_io> resvsp 3g 1g
xfs_io> resvsp 5g 1g
xfs_io> quit

[root@...nesium 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ