On Wed, 11 Aug 2021, Josef Bacik wrote: > > I think this is a step in the right direction, but I want to figure out a way to > accomplish this without magical mount points that users must be aware of. magic mount *options* ??? > > I think the stat() st_dev ship as sailed, we're stuck with that. However > Christoph does have a valid point where it breaks the various info spit out by > /proc. You've done a good job with the treeid here, but it still makes it > impossible for somebody to map the st_dev back to the correct mount. The ship might have sailed, but it is not water tight. And as the world it round, it can still come back to bite us from behind. Anything can be transitioned away from, whether it is devfs or 32-bit time or giving different device numbers to different file-trees. The linkage between device number and and filesystem is quite strong. We could modified all of /proc and /sys/ and audit and whatever else to report the fake device number, but we cannot get the fake device number into the mount table (without making the mount table unmanageablely large). And if subtrees aren't in the mount-table for the NFS server, I don't think they should be in the mount-table of the NFS client. So we cannot export them to NFS. I understand your dislike for mount options. An alternative with different costs and benefits would be to introduce a new filesystem type - btrfs2 or maybe betrfs. This would provide numdevs=1 semantics and do whatever we decided was best with inode numbers. How much would you hate that? > > I think we aren't going to solve that problem, at least not with stat(). I > think with statx() spitting out treeid we have given userspace a way to > differentiate subvolumes, and so we should fix statx() to spit out the the super > block device, that way new userspace things can do their appropriate lookup if > they so choose. I don't think we should normalize having multiple devnums per filesystem by encoding it in statx(). It *would* make sense to add a btrfs ioctl which reports the real device number of a file. Tools that really need to work with btrfs could use that, but it would always be obvious that it was an exception. > > This leaves the problem of nfsd. Can you just integrate this new treeid into > nfsd, and use that to either change the ino within nfsd itself, or do something > similar to what your first patchset did and generate a fsid based on the treeid? I would only want nfsd to change the inode number. I no longer think it is acceptable for nfsd to report different device number (as I mention above). I would want the new inode number to be explicitly provided by the filesystem. Whether that is a new export_operation or a new field in 'struct kstat' doesn't really bother me. I'd *prefer* it to be st_ino, but I can live without that. On the topic of inode numbers.... I've recently learned that btrfs never reuses inode (objectid) numbers (except possibly after an unmount). Equally it doesn't re-use subvol numbers. How much does this contribute to the 64 bits not being enough for subtree+inode? It would be nice if we could be comfortable limiting the objectid number to 40 bits and the root.objectid (filetree) number to 24 bits, and combine them into a 64bit inode number. If we added a inode number reuse scheme that was suitably performant, would that make this possible? That would remove the need for a treeid, and allow us to use project-id to identify subtrees. > > Mount options are messy, and are just going to lead to distro's turning them on > without understanding what's going on and then we have to support them forever. > I want to get this fixed in a way that we all hate the least with as little > opportunity for confused users to make bad decisions. Thanks, Hence my question: how much do you hate creating a new filesystem type to fix the problems? Thanks, NeilBrown