diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-04-23 01:58:56 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-05-14 17:20:52 -0400 |
commit | aa5c158ec97bd4014f47a2bc0150fb6b20e6c48b (patch) | |
tree | 8c79791167a5d659949952ad11a08ce325eb025c /fs/xfs/xfs_trans_buf.c | |
parent | 7ca790a507a9288ebedab90a8e40b9afa8e4e949 (diff) |
xfs: kill XBF_DONTBLOCK
Just about all callers of xfs_buf_read() and xfs_buf_get() use XBF_DONTBLOCK.
This is used to make memory allocation use GFP_NOFS rather than GFP_KERNEL to
avoid recursion through memory reclaim back into the filesystem.
All the blocking get calls in growfs occur inside a transaction, even though
they are no part of the transaction, so all allocation will be GFP_NOFS due to
the task flag PF_TRANS being set. The blocking read calls occur during log
recovery, so they will probably be unaffected by converting to GFP_NOFS
allocations.
Hence make XBF_DONTBLOCK behaviour always occur for buffers and kill the flag.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans_buf.c')
-rw-r--r-- | fs/xfs/xfs_trans_buf.c | 25 |
1 files changed, 4 insertions, 21 deletions
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) ? |