mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Make ZFS filesystem id persistent across different machines
Use ZFS dataset fsid guid as a unique file system id, similar to what is done on Illumos/OpenSolaris. Signed-off-by: Cyril Plisko <cyril.plisko@mountall.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #888
This commit is contained in:
parent
4b2f65b253
commit
04f9432d3b
@ -920,6 +920,7 @@ zfs_statvfs(struct dentry *dentry, struct kstatfs *statp)
|
||||
{
|
||||
zfs_sb_t *zsb = dentry->d_sb->s_fs_info;
|
||||
uint64_t refdbytes, availbytes, usedobjs, availobjs;
|
||||
uint64_t fsid;
|
||||
uint32_t bshift;
|
||||
|
||||
ZFS_ENTER(zsb);
|
||||
@ -927,6 +928,7 @@ zfs_statvfs(struct dentry *dentry, struct kstatfs *statp)
|
||||
dmu_objset_space(zsb->z_os,
|
||||
&refdbytes, &availbytes, &usedobjs, &availobjs);
|
||||
|
||||
fsid = dmu_objset_fsid_guid(zsb->z_os);
|
||||
/*
|
||||
* The underlying storage pool actually uses multiple block
|
||||
* size. Under Solaris frsize (fragment size) is reported as
|
||||
@ -960,8 +962,8 @@ zfs_statvfs(struct dentry *dentry, struct kstatfs *statp)
|
||||
*/
|
||||
statp->f_ffree = MIN(availobjs, availbytes >> DNODE_SHIFT);
|
||||
statp->f_files = statp->f_ffree + usedobjs;
|
||||
statp->f_fsid.val[0] = dentry->d_sb->s_dev;
|
||||
statp->f_fsid.val[1] = 0;
|
||||
statp->f_fsid.val[0] = (uint32_t)fsid;
|
||||
statp->f_fsid.val[1] = (uint32_t)(fsid >> 32);
|
||||
statp->f_type = ZFS_SUPER_MAGIC;
|
||||
statp->f_namelen = ZFS_MAXNAMELEN;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user