aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_vnops.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-01-05 14:27:30 -0800
committerBrian Behlendorf <[email protected]>2011-02-10 09:27:20 -0800
commit960e08fe3e2cdf5217996b9f42a01f7e20f2b97a (patch)
tree4b253ef28b86959a4398d7482c032e30e8b88bf5 /module/zfs/zfs_vnops.c
parent7304b6e50f656fbf4b126a4e94deac174133851c (diff)
VFS: Add zfs_inode_update() helper
For the moment we have left ZFS unchanged and it updates many values as part of the znode. However, some of these values should be set in the inode. For the moment this is handled by adding a function called zfs_inode_update() which updates the inode based on the znode. This is considered a workaround until we can systematically go through the ZFS code and have it directly update the inode. At which point zfs_update_inode() can be dropped entirely. Keeping two copies of the same data isn't only inefficient it's a breeding ground for bugs.
Diffstat (limited to 'module/zfs/zfs_vnops.c')
-rw-r--r--module/zfs/zfs_vnops.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index b666ee39c..e5e187b15 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -564,6 +564,7 @@ out:
zfs_range_unlock(rl);
ZFS_ACCESSTIME_STAMP(zfsvfs, zp);
+ zfs_inode_update(zp);
ZFS_EXIT(zfsvfs);
return (error);
}
@@ -938,6 +939,7 @@ again:
zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, zp->z_id);
+ zfs_inode_update(zp);
ZFS_EXIT(zfsvfs);
return (0);
}
@@ -1266,8 +1268,12 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct pathname *pnp,
}
error = zfs_dirlook(zdp, nm, vpp, flags, direntflags, realpnp);
- if (error == 0)
+ if (error == 0) {
+ if (*vpp)
+ zfs_inode_update(VTOZ(*vpp));
+
error = specvp_check(vpp, cr);
+ }
ZFS_EXIT(zfsvfs);
return (error);
@@ -1523,6 +1529,8 @@ out:
if (zp)
VN_RELE(ZTOV(zp));
} else {
+ zfs_inode_update(dzp);
+ zfs_inode_update(zp);
*vpp = ZTOV(zp);
error = specvp_check(vpp, cr);
}
@@ -1753,6 +1761,10 @@ out:
pn_free(realnmp);
zfs_dirent_unlock(dl);
+ zfs_inode_update(dzp);
+ zfs_inode_update(zp);
+ if (xzp)
+ zfs_inode_update(xzp);
if (!delete_now)
VN_RELE(vp);
@@ -1945,6 +1957,8 @@ top:
if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);
+ zfs_inode_update(dzp);
+ zfs_inode_update(zp);
ZFS_EXIT(zfsvfs);
return (0);
}
@@ -2074,6 +2088,8 @@ out:
if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);
+ zfs_inode_update(dzp);
+ zfs_inode_update(zp);
ZFS_EXIT(zfsvfs);
return (error);
}
@@ -3227,6 +3243,7 @@ out:
} else {
err2 = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx);
dmu_tx_commit(tx);
+ zfs_inode_update(zp);
}
out2:
@@ -3674,13 +3691,19 @@ out:
zfs_dirent_unlock(sdl);
zfs_dirent_unlock(tdl);
+ zfs_inode_update(sdzp);
if (sdzp == tdzp)
rw_exit(&sdzp->z_name_lock);
+ if (sdzp != tdzp)
+ zfs_inode_update(tdzp);
+ zfs_inode_update(szp);
VN_RELE(ZTOV(szp));
- if (tzp)
+ if (tzp) {
+ zfs_inode_update(tzp);
VN_RELE(ZTOV(tzp));
+ }
if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);
@@ -3828,6 +3851,9 @@ top:
txtype |= TX_CI;
zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);
+ zfs_inode_update(dzp);
+ zfs_inode_update(zp);
+
zfs_acl_ids_free(&acl_ids);
dmu_tx_commit(tx);
@@ -3882,6 +3908,7 @@ zfs_readlink(vnode_t *vp, uio_t *uio, cred_t *cr, caller_context_t *ct)
ZFS_ACCESSTIME_STAMP(zfsvfs, zp);
+ zfs_inode_update(zp);
ZFS_EXIT(zfsvfs);
return (error);
}
@@ -4037,6 +4064,8 @@ top:
if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
zil_commit(zilog, 0);
+ zfs_inode_update(dzp);
+ zfs_inode_update(szp);
ZFS_EXIT(zfsvfs);
return (error);
}