diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-03-04 07:59:54 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2011-03-09 09:23:33 -0500 |
commit | 86fa8af69d8e90b7b40b8dab84d168527143ae20 (patch) | |
tree | ed2b3b20570556a296c4be015d0e78a1fb527d66 /fs | |
parent | 9130090b5f04f7e7bc29b944e0b1ba494fff3f98 (diff) |
xfs: clean up the xfs_alloc_compute_aligned calling convention
Pass a xfs_alloc_arg structure to xfs_alloc_compute_aligned and derive
the alignment and minlen paramters from it. This cleans up the existing
callers, and we'll need even more information from the xfs_alloc_arg
in subsequent patches. Based on a patch from Dave Chinner.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_alloc.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index f3227984a9bf..b5af10713dca 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -147,10 +147,9 @@ xfs_alloc_get_rec( | |||
147 | */ | 147 | */ |
148 | STATIC void | 148 | STATIC void |
149 | xfs_alloc_compute_aligned( | 149 | xfs_alloc_compute_aligned( |
150 | xfs_alloc_arg_t *args, /* allocation argument structure */ | ||
150 | xfs_agblock_t foundbno, /* starting block in found extent */ | 151 | xfs_agblock_t foundbno, /* starting block in found extent */ |
151 | xfs_extlen_t foundlen, /* length in found extent */ | 152 | xfs_extlen_t foundlen, /* length in found extent */ |
152 | xfs_extlen_t alignment, /* alignment for allocation */ | ||
153 | xfs_extlen_t minlen, /* minimum length for allocation */ | ||
154 | xfs_agblock_t *resbno, /* result block number */ | 153 | xfs_agblock_t *resbno, /* result block number */ |
155 | xfs_extlen_t *reslen) /* result length */ | 154 | xfs_extlen_t *reslen) /* result length */ |
156 | { | 155 | { |
@@ -158,8 +157,8 @@ xfs_alloc_compute_aligned( | |||
158 | xfs_extlen_t diff; | 157 | xfs_extlen_t diff; |
159 | xfs_extlen_t len; | 158 | xfs_extlen_t len; |
160 | 159 | ||
161 | if (alignment > 1 && foundlen >= minlen) { | 160 | if (args->alignment > 1 && foundlen >= args->minlen) { |
162 | bno = roundup(foundbno, alignment); | 161 | bno = roundup(foundbno, args->alignment); |
163 | diff = bno - foundbno; | 162 | diff = bno - foundbno; |
164 | len = diff >= foundlen ? 0 : foundlen - diff; | 163 | len = diff >= foundlen ? 0 : foundlen - diff; |
165 | } else { | 164 | } else { |
@@ -693,8 +692,7 @@ xfs_alloc_find_best_extent( | |||
693 | if (error) | 692 | if (error) |
694 | goto error0; | 693 | goto error0; |
695 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); | 694 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); |
696 | xfs_alloc_compute_aligned(*sbno, *slen, args->alignment, | 695 | xfs_alloc_compute_aligned(args, *sbno, *slen, &bno, slena); |
697 | args->minlen, &bno, slena); | ||
698 | 696 | ||
699 | /* | 697 | /* |
700 | * The good extent is closer than this one. | 698 | * The good extent is closer than this one. |
@@ -866,8 +864,8 @@ xfs_alloc_ag_vextent_near( | |||
866 | if ((error = xfs_alloc_get_rec(cnt_cur, <bno, <len, &i))) | 864 | if ((error = xfs_alloc_get_rec(cnt_cur, <bno, <len, &i))) |
867 | goto error0; | 865 | goto error0; |
868 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); | 866 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); |
869 | xfs_alloc_compute_aligned(ltbno, ltlen, args->alignment, | 867 | xfs_alloc_compute_aligned(args, ltbno, ltlen, |
870 | args->minlen, <bnoa, <lena); | 868 | <bnoa, <lena); |
871 | if (ltlena < args->minlen) | 869 | if (ltlena < args->minlen) |
872 | continue; | 870 | continue; |
873 | args->len = XFS_EXTLEN_MIN(ltlena, args->maxlen); | 871 | args->len = XFS_EXTLEN_MIN(ltlena, args->maxlen); |
@@ -987,8 +985,8 @@ xfs_alloc_ag_vextent_near( | |||
987 | if ((error = xfs_alloc_get_rec(bno_cur_lt, <bno, <len, &i))) | 985 | if ((error = xfs_alloc_get_rec(bno_cur_lt, <bno, <len, &i))) |
988 | goto error0; | 986 | goto error0; |
989 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); | 987 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); |
990 | xfs_alloc_compute_aligned(ltbno, ltlen, args->alignment, | 988 | xfs_alloc_compute_aligned(args, ltbno, ltlen, |
991 | args->minlen, <bnoa, <lena); | 989 | <bnoa, <lena); |
992 | if (ltlena >= args->minlen) | 990 | if (ltlena >= args->minlen) |
993 | break; | 991 | break; |
994 | if ((error = xfs_btree_decrement(bno_cur_lt, 0, &i))) | 992 | if ((error = xfs_btree_decrement(bno_cur_lt, 0, &i))) |
@@ -1003,8 +1001,8 @@ xfs_alloc_ag_vextent_near( | |||
1003 | if ((error = xfs_alloc_get_rec(bno_cur_gt, >bno, >len, &i))) | 1001 | if ((error = xfs_alloc_get_rec(bno_cur_gt, >bno, >len, &i))) |
1004 | goto error0; | 1002 | goto error0; |
1005 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); | 1003 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); |
1006 | xfs_alloc_compute_aligned(gtbno, gtlen, args->alignment, | 1004 | xfs_alloc_compute_aligned(args, gtbno, gtlen, |
1007 | args->minlen, >bnoa, >lena); | 1005 | >bnoa, >lena); |
1008 | if (gtlena >= args->minlen) | 1006 | if (gtlena >= args->minlen) |
1009 | break; | 1007 | break; |
1010 | if ((error = xfs_btree_increment(bno_cur_gt, 0, &i))) | 1008 | if ((error = xfs_btree_increment(bno_cur_gt, 0, &i))) |
@@ -1183,8 +1181,7 @@ xfs_alloc_ag_vextent_size( | |||
1183 | * once aligned; if not, we search left for something better. | 1181 | * once aligned; if not, we search left for something better. |
1184 | * This can't happen in the second case above. | 1182 | * This can't happen in the second case above. |
1185 | */ | 1183 | */ |
1186 | xfs_alloc_compute_aligned(fbno, flen, args->alignment, args->minlen, | 1184 | xfs_alloc_compute_aligned(args, fbno, flen, &rbno, &rlen); |
1187 | &rbno, &rlen); | ||
1188 | rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); | 1185 | rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); |
1189 | XFS_WANT_CORRUPTED_GOTO(rlen == 0 || | 1186 | XFS_WANT_CORRUPTED_GOTO(rlen == 0 || |
1190 | (rlen <= flen && rbno + rlen <= fbno + flen), error0); | 1187 | (rlen <= flen && rbno + rlen <= fbno + flen), error0); |
@@ -1209,8 +1206,8 @@ xfs_alloc_ag_vextent_size( | |||
1209 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); | 1206 | XFS_WANT_CORRUPTED_GOTO(i == 1, error0); |
1210 | if (flen < bestrlen) | 1207 | if (flen < bestrlen) |
1211 | break; | 1208 | break; |
1212 | xfs_alloc_compute_aligned(fbno, flen, args->alignment, | 1209 | xfs_alloc_compute_aligned(args, fbno, flen, |
1213 | args->minlen, &rbno, &rlen); | 1210 | &rbno, &rlen); |
1214 | rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); | 1211 | rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); |
1215 | XFS_WANT_CORRUPTED_GOTO(rlen == 0 || | 1212 | XFS_WANT_CORRUPTED_GOTO(rlen == 0 || |
1216 | (rlen <= flen && rbno + rlen <= fbno + flen), | 1213 | (rlen <= flen && rbno + rlen <= fbno + flen), |