Kill znode->z_gen field

This field is a duplicate of the inode->i_generation, so just
kill it.

Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4538
Closes #4654
This commit is contained in:
Nikolay Borisov 2016-04-18 22:08:53 +03:00 committed by Brian Behlendorf
parent bc2d809387
commit 278f223668
6 changed files with 15 additions and 17 deletions

View File

@ -54,7 +54,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
__field(uint_t, z_blksz) __field(uint_t, z_blksz)
__field(uint_t, z_seq) __field(uint_t, z_seq)
__field(uint64_t, z_mapcnt) __field(uint64_t, z_mapcnt)
__field(uint64_t, z_gen)
__field(uint64_t, z_size) __field(uint64_t, z_size)
__field(uint64_t, z_links) __field(uint64_t, z_links)
__field(uint64_t, z_pflags) __field(uint64_t, z_pflags)
@ -91,7 +90,6 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
__entry->z_blksz = zn->z_blksz; __entry->z_blksz = zn->z_blksz;
__entry->z_seq = zn->z_seq; __entry->z_seq = zn->z_seq;
__entry->z_mapcnt = zn->z_mapcnt; __entry->z_mapcnt = zn->z_mapcnt;
__entry->z_gen = zn->z_gen;
__entry->z_size = zn->z_size; __entry->z_size = zn->z_size;
__entry->z_links = zn->z_links; __entry->z_links = zn->z_links;
__entry->z_pflags = zn->z_pflags; __entry->z_pflags = zn->z_pflags;
@ -121,17 +119,15 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
), ),
TP_printk("zn { id %llu unlinked %u atime_dirty %u " TP_printk("zn { id %llu unlinked %u atime_dirty %u "
"zn_prefetch %u moved %u blksz %u seq %u " "zn_prefetch %u moved %u blksz %u seq %u "
"mapcnt %llu gen %llu size %llu " "mapcnt %llu size %llu links %llu pflags %llu "
"links %llu pflags %llu uid %llu gid %llu " "uid %llu gid %llu sync_cnt %u mode 0x%x is_sa %d "
"sync_cnt %u mode 0x%x is_sa %d "
"is_mapped %d is_ctldir %d is_stale %d inode { " "is_mapped %d is_ctldir %d is_stale %d inode { "
"ino %lu nlink %u version %llu size %lli blkbits %u " "ino %lu nlink %u version %llu size %lli blkbits %u "
"bytes %u mode 0x%x generation %x } } ace { type %u " "bytes %u mode 0x%x generation %x } } ace { type %u "
"flags %u access_mask %u } mask_matched %u", "flags %u access_mask %u } mask_matched %u",
__entry->z_id, __entry->z_unlinked, __entry->z_atime_dirty, __entry->z_id, __entry->z_unlinked, __entry->z_atime_dirty,
__entry->z_zn_prefetch, __entry->z_moved, __entry->z_blksz, __entry->z_zn_prefetch, __entry->z_moved, __entry->z_blksz,
__entry->z_seq, __entry->z_mapcnt, __entry->z_gen, __entry->z_seq, __entry->z_mapcnt, __entry->z_size,
__entry->z_size,
__entry->z_links, __entry->z_pflags, __entry->z_uid, __entry->z_links, __entry->z_pflags, __entry->z_uid,
__entry->z_gid, __entry->z_sync_cnt, __entry->z_mode, __entry->z_gid, __entry->z_sync_cnt, __entry->z_mode,
__entry->z_is_sa, __entry->z_is_mapped, __entry->z_is_sa, __entry->z_is_mapped,

View File

@ -196,7 +196,6 @@ typedef struct znode {
uint_t z_blksz; /* block size in bytes */ uint_t z_blksz; /* block size in bytes */
uint_t z_seq; /* modification sequence number */ uint_t z_seq; /* modification sequence number */
uint64_t z_mapcnt; /* number of pages mapped to file */ uint64_t z_mapcnt; /* number of pages mapped to file */
uint64_t z_gen; /* generation (cached) */
uint64_t z_size; /* file size (cached) */ uint64_t z_size; /* file size (cached) */
uint64_t z_links; /* file links (cached) */ uint64_t z_links; /* file links (cached) */
uint64_t z_pflags; /* pflags (cached) */ uint64_t z_pflags; /* pflags (cached) */

View File

@ -477,7 +477,6 @@ zfsctl_inode_alloc(zfs_sb_t *zsb, uint64_t id,
zp->z_blksz = 0; zp->z_blksz = 0;
zp->z_seq = 0; zp->z_seq = 0;
zp->z_mapcnt = 0; zp->z_mapcnt = 0;
zp->z_gen = 0;
zp->z_size = 0; zp->z_size = 0;
zp->z_links = 0; zp->z_links = 0;
zp->z_pflags = 0; zp->z_pflags = 0;
@ -489,6 +488,7 @@ zfsctl_inode_alloc(zfs_sb_t *zsb, uint64_t id,
zp->z_is_ctldir = B_TRUE; zp->z_is_ctldir = B_TRUE;
zp->z_is_sa = B_FALSE; zp->z_is_sa = B_FALSE;
zp->z_is_stale = B_FALSE; zp->z_is_stale = B_FALSE;
ip->i_generation = 0;
ip->i_ino = id; ip->i_ino = id;
ip->i_mode = (S_IFDIR | S_IRUGO | S_IXUGO); ip->i_mode = (S_IFDIR | S_IRUGO | S_IXUGO);
ip->i_uid = SUID_TO_KUID(0); ip->i_uid = SUID_TO_KUID(0);

View File

@ -276,7 +276,7 @@ zfs_sa_upgrade(sa_handle_t *hdl, dmu_tx_t *tx)
int count = 0; int count = 0;
sa_bulk_attr_t *bulk, *sa_attrs; sa_bulk_attr_t *bulk, *sa_attrs;
zfs_acl_locator_cb_t locate = { 0 }; zfs_acl_locator_cb_t locate = { 0 };
uint64_t uid, gid, mode, rdev, xattr, parent; uint64_t uid, gid, mode, rdev, xattr, parent, tmp_gen;
uint64_t crtime[2], mtime[2], ctime[2], atime[2]; uint64_t crtime[2], mtime[2], ctime[2], atime[2];
zfs_acl_phys_t znode_acl; zfs_acl_phys_t znode_acl;
char scanstamp[AV_SCANSTAMP_SZ]; char scanstamp[AV_SCANSTAMP_SZ];
@ -319,6 +319,7 @@ zfs_sa_upgrade(sa_handle_t *hdl, dmu_tx_t *tx)
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_RDEV(zsb), NULL, &rdev, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_RDEV(zsb), NULL, &rdev, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, &uid, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, &uid, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL, &gid, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL, &gid, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GEN(zsb), NULL, &tmp_gen, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_ZNODE_ACL(zsb), NULL, SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_ZNODE_ACL(zsb), NULL,
&znode_acl, 88); &znode_acl, 88);
@ -336,8 +337,7 @@ zfs_sa_upgrade(sa_handle_t *hdl, dmu_tx_t *tx)
SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_MODE(zsb), NULL, &mode, 8); SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_MODE(zsb), NULL, &mode, 8);
SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_SIZE(zsb), NULL, SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_SIZE(zsb), NULL,
&zp->z_size, 8); &zp->z_size, 8);
SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_GEN(zsb), SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_GEN(zsb), NULL, &tmp_gen, 8);
NULL, &zp->z_gen, 8);
SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_UID(zsb), NULL, &uid, 8); SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_UID(zsb), NULL, &uid, 8);
SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_GID(zsb), NULL, &gid, 8); SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_GID(zsb), NULL, &gid, 8);
SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_PARENT(zsb), SA_ADD_BULK_ATTR(sa_attrs, count, SA_ZPL_PARENT(zsb),

View File

@ -2395,7 +2395,7 @@ zfs_getattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
XVA_SET_RTN(xvap, XAT_REPARSE); XVA_SET_RTN(xvap, XAT_REPARSE);
} }
if (XVA_ISSET_REQ(xvap, XAT_GEN)) { if (XVA_ISSET_REQ(xvap, XAT_GEN)) {
xoap->xoa_generation = zp->z_gen; xoap->xoa_generation = ip->i_generation;
XVA_SET_RTN(xvap, XAT_GEN); XVA_SET_RTN(xvap, XAT_GEN);
} }

View File

@ -539,7 +539,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); dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &blksize, &i_blocks);
spin_lock(&ip->i_lock); spin_lock(&ip->i_lock);
ip->i_generation = zp->z_gen;
ip->i_uid = SUID_TO_KUID(zp->z_uid); ip->i_uid = SUID_TO_KUID(zp->z_uid);
ip->i_gid = SGID_TO_KGID(zp->z_gid); ip->i_gid = SGID_TO_KGID(zp->z_gid);
set_nlink(ip, zp->z_links); set_nlink(ip, zp->z_links);
@ -589,6 +588,7 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
struct inode *ip; struct inode *ip;
uint64_t mode; uint64_t mode;
uint64_t parent; uint64_t parent;
uint64_t tmp_gen;
sa_bulk_attr_t bulk[8]; sa_bulk_attr_t bulk[8];
int count = 0; int count = 0;
@ -622,7 +622,7 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
zfs_znode_sa_init(zsb, zp, db, obj_type, hdl); zfs_znode_sa_init(zsb, zp, db, obj_type, hdl);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MODE(zsb), NULL, &mode, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MODE(zsb), NULL, &mode, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GEN(zsb), NULL, &zp->z_gen, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GEN(zsb), NULL, &tmp_gen, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_SIZE(zsb), NULL, &zp->z_size, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_SIZE(zsb), NULL, &zp->z_size, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zsb), NULL, &zp->z_links, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_LINKS(zsb), NULL, &zp->z_links, 8);
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zsb), NULL, SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zsb), NULL,
@ -632,7 +632,9 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, &zp->z_uid, 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_GID(zsb), NULL, &zp->z_gid, 8);
if (sa_bulk_lookup(zp->z_sa_hdl, bulk, count) != 0 || zp->z_gen == 0) { if (sa_bulk_lookup(zp->z_sa_hdl, bulk, count) != 0 ||
tmp_gen == 0) {
if (hdl == NULL) if (hdl == NULL)
sa_handle_destroy(zp->z_sa_hdl); sa_handle_destroy(zp->z_sa_hdl);
zp->z_sa_hdl = NULL; zp->z_sa_hdl = NULL;
@ -640,6 +642,7 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
} }
zp->z_mode = mode; zp->z_mode = mode;
ip->i_generation = (uint32_t)tmp_gen;
/* /*
* xattr znodes hold a reference on their unique parent * xattr znodes hold a reference on their unique parent
@ -1228,7 +1231,7 @@ zfs_rezget(znode_t *zp)
zp->z_mode = mode; zp->z_mode = mode;
if (gen != zp->z_gen) { if (gen != ZTOI(zp)->i_generation) {
zfs_znode_dmu_fini(zp); zfs_znode_dmu_fini(zp);
zfs_znode_hold_exit(zsb, zh); zfs_znode_hold_exit(zsb, zh);
return (SET_ERROR(EIO)); return (SET_ERROR(EIO));