Skip to content

Commit 841ce57

Browse files
committed
Retire z_nr_znodes
Added in ab26409 ("Linux 3.1 compat, super_block->s_shrink"), with the only consumer which needed the count getting retired in 066e825 ("Linux compat: Minimum kernel version 3.10"). The counter gets in the way of not maintaining the list to begin with. Signed-off-by: Mateusz Guzik <[email protected]>
1 parent 8af8d2a commit 841ce57

File tree

7 files changed

+6
-16
lines changed

7 files changed

+6
-16
lines changed

include/os/freebsd/zfs/sys/zfs_vfsops_os.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ struct zfsvfs {
9393
zfs_teardown_lock_t z_teardown_lock;
9494
zfs_teardown_inactive_lock_t z_teardown_inactive_lock;
9595
list_t z_all_znodes; /* all vnodes in the fs */
96-
uint64_t z_nr_znodes; /* number of znodes in the fs */
9796
kmutex_t z_znodes_lock; /* lock for z_all_znodes */
9897
struct zfsctl_root *z_ctldir; /* .zfs directory pointer */
9998
boolean_t z_show_ctldir; /* expose .zfs in the root dir */

include/os/linux/zfs/sys/zfs_vfsops_os.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ struct zfsvfs {
105105
rrmlock_t z_teardown_lock;
106106
krwlock_t z_teardown_inactive_lock;
107107
list_t z_all_znodes; /* all znodes in the fs */
108-
uint64_t z_nr_znodes; /* number of znodes in the fs */
109108
unsigned long z_rollback_time; /* last online rollback time */
110109
unsigned long z_snap_defer_time; /* last snapshot unmount deferral */
111110
kmutex_t z_znodes_lock; /* lock for z_all_znodes */

module/os/freebsd/zfs/zfs_vfsops.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,6 @@ zfsvfs_free(zfsvfs_t *zfsvfs)
11541154

11551155
mutex_destroy(&zfsvfs->z_znodes_lock);
11561156
mutex_destroy(&zfsvfs->z_lock);
1157-
ASSERT3U(zfsvfs->z_nr_znodes, ==, 0);
11581157
list_destroy(&zfsvfs->z_all_znodes);
11591158
ZFS_TEARDOWN_DESTROY(zfsvfs);
11601159
ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs);
@@ -1558,12 +1557,11 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
15581557
* may add the parents of dir-based xattrs to the taskq
15591558
* so we want to wait for these.
15601559
*
1561-
* We can safely read z_nr_znodes without locking because the
1562-
* VFS has already blocked operations which add to the
1563-
* z_all_znodes list and thus increment z_nr_znodes.
1560+
* We can safely check z_all_znodes for being empty because the
1561+
* VFS has already blocked operations which add to it.
15641562
*/
15651563
int round = 0;
1566-
while (zfsvfs->z_nr_znodes > 0) {
1564+
while (!list_is_empty(&zfsvfs->z_all_znodes)) {
15671565
taskq_wait_outstanding(dsl_pool_zrele_taskq(
15681566
dmu_objset_pool(zfsvfs->z_os)), 0);
15691567
if (++round > 1 && !unmounting)

module/os/freebsd/zfs/zfs_znode.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
537537

538538
mutex_enter(&zfsvfs->z_znodes_lock);
539539
list_insert_tail(&zfsvfs->z_all_znodes, zp);
540-
zfsvfs->z_nr_znodes++;
541540
zp->z_zfsvfs = zfsvfs;
542541
mutex_exit(&zfsvfs->z_znodes_lock);
543542

@@ -1286,7 +1285,6 @@ zfs_znode_free(znode_t *zp)
12861285
mutex_enter(&zfsvfs->z_znodes_lock);
12871286
POINTER_INVALIDATE(&zp->z_zfsvfs);
12881287
list_remove(&zfsvfs->z_all_znodes, zp);
1289-
zfsvfs->z_nr_znodes--;
12901288
mutex_exit(&zfsvfs->z_znodes_lock);
12911289

12921290
#if __FreeBSD_version >= 1300139

module/os/linux/zfs/zfs_ctldir.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ zfsctl_inode_alloc(zfsvfs_t *zfsvfs, uint64_t id,
537537

538538
mutex_enter(&zfsvfs->z_znodes_lock);
539539
list_insert_tail(&zfsvfs->z_all_znodes, zp);
540-
zfsvfs->z_nr_znodes++;
541540
membar_producer();
542541
mutex_exit(&zfsvfs->z_znodes_lock);
543542

module/os/linux/zfs/zfs_vfsops.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,12 +1330,11 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
13301330
* may add the parents of dir-based xattrs to the taskq
13311331
* so we want to wait for these.
13321332
*
1333-
* We can safely read z_nr_znodes without locking because the
1334-
* VFS has already blocked operations which add to the
1335-
* z_all_znodes list and thus increment z_nr_znodes.
1333+
* We can safely check z_all_znodes for being empty because the
1334+
* VFS has already blocked operations which add to it.
13361335
*/
13371336
int round = 0;
1338-
while (zfsvfs->z_nr_znodes > 0) {
1337+
while (!list_is_empty(&zfsvfs->z_all_znodes)) {
13391338
taskq_wait_outstanding(dsl_pool_zrele_taskq(
13401339
dmu_objset_pool(zfsvfs->z_os)), 0);
13411340
if (++round > 1 && !unmounting)

module/os/linux/zfs/zfs_znode.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ zfs_inode_destroy(struct inode *ip)
390390
mutex_enter(&zfsvfs->z_znodes_lock);
391391
if (list_link_active(&zp->z_link_node)) {
392392
list_remove(&zfsvfs->z_all_znodes, zp);
393-
zfsvfs->z_nr_znodes--;
394393
}
395394
mutex_exit(&zfsvfs->z_znodes_lock);
396395

@@ -641,7 +640,6 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz,
641640

642641
mutex_enter(&zfsvfs->z_znodes_lock);
643642
list_insert_tail(&zfsvfs->z_all_znodes, zp);
644-
zfsvfs->z_nr_znodes++;
645643
mutex_exit(&zfsvfs->z_znodes_lock);
646644

647645
if (links > 0)

0 commit comments

Comments
 (0)