lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070206134629.GG328@duck.suse.cz>
Date:	Tue, 6 Feb 2007 14:46:29 +0100
From:	Jan Kara <jack@...e.cz>
To:	Christoph Hellwig <hch@....de>
Cc:	akpm@...l.org, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] remove sb->s_files and file_list_lock usage in dquot.c

On Tue 06-02-07 14:23:33, Christoph Hellwig wrote:
> 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.
> 
> Note:  this is ontop of '[PATCH] move remove_dquot_ref to dqout.c'
> which I sent out yesterday.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@....de>
  Signed-off-by: Jan Kara <jack@...e.cz>

> Index: linux-2.6/fs/dquot.c
> ===================================================================
> --- linux-2.6.orig/fs/dquot.c	2007-02-05 18:54:36.000000000 +0100
> +++ linux-2.6/fs/dquot.c	2007-02-05 18:59:48.000000000 +0100
> @@ -689,23 +689,27 @@
>  /* 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) */

									Honza
-- 
Jan Kara <jack@...e.cz>
SuSE CR Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ