From: Al Viro <viro@ftp.linux.org.uk>
To: linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/58] unify fs/inode.c callers of clear_inode()
Date: Tue, 08 Jun 2010 23:15:12 +0100 [thread overview]
Message-ID: <E1OM74i-0004XF-VD@ZenIV.linux.org.uk> (raw)
For now, just a straightforward merge
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/inode.c | 36 +++++++++++++++++-------------------
1 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index f016efb..9f52948 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -321,6 +321,19 @@ void clear_inode(struct inode *inode)
}
EXPORT_SYMBOL(clear_inode);
+static void evict(struct inode *inode, int delete)
+{
+ const struct super_operations *op = inode->i_sb->s_op;
+
+ if (delete && op->delete_inode) {
+ op->delete_inode(inode);
+ } else {
+ if (inode->i_data.nrpages)
+ truncate_inode_pages(&inode->i_data, 0);
+ clear_inode(inode);
+ }
+}
+
/*
* dispose_list - dispose of the contents of a local list
* @head: the head of the list to free
@@ -338,9 +351,7 @@ static void dispose_list(struct list_head *head)
inode = list_first_entry(head, struct inode, i_list);
list_del(&inode->i_list);
- if (inode->i_data.nrpages)
- truncate_inode_pages(&inode->i_data, 0);
- clear_inode(inode);
+ evict(inode, 0);
spin_lock(&inode_lock);
hlist_del_init(&inode->i_hash);
@@ -1194,8 +1205,6 @@ EXPORT_SYMBOL(remove_inode_hash);
*/
void generic_delete_inode(struct inode *inode)
{
- const struct super_operations *op = inode->i_sb->s_op;
-
list_del_init(&inode->i_list);
list_del_init(&inode->i_sb_list);
WARN_ON(inode->i_state & I_NEW);
@@ -1203,17 +1212,8 @@ void generic_delete_inode(struct inode *inode)
inodes_stat.nr_inodes--;
spin_unlock(&inode_lock);
- if (op->delete_inode) {
- void (*delete)(struct inode *) = op->delete_inode;
- /* Filesystems implementing their own
- * s_op->delete_inode are required to call
- * truncate_inode_pages and clear_inode()
- * internally */
- delete(inode);
- } else {
- truncate_inode_pages(&inode->i_data, 0);
- clear_inode(inode);
- }
+ evict(inode, 1);
+
spin_lock(&inode_lock);
hlist_del_init(&inode->i_hash);
spin_unlock(&inode_lock);
@@ -1268,9 +1268,7 @@ static void generic_forget_inode(struct inode *inode)
{
if (!generic_detach_inode(inode))
return;
- if (inode->i_data.nrpages)
- truncate_inode_pages(&inode->i_data, 0);
- clear_inode(inode);
+ evict(inode, 0);
wake_up_inode(inode);
destroy_inode(inode);
}
--
1.5.6.5
next reply other threads:[~2010-06-08 22:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 22:15 Al Viro [this message]
2010-06-09 13:00 ` [PATCH 2/58] unify fs/inode.c callers of clear_inode() Christoph Hellwig
2010-06-09 13:15 ` Al Viro
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=E1OM74i-0004XF-VD@ZenIV.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.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).