]> Pileus Git - ~andy/linux/commitdiff
xfs: optimize log flushing in xfs_fsync
authorChristoph Hellwig <hch@infradead.org>
Fri, 5 Feb 2010 09:57:55 +0000 (09:57 +0000)
committerAlex Elder <aelder@sgi.com>
Fri, 12 Feb 2010 19:45:14 +0000 (13:45 -0600)
If we have a pinned inode it must have a log item attached to it.
Usually that log item will have ili_last_lsn already set, in which
case we only need to flush the log up to that LSN instead of doing a
full log force.  This gives speedups of about 5% in some fsync heavy
workloads.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
fs/xfs/xfs_vnodeops.c

index 43241e2898006ce5ee3ab2a83e2da9f7f4385305..ddd2c5d1b854b73eacb8803bee64a75b9aff7f72 100644 (file)
@@ -629,8 +629,14 @@ xfs_fsync(
                 */
                xfs_iunlock(ip, XFS_ILOCK_SHARED);
                if (xfs_ipincount(ip)) {
-                       error = _xfs_log_force(ip->i_mount, XFS_LOG_SYNC,
-                                              &log_flushed);
+                       if (ip->i_itemp->ili_last_lsn) {
+                               error = _xfs_log_force_lsn(ip->i_mount,
+                                               ip->i_itemp->ili_last_lsn,
+                                               XFS_LOG_SYNC, &log_flushed);
+                       } else {
+                               error = _xfs_log_force(ip->i_mount,
+                                               XFS_LOG_SYNC, &log_flushed);
+                       }
                }
        } else  {
                /*