From: Koen De Wit <koen.de.wit@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: The -c option of btrfs qgroup limit
Date: Wed, 27 Mar 2013 00:36:59 +0100 [thread overview]
Message-ID: <5152311B.40908@oracle.com> (raw)
All,
The "btrfs qgroup limit" command has an option -c which means "limit amount
of data after compression". Whether this option is specified or not, I seem
to be able to write more well-compressible data than the specified limit. I
was expecting that omitting the -c option would never allow me to write
more data than specified by the limit. Am I missing something? Which
difference in behavior should I expect from the -c option?
Koen.
---
This is what I did:
Mount a btrfs filesystem with the compress option and turn on quota:
# mkfs.btrfs -f /dev/sdg2
# mount -o compress /dev/sdg2 /mnt
# cd /mnt
# btrfs quota enable ./
Create a subvol and limit the amount of data after compression. Write some
well-compressible files:
# btrfs subvol create subvol1
# btrfs qgroup limit -c 3m ./subvol1
# for i in `seq 1 5`; do
dd if=/dev/zero of=subvol1/file$i bs=1024 count=1000;
sync;
done
(no errors)
# du -s subvol1
5000 subvol1
We can write 5 MB of data to a file that is limited to 3 MB, which is
normal
in this case because data from /dev/zero is very good compressible.
Create a subvol and limit the amount of data after compression. Write some
poorly compressible files:
# btrfs subvol create subvol2
# btrfs qgroup limit -c 3m ./subvol2
# for i in `seq 1 5`; do
dd if=/dev/urandom of=subvol2/file$i bs=1024 count=1000;
sync;
done
dd: writing `subvol2/file4': Disk quota exceeded
dd: opening `subvol2/file5': Disk quota exceeded
# du -s subvol2
3056 subvol2
Here we get quota violations, because data from /dev/urandom is poorly
compressible.
Now write some well-compressible data to a subvol that is limited without
the -c option:
# btrfs subvol create subvol3
# btrfs qgroup limit 3m ./subvol3
# for i in `seq 1 5`; do
dd if=/dev/zero of=subvol3/file$i bs=1024 count=1000;
sync;
done
(no errors)
# du -s subvol3
5000 subvol3
We're still able to write 5 MB of data to a subvol that is limited to 3 MB.
next reply other threads:[~2013-03-26 23:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-26 23:36 Koen De Wit [this message]
2013-03-27 6:18 ` The -c option of btrfs qgroup limit Jan Schmidt
-- strict thread matches above, loose matches on Subject: below --
2013-03-27 6:44 Wang Shilong
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=5152311B.40908@oracle.com \
--to=koen.de.wit@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/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