From: Chris Mason <chris.mason@oracle.com>
To: Siddhartha Swaroop <siddhartha.swaroop@greenturtles.in>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Is compression mode activated?
Date: Wed, 08 Apr 2009 12:46:53 -0400 [thread overview]
Message-ID: <1239209213.28688.2.camel@think.oraclecorp.com> (raw)
In-Reply-To: <d853ebb60904080304o11101887kdbbcd4626ebb9c96@mail.gmail.com>
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
parent reply other threads:[~2009-04-08 16:46 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <d853ebb60904080304o11101887kdbbcd4626ebb9c96@mail.gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1239209213.28688.2.camel@think.oraclecorp.com \
--to=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=siddhartha.swaroop@greenturtles.in \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox