[2/2] btrfs-progs: show: allow fi show -u for FS_TREE
diff mbox

Message ID e0900f28-84cf-469e-f35f-7b59decf21ab@jp.fujitsu.com
State New
Headers show

Commit Message

Misono Tomohiro Oct. 30, 2017, 8:14 a.m. UTC
Allow "fi show -u" for uuid of top-level subvolume too for consistency.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
---
 btrfs-list.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Patch
diff mbox

diff --git a/btrfs-list.c b/btrfs-list.c
index b6d7658..91fdab8 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -1594,9 +1594,15 @@  int btrfs_get_subvol(int fd, struct root_info *the_ri)
 		ri = rb_entry(rbn, struct root_info, rb_node);
 		rr = resolve_root(&rl, ri, root_id);
 		if (rr == -ENOENT) {
-			ret = -ENOENT;
-			rbn = rb_next(rbn);
-			continue;
+			if (ri->root_id == BTRFS_FS_TREE_OBJECTID) {
+				ri->path = strdup("/");
+				ri->name = strdup("<FS_TREE>");
+				ri->full_path = strdup("/");
+			} else {
+				ret = -ENOENT;
+				rbn = rb_next(rbn);
+				continue;
+			}
 		}
 
 		if (!comp_entry_with_rootid(the_ri, ri, 0) ||