public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: optimize log flushing in xfs_fsync
@ 2010-02-05  9:57 Christoph Hellwig
  2010-02-11 23:10 ` Alex Elder
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2010-02-05  9:57 UTC (permalink / raw)
  To: xfs


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>

Index: xfs/fs/xfs/xfs_vnodeops.c
===================================================================
--- xfs.orig/fs/xfs/xfs_vnodeops.c	2010-02-04 17:38:33.679254119 +0100
+++ xfs/fs/xfs/xfs_vnodeops.c	2010-02-04 17:38:51.606006156 +0100
@@ -626,8 +626,14 @@ xfs_fsync(
 		 * force the log.
 		 */
 		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	{
 		/*

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: optimize log flushing in xfs_fsync
  2010-02-05  9:57 [PATCH] xfs: optimize log flushing in xfs_fsync Christoph Hellwig
@ 2010-02-11 23:10 ` Alex Elder
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Elder @ 2010-02-11 23:10 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Fri, 2010-02-05 at 04:57 -0500, Christoph Hellwig wrote:
> 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.

This looks good.  I was going to suggest:
    ASSERT(ip->i_itemp != NULL);
before it's dereferenced, but a pinned inode had better
have an item pointer...

Reviewed-by: Alex Elder <aelder@sgi.com>

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: xfs/fs/xfs/xfs_vnodeops.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_vnodeops.c	2010-02-04 17:38:33.679254119 +0100
> +++ xfs/fs/xfs/xfs_vnodeops.c	2010-02-04 17:38:51.606006156 +0100
> @@ -626,8 +626,14 @@ xfs_fsync(
>  		 * force the log.
>  		 */
>  		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	{
>  		/*
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs



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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-11 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-05  9:57 [PATCH] xfs: optimize log flushing in xfs_fsync Christoph Hellwig
2010-02-11 23:10 ` Alex Elder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox