aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r--fs/xfs/xfs_bmap_util.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 703b3ec1796c..057f671811d6 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -258,23 +258,14 @@ xfs_bmapi_allocate_worker(
258 struct xfs_bmalloca *args = container_of(work, 258 struct xfs_bmalloca *args = container_of(work,
259 struct xfs_bmalloca, work); 259 struct xfs_bmalloca, work);
260 unsigned long pflags; 260 unsigned long pflags;
261 unsigned long new_pflags = PF_FSTRANS;
262 261
263 /* 262 /* we are in a transaction context here */
264 * we are in a transaction context here, but may also be doing work 263 current_set_flags_nested(&pflags, PF_FSTRANS);
265 * in kswapd context, and hence we may need to inherit that state
266 * temporarily to ensure that we don't block waiting for memory reclaim
267 * in any way.
268 */
269 if (args->kswapd)
270 new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
271
272 current_set_flags_nested(&pflags, new_pflags);
273 264
274 args->result = __xfs_bmapi_allocate(args); 265 args->result = __xfs_bmapi_allocate(args);
275 complete(args->done); 266 complete(args->done);
276 267
277 current_restore_flags_nested(&pflags, new_pflags); 268 current_restore_flags_nested(&pflags, PF_FSTRANS);
278} 269}
279 270
280/* 271/*
@@ -293,7 +284,6 @@ xfs_bmapi_allocate(
293 284
294 285
295 args->done = &done; 286 args->done = &done;
296 args->kswapd = current_is_kswapd();
297 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); 287 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
298 queue_work(xfs_alloc_wq, &args->work); 288 queue_work(xfs_alloc_wq, &args->work);
299 wait_for_completion(&done); 289 wait_for_completion(&done);