Skip to content

Commit

Permalink
Rename zfs_inode_update to zfs_znode_update_vfs
Browse files Browse the repository at this point in the history
zfs_znode_update_vfs is a more platform-agnostic name than
zfs_inode_update. Besides that, the function's prototype is moved to
include/sys/zfs_znode.h as the function is also used in common code.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ka Ho Ng <khng300@gmail.com>
Sponsored by: The FreeBSD Foundation
Closes openzfs#11580
  • Loading branch information
khng300 authored and jsai20 committed Mar 30, 2021
1 parent 428f8a3 commit 534e6c5
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 35 deletions.
1 change: 0 additions & 1 deletion include/os/freebsd/zfs/sys/zfs_znode_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ extern int zfsfstype;

extern int zfs_znode_parent_and_name(struct znode *zp, struct znode **dzpp,
char *buf);
extern void zfs_inode_update(struct znode *);
#ifdef __cplusplus
}
#endif
Expand Down
1 change: 0 additions & 1 deletion include/os/linux/zfs/sys/zfs_znode_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ struct znode;
extern int zfs_sync(struct super_block *, int, cred_t *);
extern int zfs_inode_alloc(struct super_block *, struct inode **ip);
extern void zfs_inode_destroy(struct inode *);
extern void zfs_inode_update(struct znode *);
extern void zfs_mark_inode_dirty(struct inode *);
extern boolean_t zfs_relatime_need_update(const struct inode *);

Expand Down
2 changes: 2 additions & 0 deletions include/sys/zfs_znode.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ extern void zfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp,
extern void zfs_xvattr_set(znode_t *zp, xvattr_t *xvap, dmu_tx_t *tx);
extern void zfs_upgrade(zfsvfs_t *zfsvfs, dmu_tx_t *tx);

extern void zfs_znode_update_vfs(struct znode *);

#endif
#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_znode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2015,7 +2015,7 @@ zfs_obj_to_stats(objset_t *osp, uint64_t obj, zfs_stat_t *sb,


void
zfs_inode_update(znode_t *zp)
zfs_znode_update_vfs(znode_t *zp)
{
vm_object_t object;

Expand Down
2 changes: 1 addition & 1 deletion module/os/linux/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp)

*ipp = ZTOI(zp);
if (*ipp)
zfs_inode_update(ITOZ(*ipp));
zfs_znode_update_vfs(ITOZ(*ipp));

ZFS_EXIT(zfsvfs);
return (0);
Expand Down
42 changes: 21 additions & 21 deletions module/os/linux/zfs/zfs_vnops_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ zfs_lookup(znode_t *zdp, char *nm, znode_t **zpp, int flags, cred_t *cr,

error = zfs_dirlook(zdp, nm, zpp, flags, direntflags, realpnp);
if ((error == 0) && (*zpp))
zfs_inode_update(*zpp);
zfs_znode_update_vfs(*zpp);

ZFS_EXIT(zfsvfs);
return (error);
Expand Down Expand Up @@ -789,8 +789,8 @@ zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl,
if (zp)
zrele(zp);
} else {
zfs_inode_update(dzp);
zfs_inode_update(zp);
zfs_znode_update_vfs(dzp);
zfs_znode_update_vfs(zp);
*zpp = zp;
}

Expand Down Expand Up @@ -912,8 +912,8 @@ zfs_tmpfile(struct inode *dip, vattr_t *vap, int excl,
if (zp)
zrele(zp);
} else {
zfs_inode_update(dzp);
zfs_inode_update(zp);
zfs_znode_update_vfs(dzp);
zfs_znode_update_vfs(zp);
*ipp = ZTOI(zp);
}

Expand Down Expand Up @@ -1139,16 +1139,16 @@ zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags)
pn_free(realnmp);

zfs_dirent_unlock(dl);
zfs_inode_update(dzp);
zfs_inode_update(zp);
zfs_znode_update_vfs(dzp);
zfs_znode_update_vfs(zp);

if (delete_now)
zrele(zp);
else
zfs_zrele_async(zp);

if (xzp) {
zfs_inode_update(xzp);
zfs_znode_update_vfs(xzp);
zfs_zrele_async(xzp);
}

Expand Down Expand Up @@ -1345,8 +1345,8 @@ zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap, znode_t **zpp,
if (error != 0) {
zrele(zp);
} else {
zfs_inode_update(dzp);
zfs_inode_update(zp);
zfs_znode_update_vfs(dzp);
zfs_znode_update_vfs(zp);
}
ZFS_EXIT(zfsvfs);
return (error);
Expand Down Expand Up @@ -1471,8 +1471,8 @@ zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd, cred_t *cr,
out:
zfs_dirent_unlock(dl);

zfs_inode_update(dzp);
zfs_inode_update(zp);
zfs_znode_update_vfs(dzp);
zfs_znode_update_vfs(zp);
zrele(zp);

if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
Expand Down Expand Up @@ -2542,7 +2542,7 @@ zfs_setattr(znode_t *zp, vattr_t *vap, int flags, cred_t *cr)
err2 = zfs_setattr_dir(attrzp);
zrele(attrzp);
}
zfs_inode_update(zp);
zfs_znode_update_vfs(zp);
}

out2:
Expand Down Expand Up @@ -3000,17 +3000,17 @@ zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp, char *tnm,
zfs_dirent_unlock(sdl);
zfs_dirent_unlock(tdl);

zfs_inode_update(sdzp);
zfs_znode_update_vfs(sdzp);
if (sdzp == tdzp)
rw_exit(&sdzp->z_name_lock);

if (sdzp != tdzp)
zfs_inode_update(tdzp);
zfs_znode_update_vfs(tdzp);

zfs_inode_update(szp);
zfs_znode_update_vfs(szp);
zrele(szp);
if (tzp) {
zfs_inode_update(tzp);
zfs_znode_update_vfs(tzp);
zrele(tzp);
}

Expand Down Expand Up @@ -3169,8 +3169,8 @@ zfs_symlink(znode_t *dzp, char *name, vattr_t *vap, char *link,
txtype |= TX_CI;
zfs_log_symlink(zilog, tx, txtype, dzp, zp, name, link);

zfs_inode_update(dzp);
zfs_inode_update(zp);
zfs_znode_update_vfs(dzp);
zfs_znode_update_vfs(zp);
}

zfs_acl_ids_free(&acl_ids);
Expand Down Expand Up @@ -3419,8 +3419,8 @@ zfs_link(znode_t *tdzp, znode_t *szp, char *name, cred_t *cr,
if (is_tmpfile && zfsvfs->z_os->os_sync != ZFS_SYNC_DISABLED)
txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), txg);

zfs_inode_update(tdzp);
zfs_inode_update(szp);
zfs_znode_update_vfs(tdzp);
zfs_znode_update_vfs(szp);
ZFS_EXIT(zfsvfs);
return (error);
}
Expand Down
14 changes: 5 additions & 9 deletions module/os/linux/zfs/zfs_znode.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,10 @@ zfs_set_inode_flags(znode_t *zp, struct inode *ip)
}

/*
* Update the embedded inode given the znode. We should work toward
* eliminating this function as soon as possible by removing values
* which are duplicated between the znode and inode. If the generic
* inode has the correct field it should be used, and the ZFS code
* updated to access the inode. This can be done incrementally.
* Update the embedded inode given the znode.
*/
void
zfs_inode_update(znode_t *zp)
zfs_znode_update_vfs(znode_t *zp)
{
zfsvfs_t *zfsvfs;
struct inode *ip;
Expand Down Expand Up @@ -602,7 +598,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
ZFS_TIME_DECODE(&ip->i_ctime, ctime);

ip->i_ino = zp->z_id;
zfs_inode_update(zp);
zfs_znode_update_vfs(zp);
zfs_inode_set_ops(zfsvfs, ip);

/*
Expand Down Expand Up @@ -1278,7 +1274,7 @@ zfs_rezget(znode_t *zp)

zp->z_blksz = doi.doi_data_block_size;
zp->z_atime_dirty = B_FALSE;
zfs_inode_update(zp);
zfs_znode_update_vfs(zp);

/*
* If the file has zero links, then it has been unlinked on the send
Expand Down Expand Up @@ -1796,7 +1792,7 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)

dmu_tx_commit(tx);

zfs_inode_update(zp);
zfs_znode_update_vfs(zp);
error = 0;

out:
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/zfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ zfs_write(znode_t *zp, zfs_uio_t *uio, int ioflag, cred_t *cr)
}
}

zfs_inode_update(zp);
zfs_znode_update_vfs(zp);
zfs_rangelock_exit(lr);

/*
Expand Down

0 comments on commit 534e6c5

Please sign in to comment.