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

Reply via email to