Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d003fb70fd356d0684ee0cd37a785e058c8678de
Commit:     d003fb70fd356d0684ee0cd37a785e058c8678de
Parent:     fb58b7316a99703afb8d076b0e5f3e1e387e4b30
Author:     Christoph Hellwig <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 12 00:51:58 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Feb 12 09:48:28 2007 -0800

    [PATCH] remove sb->s_files and file_list_lock usage in dquot.c
    
    Iterate over sb->s_inodes instead of sb->s_files in add_dquot_ref.  This
    reduces list search and lock hold time aswell as getting rid of one of the
    few uses of file_list_lock which Ingo identified as a scalability problem.
    
    Previously we called dq_op->initialize for every inode handing of a
    writeable file that wasn't initialized before.  Now we're calling it for
    every inode that has a non-zero i_writecount, aka a writeable file
    descriptor refering to it.
    
    Thanks a lot to Jan Kara for running this patch through his quota test
    harness.
    
    Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>
    Signed-off-by: Jan Kara <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/dquot.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/fs/dquot.c b/fs/dquot.c
index 5bdc4b2..9eb166f 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -688,23 +688,27 @@ static int dqinit_needed(struct inode *inode, int type)
 /* This routine is guarded by dqonoff_mutex mutex */
 static void add_dquot_ref(struct super_block *sb, int type)
 {
-       struct list_head *p;
+       struct inode *inode;
 
 restart:
-       file_list_lock();
-       list_for_each(p, &sb->s_files) {
-               struct file *filp = list_entry(p, struct file, f_u.fu_list);
-               struct inode *inode = filp->f_path.dentry->d_inode;
-               if (filp->f_mode & FMODE_WRITE && dqinit_needed(inode, type)) {
-                       struct dentry *dentry = dget(filp->f_path.dentry);
-                       file_list_unlock();
-                       sb->dq_op->initialize(inode, type);
-                       dput(dentry);
-                       /* As we may have blocked we had better restart... */
-                       goto restart;
-               }
+       spin_lock(&inode_lock);
+       list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
+               if (!atomic_read(&inode->i_writecount))
+                       continue;
+               if (!dqinit_needed(inode, type))
+                       continue;
+               if (inode->i_state & (I_FREEING|I_WILL_FREE))
+                       continue;
+
+               __iget(inode);
+               spin_unlock(&inode_lock);
+
+               sb->dq_op->initialize(inode, type);
+               iput(inode);
+               /* As we may have blocked we had better restart... */
+               goto restart;
        }
-       file_list_unlock();
+       spin_unlock(&inode_lock);
 }
 
 /* Return 0 if dqput() won't block (note that 1 doesn't necessarily mean 
blocking) */
-
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