Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2be3c79046cf90d75d436708a4e0898c7a1f9d51
Commit:     2be3c79046cf90d75d436708a4e0898c7a1f9d51
Parent:     c9ffec48487849bc277de662a6c29aad64653b99
Author:     Christoph Hellwig <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 20 13:58:11 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Feb 20 17:10:15 2007 -0800

    [PATCH] affs: implement ->drop_inode
    
    affs wants to truncate the inode when the last user goes away, currently it
    does that through a potentially racy i_count check in ->put_inode.  But we
    already have a method that's called just after the we dropped the last
    reference, ->drop_inode.  This patch implements affs_drop_inode to take
    advantage of this.
    
    Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Cc: Roman Zippel <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/affs/affs.h  |    1 +
 fs/affs/inode.c |   17 +++++++++++------
 fs/affs/super.c |    1 +
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index 7db2d28..232c694 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -171,6 +171,7 @@ extern unsigned long                 affs_parent_ino(struct 
inode *dir);
 extern struct inode            *affs_new_inode(struct inode *dir);
 extern int                      affs_notify_change(struct dentry *dentry, 
struct iattr *attr);
 extern void                     affs_put_inode(struct inode *inode);
+extern void                     affs_drop_inode(struct inode *inode);
 extern void                     affs_delete_inode(struct inode *inode);
 extern void                     affs_clear_inode(struct inode *inode);
 extern void                     affs_read_inode(struct inode *inode);
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index fce6848..c5b9d73 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -243,12 +243,17 @@ affs_put_inode(struct inode *inode)
 {
        pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, 
inode->i_nlink);
        affs_free_prealloc(inode);
-       if (atomic_read(&inode->i_count) == 1) {
-               mutex_lock(&inode->i_mutex);
-               if (inode->i_size != AFFS_I(inode)->mmu_private)
-                       affs_truncate(inode);
-               mutex_unlock(&inode->i_mutex);
-       }
+}
+
+void
+affs_drop_inode(struct inode *inode)
+{
+       mutex_lock(&inode->i_mutex);
+       if (inode->i_size != AFFS_I(inode)->mmu_private)
+               affs_truncate(inode);
+       mutex_unlock(&inode->i_mutex);
+
+       generic_drop_inode(inode);
 }
 
 void
diff --git a/fs/affs/super.c b/fs/affs/super.c
index a324045..c3986a1 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -118,6 +118,7 @@ static const struct super_operations affs_sops = {
        .read_inode     = affs_read_inode,
        .write_inode    = affs_write_inode,
        .put_inode      = affs_put_inode,
+       .drop_inode     = affs_drop_inode,
        .delete_inode   = affs_delete_inode,
        .clear_inode    = affs_clear_inode,
        .put_super      = affs_put_super,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to