Re: The -c option of btrfs qgroup limit

2013-03-27 Thread Jan Schmidt
Hi Koen,

On 27.03.2013 00:36, Koen De Wit wrote:
 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?

Today: none. In the future: The one you describe. That option is planned
but not implemented. We should have mentioned that in the qgroup usage,
I agree.

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


The -c option of btrfs qgroup limit

2013-03-27 Thread Wang Shilong
Hello Koen,

Although we offer '-c' option for btrfs qgroup limit,
it has been not implemented yet.
So until now, btrfs quota just limits the real space
that writes to the space.

Thanks,
Wang

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


The -c option of btrfs qgroup limit

2013-03-26 Thread Koen De Wit

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.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html