aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c24
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h22
2 files changed, 13 insertions, 33 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 43128395d63b..489b7f63fd1f 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -458,14 +458,7 @@ _pagebuf_lookup_pages(
458 unlock_page(bp->pb_pages[i]); 458 unlock_page(bp->pb_pages[i]);
459 } 459 }
460 460
461 if (page_count) { 461 bp->pb_flags &= ~PBF_NONE;
462 /* if we have any uptodate pages, mark that in the buffer */
463 bp->pb_flags &= ~PBF_NONE;
464
465 /* if some pages aren't uptodate, mark that in the buffer */
466 if (page_count != bp->pb_page_count)
467 bp->pb_flags |= PBF_PARTIAL;
468 }
469 462
470 PB_TRACE(bp, "lookup_pages", (long)page_count); 463 PB_TRACE(bp, "lookup_pages", (long)page_count);
471 return error; 464 return error;
@@ -676,7 +669,7 @@ xfs_buf_read_flags(
676 669
677 pb = xfs_buf_get_flags(target, ioff, isize, flags); 670 pb = xfs_buf_get_flags(target, ioff, isize, flags);
678 if (pb) { 671 if (pb) {
679 if (PBF_NOT_DONE(pb)) { 672 if (!XFS_BUF_ISDONE(pb)) {
680 PB_TRACE(pb, "read", (unsigned long)flags); 673 PB_TRACE(pb, "read", (unsigned long)flags);
681 XFS_STATS_INC(pb_get_read); 674 XFS_STATS_INC(pb_get_read);
682 pagebuf_iostart(pb, flags); 675 pagebuf_iostart(pb, flags);
@@ -813,7 +806,7 @@ pagebuf_get_no_daddr(
813 bp = pagebuf_allocate(0); 806 bp = pagebuf_allocate(0);
814 if (unlikely(bp == NULL)) 807 if (unlikely(bp == NULL))
815 goto fail; 808 goto fail;
816 _pagebuf_initialize(bp, target, 0, len, PBF_FORCEIO); 809 _pagebuf_initialize(bp, target, 0, len, 0);
817 810
818 try_again: 811 try_again:
819 data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL); 812 data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL);
@@ -1121,21 +1114,18 @@ pagebuf_iodone_work(
1121void 1114void
1122pagebuf_iodone( 1115pagebuf_iodone(
1123 xfs_buf_t *pb, 1116 xfs_buf_t *pb,
1124 int dataio,
1125 int schedule) 1117 int schedule)
1126{ 1118{
1127 pb->pb_flags &= ~(PBF_READ | PBF_WRITE); 1119 pb->pb_flags &= ~(PBF_READ | PBF_WRITE);
1128 if (pb->pb_error == 0) { 1120 if (pb->pb_error == 0)
1129 pb->pb_flags &= ~(PBF_PARTIAL | PBF_NONE); 1121 pb->pb_flags &= ~PBF_NONE;
1130 }
1131 1122
1132 PB_TRACE(pb, "iodone", pb->pb_iodone); 1123 PB_TRACE(pb, "iodone", pb->pb_iodone);
1133 1124
1134 if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) { 1125 if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) {
1135 if (schedule) { 1126 if (schedule) {
1136 INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb); 1127 INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb);
1137 queue_work(dataio ? xfsdatad_workqueue : 1128 queue_work(xfslogd_workqueue, &pb->pb_iodone_work);
1138 xfslogd_workqueue, &pb->pb_iodone_work);
1139 } else { 1129 } else {
1140 pagebuf_iodone_work(pb); 1130 pagebuf_iodone_work(pb);
1141 } 1131 }
@@ -1235,7 +1225,7 @@ _pagebuf_iodone(
1235{ 1225{
1236 if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) { 1226 if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
1237 pb->pb_locked = 0; 1227 pb->pb_locked = 0;
1238 pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), schedule); 1228 pagebuf_iodone(pb, schedule);
1239 } 1229 }
1240} 1230}
1241 1231
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 67c19f799232..39c8ca122534 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -69,14 +69,11 @@ typedef enum page_buf_flags_e { /* pb_flags values */
69 PBF_READ = (1 << 0), /* buffer intended for reading from device */ 69 PBF_READ = (1 << 0), /* buffer intended for reading from device */
70 PBF_WRITE = (1 << 1), /* buffer intended for writing to device */ 70 PBF_WRITE = (1 << 1), /* buffer intended for writing to device */
71 PBF_MAPPED = (1 << 2), /* buffer mapped (pb_addr valid) */ 71 PBF_MAPPED = (1 << 2), /* buffer mapped (pb_addr valid) */
72 PBF_PARTIAL = (1 << 3), /* buffer partially read */
73 PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */ 72 PBF_ASYNC = (1 << 4), /* initiator will not wait for completion */
74 PBF_NONE = (1 << 5), /* buffer not read at all */ 73 PBF_NONE = (1 << 5), /* buffer not read at all */
75 PBF_DELWRI = (1 << 6), /* buffer has dirty pages */ 74 PBF_DELWRI = (1 << 6), /* buffer has dirty pages */
76 PBF_STALE = (1 << 7), /* buffer has been staled, do not find it */ 75 PBF_STALE = (1 << 7), /* buffer has been staled, do not find it */
77 PBF_FS_MANAGED = (1 << 8), /* filesystem controls freeing memory */ 76 PBF_FS_MANAGED = (1 << 8), /* filesystem controls freeing memory */
78 PBF_FS_DATAIOD = (1 << 9), /* schedule IO completion on fs datad */
79 PBF_FORCEIO = (1 << 10), /* ignore any cache state */
80 PBF_FLUSH = (1 << 11), /* flush disk write cache */ 77 PBF_FLUSH = (1 << 11), /* flush disk write cache */
81 PBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead */ 78 PBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead */
82 79
@@ -92,9 +89,6 @@ typedef enum page_buf_flags_e { /* pb_flags values */
92 _PBF_DELWRI_Q = (1 << 21), /* buffer on delwri queue */ 89 _PBF_DELWRI_Q = (1 << 21), /* buffer on delwri queue */
93} page_buf_flags_t; 90} page_buf_flags_t;
94 91
95#define PBF_UPDATE (PBF_READ | PBF_WRITE)
96#define PBF_NOT_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) != 0)
97#define PBF_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) == 0)
98 92
99typedef struct xfs_bufhash { 93typedef struct xfs_bufhash {
100 struct list_head bh_list; 94 struct list_head bh_list;
@@ -258,7 +252,6 @@ extern void pagebuf_unlock( /* unlock buffer */
258 252
259extern void pagebuf_iodone( /* mark buffer I/O complete */ 253extern void pagebuf_iodone( /* mark buffer I/O complete */
260 xfs_buf_t *, /* buffer to mark */ 254 xfs_buf_t *, /* buffer to mark */
261 int, /* use data/log helper thread. */
262 int); /* run completion locally, or in 255 int); /* run completion locally, or in
263 * a helper thread. */ 256 * a helper thread. */
264 257
@@ -378,12 +371,12 @@ extern void pagebuf_trace(
378#define XFS_BUF_GETERROR(x) pagebuf_geterror(x) 371#define XFS_BUF_GETERROR(x) pagebuf_geterror(x)
379#define XFS_BUF_ISERROR(x) (pagebuf_geterror(x)?1:0) 372#define XFS_BUF_ISERROR(x) (pagebuf_geterror(x)?1:0)
380 373
381#define XFS_BUF_DONE(x) ((x)->pb_flags &= ~(PBF_PARTIAL|PBF_NONE)) 374#define XFS_BUF_DONE(x) ((x)->pb_flags &= ~PBF_NONE)
382#define XFS_BUF_UNDONE(x) ((x)->pb_flags |= PBF_PARTIAL|PBF_NONE) 375#define XFS_BUF_UNDONE(x) ((x)->pb_flags |= PBF_NONE)
383#define XFS_BUF_ISDONE(x) (!(PBF_NOT_DONE(x))) 376#define XFS_BUF_ISDONE(x) (((x)->pb_flags & PBF_NONE) == 0)
384 377
385#define XFS_BUF_BUSY(x) ((x)->pb_flags |= PBF_FORCEIO) 378#define XFS_BUF_BUSY(x) do { } while (0)
386#define XFS_BUF_UNBUSY(x) ((x)->pb_flags &= ~PBF_FORCEIO) 379#define XFS_BUF_UNBUSY(x) do { } while (0)
387#define XFS_BUF_ISBUSY(x) (1) 380#define XFS_BUF_ISBUSY(x) (1)
388 381
389#define XFS_BUF_ASYNC(x) ((x)->pb_flags |= PBF_ASYNC) 382#define XFS_BUF_ASYNC(x) ((x)->pb_flags |= PBF_ASYNC)
@@ -412,9 +405,6 @@ extern void pagebuf_trace(
412 405
413#define XFS_BUF_BP_ISMAPPED(bp) 1 406#define XFS_BUF_BP_ISMAPPED(bp) 1
414 407
415#define XFS_BUF_DATAIO(x) ((x)->pb_flags |= PBF_FS_DATAIOD)
416#define XFS_BUF_UNDATAIO(x) ((x)->pb_flags &= ~PBF_FS_DATAIOD)
417
418#define XFS_BUF_IODONE_FUNC(buf) (buf)->pb_iodone 408#define XFS_BUF_IODONE_FUNC(buf) (buf)->pb_iodone
419#define XFS_BUF_SET_IODONE_FUNC(buf, func) \ 409#define XFS_BUF_SET_IODONE_FUNC(buf, func) \
420 (buf)->pb_iodone = (func) 410 (buf)->pb_iodone = (func)
@@ -510,7 +500,7 @@ static inline void xfs_buf_relse(xfs_buf_t *bp)
510 pagebuf_trace(bp, id, NULL, (void *)__builtin_return_address(0)) 500 pagebuf_trace(bp, id, NULL, (void *)__builtin_return_address(0))
511 501
512#define xfs_biodone(pb) \ 502#define xfs_biodone(pb) \
513 pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), 0) 503 pagebuf_iodone(pb, 0)
514 504
515#define xfs_biomove(pb, off, len, data, rw) \ 505#define xfs_biomove(pb, off, len, data, rw) \
516 pagebuf_iomove((pb), (off), (len), (data), \ 506 pagebuf_iomove((pb), (off), (len), (data), \