Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446028

Re: [PATCH v3 4/4] vfs: Use dlock list for superblock's inode list

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH v3 4/4] vfs: Use dlock list for superblock's inode list
Date 2016-07-19 07:30 +0200
Message-ID <rWvLr-8iu-9@gated-at.bofh.it> (permalink)
References <rVfpn-1mA-3@gated-at.bofh.it> <rVfpo-1mA-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jul 15, 2016 at 01:39:43PM -0400, Waiman Long wrote:
>  void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
>  {
>  	struct inode *inode, *old_inode = NULL;
> +	DEFINE_DLOCK_LIST_ITER(iter);
>  
> -	spin_lock(&blockdev_superblock->s_inode_list_lock);
> -	list_for_each_entry(inode, &blockdev_superblock->s_inodes, i_sb_list) {
> -		struct address_space *mapping = inode->i_mapping;
> +	while (dlock_list_next(&blockdev_superblock->s_inodes, &iter)) {
> +		struct address_space *mapping;
>  
> +		inode   = list_entry(iter.curr, struct inode, i_sb_list);
> +		mapping = inode->i_mapping;

TBH, I would very much prefer something like
	DEFINE_DLOCK_LIST_ITER(iter, &blockdev_superblock->s_inodes);

	dlist_for_each_entry(inode, &iter, i_sb_list) {
		mapping = inode->i_mapping;

> -		spin_unlock(&blockdev_superblock->s_inode_list_lock);
> +		spin_unlock(iter.lock);

... and this might be worth dlist_{un,re}lock(&iter);

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 4/4] vfs: Use dlock list for superblock's inode list Waiman Long <Waiman.Long@hpe.com> - 2016-07-15 19:50 +0200
  Re: [PATCH v3 4/4] vfs: Use dlock list for superblock's inode list Al Viro <viro@ZenIV.linux.org.uk> - 2016-07-19 07:30 +0200
    Re: [PATCH v3 4/4] vfs: Use dlock list for superblock's inode list Tejun Heo <tj@kernel.org> - 2016-07-19 20:40 +0200

csiph-web