Re: Is compression mode activated?

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

 



On Wed, 2009-04-08 at 15:34 +0530, Siddhartha Swaroop wrote:
> Hello,
> 
> I'm Siddhartha Swaroop from Green Turtle Technologies.
> As you mentioned in mailing list, am  trying to write ioctl that
> reports on the actual size of the
> compressed file. So before starting to write I have to enable compress
> mode and check manually how much size is compressed.
> 
> For that this is the test case what I did 
> 
> Test case:
> 
> $ du -h file
> 116K    file
> 
> $ mount -t btrfs /dev/sda4 /mnt/
> 
> $ cp file /mnt/
> 
> $ du -h /mnt/file 
> 108K    /mnt/file
> 
> $ du -h install.log
> 48K     install.log
>  
> $ cp install.log /mnt/
> 
> $ du -h /mnt/install.log 
> 44K     /mnt/install.log
> 
> $ rm /mnt/file
> 
> $ rm /mnt/install.log
> 
> $ umount /mnt
> 
> $ mount -t btrfs -o compress /dev/sda4 /mnt
> 
> $ cp file /mnt/
> 
> $ du -h /mnt/file 
> 108K    /mnt/file
> 
> $ cp install.log /mnt/
> 
> $ du -h /mnt/install.log 
> 44K     /mnt/install.log
> 
> So now my question is 
> 1>whether compress mode is activated in my system or not?

If you mounted -o compress, it is activated.
> 
> 2>If yes then what is the use of this compress mode because the size
> of the file is same as before compress mode is activated in btrfs.
> 
The idea behind transparent compression is that it is transparent ;)
The inode fields from stat need to reflect the uncompressed size,
because userland applications expect them to work a certain way.

In order to find the actual space used, you need to walk the btrfs btree
and count the extents.

df is another good way to check, since df shows the actual blocks
allocated.

-chris


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

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux