diff options
-rw-r--r-- | fs/xfs/xfs_attr.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_buf.c | 25 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 4 |
5 files changed, 14 insertions, 38 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index ad85bed99de8..0960bb69e720 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -2114,8 +2114,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2114 | dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), | 2114 | dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), |
2115 | blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); | 2115 | blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); |
2116 | 2116 | ||
2117 | bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, | 2117 | bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, 0); |
2118 | XBF_DONT_BLOCK); | ||
2119 | if (!bp) | 2118 | if (!bp) |
2120 | return ENOMEM; | 2119 | return ENOMEM; |
2121 | 2120 | ||
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 8366348aa1f9..59e39160d379 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -56,11 +56,7 @@ static struct workqueue_struct *xfslogd_workqueue; | |||
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #define xb_to_gfp(flags) \ | 58 | #define xb_to_gfp(flags) \ |
59 | ((((flags) & XBF_READ_AHEAD) ? __GFP_NORETRY : \ | 59 | ((((flags) & XBF_READ_AHEAD) ? __GFP_NORETRY : GFP_NOFS) | __GFP_NOWARN) |
60 | ((flags) & XBF_DONT_BLOCK) ? GFP_NOFS : GFP_KERNEL) | __GFP_NOWARN) | ||
61 | |||
62 | #define xb_to_km(flags) \ | ||
63 | (((flags) & XBF_DONT_BLOCK) ? KM_NOFS : KM_SLEEP) | ||
64 | 60 | ||
65 | 61 | ||
66 | static inline int | 62 | static inline int |
@@ -178,14 +174,14 @@ xfs_buf_alloc( | |||
178 | { | 174 | { |
179 | struct xfs_buf *bp; | 175 | struct xfs_buf *bp; |
180 | 176 | ||
181 | bp = kmem_zone_zalloc(xfs_buf_zone, xb_to_km(flags)); | 177 | bp = kmem_zone_zalloc(xfs_buf_zone, KM_NOFS); |
182 | if (unlikely(!bp)) | 178 | if (unlikely(!bp)) |
183 | return NULL; | 179 | return NULL; |
184 | 180 | ||
185 | /* | 181 | /* |
186 | * We don't want certain flags to appear in b_flags. | 182 | * We don't want certain flags to appear in b_flags. |
187 | */ | 183 | */ |
188 | flags &= ~(XBF_MAPPED|XBF_DONT_BLOCK|XBF_READ_AHEAD); | 184 | flags &= ~(XBF_MAPPED|XBF_READ_AHEAD); |
189 | 185 | ||
190 | atomic_set(&bp->b_hold, 1); | 186 | atomic_set(&bp->b_hold, 1); |
191 | atomic_set(&bp->b_lru_ref, 1); | 187 | atomic_set(&bp->b_lru_ref, 1); |
@@ -239,7 +235,7 @@ _xfs_buf_get_pages( | |||
239 | bp->b_pages = bp->b_page_array; | 235 | bp->b_pages = bp->b_page_array; |
240 | } else { | 236 | } else { |
241 | bp->b_pages = kmem_alloc(sizeof(struct page *) * | 237 | bp->b_pages = kmem_alloc(sizeof(struct page *) * |
242 | page_count, xb_to_km(flags)); | 238 | page_count, KM_NOFS); |
243 | if (bp->b_pages == NULL) | 239 | if (bp->b_pages == NULL) |
244 | return -ENOMEM; | 240 | return -ENOMEM; |
245 | } | 241 | } |
@@ -316,7 +312,7 @@ xfs_buf_allocate_memory( | |||
316 | */ | 312 | */ |
317 | size = BBTOB(bp->b_length); | 313 | size = BBTOB(bp->b_length); |
318 | if (size < PAGE_SIZE) { | 314 | if (size < PAGE_SIZE) { |
319 | bp->b_addr = kmem_alloc(size, xb_to_km(flags)); | 315 | bp->b_addr = kmem_alloc(size, KM_NOFS); |
320 | if (!bp->b_addr) { | 316 | if (!bp->b_addr) { |
321 | /* low memory - use alloc_page loop instead */ | 317 | /* low memory - use alloc_page loop instead */ |
322 | goto use_alloc_page; | 318 | goto use_alloc_page; |
@@ -659,7 +655,7 @@ xfs_buf_readahead( | |||
659 | return; | 655 | return; |
660 | 656 | ||
661 | xfs_buf_read(target, blkno, numblks, | 657 | xfs_buf_read(target, blkno, numblks, |
662 | XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD|XBF_DONT_BLOCK); | 658 | XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD); |
663 | } | 659 | } |
664 | 660 | ||
665 | /* | 661 | /* |
@@ -750,7 +746,7 @@ xfs_buf_associate_memory( | |||
750 | bp->b_pages = NULL; | 746 | bp->b_pages = NULL; |
751 | bp->b_addr = mem; | 747 | bp->b_addr = mem; |
752 | 748 | ||
753 | rval = _xfs_buf_get_pages(bp, page_count, XBF_DONT_BLOCK); | 749 | rval = _xfs_buf_get_pages(bp, page_count, 0); |
754 | if (rval) | 750 | if (rval) |
755 | return rval; | 751 | return rval; |
756 | 752 | ||
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index 512d9a6776a5..846dee3d8dac 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h | |||
@@ -53,7 +53,6 @@ typedef enum { | |||
53 | 53 | ||
54 | /* flags used only as arguments to access routines */ | 54 | /* flags used only as arguments to access routines */ |
55 | #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ | 55 | #define XBF_TRYLOCK (1 << 16)/* lock requested, but do not wait */ |
56 | #define XBF_DONT_BLOCK (1 << 17)/* do not block in current thread */ | ||
57 | 56 | ||
58 | /* flags used only internally */ | 57 | /* flags used only internally */ |
59 | #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */ | 58 | #define _XBF_PAGES (1 << 20)/* backed by refcounted pages */ |
@@ -74,7 +73,6 @@ typedef unsigned int xfs_buf_flags_t; | |||
74 | { XBF_FUA, "FUA" }, \ | 73 | { XBF_FUA, "FUA" }, \ |
75 | { XBF_FLUSH, "FLUSH" }, \ | 74 | { XBF_FLUSH, "FLUSH" }, \ |
76 | { XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\ | 75 | { XBF_TRYLOCK, "TRYLOCK" }, /* should never be set */\ |
77 | { XBF_DONT_BLOCK, "DONT_BLOCK" }, /* ditto */\ | ||
78 | { _XBF_PAGES, "PAGES" }, \ | 76 | { _XBF_PAGES, "PAGES" }, \ |
79 | { _XBF_KMEM, "KMEM" }, \ | 77 | { _XBF_KMEM, "KMEM" }, \ |
80 | { _XBF_DELWRI_Q, "DELWRI_Q" } | 78 | { _XBF_DELWRI_Q, "DELWRI_Q" } |
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 5e4cf617e56c..ccc6da1de98d 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c | |||
@@ -148,8 +148,7 @@ xfs_trans_get_buf(xfs_trans_t *tp, | |||
148 | * Default to a normal get_buf() call if the tp is NULL. | 148 | * Default to a normal get_buf() call if the tp is NULL. |
149 | */ | 149 | */ |
150 | if (tp == NULL) | 150 | if (tp == NULL) |
151 | return xfs_buf_get(target_dev, blkno, len, | 151 | return xfs_buf_get(target_dev, blkno, len, flags); |
152 | flags | XBF_DONT_BLOCK); | ||
153 | 152 | ||
154 | /* | 153 | /* |
155 | * If we find the buffer in the cache with this transaction | 154 | * If we find the buffer in the cache with this transaction |
@@ -174,15 +173,7 @@ xfs_trans_get_buf(xfs_trans_t *tp, | |||
174 | return (bp); | 173 | return (bp); |
175 | } | 174 | } |
176 | 175 | ||
177 | /* | 176 | bp = xfs_buf_get(target_dev, blkno, len, flags); |
178 | * We always specify the XBF_DONT_BLOCK flag within a transaction | ||
179 | * so that get_buf does not try to push out a delayed write buffer | ||
180 | * which might cause another transaction to take place (if the | ||
181 | * buffer was delayed alloc). Such recursive transactions can | ||
182 | * easily deadlock with our current transaction as well as cause | ||
183 | * us to run out of stack space. | ||
184 | */ | ||
185 | bp = xfs_buf_get(target_dev, blkno, len, flags | XBF_DONT_BLOCK); | ||
186 | if (bp == NULL) { | 177 | if (bp == NULL) { |
187 | return NULL; | 178 | return NULL; |
188 | } | 179 | } |
@@ -283,7 +274,7 @@ xfs_trans_read_buf( | |||
283 | * Default to a normal get_buf() call if the tp is NULL. | 274 | * Default to a normal get_buf() call if the tp is NULL. |
284 | */ | 275 | */ |
285 | if (tp == NULL) { | 276 | if (tp == NULL) { |
286 | bp = xfs_buf_read(target, blkno, len, flags | XBF_DONT_BLOCK); | 277 | bp = xfs_buf_read(target, blkno, len, flags); |
287 | if (!bp) | 278 | if (!bp) |
288 | return (flags & XBF_TRYLOCK) ? | 279 | return (flags & XBF_TRYLOCK) ? |
289 | EAGAIN : XFS_ERROR(ENOMEM); | 280 | EAGAIN : XFS_ERROR(ENOMEM); |
@@ -367,15 +358,7 @@ xfs_trans_read_buf( | |||
367 | return 0; | 358 | return 0; |
368 | } | 359 | } |
369 | 360 | ||
370 | /* | 361 | bp = xfs_buf_read(target, blkno, len, flags); |
371 | * We always specify the XBF_DONT_BLOCK flag within a transaction | ||
372 | * so that get_buf does not try to push out a delayed write buffer | ||
373 | * which might cause another transaction to take place (if the | ||
374 | * buffer was delayed alloc). Such recursive transactions can | ||
375 | * easily deadlock with our current transaction as well as cause | ||
376 | * us to run out of stack space. | ||
377 | */ | ||
378 | bp = xfs_buf_read(target, blkno, len, flags | XBF_DONT_BLOCK); | ||
379 | if (bp == NULL) { | 362 | if (bp == NULL) { |
380 | *bpp = NULL; | 363 | *bpp = NULL; |
381 | return (flags & XBF_TRYLOCK) ? | 364 | return (flags & XBF_TRYLOCK) ? |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 8f99c7781f39..6c187450f1c8 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -82,7 +82,7 @@ xfs_readlink_bmap( | |||
82 | byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); | 82 | byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); |
83 | 83 | ||
84 | bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), | 84 | bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), |
85 | XBF_MAPPED | XBF_DONT_BLOCK); | 85 | XBF_MAPPED); |
86 | if (!bp) | 86 | if (!bp) |
87 | return XFS_ERROR(ENOMEM); | 87 | return XFS_ERROR(ENOMEM); |
88 | error = bp->b_error; | 88 | error = bp->b_error; |
@@ -1966,7 +1966,7 @@ xfs_zero_remaining_bytes( | |||
1966 | 1966 | ||
1967 | bp = xfs_buf_get_uncached(XFS_IS_REALTIME_INODE(ip) ? | 1967 | bp = xfs_buf_get_uncached(XFS_IS_REALTIME_INODE(ip) ? |
1968 | mp->m_rtdev_targp : mp->m_ddev_targp, | 1968 | mp->m_rtdev_targp : mp->m_ddev_targp, |
1969 | BTOBB(mp->m_sb.sb_blocksize), XBF_DONT_BLOCK); | 1969 | BTOBB(mp->m_sb.sb_blocksize), 0); |
1970 | if (!bp) | 1970 | if (!bp) |
1971 | return XFS_ERROR(ENOMEM); | 1971 | return XFS_ERROR(ENOMEM); |
1972 | 1972 | ||