WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: [PATCH 0/5] reduce exclusive ilock hold times V2

Re: [PATCH 3/5] xfs: reduce ilock hold times in xfs_setattr_size

by Ben Myers :: Rate this Message:

| View in Thread

On Tue, Mar 27, 2012 at 10:34:48AM -0400, Christoph Hellwig wrote:

> We do not need the ilock for most checks done in the beginning of
> xfs_setattr_size.  Replace the long critical section before starting the
> transaction with a smaller one around xfs_zero_eof and an optional one
> inside xfs_qm_dqattach that isn't entered unless using quotas.  While
> this isn't a big optimization for xfs_setattr_size itself it will allow
> pushing the ilock into xfs_zero_eof itself later.
>
> Signed-off-by: Christoph Hellwig <hch@...>
>
> ---
>  fs/xfs/xfs_iops.c |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> Index: xfs/fs/xfs/xfs_iops.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_iops.c 2012-03-26 15:17:47.088854526 +0200
> +++ xfs/fs/xfs/xfs_iops.c 2012-03-26 15:17:57.265521382 +0200
> @@ -700,7 +700,7 @@ xfs_setattr_size(
>   xfs_off_t oldsize, newsize;
>   struct xfs_trans *tp;
>   int error;
> - uint lock_flags;
> + uint lock_flags = 0;
>   uint commit_flags = 0;
>  
>   trace_xfs_setattr(ip);
> @@ -720,10 +720,10 @@ xfs_setattr_size(
>   ATTR_MTIME_SET|ATTR_KILL_SUID|ATTR_KILL_SGID|
>   ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);
>  
> - lock_flags = XFS_ILOCK_EXCL;
> - if (!(flags & XFS_ATTR_NOLOCK))
> + if (!(flags & XFS_ATTR_NOLOCK)) {
>   lock_flags |= XFS_IOLOCK_EXCL;
> - xfs_ilock(ip, lock_flags);
> + xfs_ilock(ip, lock_flags);
> + }
>  
>   oldsize = inode->i_size;
>   newsize = iattr->ia_size;

Usually the ilock is taken to protect i_d.di_nextents.

-Ben

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

 « Return to Thread: [PATCH 0/5] reduce exclusive ilock hold times V2