diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 18:23:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 18:23:52 -0400 |
commit | f21ce8f8447c8be8847dadcfdbcc76b0d7365fa5 (patch) | |
tree | fb51d60060453aef9e776c7d3a31588609d34d76 /fs/xfs/xfs_alloc.c | |
parent | 0c9aac08261512d70d7d4817bd222abca8b6bdd6 (diff) | |
parent | 5a5881cdeec2c019b5c9a307800218ee029f7f61 (diff) |
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
Pull XFS update (part 2) from Ben Myers:
"Fixes for tracing of xfs_name strings, flag handling in
open_by_handle, a log space hang with freeze/unfreeze, fstrim offset
calculations, a section mismatch with xfs_qm_exit, an oops in
xlog_recover_process_iunlinks, and a deadlock in xfs_rtfree_extent.
There are also additional trace points for attributes, and the
addition of a workqueue for allocation to work around kernel stack
size limitations."
* 'for-linus' of git://oss.sgi.com/xfs/xfs:
xfs: add lots of attribute trace points
xfs: Fix oops on IO error during xlog_recover_process_iunlinks()
xfs: fix fstrim offset calculations
xfs: Account log unmount transaction correctly
xfs: don't cache inodes read through bulkstat
xfs: trace xfs_name strings correctly
xfs: introduce an allocation workqueue
xfs: Fix open flag handling in open_by_handle code
xfs: fix deadlock in xfs_rtfree_extent
fs: xfs: fix section mismatch in linux-next
Diffstat (limited to 'fs/xfs/xfs_alloc.c')
-rw-r--r-- | fs/xfs/xfs_alloc.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index ce84ffd0264c..0f0df2759b09 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "xfs_error.h" | 35 | #include "xfs_error.h" |
36 | #include "xfs_trace.h" | 36 | #include "xfs_trace.h" |
37 | 37 | ||
38 | struct workqueue_struct *xfs_alloc_wq; | ||
38 | 39 | ||
39 | #define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b))) | 40 | #define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b))) |
40 | 41 | ||
@@ -68,7 +69,7 @@ xfs_alloc_lookup_eq( | |||
68 | * Lookup the first record greater than or equal to [bno, len] | 69 | * Lookup the first record greater than or equal to [bno, len] |
69 | * in the btree given by cur. | 70 | * in the btree given by cur. |
70 | */ | 71 | */ |
71 | STATIC int /* error */ | 72 | int /* error */ |
72 | xfs_alloc_lookup_ge( | 73 | xfs_alloc_lookup_ge( |
73 | struct xfs_btree_cur *cur, /* btree cursor */ | 74 | struct xfs_btree_cur *cur, /* btree cursor */ |
74 | xfs_agblock_t bno, /* starting block of extent */ | 75 | xfs_agblock_t bno, /* starting block of extent */ |
@@ -2207,7 +2208,7 @@ xfs_alloc_read_agf( | |||
2207 | * group or loop over the allocation groups to find the result. | 2208 | * group or loop over the allocation groups to find the result. |
2208 | */ | 2209 | */ |
2209 | int /* error */ | 2210 | int /* error */ |
2210 | xfs_alloc_vextent( | 2211 | __xfs_alloc_vextent( |
2211 | xfs_alloc_arg_t *args) /* allocation argument structure */ | 2212 | xfs_alloc_arg_t *args) /* allocation argument structure */ |
2212 | { | 2213 | { |
2213 | xfs_agblock_t agsize; /* allocation group size */ | 2214 | xfs_agblock_t agsize; /* allocation group size */ |
@@ -2417,6 +2418,37 @@ error0: | |||
2417 | return error; | 2418 | return error; |
2418 | } | 2419 | } |
2419 | 2420 | ||
2421 | static void | ||
2422 | xfs_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 | int /* error */ | ||
2440 | xfs_alloc_vextent( | ||
2441 | xfs_alloc_arg_t *args) /* allocation argument structure */ | ||
2442 | { | ||
2443 | DECLARE_COMPLETION_ONSTACK(done); | ||
2444 | |||
2445 | args->done = &done; | ||
2446 | INIT_WORK(&args->work, xfs_alloc_vextent_worker); | ||
2447 | queue_work(xfs_alloc_wq, &args->work); | ||
2448 | wait_for_completion(&done); | ||
2449 | return args->result; | ||
2450 | } | ||
2451 | |||
2420 | /* | 2452 | /* |
2421 | * Free an extent. | 2453 | * Free an extent. |
2422 | * Just break up the extent address and hand off to xfs_free_ag_extent | 2454 | * Just break up the extent address and hand off to xfs_free_ag_extent |