* [PATCH 2/58] unify fs/inode.c callers of clear_inode()
@ 2010-06-08 22:15 Al Viro
2010-06-09 13:00 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2010-06-08 22:15 UTC (permalink / raw)
To: linux-fsdevel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/58] unify fs/inode.c callers of clear_inode()
2010-06-08 22:15 [PATCH 2/58] unify fs/inode.c callers of clear_inode() Al Viro
@ 2010-06-09 13:00 ` Christoph Hellwig
2010-06-09 13:15 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2010-06-09 13:00 UTC (permalink / raw)
To: Al Viro; +Cc: linux-fsdevel
> +static void evict(struct inode *inode, int delete)
How about calling this evict_inode? That gives a better grepable
identifier in backtraces and also fits the tradition of other
wrappers for methods.
> +{
> + const struct super_operations *op = inode->i_sb->s_op;
> +
> + if (delete && op->delete_inode) {
> + op->delete_inode(inode);
What's the point in having the local op variable?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/58] unify fs/inode.c callers of clear_inode()
2010-06-09 13:00 ` Christoph Hellwig
@ 2010-06-09 13:15 ` Al Viro
0 siblings, 0 replies; 3+ messages in thread
From: Al Viro @ 2010-06-09 13:15 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Al Viro, linux-fsdevel
On Wed, Jun 09, 2010 at 09:00:47AM -0400, Christoph Hellwig wrote:
> > +static void evict(struct inode *inode, int delete)
>
> How about calling this evict_inode? That gives a better grepable
> identifier in backtraces and also fits the tradition of other
> wrappers for methods.
>
> > +{
> > + const struct super_operations *op = inode->i_sb->s_op;
> > +
> > + if (delete && op->delete_inode) {
> > + op->delete_inode(inode);
>
> What's the point in having the local op variable?
Shorter and more readable? See generic_delete_inode() in mainline for
origin of that...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-09 13:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08 22:15 [PATCH 2/58] unify fs/inode.c callers of clear_inode() Al Viro
2010-06-09 13:00 ` Christoph Hellwig
2010-06-09 13:15 ` Al Viro
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).