Skip to content

Commit

Permalink
Miscellaneous code cleanup
Browse files Browse the repository at this point in the history
Remove some extra whitespace.

Use pointer-typed asserts in Linux's znode cache destructor for more
info when debugging.

Simplify a couple of conversions from inode to znode when we already
have the znode.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#11974
  • Loading branch information
Ryan Moeller authored Apr 30, 2021
1 parent e4efb70 commit c903a75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions module/os/freebsd/zfs/zfs_znode.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,12 @@ static int
zfs_znode_cache_constructor_smr(void *mem, int size __unused, void *private,
int flags)
{

return (zfs_znode_cache_constructor(mem, private, flags));
}

static void
zfs_znode_cache_destructor_smr(void *mem, int size __unused, void *private)
{

zfs_znode_cache_destructor(mem, private);
}

Expand All @@ -202,7 +200,6 @@ zfs_znode_init(void)
static znode_t *
zfs_znode_alloc_kmem(int flags)
{

return (uma_zalloc_smr(znode_uma_zone, flags));
}

Expand All @@ -228,7 +225,6 @@ zfs_znode_init(void)
static znode_t *
zfs_znode_alloc_kmem(int flags)
{

return (kmem_cache_alloc(znode_cache, flags));
}

Expand Down
6 changes: 3 additions & 3 deletions module/os/linux/zfs/zfs_znode.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ zfs_znode_cache_destructor(void *buf, void *arg)
rw_destroy(&zp->z_xattr_lock);
zfs_rangelock_fini(&zp->z_rangelock);

ASSERT(zp->z_dirlocks == NULL);
ASSERT(zp->z_acl_cached == NULL);
ASSERT(zp->z_xattr_cached == NULL);
ASSERT3P(zp->z_dirlocks, ==, NULL);
ASSERT3P(zp->z_acl_cached, ==, NULL);
ASSERT3P(zp->z_xattr_cached, ==, NULL);
}

static int
Expand Down
4 changes: 2 additions & 2 deletions module/os/linux/zfs/zpl_xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value,
cookie = spl_fstrans_mark();
ZPL_ENTER(zfsvfs);
ZPL_VERIFY_ZP(zp);
rw_enter(&ITOZ(ip)->z_xattr_lock, RW_WRITER);
rw_enter(&zp->z_xattr_lock, RW_WRITER);

/*
* Before setting the xattr check to see if it already exists.
Expand Down Expand Up @@ -656,7 +656,7 @@ zpl_xattr_set(struct inode *ip, const char *name, const void *value,
if (error == 0 && (where & XATTR_IN_SA))
zpl_xattr_set_sa(ip, name, NULL, 0, 0, cr);
out:
rw_exit(&ITOZ(ip)->z_xattr_lock);
rw_exit(&zp->z_xattr_lock);
ZPL_EXIT(zfsvfs);
spl_fstrans_unmark(cookie);
crfree(cr);
Expand Down

0 comments on commit c903a75

Please sign in to comment.