diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:36:55 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:36:55 -0400 |
| commit | c0341b0f47722fbe5ab45f436fc6ddc1c58c0a6f (patch) | |
| tree | 63279f95e7250a3c465eb061be97fff071d0903b /fs/xfs/xfs_rtalloc.c | |
| parent | ae1390d8c3e2142e5cf6d192951d6e2b1fa213c5 (diff) | |
| parent | 1b06e7926694178e146ff708b2c15a6da64c9765 (diff) | |
Merge git://oss.sgi.com:8090/xfs/xfs-2.6
* git://oss.sgi.com:8090/xfs/xfs-2.6: (49 commits)
[XFS] Remove v1 dir trace macro - missed in a past commit.
[XFS] 955947: Infinite loop in xfs_bulkstat() on formatter() error
[XFS] pv 956241, author: nathans, rv: vapo - make ino validation checks
[XFS] pv 956240, author: nathans, rv: vapo - Minor fixes in
[XFS] Really fix use after free in xfs_iunpin.
[XFS] Collapse sv_init and init_sv into just the one interface.
[XFS] standardize on one sema init macro
[XFS] Reduce endian flipping in alloc_btree, same as was done for
[XFS] Minor cleanup from dio locking fix, remove an extra conditional.
[XFS] Fix kmem_zalloc_greedy warnings on 64 bit platforms.
[XFS] pv 955157, rv bnaujok - break the loop on EFAULT formatter() error
[XFS] pv 955157, rv bnaujok - break the loop on formatter() error
[XFS] Fixes the leak in reservation space because we weren't ungranting
[XFS] Add lock annotations to xfs_trans_update_ail and
[XFS] Fix a porting botch on the realtime subvol growfs code path.
[XFS] Minor code rearranging and cleanup to prevent some coverity false
[XFS] Remove a no-longer-correct debug assert from dio completion
[XFS] Add a greedy allocation interface, allocating within a min/max size
[XFS] Improve error handling for the zero-fsblock extent detection code.
[XFS] Be more defensive with page flags (error/private) for metadata
...
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
| -rw-r--r-- | fs/xfs/xfs_rtalloc.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 5a0b678956e0..880c73271c05 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
| @@ -1948,7 +1948,7 @@ xfs_growfs_rt( | |||
| 1948 | */ | 1948 | */ |
| 1949 | nrextents = nrblocks; | 1949 | nrextents = nrblocks; |
| 1950 | do_div(nrextents, in->extsize); | 1950 | do_div(nrextents, in->extsize); |
| 1951 | nrbmblocks = roundup_64(nrextents, NBBY * sbp->sb_blocksize); | 1951 | nrbmblocks = howmany_64(nrextents, NBBY * sbp->sb_blocksize); |
| 1952 | nrextslog = xfs_highbit32(nrextents); | 1952 | nrextslog = xfs_highbit32(nrextents); |
| 1953 | nrsumlevels = nrextslog + 1; | 1953 | nrsumlevels = nrextslog + 1; |
| 1954 | nrsumsize = (uint)sizeof(xfs_suminfo_t) * nrsumlevels * nrbmblocks; | 1954 | nrsumsize = (uint)sizeof(xfs_suminfo_t) * nrsumlevels * nrbmblocks; |
| @@ -1976,7 +1976,10 @@ xfs_growfs_rt( | |||
| 1976 | if ((error = xfs_growfs_rt_alloc(mp, rsumblocks, nrsumblocks, | 1976 | if ((error = xfs_growfs_rt_alloc(mp, rsumblocks, nrsumblocks, |
| 1977 | mp->m_sb.sb_rsumino))) | 1977 | mp->m_sb.sb_rsumino))) |
| 1978 | return error; | 1978 | return error; |
| 1979 | nmp = NULL; | 1979 | /* |
| 1980 | * Allocate a new (fake) mount/sb. | ||
| 1981 | */ | ||
| 1982 | nmp = kmem_alloc(sizeof(*nmp), KM_SLEEP); | ||
| 1980 | /* | 1983 | /* |
| 1981 | * Loop over the bitmap blocks. | 1984 | * Loop over the bitmap blocks. |
| 1982 | * We will do everything one bitmap block at a time. | 1985 | * We will do everything one bitmap block at a time. |
| @@ -1987,10 +1990,6 @@ xfs_growfs_rt( | |||
| 1987 | ((sbp->sb_rextents & ((1 << mp->m_blkbit_log) - 1)) != 0); | 1990 | ((sbp->sb_rextents & ((1 << mp->m_blkbit_log) - 1)) != 0); |
| 1988 | bmbno < nrbmblocks; | 1991 | bmbno < nrbmblocks; |
| 1989 | bmbno++) { | 1992 | bmbno++) { |
| 1990 | /* | ||
| 1991 | * Allocate a new (fake) mount/sb. | ||
| 1992 | */ | ||
| 1993 | nmp = kmem_alloc(sizeof(*nmp), KM_SLEEP); | ||
| 1994 | *nmp = *mp; | 1993 | *nmp = *mp; |
| 1995 | nsbp = &nmp->m_sb; | 1994 | nsbp = &nmp->m_sb; |
| 1996 | /* | 1995 | /* |
| @@ -2018,13 +2017,13 @@ xfs_growfs_rt( | |||
| 2018 | cancelflags = 0; | 2017 | cancelflags = 0; |
| 2019 | if ((error = xfs_trans_reserve(tp, 0, | 2018 | if ((error = xfs_trans_reserve(tp, 0, |
| 2020 | XFS_GROWRTFREE_LOG_RES(nmp), 0, 0, 0))) | 2019 | XFS_GROWRTFREE_LOG_RES(nmp), 0, 0, 0))) |
| 2021 | goto error_exit; | 2020 | break; |
| 2022 | /* | 2021 | /* |
| 2023 | * Lock out other callers by grabbing the bitmap inode lock. | 2022 | * Lock out other callers by grabbing the bitmap inode lock. |
| 2024 | */ | 2023 | */ |
| 2025 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, | 2024 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, |
| 2026 | XFS_ILOCK_EXCL, &ip))) | 2025 | XFS_ILOCK_EXCL, &ip))) |
| 2027 | goto error_exit; | 2026 | break; |
| 2028 | ASSERT(ip == mp->m_rbmip); | 2027 | ASSERT(ip == mp->m_rbmip); |
| 2029 | /* | 2028 | /* |
| 2030 | * Update the bitmap inode's size. | 2029 | * Update the bitmap inode's size. |
| @@ -2038,7 +2037,7 @@ xfs_growfs_rt( | |||
| 2038 | */ | 2037 | */ |
| 2039 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, | 2038 | if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, |
| 2040 | XFS_ILOCK_EXCL, &ip))) | 2039 | XFS_ILOCK_EXCL, &ip))) |
| 2041 | goto error_exit; | 2040 | break; |
| 2042 | ASSERT(ip == mp->m_rsumip); | 2041 | ASSERT(ip == mp->m_rsumip); |
| 2043 | /* | 2042 | /* |
| 2044 | * Update the summary inode's size. | 2043 | * Update the summary inode's size. |
| @@ -2053,7 +2052,7 @@ xfs_growfs_rt( | |||
| 2053 | mp->m_rsumlevels != nmp->m_rsumlevels) { | 2052 | mp->m_rsumlevels != nmp->m_rsumlevels) { |
| 2054 | error = xfs_rtcopy_summary(mp, nmp, tp); | 2053 | error = xfs_rtcopy_summary(mp, nmp, tp); |
| 2055 | if (error) | 2054 | if (error) |
| 2056 | goto error_exit; | 2055 | break; |
| 2057 | } | 2056 | } |
| 2058 | /* | 2057 | /* |
| 2059 | * Update superblock fields. | 2058 | * Update superblock fields. |
| @@ -2080,18 +2079,13 @@ xfs_growfs_rt( | |||
| 2080 | error = xfs_rtfree_range(nmp, tp, sbp->sb_rextents, | 2079 | error = xfs_rtfree_range(nmp, tp, sbp->sb_rextents, |
| 2081 | nsbp->sb_rextents - sbp->sb_rextents, &bp, &sumbno); | 2080 | nsbp->sb_rextents - sbp->sb_rextents, &bp, &sumbno); |
| 2082 | if (error) | 2081 | if (error) |
| 2083 | goto error_exit; | 2082 | break; |
| 2084 | /* | 2083 | /* |
| 2085 | * Mark more blocks free in the superblock. | 2084 | * Mark more blocks free in the superblock. |
| 2086 | */ | 2085 | */ |
| 2087 | xfs_trans_mod_sb(tp, XFS_TRANS_SB_FREXTENTS, | 2086 | xfs_trans_mod_sb(tp, XFS_TRANS_SB_FREXTENTS, |
| 2088 | nsbp->sb_rextents - sbp->sb_rextents); | 2087 | nsbp->sb_rextents - sbp->sb_rextents); |
| 2089 | /* | 2088 | /* |
| 2090 | * Free the fake mp structure. | ||
| 2091 | */ | ||
| 2092 | kmem_free(nmp, sizeof(*nmp)); | ||
| 2093 | nmp = NULL; | ||
| 2094 | /* | ||
| 2095 | * Update mp values into the real mp structure. | 2089 | * Update mp values into the real mp structure. |
| 2096 | */ | 2090 | */ |
| 2097 | mp->m_rsumlevels = nrsumlevels; | 2091 | mp->m_rsumlevels = nrsumlevels; |
| @@ -2101,15 +2095,15 @@ xfs_growfs_rt( | |||
| 2101 | */ | 2095 | */ |
| 2102 | xfs_trans_commit(tp, 0, NULL); | 2096 | xfs_trans_commit(tp, 0, NULL); |
| 2103 | } | 2097 | } |
| 2104 | return 0; | 2098 | |
| 2099 | if (error) | ||
| 2100 | xfs_trans_cancel(tp, cancelflags); | ||
| 2105 | 2101 | ||
| 2106 | /* | 2102 | /* |
| 2107 | * Error paths come here. | 2103 | * Free the fake mp structure. |
| 2108 | */ | 2104 | */ |
| 2109 | error_exit: | 2105 | kmem_free(nmp, sizeof(*nmp)); |
| 2110 | if (nmp) | 2106 | |
| 2111 | kmem_free(nmp, sizeof(*nmp)); | ||
| 2112 | xfs_trans_cancel(tp, cancelflags); | ||
| 2113 | return error; | 2107 | return error; |
| 2114 | } | 2108 | } |
| 2115 | 2109 | ||
