aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-03-22 05:15:07 +0000
committerBen Myers <bpm@sgi.com>2012-03-22 16:12:24 -0500
commitc999a223c2f0d31c64ef7379814cea1378b2b800 (patch)
treeed699c3c98075bbfc4aed0ab22bd174e65e575a8 /fs/xfs/xfs_alloc.h
parentxfs: Fix open flag handling in open_by_handle code (diff)
downloadlinux-dev-c999a223c2f0d31c64ef7379814cea1378b2b800.tar.xz
linux-dev-c999a223c2f0d31c64ef7379814cea1378b2b800.zip
xfs: introduce an allocation workqueue
We currently have significant issues with the amount of stack that allocation in XFS uses, especially in the writeback path. We can easily consume 4k of stack between mapping the page, manipulating the bmap btree and allocating blocks from the free list. Not to mention btree block readahead and other functionality that issues IO in the allocation path. As a result, we can no longer fit allocation in the writeback path in the stack space provided on x86_64. To alleviate this problem, introduce an allocation workqueue and move all allocations to a seperate context. This can be easily added as an interposing layer into xfs_alloc_vextent(), which takes a single argument structure and does not return until the allocation is complete or has failed. To do this, add a work structure and a completion to the allocation args structure. This allows xfs_alloc_vextent to queue the args onto the workqueue and wait for it to be completed by the worker. This can be done completely transparently to the caller. The worker function needs to ensure that it sets and clears the PF_TRANS flag appropriately as it is being run in an active transaction context. Work can also be queued in a memory reclaim context, so a rescuer is needed for the workqueue. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_alloc.h')
-rw-r--r--fs/xfs/xfs_alloc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/xfs/xfs_alloc.h b/fs/xfs/xfs_alloc.h
index 2f52b924be79..ab5d0fd2f535 100644
--- a/fs/xfs/xfs_alloc.h
+++ b/fs/xfs/xfs_alloc.h
@@ -25,6 +25,8 @@ struct xfs_perag;
struct xfs_trans;
struct xfs_busy_extent;
+extern struct workqueue_struct *xfs_alloc_wq;
+
/*
* Freespace allocation types. Argument to xfs_alloc_[v]extent.
*/
@@ -119,6 +121,9 @@ typedef struct xfs_alloc_arg {
char isfl; /* set if is freelist blocks - !acctg */
char userdata; /* set if this is user data */
xfs_fsblock_t firstblock; /* io first block allocated */
+ struct completion *done;
+ struct work_struct work;
+ int result;
} xfs_alloc_arg_t;
/*