From: Al Viro <viro@ZenIV.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Miklos Szeredi <mszeredi@redhat.com>
Subject: [PATCH 12/16] new helper: inode_fake_hash()
Date: Sun, 29 Jul 2018 23:04:49 +0100 [thread overview]
Message-ID: <20180729220453.13431-12-viro@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180729220453.13431-1-viro@ZenIV.linux.org.uk>
From: Al Viro <viro@zeniv.linux.org.uk>
open-coded in a quite a few places...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/hfs/inode.c | 2 +-
fs/jfs/jfs_imap.c | 8 +-------
fs/jfs/super.c | 2 +-
fs/xfs/xfs_iops.c | 2 +-
include/linux/fs.h | 11 +++++++++++
5 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 2a16111d312f..a2dfa1b2a89c 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -541,7 +541,7 @@ static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry,
HFS_I(inode)->rsrc_inode = dir;
HFS_I(dir)->rsrc_inode = inode;
igrab(dir);
- hlist_add_fake(&inode->i_hash);
+ inode_fake_hash(inode);
mark_inode_dirty(inode);
dont_mount(dentry);
out:
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index f36ef68905a7..93e8c590ff5c 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -491,13 +491,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary)
/* release the page */
release_metapage(mp);
- /*
- * __mark_inode_dirty expects inodes to be hashed. Since we don't
- * want special inodes in the fileset inode space, we make them
- * appear hashed, but do not put on any lists. hlist_del()
- * will work fine and require no locking.
- */
- hlist_add_fake(&ip->i_hash);
+ inode_fake_hash(ip);
return (ip);
}
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 1b9264fd54b6..5403ece57dba 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -581,7 +581,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
inode->i_ino = 0;
inode->i_size = i_size_read(sb->s_bdev->bd_inode);
inode->i_mapping->a_ops = &jfs_metapage_aops;
- hlist_add_fake(&inode->i_hash);
+ inode_fake_hash(inode);
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
sbi->direct_inode = inode;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 0fa29f39d658..3a75de777843 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -1253,7 +1253,7 @@ xfs_setup_inode(
inode_sb_list_add(inode);
/* make the inode look hashed for the writeback code */
- hlist_add_fake(&inode->i_hash);
+ inode_fake_hash(inode);
inode->i_uid = xfs_uid_to_kuid(ip->i_d.di_uid);
inode->i_gid = xfs_gid_to_kgid(ip->i_d.di_gid);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a42600565925..43941e230e2b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -685,6 +685,17 @@ static inline int inode_unhashed(struct inode *inode)
}
/*
+ * __mark_inode_dirty expects inodes to be hashed. Since we don't
+ * want special inodes in the fileset inode space, we make them
+ * appear hashed, but do not put on any lists. hlist_del()
+ * will work fine and require no locking.
+ */
+static inline void inode_fake_hash(struct inode *inode)
+{
+ hlist_add_fake(&inode->i_hash);
+}
+
+/*
* inode->i_mutex nesting subclasses for the lock validator:
*
* 0: the object of the current VFS operation
--
2.11.0
next prev parent reply other threads:[~2018-07-29 23:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-29 22:03 [PATCHES][RFC] icache-related stuff Al Viro
2018-07-29 22:04 ` [PATCH 01/16] nfs_instantiate(): prevent multiple aliases for directory inode Al Viro
2018-07-29 22:04 ` [PATCH 02/16] new primitive: discard_new_inode() Al Viro
2018-07-29 22:04 ` [PATCH 03/16] vfs: don't evict uninitialized inode Al Viro
2018-07-30 5:09 ` Amir Goldstein
2018-07-30 7:41 ` Miklos Szeredi
2018-08-16 16:29 ` Amir Goldstein
2018-08-24 6:47 ` Amir Goldstein
2018-10-08 6:41 ` Miklos Szeredi
2018-10-08 13:23 ` Greg KH
2018-07-29 22:04 ` [PATCH 04/16] btrfs: switch to discard_new_inode() Al Viro
2018-08-01 15:25 ` David Sterba
2018-07-29 22:04 ` [PATCH 05/16] ufs: " Al Viro
2018-07-29 22:04 ` [PATCH 06/16] udf: " Al Viro
2018-07-29 22:04 ` [PATCH 07/16] ext2: make sure that partially set up inodes won't be returned by ext2_iget() Al Viro
2018-07-29 22:04 ` [PATCH 08/16] btrfs: btrfs_iget() never returns an is_bad_inode() inode Al Viro
2018-07-30 8:13 ` Nikolay Borisov
2018-07-29 22:04 ` [PATCH 09/16] btrfs: IS_ERR(p) && PTR_ERR(p) == n is a weird way to spell p == ERR_PTR(n) Al Viro
2018-07-30 8:06 ` Nikolay Borisov
2018-07-29 22:04 ` [PATCH 10/16] kill d_instantiate_no_diralias() Al Viro
2018-07-29 22:04 ` [PATCH 11/16] jfs: switch to discard_new_inode() Al Viro
2018-07-29 22:04 ` Al Viro [this message]
2018-07-29 22:04 ` [PATCH 13/16] btrfs: lift make_bad_inode() into btrfs_iget() Al Viro
2018-07-30 8:15 ` Nikolay Borisov
2018-07-29 22:04 ` [PATCH 14/16] btrfs: simplify btrfs_iget() Al Viro
2018-07-30 8:17 ` Nikolay Borisov
2018-07-29 22:04 ` [PATCH 15/16] adfs: don't put inodes into icache Al Viro
2018-07-29 22:04 ` [PATCH 16/16] jfs: don't bother with make_bad_inode() in ialloc() Al Viro
2018-07-30 21:35 ` [PATCHES][RFC] icache-related stuff Linus Torvalds
2018-08-01 15:25 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180729220453.13431-12-viro@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).