diff options
author | Lachlan McIlroy <lachlan@sgi.com> | 2008-06-26 23:33:03 -0400 |
---|---|---|
committer | Niv Sardi <xaiki@debian.org> | 2008-07-28 02:59:11 -0400 |
commit | b877e3d37dda0154868a3c78f02f38a1ec14ce79 (patch) | |
tree | 0c654086bf0ed0be90bc2652eb7b67448ae568dc /fs/xfs | |
parent | 4ddd8bb1d25f9cbb345e1f64a56c0f641a787ede (diff) |
[XFS] Restore the lowspace extent allocator algorithm
When free space is running low the extent allocator may choose to allocate
an extent from an AG without leaving sufficient space for a btree split
when inserting the new extent (see where xfs_bmap_btalloc() sets minleft
to 0). In this case the allocator will enable the lowspace algorithm which
is supposed to allow further allocations (such as btree splits and
newroots) to allocate from sequential AGs. This algorithm has been broken
for a long time and this patch restores its behaviour.
SGI-PV: 983338
SGI-Modid: xfs-linux-melb:xfs-kern:31358a
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: David Chinner <dgc@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_bmap.h | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_btree.c | 8 |
2 files changed, 18 insertions, 3 deletions
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h index 6ff70cda451c..9f3e3a836d15 100644 --- a/fs/xfs/xfs_bmap.h +++ b/fs/xfs/xfs_bmap.h | |||
@@ -54,12 +54,23 @@ typedef struct xfs_bmap_free_item | |||
54 | 54 | ||
55 | /* | 55 | /* |
56 | * Header for free extent list. | 56 | * Header for free extent list. |
57 | * | ||
58 | * xbf_low is used by the allocator to activate the lowspace algorithm - | ||
59 | * when free space is running low the extent allocator may choose to | ||
60 | * allocate an extent from an AG without leaving sufficient space for | ||
61 | * a btree split when inserting the new extent. In this case the allocator | ||
62 | * will enable the lowspace algorithm which is supposed to allow further | ||
63 | * allocations (such as btree splits and newroots) to allocate from | ||
64 | * sequential AGs. In order to avoid locking AGs out of order the lowspace | ||
65 | * algorithm will start searching for free space from AG 0. If the correct | ||
66 | * transaction reservations have been made then this algorithm will eventually | ||
67 | * find all the space it needs. | ||
57 | */ | 68 | */ |
58 | typedef struct xfs_bmap_free | 69 | typedef struct xfs_bmap_free |
59 | { | 70 | { |
60 | xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extents */ | 71 | xfs_bmap_free_item_t *xbf_first; /* list of to-be-free extents */ |
61 | int xbf_count; /* count of items on list */ | 72 | int xbf_count; /* count of items on list */ |
62 | int xbf_low; /* kludge: alloc in low mode */ | 73 | int xbf_low; /* alloc in low mode */ |
63 | } xfs_bmap_free_t; | 74 | } xfs_bmap_free_t; |
64 | 75 | ||
65 | #define XFS_BMAP_MAX_NMAP 4 | 76 | #define XFS_BMAP_MAX_NMAP 4 |
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c index 3fc09cd8d517..1140cef4ba99 100644 --- a/fs/xfs/xfs_bmap_btree.c +++ b/fs/xfs/xfs_bmap_btree.c | |||
@@ -1509,7 +1509,9 @@ xfs_bmbt_split( | |||
1509 | * block allocation here and corrupt the filesystem. | 1509 | * block allocation here and corrupt the filesystem. |
1510 | */ | 1510 | */ |
1511 | args.minleft = xfs_trans_get_block_res(args.tp); | 1511 | args.minleft = xfs_trans_get_block_res(args.tp); |
1512 | } else | 1512 | } else if (cur->bc_private.b.flist->xbf_low) |
1513 | args.type = XFS_ALLOCTYPE_START_BNO; | ||
1514 | else | ||
1513 | args.type = XFS_ALLOCTYPE_NEAR_BNO; | 1515 | args.type = XFS_ALLOCTYPE_NEAR_BNO; |
1514 | args.mod = args.alignment = args.total = args.isfl = | 1516 | args.mod = args.alignment = args.total = args.isfl = |
1515 | args.userdata = args.minalignslop = 0; | 1517 | args.userdata = args.minalignslop = 0; |
@@ -2237,7 +2239,9 @@ xfs_bmbt_newroot( | |||
2237 | #endif | 2239 | #endif |
2238 | args.fsbno = be64_to_cpu(*pp); | 2240 | args.fsbno = be64_to_cpu(*pp); |
2239 | args.type = XFS_ALLOCTYPE_START_BNO; | 2241 | args.type = XFS_ALLOCTYPE_START_BNO; |
2240 | } else | 2242 | } else if (cur->bc_private.b.flist->xbf_low) |
2243 | args.type = XFS_ALLOCTYPE_START_BNO; | ||
2244 | else | ||
2241 | args.type = XFS_ALLOCTYPE_NEAR_BNO; | 2245 | args.type = XFS_ALLOCTYPE_NEAR_BNO; |
2242 | if ((error = xfs_alloc_vextent(&args))) { | 2246 | if ((error = xfs_alloc_vextent(&args))) { |
2243 | XFS_BMBT_TRACE_CURSOR(cur, ERROR); | 2247 | XFS_BMBT_TRACE_CURSOR(cur, ERROR); |