path: root/btrfs-list.c
diff options
authorLukas Czerner <>2012-12-11 15:25:00 +0100
committerDavid Sterba <>2013-02-01 16:55:03 +0100
commit8c2b1be4282aa3e8cf2bf40bd18f124fdecdda33 (patch)
tree6aa8ecc2bcd8ac0697dac84b8f5d644337b182c4 /btrfs-list.c
parent68120361745cc2cca7ad01170653b57649f26da6 (diff)
Btrfs-progs: List all subvolumes by default
Commit a1e89891eb6af5381539d9875b85c196150171b6 changed subvolume list command so that we list only subvolumes under the specified directory. However this is confusing and unnecessary obstacle, because one usually want to see all subvolumes in the file system. It was introduced with the notion the full_path may be invalid which is not exactly true as the full_path is always relative to the root subvolume which makes perfect sense. Simply making option '-a' default is not enough since it introduces the relative/absolute path distinction effectively obfuscating the subvolume nesting. This commit returns the subvolume list command behaviour before commit a1e89891eb6af5381539d9875b85c196150171b6 where we list all subvolumes in the filesystem with path naming from root subovolume. IMO this is the best default as it is well understood and gives all the important information about file system subvolumes including subvolume nesting without the need to parse additional information. Signed-off-by: Lukas Czerner <>
Diffstat (limited to 'btrfs-list.c')
1 files changed, 4 insertions, 4 deletions
diff --git a/btrfs-list.c b/btrfs-list.c
index 1429dd90..e677f45c 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -1282,12 +1282,11 @@ static void __filter_and_sort_subvol(struct root_lookup *all_subvols,
struct root_lookup *sort_tree,
struct btrfs_list_filter_set *filter_set,
struct btrfs_list_comparer_set *comp_set,
- int fd)
+ u64 top_id)
struct rb_node *n;
struct root_info *entry;
int ret;
- u64 top_id = btrfs_list_get_path_rootid(fd);
@@ -1456,11 +1455,12 @@ static void print_all_volume_info(struct root_lookup *sorted_tree,
int btrfs_list_subvols(int fd, struct btrfs_list_filter_set *filter_set,
struct btrfs_list_comparer_set *comp_set,
- int is_tab_result)
+ int is_tab_result, int full_path)
struct root_lookup root_lookup;
struct root_lookup root_sort;
int ret;
+ u64 top_id = (full_path ? 0 : btrfs_list_get_path_rootid(fd));
ret = __list_subvol_search(fd, &root_lookup);
if (ret) {
@@ -1478,7 +1478,7 @@ int btrfs_list_subvols(int fd, struct btrfs_list_filter_set *filter_set,
return ret;
__filter_and_sort_subvol(&root_lookup, &root_sort, filter_set,
- comp_set, fd);
+ comp_set, top_id);
print_all_volume_info(&root_sort, is_tab_result);