public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Is compression mode activated?
       [not found] <d853ebb60904080304o11101887kdbbcd4626ebb9c96@mail.gmail.com>
@ 2009-04-08 16:46 ` Chris Mason
  0 siblings, 0 replies; only message in thread
From: Chris Mason @ 2009-04-08 16:46 UTC (permalink / raw)
  To: Siddhartha Swaroop; +Cc: linux-btrfs

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-08 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <d853ebb60904080304o11101887kdbbcd4626ebb9c96@mail.gmail.com>
2009-04-08 16:46 ` Is compression mode activated? Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox