diff options
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 35 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 40 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 9 |
3 files changed, 39 insertions, 45 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 6ad5ae249bfb..a0d97c5a3f15 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -592,10 +592,8 @@ _xfs_buf_read( | |||
592 | ASSERT(!(flags & (XBF_DELWRI|XBF_WRITE))); | 592 | ASSERT(!(flags & (XBF_DELWRI|XBF_WRITE))); |
593 | ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL); | 593 | ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL); |
594 | 594 | ||
595 | bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_DELWRI | \ | 595 | bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_DELWRI | XBF_READ_AHEAD); |
596 | XBF_READ_AHEAD | _XBF_RUN_QUEUES); | 596 | bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); |
597 | bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | \ | ||
598 | XBF_READ_AHEAD | _XBF_RUN_QUEUES); | ||
599 | 597 | ||
600 | status = xfs_buf_iorequest(bp); | 598 | status = xfs_buf_iorequest(bp); |
601 | if (status || XFS_BUF_ISERROR(bp) || (flags & XBF_ASYNC)) | 599 | if (status || XFS_BUF_ISERROR(bp) || (flags & XBF_ASYNC)) |
@@ -1211,23 +1209,21 @@ _xfs_buf_ioapply( | |||
1211 | total_nr_pages = bp->b_page_count; | 1209 | total_nr_pages = bp->b_page_count; |
1212 | map_i = 0; | 1210 | map_i = 0; |
1213 | 1211 | ||
1214 | if (bp->b_flags & XBF_ORDERED) { | 1212 | if (bp->b_flags & XBF_WRITE) { |
1215 | ASSERT(!(bp->b_flags & XBF_READ)); | 1213 | if (bp->b_flags & XBF_SYNCIO) |
1216 | rw = WRITE_FLUSH_FUA; | 1214 | rw = WRITE_SYNC; |
1217 | } else if (bp->b_flags & XBF_LOG_BUFFER) { | 1215 | else |
1218 | ASSERT(!(bp->b_flags & XBF_READ_AHEAD)); | 1216 | rw = WRITE; |
1219 | bp->b_flags &= ~_XBF_RUN_QUEUES; | 1217 | if (bp->b_flags & XBF_FUA) |
1220 | rw = (bp->b_flags & XBF_WRITE) ? WRITE_SYNC : READ_SYNC; | 1218 | rw |= REQ_FUA; |
1221 | } else if (bp->b_flags & _XBF_RUN_QUEUES) { | 1219 | if (bp->b_flags & XBF_FLUSH) |
1222 | ASSERT(!(bp->b_flags & XBF_READ_AHEAD)); | 1220 | rw |= REQ_FLUSH; |
1223 | bp->b_flags &= ~_XBF_RUN_QUEUES; | 1221 | } else if (bp->b_flags & XBF_READ_AHEAD) { |
1224 | rw = (bp->b_flags & XBF_WRITE) ? WRITE_META : READ_META; | 1222 | rw = READA; |
1225 | } else { | 1223 | } else { |
1226 | rw = (bp->b_flags & XBF_WRITE) ? WRITE : | 1224 | rw = READ; |
1227 | (bp->b_flags & XBF_READ_AHEAD) ? READA : READ; | ||
1228 | } | 1225 | } |
1229 | 1226 | ||
1230 | |||
1231 | next_chunk: | 1227 | next_chunk: |
1232 | atomic_inc(&bp->b_io_remaining); | 1228 | atomic_inc(&bp->b_io_remaining); |
1233 | nr_pages = BIO_MAX_SECTORS >> (PAGE_SHIFT - BBSHIFT); | 1229 | nr_pages = BIO_MAX_SECTORS >> (PAGE_SHIFT - BBSHIFT); |
@@ -1689,8 +1685,7 @@ xfs_buf_delwri_split( | |||
1689 | break; | 1685 | break; |
1690 | } | 1686 | } |
1691 | 1687 | ||
1692 | bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q| | 1688 | bp->b_flags &= ~(XBF_DELWRI | _XBF_DELWRI_Q); |
1693 | _XBF_RUN_QUEUES); | ||
1694 | bp->b_flags |= XBF_WRITE; | 1689 | bp->b_flags |= XBF_WRITE; |
1695 | list_move_tail(&bp->b_list, list); | 1690 | list_move_tail(&bp->b_list, list); |
1696 | trace_xfs_buf_delwri_split(bp, _RET_IP_); | 1691 | trace_xfs_buf_delwri_split(bp, _RET_IP_); |
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 706c40069116..21604a17e2a3 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -46,43 +46,46 @@ typedef enum { | |||
46 | 46 | ||
47 | #define XBF_READ (1 << 0) /* buffer intended for reading from device */ | 47 | #define XBF_READ (1 << 0) /* buffer intended for reading from device */ |
48 | #define XBF_WRITE (1 << 1) /* buffer intended for writing to device */ | 48 | #define XBF_WRITE (1 << 1) /* buffer intended for writing to device */ |
49 | #define XBF_MAPPED (1 << 2) /* buffer mapped (b_addr valid) */ | 49 | #define XBF_READ_AHEAD (1 << 2) /* asynchronous read-ahead */ |
50 | #define XBF_MAPPED (1 << 3) /* buffer mapped (b_addr valid) */ | ||
50 | #define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */ | 51 | #define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */ |
51 | #define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */ | 52 | #define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */ |
52 | #define XBF_DELWRI (1 << 6) /* buffer has dirty pages */ | 53 | #define XBF_DELWRI (1 << 6) /* buffer has dirty pages */ |
53 | #define XBF_STALE (1 << 7) /* buffer has been staled, do not find it */ | 54 | #define XBF_STALE (1 << 7) /* buffer has been staled, do not find it */ |
54 | #define XBF_ORDERED (1 << 11)/* use ordered writes */ | 55 | |
55 | #define XBF_READ_AHEAD (1 << 12)/* asynchronous read-ahead */ | 56 | /* I/O hints for the BIO layer */ |
56 | #define XBF_LOG_BUFFER (1 << 13)/* this is a buffer used for the log */ | 57 | #define XBF_SYNCIO (1 << 10)/* treat this buffer as synchronous I/O */ |
58 | #define XBF_FUA (1 << 11)/* force cache write through mode */ | ||
59 | #define XBF_FLUSH (1 << 12)/* flush the disk cache before a write */ | ||
57 | 60 | ||
58 | /* flags used only as arguments to access routines */ | 61 | /* flags used only as arguments to access routines */ |
59 | #define XBF_LOCK (1 << 14)/* lock requested */ | 62 | #define XBF_LOCK (1 << 15)/* lock requested */ |
60 | #define XBF_TRYLOCK (1 << 15)/* lock requested, but do not wait */ | 63 | #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ |
61 | #define XBF_DONT_BLOCK (1 << 16)/* do not block in current thread */ | 64 | #define XBF_DONT_BLOCK (1 << 17)/* do not block in current thread */ |
62 | 65 | ||
63 | /* flags used only internally */ | 66 | /* flags used only internally */ |
64 | #define _XBF_PAGES (1 << 18)/* backed by refcounted pages */ | 67 | #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */ |
65 | #define _XBF_RUN_QUEUES (1 << 19)/* run block device task queue */ | 68 | #define _XBF_KMEM (1 << 21)/* backed by heap memory */ |
66 | #define _XBF_KMEM (1 << 20)/* backed by heap memory */ | 69 | #define _XBF_DELWRI_Q (1 << 22)/* buffer on delwri queue */ |
67 | #define _XBF_DELWRI_Q (1 << 21)/* buffer on delwri queue */ | ||
68 | 70 | ||
69 | typedef unsigned int xfs_buf_flags_t; | 71 | typedef unsigned int xfs_buf_flags_t; |
70 | 72 | ||
71 | #define XFS_BUF_FLAGS \ | 73 | #define XFS_BUF_FLAGS \ |
72 | { XBF_READ, "READ" }, \ | 74 | { XBF_READ, "READ" }, \ |
73 | { XBF_WRITE, "WRITE" }, \ | 75 | { XBF_WRITE, "WRITE" }, \ |
76 | { XBF_READ_AHEAD, "READ_AHEAD" }, \ | ||
74 | { XBF_MAPPED, "MAPPED" }, \ | 77 | { XBF_MAPPED, "MAPPED" }, \ |
75 | { XBF_ASYNC, "ASYNC" }, \ | 78 | { XBF_ASYNC, "ASYNC" }, \ |
76 | { XBF_DONE, "DONE" }, \ | 79 | { XBF_DONE, "DONE" }, \ |
77 | { XBF_DELWRI, "DELWRI" }, \ | 80 | { XBF_DELWRI, "DELWRI" }, \ |
78 | { XBF_STALE, "STALE" }, \ | 81 | { XBF_STALE, "STALE" }, \ |
79 | { XBF_ORDERED, "ORDERED" }, \ | 82 | { XBF_SYNCIO, "SYNCIO" }, \ |
80 | { XBF_READ_AHEAD, "READ_AHEAD" }, \ | 83 | { XBF_FUA, "FUA" }, \ |
84 | { XBF_FLUSH, "FLUSH" }, \ | ||
81 | { XBF_LOCK, "LOCK" }, /* should never be set */\ | 85 | { XBF_LOCK, "LOCK" }, /* should never be set */\ |
82 | { XBF_TRYLOCK, "TRYLOCK" }, /* ditto */\ | 86 | { XBF_TRYLOCK, "TRYLOCK" }, /* ditto */\ |
83 | { XBF_DONT_BLOCK, "DONT_BLOCK" }, /* ditto */\ | 87 | { XBF_DONT_BLOCK, "DONT_BLOCK" }, /* ditto */\ |
84 | { _XBF_PAGES, "PAGES" }, \ | 88 | { _XBF_PAGES, "PAGES" }, \ |
85 | { _XBF_RUN_QUEUES, "RUN_QUEUES" }, \ | ||
86 | { _XBF_KMEM, "KMEM" }, \ | 89 | { _XBF_KMEM, "KMEM" }, \ |
87 | { _XBF_DELWRI_Q, "DELWRI_Q" } | 90 | { _XBF_DELWRI_Q, "DELWRI_Q" } |
88 | 91 | ||
@@ -230,8 +233,9 @@ extern void xfs_buf_terminate(void); | |||
230 | 233 | ||
231 | 234 | ||
232 | #define XFS_BUF_BFLAGS(bp) ((bp)->b_flags) | 235 | #define XFS_BUF_BFLAGS(bp) ((bp)->b_flags) |
233 | #define XFS_BUF_ZEROFLAGS(bp) ((bp)->b_flags &= \ | 236 | #define XFS_BUF_ZEROFLAGS(bp) \ |
234 | ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI|XBF_ORDERED)) | 237 | ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC|XBF_DELWRI| \ |
238 | XBF_SYNCIO|XBF_FUA|XBF_FLUSH)) | ||
235 | 239 | ||
236 | void xfs_buf_stale(struct xfs_buf *bp); | 240 | void xfs_buf_stale(struct xfs_buf *bp); |
237 | #define XFS_BUF_STALE(bp) xfs_buf_stale(bp); | 241 | #define XFS_BUF_STALE(bp) xfs_buf_stale(bp); |
@@ -263,10 +267,6 @@ void xfs_buf_stale(struct xfs_buf *bp); | |||
263 | #define XFS_BUF_UNASYNC(bp) ((bp)->b_flags &= ~XBF_ASYNC) | 267 | #define XFS_BUF_UNASYNC(bp) ((bp)->b_flags &= ~XBF_ASYNC) |
264 | #define XFS_BUF_ISASYNC(bp) ((bp)->b_flags & XBF_ASYNC) | 268 | #define XFS_BUF_ISASYNC(bp) ((bp)->b_flags & XBF_ASYNC) |
265 | 269 | ||
266 | #define XFS_BUF_ORDERED(bp) ((bp)->b_flags |= XBF_ORDERED) | ||
267 | #define XFS_BUF_UNORDERED(bp) ((bp)->b_flags &= ~XBF_ORDERED) | ||
268 | #define XFS_BUF_ISORDERED(bp) ((bp)->b_flags & XBF_ORDERED) | ||
269 | |||
270 | #define XFS_BUF_HOLD(bp) xfs_buf_hold(bp) | 270 | #define XFS_BUF_HOLD(bp) xfs_buf_hold(bp) |
271 | #define XFS_BUF_READ(bp) ((bp)->b_flags |= XBF_READ) | 271 | #define XFS_BUF_READ(bp) ((bp)->b_flags |= XBF_READ) |
272 | #define XFS_BUF_UNREAD(bp) ((bp)->b_flags &= ~XBF_READ) | 272 | #define XFS_BUF_UNREAD(bp) ((bp)->b_flags &= ~XBF_READ) |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 44c269b387c7..4c2d30e3b78d 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -1268,7 +1268,6 @@ xlog_bdstrat( | |||
1268 | return 0; | 1268 | return 0; |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | bp->b_flags |= _XBF_RUN_QUEUES; | ||
1272 | xfs_buf_iorequest(bp); | 1271 | xfs_buf_iorequest(bp); |
1273 | return 0; | 1272 | return 0; |
1274 | } | 1273 | } |
@@ -1369,7 +1368,7 @@ xlog_sync(xlog_t *log, | |||
1369 | XFS_BUF_ZEROFLAGS(bp); | 1368 | XFS_BUF_ZEROFLAGS(bp); |
1370 | XFS_BUF_BUSY(bp); | 1369 | XFS_BUF_BUSY(bp); |
1371 | XFS_BUF_ASYNC(bp); | 1370 | XFS_BUF_ASYNC(bp); |
1372 | bp->b_flags |= XBF_LOG_BUFFER; | 1371 | bp->b_flags |= XBF_SYNCIO; |
1373 | 1372 | ||
1374 | if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) { | 1373 | if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) { |
1375 | /* | 1374 | /* |
@@ -1380,7 +1379,7 @@ xlog_sync(xlog_t *log, | |||
1380 | */ | 1379 | */ |
1381 | if (log->l_mp->m_logdev_targp != log->l_mp->m_ddev_targp) | 1380 | if (log->l_mp->m_logdev_targp != log->l_mp->m_ddev_targp) |
1382 | xfs_blkdev_issue_flush(log->l_mp->m_ddev_targp); | 1381 | xfs_blkdev_issue_flush(log->l_mp->m_ddev_targp); |
1383 | XFS_BUF_ORDERED(bp); | 1382 | bp->b_flags |= XBF_FUA | XBF_FLUSH; |
1384 | } | 1383 | } |
1385 | 1384 | ||
1386 | ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1); | 1385 | ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1); |
@@ -1413,9 +1412,9 @@ xlog_sync(xlog_t *log, | |||
1413 | XFS_BUF_ZEROFLAGS(bp); | 1412 | XFS_BUF_ZEROFLAGS(bp); |
1414 | XFS_BUF_BUSY(bp); | 1413 | XFS_BUF_BUSY(bp); |
1415 | XFS_BUF_ASYNC(bp); | 1414 | XFS_BUF_ASYNC(bp); |
1416 | bp->b_flags |= XBF_LOG_BUFFER; | 1415 | bp->b_flags |= XBF_SYNCIO; |
1417 | if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) | 1416 | if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) |
1418 | XFS_BUF_ORDERED(bp); | 1417 | bp->b_flags |= XBF_FUA | XBF_FLUSH; |
1419 | dptr = XFS_BUF_PTR(bp); | 1418 | dptr = XFS_BUF_PTR(bp); |
1420 | /* | 1419 | /* |
1421 | * Bump the cycle numbers at the start of each block | 1420 | * Bump the cycle numbers at the start of each block |