Use BIO_META tags for metadata rather than BIO_SYNC
Subsystems (2)
PATCH 1/1 Use BIO_META tags for metadata rather than BIO_SYNC
Improve metadata I/O merging in the elevator
Change all async metadata buffers to use [READ|WRITE]_META I/O types so that the I/O doesn't get issued immediately. This allows merging of adjacent metadata requests but still prioritises them over bulk data. This shows a 10-15% improvement in sequential create speed of small files.
Don't include the log buffers in this classification - leave them as sync types so they are issued immediately.
--- fs/xfs/linux-2.6/xfs_buf.c | 6 +++++- include/linux/fs.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
fs/xfs/linux-2.6/xfs_buf.c +5 -1
@@ -1136,10 +1136,14 @@ _xfs_buf_ioapply(if (bp->b_flags &XBF_ORDERED ) {ASSERT (!(bp->b_flags &XBF_READ )); rw =WRITE_BARRIER ; - }else if (bp->b_flags & _XBF_RUN_QUEUES) { + }else if (bp->b_flags &XBF_LOG_BUFFER ) {ASSERT (!(bp->b_flags &XBF_READ_AHEAD )); bp->b_flags &= ~_XBF_RUN_QUEUES; rw = (bp->b_flags &XBF_WRITE ) ?WRITE_SYNC :READ_SYNC ; + }else if (bp->b_flags & _XBF_RUN_QUEUES) { +ASSERT (!(bp->b_flags &XBF_READ_AHEAD )); + bp->b_flags &= ~_XBF_RUN_QUEUES; + rw = (bp->b_flags &XBF_WRITE ) ?WRITE_META :READ_META ; }else { rw = (bp->b_flags &XBF_WRITE ) ?WRITE : (bp->b_flags &XBF_READ_AHEAD ) ?READA :READ ;
include/linux/fs.h +1 -0
@@ -83,6 +83,7 @@ extern int dir_notify_enable;#define READ_SYNC (READ | (1 << BIO_RW_SYNC))#define READ_META (READ | (1 << BIO_RW_META))#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) +#define WRITE_META (WRITE | (1 << BIO_RW_META))#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))#define SEL_IN 1
Looks good.
Quoted 52 lines · David Chinner
Improve metadata I/O merging in the elevator
Change all async metadata buffers to use [READ|WRITE]_META I/O types so that the I/O doesn't get issued immediately. This allows merging of adjacent metadata requests but still prioritises them over bulk data. This shows a 10-15% improvement in sequential create speed of small files.
Don't include the log buffers in this classification - leave them as sync types so they are issued immediately.
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/linux-2.6/xfs_buf.c | 6 +++++- include/linux/fs.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)Index:
2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c
===================================================================fs/xfs/linux-2.6/xfs_buf.c +5
-1@@ -1136,10 +1136,14 @@ _xfs_buf_ioapply(if (bp->b_flags &XBF_ORDERED ) {ASSERT (!(bp->b_flags &XBF_READ )); rw =WRITE_BARRIER ; - }else if (bp->b_flags & _XBF_RUN_QUEUES) { + }else if (bp->b_flags &XBF_LOG_BUFFER ) {ASSERT (!(bp->b_flags &XBF_READ_AHEAD )); bp->b_flags &= ~_XBF_RUN_QUEUES; rw = (bp->b_flags &XBF_WRITE ) ?WRITE_SYNC :READ_SYNC ; + }else if (bp->b_flags & _XBF_RUN_QUEUES) { +ASSERT (!(bp->b_flags &XBF_READ_AHEAD )); + bp->b_flags &= ~_XBF_RUN_QUEUES; + rw = (bp->b_flags &XBF_WRITE ) ?WRITE_META :READ_META ; }else { rw = (bp->b_flags &XBF_WRITE ) ?WRITE : (bp->b_flags &XBF_READ_AHEAD ) ?READA :READ ;Index:
2.6.x-xfs-new/include/linux/fs.h
===================================================================include/linux/fs.h +1
-0@@ -83,6 +83,7 @@ extern int dir_notify_enable;#define READ_SYNC (READ | (1 << BIO_RW_SYNC))#define READ_META (READ | (1 << BIO_RW_META))#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) +#define WRITE_META (WRITE | (1 << BIO_RW_META))#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))#define SEL_IN 1
Quoted 7 lines · David Chinner
Improve metadata I/O merging in the elevator
Change all async metadata buffers to use [READ|WRITE]_META I/O types so that the I/O doesn't get issued immediately. This allows merging of adjacent metadata requests but still prioritises them over bulk data. This shows a 10-15% improvement in sequential create speed of small files.
That sounds awesome. I'll test it on a similar workload I've been playing with. Lachlan reviewed this, I think - any plans to add it?
I'll run my test & post results.
Thanks,
-Eric
Quoted 43 lines
Don't include the log buffers in this classification - leave them as sync types so they are issued immediately.
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/linux-2.6/xfs_buf.c | 6 +++++- include/linux/fs.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)Index:
2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_buf.c
===================================================================fs/xfs/linux-2.6/xfs_buf.c +5
-1@@ -1136,10 +1136,14 @@ _xfs_buf_ioapply(if (bp->b_flags &XBF_ORDERED ) {ASSERT (!(bp->b_flags &XBF_READ )); rw =WRITE_BARRIER ; - }else if (bp->b_flags & _XBF_RUN_QUEUES) { + }else if (bp->b_flags &XBF_LOG_BUFFER ) {ASSERT (!(bp->b_flags &XBF_READ_AHEAD )); bp->b_flags &= ~_XBF_RUN_QUEUES; rw = (bp->b_flags &XBF_WRITE ) ?WRITE_SYNC :READ_SYNC ; + }else if (bp->b_flags & _XBF_RUN_QUEUES) { +ASSERT (!(bp->b_flags &XBF_READ_AHEAD )); + bp->b_flags &= ~_XBF_RUN_QUEUES; + rw = (bp->b_flags &XBF_WRITE ) ?WRITE_META :READ_META ; }else { rw = (bp->b_flags &XBF_WRITE ) ?WRITE : (bp->b_flags &XBF_READ_AHEAD ) ?READA :READ ;Index:
2.6.x-xfs-new/include/linux/fs.h
===================================================================include/linux/fs.h +1
-0@@ -83,6 +83,7 @@ extern int dir_notify_enable;#define READ_SYNC (READ | (1 << BIO_RW_SYNC))#define READ_META (READ | (1 << BIO_RW_META))#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) +#define WRITE_META (WRITE | (1 << BIO_RW_META))#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))#define SEL_IN 1