On Wed, Apr 08, 2015 at 02:06:14PM +0800, Qu Wenruo wrote:The story seems to be long.
-------- Original Message --------
Subject: [PATCH 2/3] Btrfs: unify subvol= and subvolid= mounting
From: Omar Sandoval <osandov@xxxxxxxxxxx>
To: Chris Mason <clm@xxxxxx>, Josef Bacik <jbacik@xxxxxx>, David Sterba
Date: 2015å04æ08æ 13:34
Currently, mounting a subvolume with subvolid= takes a different code
path than mounting with subvol=. This isn't really a big deal except for
the fact that mounts done with subvolid= or the default subvolume don't
have a dentry that's connected to the dentry tree like in the subvol=
case. To unify the code paths, when given subvolid= or using the default
subvolume ID, translate it into a subvolume name by walking
ROOT_BACKREFs in the root tree and INODE_REFs in the filesystem trees.
Oh, this patch is what I have tried long long ago, and want to do the same
thing, to show subvolume mount for btrfs.
Thanks for pointing that out, I didn't come across your post when I was
looking around. I figured that someone must have thought of it first :)
But it came to me that, superblock->show_path() is a better method to do it.
You can implement btrfs_show_path() to allow mountinfo to get the subvolume
name from subvolid, and don't change the mount routine much.
Hm, I don't think that the changes to the mount code would be
unwarranted. Having one code path makes it more obvious what's going on.
Do you mind elaborating on why you preferred doing it in ->show_path()?