aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_alloc.c')
-rw-r--r--fs/xfs/xfs_alloc.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 43f791bcd8b1..335206a9c698 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -2208,7 +2208,7 @@ xfs_alloc_read_agf(
2208 * group or loop over the allocation groups to find the result. 2208 * group or loop over the allocation groups to find the result.
2209 */ 2209 */
2210int /* error */ 2210int /* error */
2211__xfs_alloc_vextent( 2211xfs_alloc_vextent(
2212 xfs_alloc_arg_t *args) /* allocation argument structure */ 2212 xfs_alloc_arg_t *args) /* allocation argument structure */
2213{ 2213{
2214 xfs_agblock_t agsize; /* allocation group size */ 2214 xfs_agblock_t agsize; /* allocation group size */
@@ -2418,46 +2418,6 @@ error0:
2418 return error; 2418 return error;
2419} 2419}
2420 2420
2421static void
2422xfs_alloc_vextent_worker(
2423 struct work_struct *work)
2424{
2425 struct xfs_alloc_arg *args = container_of(work,
2426 struct xfs_alloc_arg, work);
2427 unsigned long pflags;
2428
2429 /* we are in a transaction context here */
2430 current_set_flags_nested(&pflags, PF_FSTRANS);
2431
2432 args->result = __xfs_alloc_vextent(args);
2433 complete(args->done);
2434
2435 current_restore_flags_nested(&pflags, PF_FSTRANS);
2436}
2437
2438/*
2439 * Data allocation requests often come in with little stack to work on. Push
2440 * them off to a worker thread so there is lots of stack to use. Metadata
2441 * requests, OTOH, are generally from low stack usage paths, so avoid the
2442 * context switch overhead here.
2443 */
2444int
2445xfs_alloc_vextent(
2446 struct xfs_alloc_arg *args)
2447{
2448 DECLARE_COMPLETION_ONSTACK(done);
2449
2450 if (!args->stack_switch)
2451 return __xfs_alloc_vextent(args);
2452
2453
2454 args->done = &done;
2455 INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);
2456 queue_work(xfs_alloc_wq, &args->work);
2457 wait_for_completion(&done);
2458 return args->result;
2459}
2460
2461/* 2421/*
2462 * Free an extent. 2422 * Free an extent.
2463 * Just break up the extent address and hand off to xfs_free_ag_extent 2423 * Just break up the extent address and hand off to xfs_free_ag_extent