Skip to content

Commit 7fd4d7f

Browse files
committed
Linux: i_op: use .free_inode
as per Documentation/filesystems/porting.rst: quote: **strongly recommended** take the RCU-delayed parts of ->destroy_inode() into a new method - ->free_inode(). If ->destroy_inode() becomes empty - all the better, just get rid of it. endquote. Signed-off-by: Pavel Snajdr <[email protected]>
1 parent 7cd1e2a commit 7fd4d7f

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ struct znode;
158158
extern int zfs_sync(struct super_block *, int, cred_t *);
159159
extern int zfs_inode_alloc(struct super_block *, struct inode **ip);
160160
extern void zfs_inode_destroy(struct inode *);
161+
extern void zfs_inode_free(struct inode *);
161162
extern void zfs_mark_inode_dirty(struct inode *);
162163
extern boolean_t zfs_relatime_need_update(const struct inode *);
163164
extern zil_replay_func_t *const zfs_replay_vector[TX_MAX_TYPE];

module/os/linux/zfs/zfs_znode_os.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,14 @@ zfs_inode_alloc(struct super_block *sb, struct inode **ip)
370370
return (0);
371371
}
372372

373-
/*
374-
* Called in multiple places when an inode should be destroyed.
375-
*/
373+
void
374+
zfs_inode_free(struct inode *ip)
375+
{
376+
znode_t *zp = ITOZ(ip);
377+
378+
kmem_cache_free(znode_cache, zp);
379+
}
380+
376381
void
377382
zfs_inode_destroy(struct inode *ip)
378383
{
@@ -395,7 +400,9 @@ zfs_inode_destroy(struct inode *ip)
395400
zp->z_xattr_cached = NULL;
396401
}
397402

398-
kmem_cache_free(znode_cache, zp);
403+
#if 0
404+
zfs_inode_free(ip);
405+
#endif
399406
}
400407

401408
static void

module/os/linux/zfs/zpl_super.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ zpl_inode_alloc(struct super_block *sb)
4444
}
4545

4646
static void
47+
zpl_inode_free(struct inode *ip)
48+
{
49+
zfs_inode_free(ip);
50+
}
51+
52+
static void __maybe_unused
4753
zpl_inode_destroy(struct inode *ip)
4854
{
49-
ASSERT(atomic_read(&ip->i_count) == 0);
5055
zfs_inode_destroy(ip);
5156
}
5257

@@ -89,6 +94,9 @@ zpl_evict_inode(struct inode *ip)
8994
truncate_inode_pages_final(&ip->i_data);
9095
clear_inode(ip);
9196
zfs_inactive(ip);
97+
#if 1
98+
zfs_inode_destroy(ip);
99+
#endif
92100
spl_fstrans_unmark(cookie);
93101
}
94102

@@ -384,7 +392,11 @@ zpl_prune_sb(uint64_t nr_to_scan, void *arg)
384392

385393
const struct super_operations zpl_super_operations = {
386394
.alloc_inode = zpl_inode_alloc,
395+
#if 1
396+
.free_inode = zpl_inode_free,
397+
#else
387398
.destroy_inode = zpl_inode_destroy,
399+
#endif
388400
.dirty_inode = zpl_dirty_inode,
389401
.write_inode = NULL,
390402
.evict_inode = zpl_evict_inode,

0 commit comments

Comments
 (0)