All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rich Johnston <rjohnston@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 3/5] xfs: do not take the iolock in xfs_inactive
Date: Thu, 26 Jul 2012 10:31:06 -0500	[thread overview]
Message-ID: <501162BA.4000108@sgi.com> (raw)
In-Reply-To: <20120704151443.765745844@bombadil.infradead.org>

On 07/04/2012 10:13 AM, Christoph Hellwig wrote:
> An inode that enters xfs_inactive has been removed from all global
> lists but the inode hash, and can't be recycled in xfs_iget before
> it has been marked reclaimable.  Thus taking the iolock in here
> is not nessecary at all, and given the amount of lockdep false
> positives it has triggered already I'd rather remove the locking.
>
> The only change outside of xfs_inactive is relaxing an assert in
> xfs_itruncate_extents.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> ---
>  fs/xfs/xfs_inode.c    |    4 +++-
>  fs/xfs/xfs_vnodeops.c |   29 ++++++++++++-----------------
>  2 files changed, 15 insertions(+), 18 deletions(-)
>
> Index: xfs/fs/xfs/xfs_vnodeops.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_vnodeops.c	2012-07-04 09:51:01.347038413 +0200
> +++ xfs/fs/xfs/xfs_vnodeops.c	2012-07-04 09:51:03.913705064 +0200
> @@ -554,7 +554,7 @@ xfs_inactive(
>  		return VN_INACTIVE_CACHE;
>  	}
>
> -	xfs_ilock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
> +	xfs_ilock(ip, XFS_ILOCK_EXCL);
>  	xfs_trans_ijoin(tp, ip, 0);
>
>  	if (S_ISLNK(ip->i_d.di_mode)) {
> @@ -591,21 +591,24 @@ xfs_inactive(
>  		ASSERT(ip->i_d.di_forkoff != 0);
>
>  		error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
> -		xfs_iunlock(ip, XFS_ILOCK_EXCL);
>  		if (error)
> -			goto error_unlock;
> +			goto out_unlock;
> +
> +		xfs_iunlock(ip, XFS_ILOCK_EXCL);
>
>  		error = xfs_attr_inactive(ip);
>  		if (error)
> -			goto error_unlock;
> +			goto out;
>
>  		tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE);
>  		error = xfs_trans_reserve(tp, 0,
>  					  XFS_IFREE_LOG_RES(mp),
>  					  0, XFS_TRANS_PERM_LOG_RES,
>  					  XFS_INACTIVE_LOG_COUNT);
> -		if (error)
> -			goto error_cancel;
> +		if (error) {
> +			xfs_trans_cancel(tp, 0);
> +			goto out;
> +		}
>
>  		xfs_ilock(ip, XFS_ILOCK_EXCL);
>  		xfs_trans_ijoin(tp, ip, 0);
> @@ -658,21 +661,13 @@ xfs_inactive(
>  	 * Release the dquots held by inode, if any.
>  	 */
>  	xfs_qm_dqdetach(ip);
> -	xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
> -
> +out_unlock:
> +	xfs_iunlock(ip, XFS_ILOCK_EXCL);
>  out:
>  	return VN_INACTIVE_CACHE;
>  out_cancel:
>  	xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT);
> -	xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
> -	return VN_INACTIVE_CACHE;
> -
> -error_cancel:
> -	ASSERT(XFS_FORCED_SHUTDOWN(mp));
> -	xfs_trans_cancel(tp, 0);
> -error_unlock:
> -	xfs_iunlock(ip, XFS_IOLOCK_EXCL);
> -	return VN_INACTIVE_CACHE;
> +	goto out_unlock;
>  }
Although I am not a fan of goto statements, this code would be very ugly 
without it.
>
>  /*
> Index: xfs/fs/xfs/xfs_inode.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_inode.c	2012-07-04 09:40:04.413709004 +0200
> +++ xfs/fs/xfs/xfs_inode.c	2012-07-04 09:51:03.913705064 +0200
> @@ -1123,7 +1123,9 @@ xfs_itruncate_extents(
>  	int			error = 0;
>  	int			done = 0;
>
> -	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
> +	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> +	ASSERT(!atomic_read(&VFS_I(ip)->i_count) ||
> +	       xfs_isilocked(ip, XFS_IOLOCK_EXCL));
>  	ASSERT(new_size <= XFS_ISIZE(ip));
>  	ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
>  	ASSERT(ip->i_itemp != NULL);
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

This is a good first step to removing the iolock.  Looks good.

Reviewed-by:	Rich Johnston <rjohnston@sgi.com>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2012-07-26 15:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04 15:13 [PATCH 0/5] do not take the iolock in inode reclaim context Christoph Hellwig
2012-07-04 15:13 ` [PATCH 1/5] xfs: clean up xfs_inactive Christoph Hellwig
2012-07-26 15:30   ` Rich Johnston
2012-07-04 15:13 ` [PATCH 2/5] xfs: remove xfs_inactive_attrs Christoph Hellwig
2012-07-26 15:31   ` Rich Johnston
2012-07-04 15:13 ` [PATCH 3/5] xfs: do not take the iolock in xfs_inactive Christoph Hellwig
2012-07-26 15:31   ` Rich Johnston [this message]
2012-07-04 15:13 ` [PATCH 4/5] xfs: avoid the iolock in xfs_free_eofblocks for evicted inodes Christoph Hellwig
2012-07-26 15:31   ` Rich Johnston
2012-07-04 15:13 ` [PATCH 5/5] xfs: remove iolock lock classes Christoph Hellwig
2012-07-26 15:31   ` Rich Johnston
2012-07-06  0:05 ` [PATCH 0/5] do not take the iolock in inode reclaim context Sage Weil
     [not found] ` <20120717071923.GD15473@infradead.org>
2012-07-17 15:46   ` Sage Weil
2012-07-17 17:27     ` Mark Tinguely
2012-07-26 15:30 ` Rich Johnston

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=501162BA.4000108@sgi.com \
    --to=rjohnston@sgi.com \
    --cc=hch@infradead.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.