Skip to content

Commit 5bef915

Browse files
author
Al Viro
committed
new helper: inode_fake_hash()
open-coded in a quite a few places... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent e950564 commit 5bef915

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

‎fs/hfs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry,
541541
HFS_I(inode)->rsrc_inode = dir;
542542
HFS_I(dir)->rsrc_inode = inode;
543543
igrab(dir);
544-
hlist_add_fake(&inode->i_hash);
544+
inode_fake_hash(inode);
545545
mark_inode_dirty(inode);
546546
dont_mount(dentry);
547547
out:

‎fs/jfs/jfs_imap.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary)
491491
/* release the page */
492492
release_metapage(mp);
493493

494-
/*
495-
* __mark_inode_dirty expects inodes to be hashed. Since we don't
496-
* want special inodes in the fileset inode space, we make them
497-
* appear hashed, but do not put on any lists. hlist_del()
498-
* will work fine and require no locking.
499-
*/
500-
hlist_add_fake(&ip->i_hash);
494+
inode_fake_hash(ip);
501495

502496
return (ip);
503497
}

‎fs/jfs/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
581581
inode->i_ino = 0;
582582
inode->i_size = i_size_read(sb->s_bdev->bd_inode);
583583
inode->i_mapping->a_ops = &jfs_metapage_aops;
584-
hlist_add_fake(&inode->i_hash);
584+
inode_fake_hash(inode);
585585
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
586586

587587
sbi->direct_inode = inode;

‎fs/xfs/xfs_iops.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ xfs_setup_inode(
12531253

12541254
inode_sb_list_add(inode);
12551255
/* make the inode look hashed for the writeback code */
1256-
hlist_add_fake(&inode->i_hash);
1256+
inode_fake_hash(inode);
12571257

12581258
inode->i_uid = xfs_uid_to_kuid(ip->i_d.di_uid);
12591259
inode->i_gid = xfs_gid_to_kgid(ip->i_d.di_gid);

‎include/linux/fs.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,17 @@ static inline int inode_unhashed(struct inode *inode)
684684
return hlist_unhashed(&inode->i_hash);
685685
}
686686

687+
/*
688+
* __mark_inode_dirty expects inodes to be hashed. Since we don't
689+
* want special inodes in the fileset inode space, we make them
690+
* appear hashed, but do not put on any lists. hlist_del()
691+
* will work fine and require no locking.
692+
*/
693+
static inline void inode_fake_hash(struct inode *inode)
694+
{
695+
hlist_add_fake(&inode->i_hash);
696+
}
697+
687698
/*
688699
* inode->i_mutex nesting subclasses for the lock validator:
689700
*

0 commit comments

Comments
 (0)