Commit graph

64 commits

Author SHA1 Message Date
David Sterba c147aaa59b btrfs-progs: clarify unlinked and deleted terminology for subvolumes
Recent patches updated stale qgroup handling, using 'unlinked' and
'dropped' where we otherwise use 'deleted' and 'cleaned'.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-05-17 18:13:18 +02:00
Qu Wenruo 7f3ab46400 btrfs-progs: qgroup: add more special statuses for qgroups
Currently `btrfs qgroup show` command shows any 0 level qgroup without a
root backref as `<stale>`, which is not correct.

There are several more cases:

- Under deletion
  The subvolume is not yet full dropped, but unlinked.
  In that case we would not have a root backref item, but the qgroup is
  not stale.

- Squota space holder
  This is for squota mode, that a fully dropped subvolume still have
  extents accounting on the already-gone subvolume.
  In this case it's not stale either, and future accounting relies on
  it.

This patch would add above special cases, and add an extra `SPECIAL
PATHS` section to explain all the cases, including `<stale>`.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-05-17 18:01:49 +02:00
Qu Wenruo 82f7d6c1d7 btrfs-progs: qgroup: handle stale qgroup deletion more accurately
The current stale qgroup deletion doesn't handle the following cases at
all:

- It doesn't detect stale qgroups correctly
  The current check is using the root backref, which means unlinked but
  not yet fully dropped subvolumes would mark its corresponding qgroups
  stale.

  This is incorrect. The real stale check should be based on the root
  item, not root backref.

- Squota non-empty but stale qgroups
  Such qgroups can not and should not be deleted, as future accounting
  still require them.

- Full accounting mode, stale qgroups but not empty
  Since qgroup numbers are inconsistent already, it's common to have
  such stale qgroups with non-zero numbers.

  Now it's dependent on the kernel to determine whether such qgroup can
  be deleted.

Address the above problems:

- Do root_item based detection
  So that btrfs_qgroup::stale would properly indicate if there is a
  subvolume root item for the qgroup.

- Do not attempt to delete squota stale but non-empty qgroups

- Attempt to delete stale but non-empty qgroups for full accounting mode
  And deletion failure would not count as an error.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-05-17 17:55:04 +02:00
Qu Wenruo 468bbb6b25 btrfs-progs: qgroup: add qgroup_lookup::flags member
This allows the users to identify if the running qgroup mode and whether
the numbers are already inconsistent.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-05-17 17:50:26 +02:00
Qu Wenruo 1297013cea btrfs-progs: qgroup clear-stale: sync the fs before doing qgroup search
Since qgroup numbers are only updated at transaction commit time, it's
better to do a sync before reading the quota tree, to reduce the chance
of uncommitted qgroup changes.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-05-17 17:49:35 +02:00
David Sterba 7f396f5ced btrfs-progs: reorder key initializations
Use the objectid, type, offset natural order as it's more readable and
we're used to read keys like that.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-04-30 21:49:15 +02:00
David Sterba f3ece218b6 btrfs-progs: unify tree search header access
Use a local copy of the search header for proper aligned access instead
of the unaligned helpers, move the definitions to the closest scope.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-03-16 18:15:51 +01:00
David Sterba 005aeb8cb0 btrfs-progs: use TREE_SEARCH ioctl wrappers for all non-library code
Use tree search ioctl wrappers for code that is considered internal, ie.
leaving out libbtrfs (legacy), libbtrfsutil (needs own API for that).

Conversion is mostly direct of what the API provides.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-03-16 18:15:51 +01:00
Qu Wenruo 4da5f22b23 btrfs-progs: qgroups: remove support for num_ref_copies/num_excl_copies
Remove btrfs_qgroup_inherit_add_copy() and the command line interface.

This was designed to add a pair of source/destination qgroups into
btrfs_qgroup_inherit structure, so that rfer/excl numbers would be
copied from the source qgroup into the destination one.

This behavior has been intentionally hidden since 2016, as such copy will
cause qgroup inconsistent immediately and a rescan would reset whatever
numbers copied anyway.

Now we're going to reject the copy behavior from kernel, there is no
need to keep those hidden (and already disabled for "subvolume create")
case.

Remove btrfs_qgroup_inherit_add_copy() call, and cleanup the
undocumented options.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-03-04 22:55:07 +01:00
David Sterba 590bcf20bf btrfs-progs: drop _fd from btrfs_open_dir_fd()
Signed-off-by: David Sterba <dsterba@suse.com>
2024-02-20 12:56:24 +01:00
Goffredo Baroncelli 372c79e7ad btrfs-progs: replace btrfs_open_dir with btrfs_open_dir_fd
For historical reasons the helpers [btrfs_]open_dir... return also
the 'DIR *dirstream' value when a directory is opened.

Replace btrfs_open_dir() with btrfs_open_dir_fd() removing
any reference to the unused/useless dirstream variables.
Calling btrfs_open_dir_fd() with only the path is equivalent to
btrfs_open_dir(_, _, 1).

Signed-off-by: Goffredo Baroncelli <kreijack@libero.it>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-02-20 11:40:08 +01:00
Qu Wenruo 389c959d6d btrfs-progs: implement arg_strtou64_with_suffix() with a new helper
This patch introduces a new parser helper, parse_u64_with_suffix(),
which has a better error handling, following all the parse_*()
helpers to return non-zero value for errors.

This new helper is going to replace parse_size_from_string(), which
would directly call exit(1) to stop the whole program.

Furthermore most callers of parse_size_from_string() are expecting
exit(1) for error, so that they can skip the error handling.

For those call sites, introduce a wrapper, arg_strtou64_with_suffix(),
to do that.  The only disadvantage is a little less detailed error
report for why the parse failed, but for most cases the generic error
string should be enough.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-18 02:14:23 +01:00
Sam James ae9ead781d btrfs-progs: fix -Walloc-size warnings reported by gcc 14
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
common/utils.c:983:15: warning: allocation of insufficient size ‘1’ for type ‘struct config_param’ with size ‘32’ [-Walloc-size]
cmds/qgroup.c:1644:13: warning: allocation of insufficient size ‘1’ for type ‘struct btrfs_qgroup_inherit’ with size ‘72’ [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not
doing anything wrong.

Pull-request: #707
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-14 13:14:24 +01:00
Sidong Yang 8473ab8131 btrfs-progs: qgroup: check null when comparing paths
This patch fixes a bug that could occur when comparing paths in showing
qgroups list. Old code doesn't check it and the bug occurs when there is
stale qgroup and its path is null. Check whether it is null and return
without comparing paths.

Issue: #687
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Sidong Yang <realwakka@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-13 18:13:12 +02:00
David Sterba 21aa6777b2 btrfs-progs: clean up includes, using include-what-you-use
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-03 01:11:57 +02:00
David Sterba ab32c4445d btrfs-progs: qgroup show: fix formatting of limit values in json output
There are reports that json output of 'qgroup show' crashes due to
internal error when printing the limit values:

  INTERNAL ERROR: unknown unit base, mode 2304
  btrfs(internal_error+0x10a)[0x5605c37ce48a]
  btrfs(pretty_size_snprintf+0x5c)[0x5605c37d105c]
  btrfs(fmt_print+0x44e)[0x5605c37d178e]
  btrfs(+0x7ed1d)[0x5605c3800d1d]
  btrfs(main+0x8f)[0x5605c379beff]
  /lib64/libc.so.6(+0x27bb0)[0x7f83924ddbb0]
  /lib64/libc.so.6(__libc_start_main+0x8b)[0x7f83924ddc79]
  btrfs(_start+0x25)[0x5605c379d405]
  common/units.c:82: pretty_size_snprintf: Assertion `0` failed, value 0
  btrfs(+0x1d4b1)[0x5605c379f4b1]
  btrfs(pretty_size_snprintf+0x7b)[0x5605c37d107b]
  btrfs(fmt_print+0x44e)[0x5605c37d178e]
  btrfs(+0x7ed1d)[0x5605c3800d1d]
  btrfs(main+0x8f)[0x5605c379beff]
  /lib64/libc.so.6(+0x27bb0)[0x7f83924ddbb0]
  /lib64/libc.so.6(__libc_start_main+0x8b)[0x7f83924ddc79]
  btrfs(_start+0x25)[0x5605c379d405]

This is caused by "size" format that requires the unit mode, but it was not
specified and some stack value used. As json prints the raw values, use
the plain %llu format.

Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1206960
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1209136#c15
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 18:02:33 +02:00
Qu Wenruo b3327119ec btrfs-progs: fix -Wmissing-prototypes warnings
The fixes involve the following changes:

- Unexport functions which are not utilized out of the file
  * print_path_column()
  * parse_reflink_range()
  * btrfs_list_setup_print_column()
  * device_get_partition_size_sysfs()
  * max_zone_append_size()

- Include related headers before implementing the function
  * change-uuid.c
  * convert-bgt.c
  * seed.h

- Add missing headers caused by the above header changes
  * include <uuid/uuid.h> for tune/tune.h.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 18:02:31 +02:00
Josef Bacik a754fe29d9 btrfs-progs: sync uapi/btrfs.h into btrfs-progs
We want to keep this file locally as we want to be uptodate with
upstream, so we can build btrfs-progs regardless of which kernel is
currently installed.  Sync this with the upstream version and put it in
kernel-shared/uapi to maintain some semblance of where this file comes
from.

There are some changes that need to be synced back to kernel. A local
definition of static_assert is used to avoid compilation problems on gcc
(< 9) due to mandatory 2nd parameter.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 18:02:28 +02:00
Josef Bacik bee10e7fc9 btrfs-progs: rename the qgroup structs to match the kernel
Now that the libbtrfs stuff has it's own local copy of ctree.h and
ioctl.h, let's rename these qgroup struct members to match the kernel
names, this way it'll make it easier to sync the kernel code into
btrfs-progs.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 18:02:28 +02:00
Josef Bacik bf0f3db765 btrfs-progs: introduce UASSERT() for purely userspace code
While syncing messages.[ch] I had to back out the ASSERT() code in
kerncompat.h, which means we now rely on the kernel code for ASSERT().
In order to maintain some semblance of separation introduce UASSERT()
and use that in all the purely userspace code.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 18:02:28 +02:00
David Sterba 600f374058 btrfs-progs: qgroup show: fix formatting of qgroupid on json output
On a 32bit host the split qgroupid is wrong due to the way the numbers
are passed to the formatter as variable length arguments. The level is
u16, promoted to int and then parsed as u64. This means that the values
are shifted and some stack data are printed instead.

Example error messages from yast2-bootloader:

  SystemCmd.cc(addLine):569 Adding Line 7 "      "qgroupid": "21474836480/23885859321282560","

The value 21474836480 = 0x5000000 is 0x5 shifted by 32 bits,
23885859321282560 is 0x54dc1000000000 and shifting by 32 does not
lead to a valid value which should be 0 in this case.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1209136
Signed-off-by: David Sterba <dsterba@suse.com>
2023-03-16 15:48:41 +01:00
David Sterba e8569299c4 btrfs-progs: qgroup: convert help text to option formatter
Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 20:11:24 +01:00
Qu Wenruo f61b90aff9 btrfs-progs: make usage call properly return an exit value
[BUG]
Currently cli/009 test case failed with different exit number:

  ====== RUN CHECK /home/adam/btrfs-progs/btrfstune --help
  usage: btrfstune [options] device
  [...]
  failed: /home/adam/btrfs-progs/btrfstune --help
  test failed for case 009-btrfstune

[CAUSE]
In tune/main.c, we have the following call on usage():

  static void print_usage(int ret)
  {
	usage(&tune_cmd);
	exit(ret);
  }

However usage() itself would always call exit(1):

  void usage(const struct cmd_struct *cmd)
  {
	usage_command_usagestr(cmd->usagestr, NULL, 0, true, true);
	exit(1);
  }

This makes prevents any caller of usage() to modify its exit number.

[FIX]
Add a new argument @error for print_usage(), so we can properly return 0
for -h/--help usage.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 20:11:23 +01:00
David Sterba e78fe2d92e Revert "btrfs-progs: rename qgroup items to match the kernel naming scheme"
This reverts commit 03451430de.
(It's not 1:1, there are some additional trivial fixups in cmds/qgroup.c)

This breaks a lot of 3rd party tools that depend on it as Neal reports:

* btrfs-assistant
* buildah
* cri-o
* podman
* skopeo
* containerd
* moby/docker
* snapper
* source-to-image

Link: https://lore.kernel.org/linux-btrfs/CAEg-Je8L7jieKdoWoZBuBZ6RdXwvwrx04AB0fOZF1fr5Pb-o1g@mail.gmail.com/
Reported-by: Neal Gompa <ngompa@fedoraproject.org>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-01-03 13:10:54 +01:00
David Sterba 62d818e365 btrfs-progs: use escaped json format for paths
Use the new escaped formatter for paths in command 'device stats' and
'qgroup show'.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-12-16 00:43:25 +01:00
David Sterba 6ecaa3ee4f btrfs-progs: qgroup show: add json output
Support json for 'qgroup show' with values printed by "btrfs qgroup
-pcre", the accounted size and the limits.  It's implemented as a
separate call and not sharing the printing routines so any visible
changes need to by synchronized.

Formatter updates: don't print key name if .out_json is NULL.

Example output:

 # btrfs --format json qgroup show /mnt/path
{
  "__header": {
    "version": "1"
  },
  "qgroup-show": [
    {
      "qgroupid": "0/5",
      "referenced": "8831393792",
      "max_referenced": "none",
      "exclusive": "8224075776",
      "max_exclusive": "none",
      "path": "",
      "parents": [
      ],
      "children": [
      ]
    },
    {
      "qgroupid": "0/361",
      "referenced": "611459072",
      "max_referenced": "none",
      "exclusive": "65536",
      "max_exclusive": "none",
      "path": "subv1",
      "parents": [
        "1/1"
      ],
      "children": [
      ]
    },
    {
      "qgroupid": "0/362",
      "referenced": "611459072",
      "max_referenced": "none",
      "exclusive": "65536",
      "max_exclusive": "none",
      "path": "snap1-r",
      "parents": [
      ],
      "children": [
      ]
    },
    {
      "qgroupid": "1/1",
      "referenced": "611459072",
      "max_referenced": "none",
      "exclusive": "65536",
      "max_exclusive": "none",
      "path": "",
      "parents": [
      ],
      "children": [
        "0/361"
      ]
    }
  ]
}

Issue: #555
Signed-off-by: David Sterba <dsterba@suse.com>
2022-12-14 23:42:03 +01:00
Josef Bacik 53f8b8fd01 btrfs-progs: make btrfs_qgroup_level helper match the kernel
We return __u16 in the kernel, as this is actually the size of
btrfs_qgroup_level.  Adjust the existing helpers and update all the
callers to deal with the new size appropriately.  This will make syncing
the kernel code cleaner.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-11-28 18:57:43 +01:00
Josef Bacik 03451430de btrfs-progs: rename qgroup items to match the kernel naming scheme
We're going to sync the kernel source into btrfs-progs, and in the
kernel we have all these qgroup fields named with short names instead of
the full name, so rename

referenced -> rfer
compressed -> cmpr
exclusive -> excl

to match the kernel and update all the users, this will make the sync
cleaner.

ioctl.h is a public header but there are no users of the
btrfs_qgroup_limit structure.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-11-28 18:57:43 +01:00
David Sterba c24f14c6a4 btrfs-progs: qgroups: update help texts
Where missing, add the second line with more verbose description, fix
typos or formatting.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-26 10:15:40 +02:00
David Sterba 1414ecbb6f btrfs-progs: replace strerror(errno) with %m in printf formats
We're using the %m format where possible.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-26 09:46:22 +02:00
David Sterba 44efde7fa0 btrfs-progs: unify naming of qgroup subvolid helpers
Kernel function name is btrfs_qgroup_subvolid so rename it in progs. The
libbtrfs can't API be changed without versioning so at least add the new
helper.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-26 09:36:44 +02:00
David Sterba 701ab151c2 btrfs-progs: qgroup: new command to delete stale qgroups
A stale qgroup is level 0 and without a corresponding subvolume. There's
no convenient command for removing them and kernel does not remove them
automatically. Add a command so users don't have to parse and script the
output and/or delete them manually.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-26 09:21:35 +02:00
David Sterba 69b0d7756d btrfs-progs: qgroup show: adjust column widths and names
Use more human readable column description and adjust the width. Use a
single "-" for an empty value as is done elsewhere too.

Sample output:

Qgroupid    Referenced    Exclusive   Path
--------    ----------    ---------   ----
0/5           16.00KiB     16.00KiB   <toplevel>
0/256         16.00KiB     16.00KiB   subv1
0/257         16.00KiB     16.00KiB   <stale>
0/258         16.00KiB     16.00KiB   dir1/subv3
0/259         16.00KiB     16.00KiB   snap1
1/1           16.00KiB     16.00KiB   <0 member qgroups>

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-25 21:44:28 +02:00
David Sterba f486f0f01e btrfs-progs: qgroup show: print pretty names of columns
There are two column name definitions, one for sorting and one for more
human readable format but it was not used for some reason.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-25 21:36:51 +02:00
David Sterba 274a53a4d2 btrfs-progs: qgroup show: adjust printed path format
Convert fputs and printf to message helpers that respect the verbosity
levels.

- print <stale> instead of <missing> for qgroups without a corresponding
  subvolume after it was deleted
- print <toplevel> for toplevel
- for higher level qgroups print the number of member groups, 0 if empty
  and not a special string
- drop the <FS_ROOT>
- print paths relative to toplevel path, like subvolume list does by
  default

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-25 21:34:28 +02:00
David Sterba dac73d6e2c btrfs-progs: qgroup show: print subvolume path by default
Previous patch optionally printed the path but it would be better to
print it by default, so drop the option and verbosity. This is a
separate change as the original change was from an old pull request and
it was ported without significant changes first.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-25 21:12:29 +02:00
Jeff Mahoney 8d1c854094 btrfs-progs: qgroup: add path to show output
The 'btrfs qgroup show' command currently only prints qgroup IDs,
forcing the user to resolve which subvolume each corresponds to.

Adds subvolume path resolution to 'qgroup show' so that when
the -P option is used, the last column contains the pathname of
the root of the subvolume it describes.  In the case of nested
qgroups, it will show the number of member qgroups or the paths
of the members if the -v option is used.

Path can also be used as a sort parameter.

Sample output:

qgroupid         rfer         excl       path
--------         ----         ----       ----
0/5          16.00KiB     16.00KiB   <FS_ROOT>
0/256        16.00KiB     16.00KiB   <FS_ROOT>/subv1
0/257        16.00KiB     16.00KiB   <missing>
0/258        16.00KiB     16.00KiB   <FS_ROOT>/subv3
0/259        16.00KiB     16.00KiB   <FS_ROOT>/snap1

Pull-request: #139
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-25 21:12:24 +02:00
David Sterba b2729396d2 btrfs-progs: cmds: use bool for status variables
Using bool for on/off variables is cleaner, convert all in cmds/ .

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:12 +02:00
David Sterba b0fcdb9224 btrfs-progs: cmds: remove unnecessary casts for u64
The (unsigned long long) type casts can be dropped, printf understands
%llu and u64 and does not warn. In cases where the type is not u64 keep
the cast.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:11 +02:00
David Sterba c2be0e2ce0 btrfs-progs: use template for out of memory error messages
Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:08:09 +02:00
David Sterba 40c4ba74ec btrfs-progs: cmds: update include lists
The tool IWYU (include what you use) suggests to remove and add some
includes.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:07:59 +02:00
David Sterba b121ac4404 btrfs-progs: fix path to internal libbtrfsutil includes
All files include the <btrfsutil.h> which could be confused with the
system-wide installation. Drop the -I path from build and use full path
for any libbtrfsutil headers.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:06:12 +02:00
David Sterba 3df6617b9b btrfs-progs: cmds: reorder includes
The preferred order:
- system headers
- standard headers
- libraries
- kernel library
- kernel shared
- common headers
- other tools
- own headers

Signed-off-by: David Sterba <dsterba@suse.com>
2022-10-11 09:06:12 +02:00
David Sterba a33af50c52 btrfs-progs: add constant for initial getopt values
Add constant for initial value to avoid unexpected clashes with user
defined getopt values and shift the common size getopt values.

Signed-off-by: David Sterba <dsterba@suse.com>
2022-08-16 15:18:11 +02:00
David Sterba c1953c36dd btrfs-progs: move all private definitions to cmds/qgroup.c
Move everything related to the output formatting and filtering out of
qgroup.h and leave only the structures used by the public API.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-09-07 19:21:14 +02:00
David Sterba f67e5da2fa btrfs-progs: remove prefix from all static qgroup helpers
The exported functions provided by qgroups have been changed, now remove
the prefix from the local helpers.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-09-07 19:15:55 +02:00
David Sterba 49671bf29e btrfs-progs: add prefixes to exported qgroup helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2021-09-07 19:09:33 +02:00
David Sterba 353b55a5cf btrfs-progs: unexport local qgroup helpers
After merging the files, many functions can be made static, leaving only
a few helpers that are used by subvolume.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-09-07 19:07:54 +02:00
David Sterba ae56c6a071 btrfs-progs: merge qgroup.c into cmds/qgroup.c
The contents of top level qgroups.c is only for command line output and
filtering, we already have cmds/qgroup.c for that so merge the files.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-09-07 18:59:43 +02:00
David Sterba 9be1b1c442 btrfs-progs: qgroup create: accept only valid qgroupid
Many qgroup commands accept the level/id format and also a path to
subvolume, the qgroup id is derived from that. This does not make sense
for the create command as we can't create the 0/subvolid qgroup (thus
can't be derived from the path), only the higher levels.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-09-07 14:20:42 +02:00