diff options
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r-- | fs/xfs/xfs_buf.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 24b4ebea0d4d..bb502a391792 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -34,18 +34,16 @@ | |||
34 | #include <linux/backing-dev.h> | 34 | #include <linux/backing-dev.h> |
35 | #include <linux/freezer.h> | 35 | #include <linux/freezer.h> |
36 | 36 | ||
37 | #include "xfs_format.h" | ||
37 | #include "xfs_log_format.h" | 38 | #include "xfs_log_format.h" |
38 | #include "xfs_trans_resv.h" | 39 | #include "xfs_trans_resv.h" |
39 | #include "xfs_sb.h" | 40 | #include "xfs_sb.h" |
40 | #include "xfs_ag.h" | ||
41 | #include "xfs_mount.h" | 41 | #include "xfs_mount.h" |
42 | #include "xfs_trace.h" | 42 | #include "xfs_trace.h" |
43 | #include "xfs_log.h" | 43 | #include "xfs_log.h" |
44 | 44 | ||
45 | static kmem_zone_t *xfs_buf_zone; | 45 | static kmem_zone_t *xfs_buf_zone; |
46 | 46 | ||
47 | static struct workqueue_struct *xfslogd_workqueue; | ||
48 | |||
49 | #ifdef XFS_BUF_LOCK_TRACKING | 47 | #ifdef XFS_BUF_LOCK_TRACKING |
50 | # define XB_SET_OWNER(bp) ((bp)->b_last_holder = current->pid) | 48 | # define XB_SET_OWNER(bp) ((bp)->b_last_holder = current->pid) |
51 | # define XB_CLEAR_OWNER(bp) ((bp)->b_last_holder = -1) | 49 | # define XB_CLEAR_OWNER(bp) ((bp)->b_last_holder = -1) |
@@ -463,7 +461,7 @@ _xfs_buf_find( | |||
463 | * have to check that the buffer falls within the filesystem bounds. | 461 | * have to check that the buffer falls within the filesystem bounds. |
464 | */ | 462 | */ |
465 | eofs = XFS_FSB_TO_BB(btp->bt_mount, btp->bt_mount->m_sb.sb_dblocks); | 463 | eofs = XFS_FSB_TO_BB(btp->bt_mount, btp->bt_mount->m_sb.sb_dblocks); |
466 | if (blkno >= eofs) { | 464 | if (blkno < 0 || blkno >= eofs) { |
467 | /* | 465 | /* |
468 | * XXX (dgc): we should really be returning -EFSCORRUPTED here, | 466 | * XXX (dgc): we should really be returning -EFSCORRUPTED here, |
469 | * but none of the higher level infrastructure supports | 467 | * but none of the higher level infrastructure supports |
@@ -1043,7 +1041,7 @@ xfs_buf_ioend_work( | |||
1043 | struct work_struct *work) | 1041 | struct work_struct *work) |
1044 | { | 1042 | { |
1045 | struct xfs_buf *bp = | 1043 | struct xfs_buf *bp = |
1046 | container_of(work, xfs_buf_t, b_iodone_work); | 1044 | container_of(work, xfs_buf_t, b_ioend_work); |
1047 | 1045 | ||
1048 | xfs_buf_ioend(bp); | 1046 | xfs_buf_ioend(bp); |
1049 | } | 1047 | } |
@@ -1052,8 +1050,8 @@ void | |||
1052 | xfs_buf_ioend_async( | 1050 | xfs_buf_ioend_async( |
1053 | struct xfs_buf *bp) | 1051 | struct xfs_buf *bp) |
1054 | { | 1052 | { |
1055 | INIT_WORK(&bp->b_iodone_work, xfs_buf_ioend_work); | 1053 | INIT_WORK(&bp->b_ioend_work, xfs_buf_ioend_work); |
1056 | queue_work(xfslogd_workqueue, &bp->b_iodone_work); | 1054 | queue_work(bp->b_ioend_wq, &bp->b_ioend_work); |
1057 | } | 1055 | } |
1058 | 1056 | ||
1059 | void | 1057 | void |
@@ -1222,6 +1220,13 @@ _xfs_buf_ioapply( | |||
1222 | */ | 1220 | */ |
1223 | bp->b_error = 0; | 1221 | bp->b_error = 0; |
1224 | 1222 | ||
1223 | /* | ||
1224 | * Initialize the I/O completion workqueue if we haven't yet or the | ||
1225 | * submitter has not opted to specify a custom one. | ||
1226 | */ | ||
1227 | if (!bp->b_ioend_wq) | ||
1228 | bp->b_ioend_wq = bp->b_target->bt_mount->m_buf_workqueue; | ||
1229 | |||
1225 | if (bp->b_flags & XBF_WRITE) { | 1230 | if (bp->b_flags & XBF_WRITE) { |
1226 | if (bp->b_flags & XBF_SYNCIO) | 1231 | if (bp->b_flags & XBF_SYNCIO) |
1227 | rw = WRITE_SYNC; | 1232 | rw = WRITE_SYNC; |
@@ -1882,15 +1887,8 @@ xfs_buf_init(void) | |||
1882 | if (!xfs_buf_zone) | 1887 | if (!xfs_buf_zone) |
1883 | goto out; | 1888 | goto out; |
1884 | 1889 | ||
1885 | xfslogd_workqueue = alloc_workqueue("xfslogd", | ||
1886 | WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_FREEZABLE, 1); | ||
1887 | if (!xfslogd_workqueue) | ||
1888 | goto out_free_buf_zone; | ||
1889 | |||
1890 | return 0; | 1890 | return 0; |
1891 | 1891 | ||
1892 | out_free_buf_zone: | ||
1893 | kmem_zone_destroy(xfs_buf_zone); | ||
1894 | out: | 1892 | out: |
1895 | return -ENOMEM; | 1893 | return -ENOMEM; |
1896 | } | 1894 | } |
@@ -1898,6 +1896,5 @@ xfs_buf_init(void) | |||
1898 | void | 1896 | void |
1899 | xfs_buf_terminate(void) | 1897 | xfs_buf_terminate(void) |
1900 | { | 1898 | { |
1901 | destroy_workqueue(xfslogd_workqueue); | ||
1902 | kmem_zone_destroy(xfs_buf_zone); | 1899 | kmem_zone_destroy(xfs_buf_zone); |
1903 | } | 1900 | } |