public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] reduce log I/O latency V2
@ 2008-01-21  4:16 David Chinner
  2008-01-22  3:42 ` Lachlan McIlroy
  0 siblings, 1 reply; 4+ messages in thread
From: David Chinner @ 2008-01-21  4:16 UTC (permalink / raw)
  To: xfs-dev; +Cc: xfs-oss

Reduce log I/O latency

To ensure that log I/O is issued as the highest priority I/O, set
the I/O priority of the log I/O to the highest possible. This will
ensure that log I/O is not held up behind bulk data or other
metadata I/O as delaying log I/O can pause the entire transaction
subsystem. Introduce a new buffer flag to allow us to tag the log
buffers so we can discriminate when issuing the I/O.

Version 2:
- don't use realtime priority class

Signed-off-by: Dave Chinner <dgc@sgi.com>
---
 fs/xfs/linux-2.6/xfs_buf.c |    3 +++
 fs/xfs/linux-2.6/xfs_buf.h |    5 ++++-
 fs/xfs/xfs_log.c           |    2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.c	2007-12-19 01:39:42.286538135 +1100
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c	2007-12-19 11:56:47.977477993 +1100
@@ -1198,6 +1198,9 @@ next_chunk:
 
 submit_io:
 	if (likely(bio->bi_size)) {
+		/* log I/O should not be delayed by anything except realtime. */
+		if (bp->b_flags & XBF_LOG_BUFFER)
+			bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0));
 		submit_bio(rw, bio);
 		if (size)
 			goto next_chunk;
Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.h	2007-12-19 01:11:16.871181483 +1100
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h	2007-12-19 11:55:09.642183801 +1100
@@ -53,7 +53,8 @@ typedef enum {
 	XBF_DELWRI = (1 << 6),  /* buffer has dirty pages                  */
 	XBF_STALE = (1 << 7),	/* buffer has been staled, do not find it  */
 	XBF_FS_MANAGED = (1 << 8),  /* filesystem controls freeing memory  */
- 	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
+	XBF_LOG_BUFFER = (1 << 9),  /* Buffer issued by the log		   */
+	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
 	XBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead		   */
 
 	/* flags used only as arguments to access routines */
@@ -339,6 +340,8 @@ extern void xfs_buf_trace(xfs_buf_t *, c
 #define XFS_BUF_TARGET(bp)		((bp)->b_target)
 #define XFS_BUFTARG_NAME(target)	xfs_buf_target_name(target)
 
+#define XFS_BUF_SET_LOGBUF(bp)	((bp)->b_flags |= XBF_LOG_BUFFER)
+
 static inline int xfs_bawrite(void *mp, xfs_buf_t *bp)
 {
 	bp->b_fspriv3 = mp;
Index: 2.6.x-xfs-new/fs/xfs/xfs_log.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_log.c	2007-12-19 01:11:16.871181483 +1100
+++ 2.6.x-xfs-new/fs/xfs/xfs_log.c	2007-12-19 11:55:09.698176566 +1100
@@ -1443,6 +1443,8 @@ xlog_sync(xlog_t		*log,
 	XFS_BUF_ZEROFLAGS(bp);
 	XFS_BUF_BUSY(bp);
 	XFS_BUF_ASYNC(bp);
+	XFS_BUF_SET_LOGBUF(bp);
+
 	/*
 	 * Do an ordered write for the log block.
 	 * Its unnecessary to flush the first split block in the log wrap case.

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

* Re: [patch] reduce log I/O latency V2
  2008-01-21  4:16 [patch] reduce log I/O latency V2 David Chinner
@ 2008-01-22  3:42 ` Lachlan McIlroy
  2008-01-22  3:58   ` David Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Lachlan McIlroy @ 2008-01-22  3:42 UTC (permalink / raw)
  To: David Chinner; +Cc: xfs-dev, xfs-oss

Looks good Dave.  Shouldn't we also tag the second buffer in the
split log write case?

David Chinner wrote:
> Reduce log I/O latency
> 
> To ensure that log I/O is issued as the highest priority I/O, set
> the I/O priority of the log I/O to the highest possible. This will
> ensure that log I/O is not held up behind bulk data or other
> metadata I/O as delaying log I/O can pause the entire transaction
> subsystem. Introduce a new buffer flag to allow us to tag the log
> buffers so we can discriminate when issuing the I/O.
> 
> Version 2:
> - don't use realtime priority class
> 
> Signed-off-by: Dave Chinner <dgc@sgi.com>
> ---
>  fs/xfs/linux-2.6/xfs_buf.c |    3 +++
>  fs/xfs/linux-2.6/xfs_buf.h |    5 ++++-
>  fs/xfs/xfs_log.c           |    2 ++
>  3 files changed, 9 insertions(+), 1 deletion(-)
> 
> Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.c	2007-12-19 01:39:42.286538135 +1100
> +++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c	2007-12-19 11:56:47.977477993 +1100
> @@ -1198,6 +1198,9 @@ next_chunk:
>  
>  submit_io:
>  	if (likely(bio->bi_size)) {
> +		/* log I/O should not be delayed by anything except realtime. */
> +		if (bp->b_flags & XBF_LOG_BUFFER)
> +			bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0));
>  		submit_bio(rw, bio);
>  		if (size)
>  			goto next_chunk;
> Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.h	2007-12-19 01:11:16.871181483 +1100
> +++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h	2007-12-19 11:55:09.642183801 +1100
> @@ -53,7 +53,8 @@ typedef enum {
>  	XBF_DELWRI = (1 << 6),  /* buffer has dirty pages                  */
>  	XBF_STALE = (1 << 7),	/* buffer has been staled, do not find it  */
>  	XBF_FS_MANAGED = (1 << 8),  /* filesystem controls freeing memory  */
> - 	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
> +	XBF_LOG_BUFFER = (1 << 9),  /* Buffer issued by the log		   */
> +	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
>  	XBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead		   */
>  
>  	/* flags used only as arguments to access routines */
> @@ -339,6 +340,8 @@ extern void xfs_buf_trace(xfs_buf_t *, c
>  #define XFS_BUF_TARGET(bp)		((bp)->b_target)
>  #define XFS_BUFTARG_NAME(target)	xfs_buf_target_name(target)
>  
> +#define XFS_BUF_SET_LOGBUF(bp)	((bp)->b_flags |= XBF_LOG_BUFFER)
> +
>  static inline int xfs_bawrite(void *mp, xfs_buf_t *bp)
>  {
>  	bp->b_fspriv3 = mp;
> Index: 2.6.x-xfs-new/fs/xfs/xfs_log.c
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/xfs_log.c	2007-12-19 01:11:16.871181483 +1100
> +++ 2.6.x-xfs-new/fs/xfs/xfs_log.c	2007-12-19 11:55:09.698176566 +1100
> @@ -1443,6 +1443,8 @@ xlog_sync(xlog_t		*log,
>  	XFS_BUF_ZEROFLAGS(bp);
>  	XFS_BUF_BUSY(bp);
>  	XFS_BUF_ASYNC(bp);
> +	XFS_BUF_SET_LOGBUF(bp);
> +
>  	/*
>  	 * Do an ordered write for the log block.
>  	 * Its unnecessary to flush the first split block in the log wrap case.
> 

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

* Re: [patch] reduce log I/O latency V2
  2008-01-22  3:42 ` Lachlan McIlroy
@ 2008-01-22  3:58   ` David Chinner
  2008-01-22  5:07     ` Lachlan McIlroy
  0 siblings, 1 reply; 4+ messages in thread
From: David Chinner @ 2008-01-22  3:58 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: David Chinner, xfs-dev, xfs-oss

On Tue, Jan 22, 2008 at 02:42:13PM +1100, Lachlan McIlroy wrote:
> Looks good Dave.  Shouldn't we also tag the second buffer in the
> split log write case?

Hmm - I thought it was being tagged. looks like I missed a reject
on my last set of patch re-orderings - updated patch attached.

---

Reduce log I/O latency

To ensure that log I/O is issued as the highest priority I/O, set
the I/O priority of the log I/O to the highest possible. This will
ensure that log I/O is not held up behind bulk data or other
metadata I/O as delaying log I/O can pause the entire transaction
subsystem. Introduce a new buffer flag to allow us to tag the log
buffers so we can discriminate when issuing the I/O.

Signed-off-by: Dave Chinner <dgc@sgi.com>
---
 fs/xfs/linux-2.6/xfs_buf.c |    3 +++
 fs/xfs/linux-2.6/xfs_buf.h |    5 ++++-
 fs/xfs/xfs_log.c           |    3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.c	2008-01-18 19:13:07.499131222 +1100
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c	2008-01-22 14:56:58.738098626 +1100
@@ -1198,6 +1198,9 @@ next_chunk:
 
 submit_io:
 	if (likely(bio->bi_size)) {
+		/* log I/O should not be delayed by anything except realtime. */
+		if (bp->b_flags & XBF_LOG_BUFFER)
+			bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0));
 		submit_bio(rw, bio);
 		if (size)
 			goto next_chunk;
Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.h	2008-01-18 19:13:07.503130710 +1100
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h	2008-01-18 19:13:29.448320166 +1100
@@ -53,7 +53,8 @@ typedef enum {
 	XBF_DELWRI = (1 << 6),  /* buffer has dirty pages                  */
 	XBF_STALE = (1 << 7),	/* buffer has been staled, do not find it  */
 	XBF_FS_MANAGED = (1 << 8),  /* filesystem controls freeing memory  */
- 	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
+	XBF_LOG_BUFFER = (1 << 9),  /* Buffer issued by the log		   */
+	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
 	XBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead		   */
 
 	/* flags used only as arguments to access routines */
@@ -339,6 +340,8 @@ extern void xfs_buf_trace(xfs_buf_t *, c
 #define XFS_BUF_TARGET(bp)		((bp)->b_target)
 #define XFS_BUFTARG_NAME(target)	xfs_buf_target_name(target)
 
+#define XFS_BUF_SET_LOGBUF(bp)	((bp)->b_flags |= XBF_LOG_BUFFER)
+
 static inline int xfs_bawrite(void *mp, xfs_buf_t *bp)
 {
 	bp->b_fspriv3 = mp;
Index: 2.6.x-xfs-new/fs/xfs/xfs_log.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_log.c	2008-01-18 19:13:07.519128661 +1100
+++ 2.6.x-xfs-new/fs/xfs/xfs_log.c	2008-01-22 14:56:57.550673091 +1100
@@ -1462,6 +1462,8 @@ xlog_sync(xlog_t		*log,
 	XFS_BUF_ZEROFLAGS(bp);
 	XFS_BUF_BUSY(bp);
 	XFS_BUF_ASYNC(bp);
+	XFS_BUF_SET_LOGBUF(bp);
+
 	/*
 	 * Do an ordered write for the log block.
 	 * Its unnecessary to flush the first split block in the log wrap case.
@@ -1499,6 +1501,7 @@ xlog_sync(xlog_t		*log,
 		XFS_BUF_ZEROFLAGS(bp);
 		XFS_BUF_BUSY(bp);
 		XFS_BUF_ASYNC(bp);
+		XFS_BUF_SET_LOGBUF(bp);
 		if (log->l_mp->m_flags & XFS_MOUNT_BARRIER)
 			XFS_BUF_ORDERED(bp);
 		dptr = XFS_BUF_PTR(bp);

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

* Re: [patch] reduce log I/O latency V2
  2008-01-22  3:58   ` David Chinner
@ 2008-01-22  5:07     ` Lachlan McIlroy
  0 siblings, 0 replies; 4+ messages in thread
From: Lachlan McIlroy @ 2008-01-22  5:07 UTC (permalink / raw)
  To: David Chinner; +Cc: xfs-dev, xfs-oss

Yup, all good now.

David Chinner wrote:
> On Tue, Jan 22, 2008 at 02:42:13PM +1100, Lachlan McIlroy wrote:
>> Looks good Dave.  Shouldn't we also tag the second buffer in the
>> split log write case?
> 
> Hmm - I thought it was being tagged. looks like I missed a reject
> on my last set of patch re-orderings - updated patch attached.
> 
> ---
> 
> Reduce log I/O latency
> 
> To ensure that log I/O is issued as the highest priority I/O, set
> the I/O priority of the log I/O to the highest possible. This will
> ensure that log I/O is not held up behind bulk data or other
> metadata I/O as delaying log I/O can pause the entire transaction
> subsystem. Introduce a new buffer flag to allow us to tag the log
> buffers so we can discriminate when issuing the I/O.
> 
> Signed-off-by: Dave Chinner <dgc@sgi.com>
> ---
>  fs/xfs/linux-2.6/xfs_buf.c |    3 +++
>  fs/xfs/linux-2.6/xfs_buf.h |    5 ++++-
>  fs/xfs/xfs_log.c           |    3 +++
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.c	2008-01-18 19:13:07.499131222 +1100
> +++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c	2008-01-22 14:56:58.738098626 +1100
> @@ -1198,6 +1198,9 @@ next_chunk:
>  
>  submit_io:
>  	if (likely(bio->bi_size)) {
> +		/* log I/O should not be delayed by anything except realtime. */
> +		if (bp->b_flags & XBF_LOG_BUFFER)
> +			bio_set_prio(bio, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 0));
>  		submit_bio(rw, bio);
>  		if (size)
>  			goto next_chunk;
> Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_buf.h	2008-01-18 19:13:07.503130710 +1100
> +++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.h	2008-01-18 19:13:29.448320166 +1100
> @@ -53,7 +53,8 @@ typedef enum {
>  	XBF_DELWRI = (1 << 6),  /* buffer has dirty pages                  */
>  	XBF_STALE = (1 << 7),	/* buffer has been staled, do not find it  */
>  	XBF_FS_MANAGED = (1 << 8),  /* filesystem controls freeing memory  */
> - 	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
> +	XBF_LOG_BUFFER = (1 << 9),  /* Buffer issued by the log		   */
> +	XBF_ORDERED = (1 << 11),    /* use ordered writes		   */
>  	XBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead		   */
>  
>  	/* flags used only as arguments to access routines */
> @@ -339,6 +340,8 @@ extern void xfs_buf_trace(xfs_buf_t *, c
>  #define XFS_BUF_TARGET(bp)		((bp)->b_target)
>  #define XFS_BUFTARG_NAME(target)	xfs_buf_target_name(target)
>  
> +#define XFS_BUF_SET_LOGBUF(bp)	((bp)->b_flags |= XBF_LOG_BUFFER)
> +
>  static inline int xfs_bawrite(void *mp, xfs_buf_t *bp)
>  {
>  	bp->b_fspriv3 = mp;
> Index: 2.6.x-xfs-new/fs/xfs/xfs_log.c
> ===================================================================
> --- 2.6.x-xfs-new.orig/fs/xfs/xfs_log.c	2008-01-18 19:13:07.519128661 +1100
> +++ 2.6.x-xfs-new/fs/xfs/xfs_log.c	2008-01-22 14:56:57.550673091 +1100
> @@ -1462,6 +1462,8 @@ xlog_sync(xlog_t		*log,
>  	XFS_BUF_ZEROFLAGS(bp);
>  	XFS_BUF_BUSY(bp);
>  	XFS_BUF_ASYNC(bp);
> +	XFS_BUF_SET_LOGBUF(bp);
> +
>  	/*
>  	 * Do an ordered write for the log block.
>  	 * Its unnecessary to flush the first split block in the log wrap case.
> @@ -1499,6 +1501,7 @@ xlog_sync(xlog_t		*log,
>  		XFS_BUF_ZEROFLAGS(bp);
>  		XFS_BUF_BUSY(bp);
>  		XFS_BUF_ASYNC(bp);
> +		XFS_BUF_SET_LOGBUF(bp);
>  		if (log->l_mp->m_flags & XFS_MOUNT_BARRIER)
>  			XFS_BUF_ORDERED(bp);
>  		dptr = XFS_BUF_PTR(bp);
> 
> 
> 

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

end of thread, other threads:[~2008-01-22  5:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21  4:16 [patch] reduce log I/O latency V2 David Chinner
2008-01-22  3:42 ` Lachlan McIlroy
2008-01-22  3:58   ` David Chinner
2008-01-22  5:07     ` Lachlan McIlroy

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