xfs
[Top] [All Lists]

[PATCH 2/3] xfs: unlock the inode before log force in xfs_fs_nfs_commit_

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/3] xfs: unlock the inode before log force in xfs_fs_nfs_commit_metadata
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sun, 18 Sep 2011 16:47:50 -0400
References: <20110918204748.547510183@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
Only read the LSN we need to push to with the ilock held, and then release
it before we do the log force to improve concurrency.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs/fs/xfs/xfs_export.c
===================================================================
--- xfs.orig/fs/xfs/xfs_export.c        2011-09-07 11:08:48.670961391 +0200
+++ xfs/fs/xfs/xfs_export.c     2011-09-07 11:08:56.515960258 +0200
@@ -229,16 +229,16 @@ xfs_fs_nfs_commit_metadata(
 {
        struct xfs_inode        *ip = XFS_I(inode);
        struct xfs_mount        *mp = ip->i_mount;
-       int                     error = 0;
+       xfs_lsn_t               lsn = 0;
 
        xfs_ilock(ip, XFS_ILOCK_SHARED);
-       if (xfs_ipincount(ip)) {
-               error = _xfs_log_force_lsn(mp, ip->i_itemp->ili_last_lsn,
-                               XFS_LOG_SYNC, NULL);
-       }
+       if (xfs_ipincount(ip))
+               lsn = ip->i_itemp->ili_last_lsn;
        xfs_iunlock(ip, XFS_ILOCK_SHARED);
 
-       return error;
+       if (!lsn)
+               return 0;
+       return _xfs_log_force_lsn(mp, lsn, XFS_LOG_SYNC, NULL);
 }
 
 const struct export_operations xfs_export_operations = {

<Prev in Thread] Current Thread [Next in Thread>