Skip to content

Commit

Permalink
Make ZFS filesystem id persistent across different machines
Browse files Browse the repository at this point in the history
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
  • Loading branch information
imp authored and behlendorf committed Sep 6, 2012
1 parent 4b2f65b commit 04f9432
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions module/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,13 +920,15 @@ 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);

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
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 04f9432

Please sign in to comment.