linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: How exclusive in parent qgroup is computed? (was: Re: exclusive subvolume space missing)
Date: Tue, 5 Dec 2017 21:47:59 +0300	[thread overview]
Message-ID: <ceb66754-5369-eb32-0aa2-ec17cff18d3d@gmail.com> (raw)
In-Reply-To: <55036341-2e8e-41dc-535f-f68d8e74d43f@gmx.com>


[-- Attachment #1.1: Type: text/plain, Size: 3033 bytes --]

02.12.2017 03:27, Qu Wenruo пишет:
> 
> That's the difference between how sub show and quota works.
> 
> For quota, it's per-root owner check.
> Means even a file extent is shared between different inodes, if all
> inodes are inside the same subvolume, it's counted as exclusive.
> And if any of the file extent belongs to other subvolume, then it's
> counted as shared.
> 

Could you also explain how parent qgroup computes exclusive space? I.e.

10:~ # mkfs -t btrfs -f /dev/sdb1
btrfs-progs v4.13.3
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM /dev/sdb1 (1023.00MiB) ...
Label:              (null)
UUID:               b9b0643f-a248-4667-9e69-acf5baaef05b
Node size:          16384
Sector size:        4096
Filesystem size:    1023.00MiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP              51.12MiB
  System:           DUP               8.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1  1023.00MiB  /dev/sdb1

10:~ # mount -t btrfs /dev/sdb1 /mnt
10:~ # cd /mnt
10:/mnt # btrfs quota enable .
10:/mnt # btrfs su cre sub1
Create subvolume './sub1'
10:/mnt # dd if=/dev/urandom of=sub1/file1 bs=1K count=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.00833739 s, 126 MB/s
10:/mnt # dd if=/dev/urandom of=sub1/file2 bs=1K count=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0179272 s, 58.5 MB/s
10:/mnt # btrfs subvolume snapshot sub1 sub2
Create a snapshot of 'sub1' in './sub2'
10:/mnt # dd if=/dev/urandom of=sub2/file2 bs=1K count=1024 conv=notrunc
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0348762 s, 30.1 MB/s
10:/mnt # btrfs qgroup show --sync -p .
qgroupid         rfer         excl parent
--------         ----         ---- ------
0/5          16.00KiB     16.00KiB ---
0/256         2.02MiB      1.02MiB ---
0/257         2.02MiB      1.02MiB ---

So far so good. This is expected, each subvolume has 1MiB shared and
1MiB exclusive.

10:/mnt # btrfs qgroup create 22/7 /mnt
10:/mnt # btrfs qgroup assign --rescan 0/256 22/7 /mnt
Quota data changed, rescan scheduled
10:/mnt # btrfs quota rescan -s /mnt
no rescan operation in progress
10:/mnt # btrfs qgroup assign --rescan 0/257 22/7 /mnt
Quota data changed, rescan scheduled
10:/mnt # btrfs quota rescan -s /mnt
no rescan operation in progress
10:/mnt # btrfs qgroup show --sync -p .
qgroupid         rfer         excl parent
--------         ----         ---- ------
0/5          16.00KiB     16.00KiB ---
0/256         2.02MiB      1.02MiB 22/7
0/257         2.02MiB      1.02MiB 22/7
22/7          3.03MiB      3.03MiB ---
10:/mnt #

Oops. Total for 22/7 is correct (1MiB shared + 2 * 1MiB exclusive) but
why all data is treated as exclusive here? It does not match your
explanation ...


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2017-12-05 18:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 16:15 exclusive subvolume space missing Tomasz Pala
2017-12-01 21:27 ` Duncan
2017-12-01 21:36 ` Hugo Mills
2017-12-02  0:53   ` Tomasz Pala
2017-12-02  1:05     ` Qu Wenruo
2017-12-02  1:43       ` Tomasz Pala
2017-12-02  2:17         ` Qu Wenruo
2017-12-02  2:56     ` Duncan
2017-12-02 16:28     ` Tomasz Pala
2017-12-02 17:18       ` Tomasz Pala
2017-12-03  1:45         ` Duncan
2017-12-03 10:47           ` Adam Borowski
2017-12-04  5:11             ` Chris Murphy
2017-12-10 10:49           ` Tomasz Pala
2017-12-04  4:58     ` Chris Murphy
2017-12-02  0:27 ` Qu Wenruo
2017-12-02  1:23   ` Tomasz Pala
2017-12-02  1:47     ` Qu Wenruo
2017-12-02  2:21       ` Tomasz Pala
2017-12-02  2:35         ` Qu Wenruo
2017-12-02  9:33           ` Tomasz Pala
2017-12-04  0:34             ` Qu Wenruo
2017-12-10 11:27               ` Tomasz Pala
2017-12-10 15:49                 ` Tomasz Pala
2017-12-10 23:44                 ` Qu Wenruo
2017-12-11  0:24                   ` Qu Wenruo
2017-12-11 11:40                   ` Tomasz Pala
2017-12-12  0:50                     ` Qu Wenruo
2017-12-15  8:22                       ` Tomasz Pala
2017-12-16  3:21                         ` Duncan
2017-12-05 18:47   ` Andrei Borzenkov [this message]
2017-12-05 23:57     ` How exclusive in parent qgroup is computed? Qu Wenruo

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=ceb66754-5369-eb32-0aa2-ec17cff18d3d@gmail.com \
    --to=arvidjaar@gmail.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;
as well as URLs for NNTP newsgroup(s).