All of lore.kernel.org
 help / color / mirror / Atom feed
From: Koen De Wit <koen.de.wit@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: Adding a non-empty subvol to a qgroup
Date: Fri, 22 Mar 2013 11:34:10 +0100	[thread overview]
Message-ID: <514C33A2.9050709@oracle.com> (raw)

All,

When adding a subvolume to a qgroup, pre-existing files in that 
subvolume are not counted in the referenced/exclusive space of the 
qgroup. Is this intended behavior ?

I create a subvol with one file:

   # mkfs.btrfs /dev/sdg
   # mount /dev/sdg /mnt/fulldisk
   # cd /mnt/fulldisk
   # btrfs quota enable ./
   # btrfs sub create sub1
   # dd if=/dev/zero of=sub1/file1 bs=100000 count=1
   # sync
   # btrfs qgroup show ./
   0/257 106496 106496

Now I create a new qgroup on level 1 and add the qgroup of sub1 to it :

   # btrfs qgroup create 1/0 ./
   # btrfs qgroup assign 0/257 1/0 ./
   # sync
   # btrfs fi sync ./
   # btrfs quota rescan ./
   # btrfs quota rescan ./sub1
   # btrfs qgroup show ./
   0/257 106496 106496
   1/0 0 0

The pre-existing file does not contribute to the space numbers.

Let's create a new file:

   # dd if=/dev/zero of=sub1/file2 bs=50000 count=1
   # sync
   # btrfs qgroup show ./
   0/257 159744 159744
   1/0 53248 53248

We see that only the new file is included in the space numbers.

Now I remove the first file:

   # rm -f sub1/file1
   # sync
   # btrfs qgroup show ./
   0/257 57344 57344
   1/0 -49152 -49152

The space numbers go below zero. Even if the behavior above is intended, 
the removal of the pre-existing file should not result in negative space 
numbers.

Koen.

             reply	other threads:[~2013-03-22 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 10:34 Koen De Wit [this message]
2013-03-22 11:27 ` Adding a non-empty subvol to a qgroup Wang Shilong
2013-03-22 12:03 ` Wang Shilong
2013-03-22 12:29   ` Arne Jansen

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=514C33A2.9050709@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.