Re: [PATCH] btrfs: add new ioctl to determine size of compressed file

2011-12-20 Thread David Sterba
On Tue, Dec 20, 2011 at 09:33:06AM +0800, Liu Bo wrote: +static long btrfs_ioctl_compr_size(struct file *file, void __user *argp) +{ + struct inode *inode = fdentry(file)-d_inode; + struct btrfs_ioctl_compr_size_args compr_args; + u64 len; + u64 compressed_size = 0; + u64

[PATCH] btrfs: add new ioctl to determine size of compressed file

2011-12-19 Thread David Sterba
Go through all extents of a file in a given [start,end) range and sum for: * regular extent: -block_len, size is already rounded up to blocks * inline extents: length rounded up to 512 The range is start inclusive / end exclusive. For the whole file pass 0 and (u64)-1. The resulting value is

Re: [PATCH] btrfs: add new ioctl to determine size of compressed file

2011-12-19 Thread Liu Bo
On 12/19/2011 10:17 PM, David Sterba wrote: Go through all extents of a file in a given [start,end) range and sum for: * regular extent: -block_len, size is already rounded up to blocks * inline extents: length rounded up to 512 The range is start inclusive / end exclusive. For the whole