diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_buf.c')
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 62 |
1 files changed, 19 insertions, 43 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 2ee3f7a6016..ea79072f521 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
| @@ -39,7 +39,6 @@ | |||
| 39 | #include "xfs_inum.h" | 39 | #include "xfs_inum.h" |
| 40 | #include "xfs_log.h" | 40 | #include "xfs_log.h" |
| 41 | #include "xfs_ag.h" | 41 | #include "xfs_ag.h" |
| 42 | #include "xfs_dmapi.h" | ||
| 43 | #include "xfs_mount.h" | 42 | #include "xfs_mount.h" |
| 44 | #include "xfs_trace.h" | 43 | #include "xfs_trace.h" |
| 45 | 44 | ||
| @@ -579,9 +578,9 @@ _xfs_buf_read( | |||
| 579 | XBF_READ_AHEAD | _XBF_RUN_QUEUES); | 578 | XBF_READ_AHEAD | _XBF_RUN_QUEUES); |
| 580 | 579 | ||
| 581 | status = xfs_buf_iorequest(bp); | 580 | status = xfs_buf_iorequest(bp); |
| 582 | if (!status && !(flags & XBF_ASYNC)) | 581 | if (status || XFS_BUF_ISERROR(bp) || (flags & XBF_ASYNC)) |
| 583 | status = xfs_buf_iowait(bp); | 582 | return status; |
| 584 | return status; | 583 | return xfs_buf_iowait(bp); |
| 585 | } | 584 | } |
| 586 | 585 | ||
| 587 | xfs_buf_t * | 586 | xfs_buf_t * |
| @@ -897,36 +896,6 @@ xfs_buf_unlock( | |||
| 897 | trace_xfs_buf_unlock(bp, _RET_IP_); | 896 | trace_xfs_buf_unlock(bp, _RET_IP_); |
| 898 | } | 897 | } |
| 899 | 898 | ||
| 900 | |||
| 901 | /* | ||
| 902 | * Pinning Buffer Storage in Memory | ||
| 903 | * Ensure that no attempt to force a buffer to disk will succeed. | ||
| 904 | */ | ||
| 905 | void | ||
| 906 | xfs_buf_pin( | ||
| 907 | xfs_buf_t *bp) | ||
| 908 | { | ||
| 909 | trace_xfs_buf_pin(bp, _RET_IP_); | ||
| 910 | atomic_inc(&bp->b_pin_count); | ||
| 911 | } | ||
| 912 | |||
| 913 | void | ||
| 914 | xfs_buf_unpin( | ||
| 915 | xfs_buf_t *bp) | ||
| 916 | { | ||
| 917 | trace_xfs_buf_unpin(bp, _RET_IP_); | ||
| 918 | |||
| 919 | if (atomic_dec_and_test(&bp->b_pin_count)) | ||
| 920 | wake_up_all(&bp->b_waiters); | ||
| 921 | } | ||
| 922 | |||
| 923 | int | ||
| 924 | xfs_buf_ispin( | ||
| 925 | xfs_buf_t *bp) | ||
| 926 | { | ||
| 927 | return atomic_read(&bp->b_pin_count); | ||
| 928 | } | ||
| 929 | |||
| 930 | STATIC void | 899 | STATIC void |
| 931 | xfs_buf_wait_unpin( | 900 | xfs_buf_wait_unpin( |
| 932 | xfs_buf_t *bp) | 901 | xfs_buf_t *bp) |
| @@ -1018,13 +987,12 @@ xfs_bwrite( | |||
| 1018 | { | 987 | { |
| 1019 | int error; | 988 | int error; |
| 1020 | 989 | ||
| 1021 | bp->b_strat = xfs_bdstrat_cb; | ||
| 1022 | bp->b_mount = mp; | 990 | bp->b_mount = mp; |
| 1023 | bp->b_flags |= XBF_WRITE; | 991 | bp->b_flags |= XBF_WRITE; |
| 1024 | bp->b_flags &= ~(XBF_ASYNC | XBF_READ); | 992 | bp->b_flags &= ~(XBF_ASYNC | XBF_READ); |
| 1025 | 993 | ||
| 1026 | xfs_buf_delwri_dequeue(bp); | 994 | xfs_buf_delwri_dequeue(bp); |
| 1027 | xfs_buf_iostrategy(bp); | 995 | xfs_bdstrat_cb(bp); |
| 1028 | 996 | ||
| 1029 | error = xfs_buf_iowait(bp); | 997 | error = xfs_buf_iowait(bp); |
| 1030 | if (error) | 998 | if (error) |
| @@ -1040,7 +1008,6 @@ xfs_bdwrite( | |||
| 1040 | { | 1008 | { |
| 1041 | trace_xfs_buf_bdwrite(bp, _RET_IP_); | 1009 | trace_xfs_buf_bdwrite(bp, _RET_IP_); |
| 1042 | 1010 | ||
| 1043 | bp->b_strat = xfs_bdstrat_cb; | ||
| 1044 | bp->b_mount = mp; | 1011 | bp->b_mount = mp; |
| 1045 | 1012 | ||
| 1046 | bp->b_flags &= ~XBF_READ; | 1013 | bp->b_flags &= ~XBF_READ; |
| @@ -1075,7 +1042,6 @@ xfs_bioerror( | |||
| 1075 | XFS_BUF_UNDONE(bp); | 1042 | XFS_BUF_UNDONE(bp); |
| 1076 | XFS_BUF_STALE(bp); | 1043 | XFS_BUF_STALE(bp); |
| 1077 | 1044 | ||
| 1078 | XFS_BUF_CLR_BDSTRAT_FUNC(bp); | ||
| 1079 | xfs_biodone(bp); | 1045 | xfs_biodone(bp); |
| 1080 | 1046 | ||
| 1081 | return EIO; | 1047 | return EIO; |
| @@ -1105,7 +1071,6 @@ xfs_bioerror_relse( | |||
| 1105 | XFS_BUF_DONE(bp); | 1071 | XFS_BUF_DONE(bp); |
| 1106 | XFS_BUF_STALE(bp); | 1072 | XFS_BUF_STALE(bp); |
| 1107 | XFS_BUF_CLR_IODONE_FUNC(bp); | 1073 | XFS_BUF_CLR_IODONE_FUNC(bp); |
| 1108 | XFS_BUF_CLR_BDSTRAT_FUNC(bp); | ||
| 1109 | if (!(fl & XBF_ASYNC)) { | 1074 | if (!(fl & XBF_ASYNC)) { |
| 1110 | /* | 1075 | /* |
| 1111 | * Mark b_error and B_ERROR _both_. | 1076 | * Mark b_error and B_ERROR _both_. |
| @@ -1311,8 +1276,19 @@ submit_io: | |||
| 1311 | if (size) | 1276 | if (size) |
| 1312 | goto next_chunk; | 1277 | goto next_chunk; |
| 1313 | } else { | 1278 | } else { |
| 1314 | bio_put(bio); | 1279 | /* |
| 1280 | * if we get here, no pages were added to the bio. However, | ||
| 1281 | * we can't just error out here - if the pages are locked then | ||
| 1282 | * we have to unlock them otherwise we can hang on a later | ||
| 1283 | * access to the page. | ||
| 1284 | */ | ||
| 1315 | xfs_buf_ioerror(bp, EIO); | 1285 | xfs_buf_ioerror(bp, EIO); |
| 1286 | if (bp->b_flags & _XBF_PAGE_LOCKED) { | ||
| 1287 | int i; | ||
| 1288 | for (i = 0; i < bp->b_page_count; i++) | ||
| 1289 | unlock_page(bp->b_pages[i]); | ||
| 1290 | } | ||
| 1291 | bio_put(bio); | ||
| 1316 | } | 1292 | } |
| 1317 | } | 1293 | } |
| 1318 | 1294 | ||
| @@ -1804,7 +1780,7 @@ xfs_buf_delwri_split( | |||
| 1804 | trace_xfs_buf_delwri_split(bp, _RET_IP_); | 1780 | trace_xfs_buf_delwri_split(bp, _RET_IP_); |
| 1805 | ASSERT(bp->b_flags & XBF_DELWRI); | 1781 | ASSERT(bp->b_flags & XBF_DELWRI); |
| 1806 | 1782 | ||
| 1807 | if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) { | 1783 | if (!XFS_BUF_ISPINNED(bp) && !xfs_buf_cond_lock(bp)) { |
| 1808 | if (!force && | 1784 | if (!force && |
| 1809 | time_before(jiffies, bp->b_queuetime + age)) { | 1785 | time_before(jiffies, bp->b_queuetime + age)) { |
| 1810 | xfs_buf_unlock(bp); | 1786 | xfs_buf_unlock(bp); |
| @@ -1889,7 +1865,7 @@ xfsbufd( | |||
| 1889 | struct xfs_buf *bp; | 1865 | struct xfs_buf *bp; |
| 1890 | bp = list_first_entry(&tmp, struct xfs_buf, b_list); | 1866 | bp = list_first_entry(&tmp, struct xfs_buf, b_list); |
| 1891 | list_del_init(&bp->b_list); | 1867 | list_del_init(&bp->b_list); |
| 1892 | xfs_buf_iostrategy(bp); | 1868 | xfs_bdstrat_cb(bp); |
| 1893 | count++; | 1869 | count++; |
| 1894 | } | 1870 | } |
| 1895 | if (count) | 1871 | if (count) |
| @@ -1936,7 +1912,7 @@ xfs_flush_buftarg( | |||
| 1936 | bp->b_flags &= ~XBF_ASYNC; | 1912 | bp->b_flags &= ~XBF_ASYNC; |
| 1937 | list_add(&bp->b_list, &wait_list); | 1913 | list_add(&bp->b_list, &wait_list); |
| 1938 | } | 1914 | } |
| 1939 | xfs_buf_iostrategy(bp); | 1915 | xfs_bdstrat_cb(bp); |
| 1940 | } | 1916 | } |
| 1941 | 1917 | ||
| 1942 | if (wait) { | 1918 | if (wait) { |
