diff options
| -rw-r--r-- | fs/xfs/xfs_bmap.c | 138 | ||||
| -rw-r--r-- | fs/xfs/xfs_bmap.h | 8 | ||||
| -rw-r--r-- | fs/xfs/xfs_filestream.c | 2 |
3 files changed, 75 insertions, 73 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 608a0013791b..b47555cfbd8f 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
| @@ -2017,15 +2017,15 @@ xfs_bmap_adjacent( | |||
| 2017 | !isnullstartblock(ap->prev.br_startblock) && | 2017 | !isnullstartblock(ap->prev.br_startblock) && |
| 2018 | ISVALID(ap->prev.br_startblock + ap->prev.br_blockcount, | 2018 | ISVALID(ap->prev.br_startblock + ap->prev.br_blockcount, |
| 2019 | ap->prev.br_startblock)) { | 2019 | ap->prev.br_startblock)) { |
| 2020 | ap->rval = ap->prev.br_startblock + ap->prev.br_blockcount; | 2020 | ap->blkno = ap->prev.br_startblock + ap->prev.br_blockcount; |
| 2021 | /* | 2021 | /* |
| 2022 | * Adjust for the gap between prevp and us. | 2022 | * Adjust for the gap between prevp and us. |
| 2023 | */ | 2023 | */ |
| 2024 | adjust = ap->off - | 2024 | adjust = ap->offset - |
| 2025 | (ap->prev.br_startoff + ap->prev.br_blockcount); | 2025 | (ap->prev.br_startoff + ap->prev.br_blockcount); |
| 2026 | if (adjust && | 2026 | if (adjust && |
| 2027 | ISVALID(ap->rval + adjust, ap->prev.br_startblock)) | 2027 | ISVALID(ap->blkno + adjust, ap->prev.br_startblock)) |
| 2028 | ap->rval += adjust; | 2028 | ap->blkno += adjust; |
| 2029 | } | 2029 | } |
| 2030 | /* | 2030 | /* |
| 2031 | * If not at eof, then compare the two neighbor blocks. | 2031 | * If not at eof, then compare the two neighbor blocks. |
| @@ -2050,7 +2050,7 @@ xfs_bmap_adjacent( | |||
| 2050 | /* | 2050 | /* |
| 2051 | * Calculate gap to end of previous block. | 2051 | * Calculate gap to end of previous block. |
| 2052 | */ | 2052 | */ |
| 2053 | adjust = prevdiff = ap->off - | 2053 | adjust = prevdiff = ap->offset - |
| 2054 | (ap->prev.br_startoff + | 2054 | (ap->prev.br_startoff + |
| 2055 | ap->prev.br_blockcount); | 2055 | ap->prev.br_blockcount); |
| 2056 | /* | 2056 | /* |
| @@ -2061,7 +2061,7 @@ xfs_bmap_adjacent( | |||
| 2061 | * allocating, or using it gives us an invalid block | 2061 | * allocating, or using it gives us an invalid block |
| 2062 | * number, then just use the end of the previous block. | 2062 | * number, then just use the end of the previous block. |
| 2063 | */ | 2063 | */ |
| 2064 | if (prevdiff <= XFS_ALLOC_GAP_UNITS * ap->alen && | 2064 | if (prevdiff <= XFS_ALLOC_GAP_UNITS * ap->length && |
| 2065 | ISVALID(prevbno + prevdiff, | 2065 | ISVALID(prevbno + prevdiff, |
| 2066 | ap->prev.br_startblock)) | 2066 | ap->prev.br_startblock)) |
| 2067 | prevbno += adjust; | 2067 | prevbno += adjust; |
| @@ -2088,7 +2088,7 @@ xfs_bmap_adjacent( | |||
| 2088 | /* | 2088 | /* |
| 2089 | * Calculate gap to start of next block. | 2089 | * Calculate gap to start of next block. |
| 2090 | */ | 2090 | */ |
| 2091 | adjust = gotdiff = ap->got.br_startoff - ap->off; | 2091 | adjust = gotdiff = ap->got.br_startoff - ap->offset; |
| 2092 | /* | 2092 | /* |
| 2093 | * Figure the startblock based on the next block's | 2093 | * Figure the startblock based on the next block's |
| 2094 | * start and the gap size. | 2094 | * start and the gap size. |
| @@ -2101,12 +2101,12 @@ xfs_bmap_adjacent( | |||
| 2101 | * number, then just use the start of the next block | 2101 | * number, then just use the start of the next block |
| 2102 | * offset by our length. | 2102 | * offset by our length. |
| 2103 | */ | 2103 | */ |
| 2104 | if (gotdiff <= XFS_ALLOC_GAP_UNITS * ap->alen && | 2104 | if (gotdiff <= XFS_ALLOC_GAP_UNITS * ap->length && |
| 2105 | ISVALID(gotbno - gotdiff, gotbno)) | 2105 | ISVALID(gotbno - gotdiff, gotbno)) |
| 2106 | gotbno -= adjust; | 2106 | gotbno -= adjust; |
| 2107 | else if (ISVALID(gotbno - ap->alen, gotbno)) { | 2107 | else if (ISVALID(gotbno - ap->length, gotbno)) { |
| 2108 | gotbno -= ap->alen; | 2108 | gotbno -= ap->length; |
| 2109 | gotdiff += adjust - ap->alen; | 2109 | gotdiff += adjust - ap->length; |
| 2110 | } else | 2110 | } else |
| 2111 | gotdiff += adjust; | 2111 | gotdiff += adjust; |
| 2112 | /* | 2112 | /* |
| @@ -2124,14 +2124,14 @@ xfs_bmap_adjacent( | |||
| 2124 | gotbno = NULLFSBLOCK; | 2124 | gotbno = NULLFSBLOCK; |
| 2125 | /* | 2125 | /* |
| 2126 | * If both valid, pick the better one, else the only good | 2126 | * If both valid, pick the better one, else the only good |
| 2127 | * one, else ap->rval is already set (to 0 or the inode block). | 2127 | * one, else ap->blkno is already set (to 0 or the inode block). |
| 2128 | */ | 2128 | */ |
| 2129 | if (prevbno != NULLFSBLOCK && gotbno != NULLFSBLOCK) | 2129 | if (prevbno != NULLFSBLOCK && gotbno != NULLFSBLOCK) |
| 2130 | ap->rval = prevdiff <= gotdiff ? prevbno : gotbno; | 2130 | ap->blkno = prevdiff <= gotdiff ? prevbno : gotbno; |
| 2131 | else if (prevbno != NULLFSBLOCK) | 2131 | else if (prevbno != NULLFSBLOCK) |
| 2132 | ap->rval = prevbno; | 2132 | ap->blkno = prevbno; |
| 2133 | else if (gotbno != NULLFSBLOCK) | 2133 | else if (gotbno != NULLFSBLOCK) |
| 2134 | ap->rval = gotbno; | 2134 | ap->blkno = gotbno; |
| 2135 | } | 2135 | } |
| 2136 | #undef ISVALID | 2136 | #undef ISVALID |
| 2137 | } | 2137 | } |
| @@ -2153,22 +2153,22 @@ xfs_bmap_rtalloc( | |||
| 2153 | prod = align / mp->m_sb.sb_rextsize; | 2153 | prod = align / mp->m_sb.sb_rextsize; |
| 2154 | error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, | 2154 | error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, |
| 2155 | align, 1, ap->eof, 0, | 2155 | align, 1, ap->eof, 0, |
| 2156 | ap->conv, &ap->off, &ap->alen); | 2156 | ap->conv, &ap->offset, &ap->length); |
| 2157 | if (error) | 2157 | if (error) |
| 2158 | return error; | 2158 | return error; |
| 2159 | ASSERT(ap->alen); | 2159 | ASSERT(ap->length); |
| 2160 | ASSERT(ap->alen % mp->m_sb.sb_rextsize == 0); | 2160 | ASSERT(ap->length % mp->m_sb.sb_rextsize == 0); |
| 2161 | 2161 | ||
| 2162 | /* | 2162 | /* |
| 2163 | * If the offset & length are not perfectly aligned | 2163 | * If the offset & length are not perfectly aligned |
| 2164 | * then kill prod, it will just get us in trouble. | 2164 | * then kill prod, it will just get us in trouble. |
| 2165 | */ | 2165 | */ |
| 2166 | if (do_mod(ap->off, align) || ap->alen % align) | 2166 | if (do_mod(ap->offset, align) || ap->length % align) |
| 2167 | prod = 1; | 2167 | prod = 1; |
| 2168 | /* | 2168 | /* |
| 2169 | * Set ralen to be the actual requested length in rtextents. | 2169 | * Set ralen to be the actual requested length in rtextents. |
| 2170 | */ | 2170 | */ |
| 2171 | ralen = ap->alen / mp->m_sb.sb_rextsize; | 2171 | ralen = ap->length / mp->m_sb.sb_rextsize; |
| 2172 | /* | 2172 | /* |
| 2173 | * If the old value was close enough to MAXEXTLEN that | 2173 | * If the old value was close enough to MAXEXTLEN that |
| 2174 | * we rounded up to it, cut it back so it's valid again. | 2174 | * we rounded up to it, cut it back so it's valid again. |
| @@ -2189,15 +2189,15 @@ xfs_bmap_rtalloc( | |||
| 2189 | * If it's an allocation to an empty file at offset 0, | 2189 | * If it's an allocation to an empty file at offset 0, |
| 2190 | * pick an extent that will space things out in the rt area. | 2190 | * pick an extent that will space things out in the rt area. |
| 2191 | */ | 2191 | */ |
| 2192 | if (ap->eof && ap->off == 0) { | 2192 | if (ap->eof && ap->offset == 0) { |
| 2193 | xfs_rtblock_t uninitialized_var(rtx); /* realtime extent no */ | 2193 | xfs_rtblock_t uninitialized_var(rtx); /* realtime extent no */ |
| 2194 | 2194 | ||
| 2195 | error = xfs_rtpick_extent(mp, ap->tp, ralen, &rtx); | 2195 | error = xfs_rtpick_extent(mp, ap->tp, ralen, &rtx); |
| 2196 | if (error) | 2196 | if (error) |
| 2197 | return error; | 2197 | return error; |
| 2198 | ap->rval = rtx * mp->m_sb.sb_rextsize; | 2198 | ap->blkno = rtx * mp->m_sb.sb_rextsize; |
| 2199 | } else { | 2199 | } else { |
| 2200 | ap->rval = 0; | 2200 | ap->blkno = 0; |
| 2201 | } | 2201 | } |
| 2202 | 2202 | ||
| 2203 | xfs_bmap_adjacent(ap); | 2203 | xfs_bmap_adjacent(ap); |
| @@ -2205,23 +2205,23 @@ xfs_bmap_rtalloc( | |||
| 2205 | /* | 2205 | /* |
| 2206 | * Realtime allocation, done through xfs_rtallocate_extent. | 2206 | * Realtime allocation, done through xfs_rtallocate_extent. |
| 2207 | */ | 2207 | */ |
| 2208 | atype = ap->rval == 0 ? XFS_ALLOCTYPE_ANY_AG : XFS_ALLOCTYPE_NEAR_BNO; | 2208 | atype = ap->blkno == 0 ? XFS_ALLOCTYPE_ANY_AG : XFS_ALLOCTYPE_NEAR_BNO; |
| 2209 | do_div(ap->rval, mp->m_sb.sb_rextsize); | 2209 | do_div(ap->blkno, mp->m_sb.sb_rextsize); |
| 2210 | rtb = ap->rval; | 2210 | rtb = ap->blkno; |
| 2211 | ap->alen = ralen; | 2211 | ap->length = ralen; |
| 2212 | if ((error = xfs_rtallocate_extent(ap->tp, ap->rval, 1, ap->alen, | 2212 | if ((error = xfs_rtallocate_extent(ap->tp, ap->blkno, 1, ap->length, |
| 2213 | &ralen, atype, ap->wasdel, prod, &rtb))) | 2213 | &ralen, atype, ap->wasdel, prod, &rtb))) |
| 2214 | return error; | 2214 | return error; |
| 2215 | if (rtb == NULLFSBLOCK && prod > 1 && | 2215 | if (rtb == NULLFSBLOCK && prod > 1 && |
| 2216 | (error = xfs_rtallocate_extent(ap->tp, ap->rval, 1, | 2216 | (error = xfs_rtallocate_extent(ap->tp, ap->blkno, 1, |
| 2217 | ap->alen, &ralen, atype, | 2217 | ap->length, &ralen, atype, |
| 2218 | ap->wasdel, 1, &rtb))) | 2218 | ap->wasdel, 1, &rtb))) |
| 2219 | return error; | 2219 | return error; |
| 2220 | ap->rval = rtb; | 2220 | ap->blkno = rtb; |
| 2221 | if (ap->rval != NULLFSBLOCK) { | 2221 | if (ap->blkno != NULLFSBLOCK) { |
| 2222 | ap->rval *= mp->m_sb.sb_rextsize; | 2222 | ap->blkno *= mp->m_sb.sb_rextsize; |
| 2223 | ralen *= mp->m_sb.sb_rextsize; | 2223 | ralen *= mp->m_sb.sb_rextsize; |
| 2224 | ap->alen = ralen; | 2224 | ap->length = ralen; |
| 2225 | ap->ip->i_d.di_nblocks += ralen; | 2225 | ap->ip->i_d.di_nblocks += ralen; |
| 2226 | xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); | 2226 | xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); |
| 2227 | if (ap->wasdel) | 2227 | if (ap->wasdel) |
| @@ -2234,7 +2234,7 @@ xfs_bmap_rtalloc( | |||
| 2234 | ap->wasdel ? XFS_TRANS_DQ_DELRTBCOUNT : | 2234 | ap->wasdel ? XFS_TRANS_DQ_DELRTBCOUNT : |
| 2235 | XFS_TRANS_DQ_RTBCOUNT, (long) ralen); | 2235 | XFS_TRANS_DQ_RTBCOUNT, (long) ralen); |
| 2236 | } else { | 2236 | } else { |
| 2237 | ap->alen = 0; | 2237 | ap->length = 0; |
| 2238 | } | 2238 | } |
| 2239 | return 0; | 2239 | return 0; |
| 2240 | } | 2240 | } |
| @@ -2349,7 +2349,7 @@ xfs_bmap_btalloc_nullfb( | |||
| 2349 | * AG as the stream may have moved. | 2349 | * AG as the stream may have moved. |
| 2350 | */ | 2350 | */ |
| 2351 | if (xfs_inode_is_filestream(ap->ip)) | 2351 | if (xfs_inode_is_filestream(ap->ip)) |
| 2352 | ap->rval = args->fsbno = XFS_AGB_TO_FSB(mp, ag, 0); | 2352 | ap->blkno = args->fsbno = XFS_AGB_TO_FSB(mp, ag, 0); |
| 2353 | 2353 | ||
| 2354 | return 0; | 2354 | return 0; |
| 2355 | } | 2355 | } |
| @@ -2376,9 +2376,9 @@ xfs_bmap_btalloc( | |||
| 2376 | if (unlikely(align)) { | 2376 | if (unlikely(align)) { |
| 2377 | error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, | 2377 | error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, |
| 2378 | align, 0, ap->eof, 0, ap->conv, | 2378 | align, 0, ap->eof, 0, ap->conv, |
| 2379 | &ap->off, &ap->alen); | 2379 | &ap->offset, &ap->length); |
| 2380 | ASSERT(!error); | 2380 | ASSERT(!error); |
| 2381 | ASSERT(ap->alen); | 2381 | ASSERT(ap->length); |
| 2382 | } | 2382 | } |
| 2383 | nullfb = *ap->firstblock == NULLFSBLOCK; | 2383 | nullfb = *ap->firstblock == NULLFSBLOCK; |
| 2384 | fb_agno = nullfb ? NULLAGNUMBER : XFS_FSB_TO_AGNO(mp, *ap->firstblock); | 2384 | fb_agno = nullfb ? NULLAGNUMBER : XFS_FSB_TO_AGNO(mp, *ap->firstblock); |
| @@ -2386,33 +2386,33 @@ xfs_bmap_btalloc( | |||
| 2386 | if (ap->userdata && xfs_inode_is_filestream(ap->ip)) { | 2386 | if (ap->userdata && xfs_inode_is_filestream(ap->ip)) { |
| 2387 | ag = xfs_filestream_lookup_ag(ap->ip); | 2387 | ag = xfs_filestream_lookup_ag(ap->ip); |
| 2388 | ag = (ag != NULLAGNUMBER) ? ag : 0; | 2388 | ag = (ag != NULLAGNUMBER) ? ag : 0; |
| 2389 | ap->rval = XFS_AGB_TO_FSB(mp, ag, 0); | 2389 | ap->blkno = XFS_AGB_TO_FSB(mp, ag, 0); |
| 2390 | } else { | 2390 | } else { |
| 2391 | ap->rval = XFS_INO_TO_FSB(mp, ap->ip->i_ino); | 2391 | ap->blkno = XFS_INO_TO_FSB(mp, ap->ip->i_ino); |
| 2392 | } | 2392 | } |
| 2393 | } else | 2393 | } else |
| 2394 | ap->rval = *ap->firstblock; | 2394 | ap->blkno = *ap->firstblock; |
| 2395 | 2395 | ||
| 2396 | xfs_bmap_adjacent(ap); | 2396 | xfs_bmap_adjacent(ap); |
| 2397 | 2397 | ||
| 2398 | /* | 2398 | /* |
| 2399 | * If allowed, use ap->rval; otherwise must use firstblock since | 2399 | * If allowed, use ap->blkno; otherwise must use firstblock since |
| 2400 | * it's in the right allocation group. | 2400 | * it's in the right allocation group. |
| 2401 | */ | 2401 | */ |
| 2402 | if (nullfb || XFS_FSB_TO_AGNO(mp, ap->rval) == fb_agno) | 2402 | if (nullfb || XFS_FSB_TO_AGNO(mp, ap->blkno) == fb_agno) |
| 2403 | ; | 2403 | ; |
| 2404 | else | 2404 | else |
| 2405 | ap->rval = *ap->firstblock; | 2405 | ap->blkno = *ap->firstblock; |
| 2406 | /* | 2406 | /* |
| 2407 | * Normal allocation, done through xfs_alloc_vextent. | 2407 | * Normal allocation, done through xfs_alloc_vextent. |
| 2408 | */ | 2408 | */ |
| 2409 | tryagain = isaligned = 0; | 2409 | tryagain = isaligned = 0; |
| 2410 | args.tp = ap->tp; | 2410 | args.tp = ap->tp; |
| 2411 | args.mp = mp; | 2411 | args.mp = mp; |
| 2412 | args.fsbno = ap->rval; | 2412 | args.fsbno = ap->blkno; |
| 2413 | 2413 | ||
| 2414 | /* Trim the allocation back to the maximum an AG can fit. */ | 2414 | /* Trim the allocation back to the maximum an AG can fit. */ |
| 2415 | args.maxlen = MIN(ap->alen, XFS_ALLOC_AG_MAX_USABLE(mp)); | 2415 | args.maxlen = MIN(ap->length, XFS_ALLOC_AG_MAX_USABLE(mp)); |
| 2416 | args.firstblock = *ap->firstblock; | 2416 | args.firstblock = *ap->firstblock; |
| 2417 | blen = 0; | 2417 | blen = 0; |
| 2418 | if (nullfb) { | 2418 | if (nullfb) { |
| @@ -2433,14 +2433,14 @@ xfs_bmap_btalloc( | |||
| 2433 | /* apply extent size hints if obtained earlier */ | 2433 | /* apply extent size hints if obtained earlier */ |
| 2434 | if (unlikely(align)) { | 2434 | if (unlikely(align)) { |
| 2435 | args.prod = align; | 2435 | args.prod = align; |
| 2436 | if ((args.mod = (xfs_extlen_t)do_mod(ap->off, args.prod))) | 2436 | if ((args.mod = (xfs_extlen_t)do_mod(ap->offset, args.prod))) |
| 2437 | args.mod = (xfs_extlen_t)(args.prod - args.mod); | 2437 | args.mod = (xfs_extlen_t)(args.prod - args.mod); |
| 2438 | } else if (mp->m_sb.sb_blocksize >= PAGE_CACHE_SIZE) { | 2438 | } else if (mp->m_sb.sb_blocksize >= PAGE_CACHE_SIZE) { |
| 2439 | args.prod = 1; | 2439 | args.prod = 1; |
| 2440 | args.mod = 0; | 2440 | args.mod = 0; |
| 2441 | } else { | 2441 | } else { |
| 2442 | args.prod = PAGE_CACHE_SIZE >> mp->m_sb.sb_blocklog; | 2442 | args.prod = PAGE_CACHE_SIZE >> mp->m_sb.sb_blocklog; |
| 2443 | if ((args.mod = (xfs_extlen_t)(do_mod(ap->off, args.prod)))) | 2443 | if ((args.mod = (xfs_extlen_t)(do_mod(ap->offset, args.prod)))) |
| 2444 | args.mod = (xfs_extlen_t)(args.prod - args.mod); | 2444 | args.mod = (xfs_extlen_t)(args.prod - args.mod); |
| 2445 | } | 2445 | } |
| 2446 | /* | 2446 | /* |
| @@ -2453,7 +2453,7 @@ xfs_bmap_btalloc( | |||
| 2453 | * at the end of file. | 2453 | * at the end of file. |
| 2454 | */ | 2454 | */ |
| 2455 | if (!ap->flist->xbf_low && ap->aeof) { | 2455 | if (!ap->flist->xbf_low && ap->aeof) { |
| 2456 | if (!ap->off) { | 2456 | if (!ap->offset) { |
| 2457 | args.alignment = mp->m_dalign; | 2457 | args.alignment = mp->m_dalign; |
| 2458 | atype = args.type; | 2458 | atype = args.type; |
| 2459 | isaligned = 1; | 2459 | isaligned = 1; |
| @@ -2506,7 +2506,7 @@ xfs_bmap_btalloc( | |||
| 2506 | * turned on. | 2506 | * turned on. |
| 2507 | */ | 2507 | */ |
| 2508 | args.type = atype; | 2508 | args.type = atype; |
| 2509 | args.fsbno = ap->rval; | 2509 | args.fsbno = ap->blkno; |
| 2510 | args.alignment = mp->m_dalign; | 2510 | args.alignment = mp->m_dalign; |
| 2511 | args.minlen = nextminlen; | 2511 | args.minlen = nextminlen; |
| 2512 | args.minalignslop = 0; | 2512 | args.minalignslop = 0; |
| @@ -2520,7 +2520,7 @@ xfs_bmap_btalloc( | |||
| 2520 | * try again. | 2520 | * try again. |
| 2521 | */ | 2521 | */ |
| 2522 | args.type = atype; | 2522 | args.type = atype; |
| 2523 | args.fsbno = ap->rval; | 2523 | args.fsbno = ap->blkno; |
| 2524 | args.alignment = 0; | 2524 | args.alignment = 0; |
| 2525 | if ((error = xfs_alloc_vextent(&args))) | 2525 | if ((error = xfs_alloc_vextent(&args))) |
| 2526 | return error; | 2526 | return error; |
| @@ -2529,7 +2529,7 @@ xfs_bmap_btalloc( | |||
| 2529 | args.minlen > ap->minlen) { | 2529 | args.minlen > ap->minlen) { |
| 2530 | args.minlen = ap->minlen; | 2530 | args.minlen = ap->minlen; |
| 2531 | args.type = XFS_ALLOCTYPE_START_BNO; | 2531 | args.type = XFS_ALLOCTYPE_START_BNO; |
| 2532 | args.fsbno = ap->rval; | 2532 | args.fsbno = ap->blkno; |
| 2533 | if ((error = xfs_alloc_vextent(&args))) | 2533 | if ((error = xfs_alloc_vextent(&args))) |
| 2534 | return error; | 2534 | return error; |
| 2535 | } | 2535 | } |
| @@ -2554,12 +2554,12 @@ xfs_bmap_btalloc( | |||
| 2554 | XFS_FSB_TO_AGNO(mp, *ap->firstblock) < | 2554 | XFS_FSB_TO_AGNO(mp, *ap->firstblock) < |
| 2555 | XFS_FSB_TO_AGNO(mp, args.fsbno))); | 2555 | XFS_FSB_TO_AGNO(mp, args.fsbno))); |
| 2556 | 2556 | ||
| 2557 | ap->rval = args.fsbno; | 2557 | ap->blkno = args.fsbno; |
| 2558 | if (*ap->firstblock == NULLFSBLOCK) | 2558 | if (*ap->firstblock == NULLFSBLOCK) |
| 2559 | *ap->firstblock = args.fsbno; | 2559 | *ap->firstblock = args.fsbno; |
| 2560 | ASSERT(nullfb || fb_agno == args.agno || | 2560 | ASSERT(nullfb || fb_agno == args.agno || |
| 2561 | (ap->flist->xbf_low && fb_agno < args.agno)); | 2561 | (ap->flist->xbf_low && fb_agno < args.agno)); |
| 2562 | ap->alen = args.len; | 2562 | ap->length = args.len; |
| 2563 | ap->ip->i_d.di_nblocks += args.len; | 2563 | ap->ip->i_d.di_nblocks += args.len; |
| 2564 | xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); | 2564 | xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); |
| 2565 | if (ap->wasdel) | 2565 | if (ap->wasdel) |
| @@ -2573,8 +2573,8 @@ xfs_bmap_btalloc( | |||
| 2573 | XFS_TRANS_DQ_BCOUNT, | 2573 | XFS_TRANS_DQ_BCOUNT, |
| 2574 | (long) args.len); | 2574 | (long) args.len); |
| 2575 | } else { | 2575 | } else { |
| 2576 | ap->rval = NULLFSBLOCK; | 2576 | ap->blkno = NULLFSBLOCK; |
| 2577 | ap->alen = 0; | 2577 | ap->length = 0; |
| 2578 | } | 2578 | } |
| 2579 | return 0; | 2579 | return 0; |
| 2580 | } | 2580 | } |
| @@ -3902,8 +3902,8 @@ xfs_bmap_isaeof( | |||
| 3902 | * Check if we are allocation or past the last extent, or at least into | 3902 | * Check if we are allocation or past the last extent, or at least into |
| 3903 | * the last delayed allocated extent. | 3903 | * the last delayed allocated extent. |
| 3904 | */ | 3904 | */ |
| 3905 | bma->aeof = bma->off >= rec.br_startoff + rec.br_blockcount || | 3905 | bma->aeof = bma->offset >= rec.br_startoff + rec.br_blockcount || |
| 3906 | (bma->off >= rec.br_startoff && | 3906 | (bma->offset >= rec.br_startoff && |
| 3907 | isnullstartblock(rec.br_startblock)); | 3907 | isnullstartblock(rec.br_startblock)); |
| 3908 | return 0; | 3908 | return 0; |
| 3909 | } | 3909 | } |
| @@ -4637,11 +4637,11 @@ xfs_bmapi_allocate( | |||
| 4637 | &bma->prev); | 4637 | &bma->prev); |
| 4638 | } | 4638 | } |
| 4639 | } else { | 4639 | } else { |
| 4640 | alen = (xfs_extlen_t)XFS_FILBLKS_MIN(bma->alen, MAXEXTLEN); | 4640 | alen = (xfs_extlen_t)XFS_FILBLKS_MIN(bma->length, MAXEXTLEN); |
| 4641 | if (!bma->eof) | 4641 | if (!bma->eof) |
| 4642 | alen = (xfs_extlen_t)XFS_FILBLKS_MIN(alen, | 4642 | alen = (xfs_extlen_t)XFS_FILBLKS_MIN(alen, |
| 4643 | bma->got.br_startoff - bma->off); | 4643 | bma->got.br_startoff - bma->offset); |
| 4644 | aoff = bma->off; | 4644 | aoff = bma->offset; |
| 4645 | } | 4645 | } |
| 4646 | 4646 | ||
| 4647 | /* | 4647 | /* |
| @@ -4656,8 +4656,8 @@ xfs_bmapi_allocate( | |||
| 4656 | /* | 4656 | /* |
| 4657 | * Fill in changeable bma fields. | 4657 | * Fill in changeable bma fields. |
| 4658 | */ | 4658 | */ |
| 4659 | bma->alen = alen; | 4659 | bma->length = alen; |
| 4660 | bma->off = aoff; | 4660 | bma->offset = aoff; |
| 4661 | bma->minlen = (flags & XFS_BMAPI_CONTIG) ? alen : 1; | 4661 | bma->minlen = (flags & XFS_BMAPI_CONTIG) ? alen : 1; |
| 4662 | bma->aeof = 0; | 4662 | bma->aeof = 0; |
| 4663 | 4663 | ||
| @@ -4679,9 +4679,9 @@ xfs_bmapi_allocate( | |||
| 4679 | /* | 4679 | /* |
| 4680 | * Copy out result fields. | 4680 | * Copy out result fields. |
| 4681 | */ | 4681 | */ |
| 4682 | abno = bma->rval; | 4682 | abno = bma->blkno; |
| 4683 | alen = bma->alen; | 4683 | alen = bma->length; |
| 4684 | aoff = bma->off; | 4684 | aoff = bma->offset; |
| 4685 | if (bma->flist->xbf_low) | 4685 | if (bma->flist->xbf_low) |
| 4686 | bma->minleft = 0; | 4686 | bma->minleft = 0; |
| 4687 | if (*cur) | 4687 | if (*cur) |
| @@ -4939,15 +4939,15 @@ xfs_bmapi_write( | |||
| 4939 | bma.eof = eof; | 4939 | bma.eof = eof; |
| 4940 | bma.conv = !!(flags & XFS_BMAPI_CONVERT); | 4940 | bma.conv = !!(flags & XFS_BMAPI_CONVERT); |
| 4941 | bma.wasdel = wasdelay; | 4941 | bma.wasdel = wasdelay; |
| 4942 | bma.alen = len; | 4942 | bma.length = len; |
| 4943 | bma.off = bno; | 4943 | bma.offset = bno; |
| 4944 | 4944 | ||
| 4945 | error = xfs_bmapi_allocate(&bma, &lastx, &cur, flags, | 4945 | error = xfs_bmapi_allocate(&bma, &lastx, &cur, flags, |
| 4946 | &nallocs, &tmp_logflags); | 4946 | &nallocs, &tmp_logflags); |
| 4947 | logflags |= tmp_logflags; | 4947 | logflags |= tmp_logflags; |
| 4948 | if (error) | 4948 | if (error) |
| 4949 | goto error0; | 4949 | goto error0; |
| 4950 | if (bma.rval == NULLFSBLOCK) | 4950 | if (bma.blkno == NULLFSBLOCK) |
| 4951 | break; | 4951 | break; |
| 4952 | } | 4952 | } |
| 4953 | 4953 | ||
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h index 6e7c7a50d248..5f398b1ac70c 100644 --- a/fs/xfs/xfs_bmap.h +++ b/fs/xfs/xfs_bmap.h | |||
| @@ -111,13 +111,15 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) | |||
| 111 | typedef struct xfs_bmalloca { | 111 | typedef struct xfs_bmalloca { |
| 112 | xfs_fsblock_t *firstblock; /* i/o first block allocated */ | 112 | xfs_fsblock_t *firstblock; /* i/o first block allocated */ |
| 113 | struct xfs_bmap_free *flist; /* bmap freelist */ | 113 | struct xfs_bmap_free *flist; /* bmap freelist */ |
| 114 | xfs_fsblock_t rval; /* starting block of new extent */ | ||
| 115 | xfs_fileoff_t off; /* offset in file filling in */ | ||
| 116 | struct xfs_trans *tp; /* transaction pointer */ | 114 | struct xfs_trans *tp; /* transaction pointer */ |
| 117 | struct xfs_inode *ip; /* incore inode pointer */ | 115 | struct xfs_inode *ip; /* incore inode pointer */ |
| 118 | struct xfs_bmbt_irec prev; /* extent before the new one */ | 116 | struct xfs_bmbt_irec prev; /* extent before the new one */ |
| 119 | struct xfs_bmbt_irec got; /* extent after, or delayed */ | 117 | struct xfs_bmbt_irec got; /* extent after, or delayed */ |
| 120 | xfs_extlen_t alen; /* i/o length asked/allocated */ | 118 | |
| 119 | xfs_fileoff_t offset; /* offset in file filling in */ | ||
| 120 | xfs_extlen_t length; /* i/o length asked/allocated */ | ||
| 121 | xfs_fsblock_t blkno; /* starting block of new extent */ | ||
| 122 | |||
| 121 | xfs_extlen_t total; /* total blocks needed for xaction */ | 123 | xfs_extlen_t total; /* total blocks needed for xaction */ |
| 122 | xfs_extlen_t minlen; /* minimum allocation size (blocks) */ | 124 | xfs_extlen_t minlen; /* minimum allocation size (blocks) */ |
| 123 | xfs_extlen_t minleft; /* amount must be left after alloc */ | 125 | xfs_extlen_t minleft; /* amount must be left after alloc */ |
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c index 137f957b8c7e..5170306a1009 100644 --- a/fs/xfs/xfs_filestream.c +++ b/fs/xfs/xfs_filestream.c | |||
| @@ -682,7 +682,7 @@ xfs_filestream_new_ag( | |||
| 682 | ip = ap->ip; | 682 | ip = ap->ip; |
| 683 | mp = ip->i_mount; | 683 | mp = ip->i_mount; |
| 684 | cache = mp->m_filestream; | 684 | cache = mp->m_filestream; |
| 685 | minlen = ap->alen; | 685 | minlen = ap->length; |
| 686 | *agp = NULLAGNUMBER; | 686 | *agp = NULLAGNUMBER; |
| 687 | 687 | ||
| 688 | /* | 688 | /* |
