mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Remove znode's z_uid/z_gid member
Remove duplicate z_uid/z_gid member which are also held in the generic vfs inode struct. This is done by first removing the members from struct znode and then using the KUID_TO_SUID/KGID_TO_SGID macros to access the respective member from struct inode. In cases where the uid/gids are being marshalled from/to disk, use the newly introduced zfs_(uid|gid)_(read|write) functions to properly save the uids rather than the internal kernel representation. Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #4685 Issue #227
This commit is contained in:
committed by
Brian Behlendorf
parent
82a1b2d628
commit
2c6abf15ff
+10
-6
@@ -533,8 +533,6 @@ zfs_inode_update_impl(znode_t *zp, boolean_t new)
|
||||
dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &blksize, &i_blocks);
|
||||
|
||||
spin_lock(&ip->i_lock);
|
||||
ip->i_uid = SUID_TO_KUID(zp->z_uid);
|
||||
ip->i_gid = SGID_TO_KGID(zp->z_gid);
|
||||
ip->i_mode = zp->z_mode;
|
||||
zfs_set_inode_flags(zp, ip);
|
||||
ip->i_blkbits = SPA_MINBLOCKSHIFT;
|
||||
@@ -582,6 +580,7 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
|
||||
uint64_t parent;
|
||||
uint64_t tmp_gen;
|
||||
uint64_t links;
|
||||
uint64_t z_uid, z_gid;
|
||||
sa_bulk_attr_t bulk[8];
|
||||
int count = 0;
|
||||
|
||||
@@ -621,8 +620,8 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
|
||||
&zp->z_pflags, 8);
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_PARENT(zsb), NULL,
|
||||
&parent, 8);
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, &zp->z_uid, 8);
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL, &zp->z_gid, 8);
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, &z_uid, 8);
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL, &z_gid, 8);
|
||||
|
||||
if (sa_bulk_lookup(zp->z_sa_hdl, bulk, count) != 0 ||
|
||||
tmp_gen == 0) {
|
||||
@@ -636,6 +635,8 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
|
||||
zp->z_mode = mode;
|
||||
ip->i_generation = (uint32_t)tmp_gen;
|
||||
set_nlink(ip, (uint32_t)links);
|
||||
zfs_uid_write(ip, z_uid);
|
||||
zfs_gid_write(ip, z_gid);
|
||||
|
||||
ip->i_ino = obj;
|
||||
zfs_inode_update_new(zp);
|
||||
@@ -1159,6 +1160,7 @@ zfs_rezget(znode_t *zp)
|
||||
int err;
|
||||
int count = 0;
|
||||
uint64_t gen;
|
||||
uint64_t z_uid, z_gid;
|
||||
znode_hold_t *zh;
|
||||
|
||||
/*
|
||||
@@ -1216,9 +1218,9 @@ zfs_rezget(znode_t *zp)
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zsb), NULL,
|
||||
&zp->z_pflags, sizeof (zp->z_pflags));
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL,
|
||||
&zp->z_uid, sizeof (zp->z_uid));
|
||||
&z_uid, sizeof (z_uid));
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL,
|
||||
&zp->z_gid, sizeof (zp->z_gid));
|
||||
&z_gid, sizeof (z_gid));
|
||||
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MODE(zsb), NULL,
|
||||
&mode, sizeof (mode));
|
||||
|
||||
@@ -1229,6 +1231,8 @@ zfs_rezget(znode_t *zp)
|
||||
}
|
||||
|
||||
zp->z_mode = mode;
|
||||
zfs_uid_write(ZTOI(zp), z_uid);
|
||||
zfs_gid_write(ZTOI(zp), z_gid);
|
||||
|
||||
if (gen != ZTOI(zp)->i_generation) {
|
||||
zfs_znode_dmu_fini(zp);
|
||||
|
||||
Reference in New Issue
Block a user