aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_bmap_util.c16
-rw-r--r--fs/xfs/xfs_bmap_util.h13
2 files changed, 9 insertions, 20 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);
diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h
index 075f72232a64..935ed2b24edf 100644
--- a/fs/xfs/xfs_bmap_util.h
+++ b/fs/xfs/xfs_bmap_util.h
@@ -50,13 +50,12 @@ struct xfs_bmalloca {
50 xfs_extlen_t total; /* total blocks needed for xaction */ 50 xfs_extlen_t total; /* total blocks needed for xaction */
51 xfs_extlen_t minlen; /* minimum allocation size (blocks) */ 51 xfs_extlen_t minlen; /* minimum allocation size (blocks) */
52 xfs_extlen_t minleft; /* amount must be left after alloc */ 52 xfs_extlen_t minleft; /* amount must be left after alloc */
53 bool eof; /* set if allocating past last extent */ 53 char eof; /* set if allocating past last extent */
54 bool wasdel; /* replacing a delayed allocation */ 54 char wasdel; /* replacing a delayed allocation */
55 bool userdata;/* set if is user data */ 55 char userdata;/* set if is user data */
56 bool aeof; /* allocated space at eof */ 56 char aeof; /* allocated space at eof */
57 bool conv; /* overwriting unwritten extents */ 57 char conv; /* overwriting unwritten extents */
58 bool stack_switch; 58 char stack_switch;
59 bool kswapd; /* allocation in kswapd context */
60 int flags; 59 int flags;
61 struct completion *done; 60 struct completion *done;
62 struct work_struct work; 61 struct work_struct work;