diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 01:57:40 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 01:57:40 -0400 |
commit | 4b22a57188d87e873346b73c227607715be96399 (patch) | |
tree | 4cf2d0deede695968b7a32b098c0c64fac8610e5 /fs/xfs/xfs_bmap.c | |
parent | ea77b0a66e6c910ef265d9af522d6303ea6b3055 (diff) |
[XFS] implement generic xfs_btree_insert/insrec
Make the btree insert code generic. Based on a patch from David Chinner
with lots of changes to follow the original btree implementations more
closely. While this loses some of the generic helper routines for
inserting/moving/removing records it also solves some of the one off bugs
in the original code and makes it easier to verify.
SGI-PV: 985583
SGI-Modid: xfs-linux-melb:xfs-kern:32202a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Bill O'Donnell <billodo@sgi.com>
Signed-off-by: David Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/xfs_bmap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 315bc2912682..85e2e8b9cf41 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -977,7 +977,7 @@ xfs_bmap_add_extent_delay_real( | |||
977 | goto done; | 977 | goto done; |
978 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); | 978 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
979 | cur->bc_rec.b.br_state = XFS_EXT_NORM; | 979 | cur->bc_rec.b.br_state = XFS_EXT_NORM; |
980 | if ((error = xfs_bmbt_insert(cur, &i))) | 980 | if ((error = xfs_btree_insert(cur, &i))) |
981 | goto done; | 981 | goto done; |
982 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 982 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
983 | } | 983 | } |
@@ -1053,7 +1053,7 @@ xfs_bmap_add_extent_delay_real( | |||
1053 | goto done; | 1053 | goto done; |
1054 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); | 1054 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
1055 | cur->bc_rec.b.br_state = XFS_EXT_NORM; | 1055 | cur->bc_rec.b.br_state = XFS_EXT_NORM; |
1056 | if ((error = xfs_bmbt_insert(cur, &i))) | 1056 | if ((error = xfs_btree_insert(cur, &i))) |
1057 | goto done; | 1057 | goto done; |
1058 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1058 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1059 | } | 1059 | } |
@@ -1143,7 +1143,7 @@ xfs_bmap_add_extent_delay_real( | |||
1143 | goto done; | 1143 | goto done; |
1144 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); | 1144 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
1145 | cur->bc_rec.b.br_state = XFS_EXT_NORM; | 1145 | cur->bc_rec.b.br_state = XFS_EXT_NORM; |
1146 | if ((error = xfs_bmbt_insert(cur, &i))) | 1146 | if ((error = xfs_btree_insert(cur, &i))) |
1147 | goto done; | 1147 | goto done; |
1148 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1148 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1149 | } | 1149 | } |
@@ -1198,7 +1198,7 @@ xfs_bmap_add_extent_delay_real( | |||
1198 | goto done; | 1198 | goto done; |
1199 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); | 1199 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
1200 | cur->bc_rec.b.br_state = XFS_EXT_NORM; | 1200 | cur->bc_rec.b.br_state = XFS_EXT_NORM; |
1201 | if ((error = xfs_bmbt_insert(cur, &i))) | 1201 | if ((error = xfs_btree_insert(cur, &i))) |
1202 | goto done; | 1202 | goto done; |
1203 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1203 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1204 | } | 1204 | } |
@@ -1651,7 +1651,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1651 | oldext))) | 1651 | oldext))) |
1652 | goto done; | 1652 | goto done; |
1653 | cur->bc_rec.b = *new; | 1653 | cur->bc_rec.b = *new; |
1654 | if ((error = xfs_bmbt_insert(cur, &i))) | 1654 | if ((error = xfs_btree_insert(cur, &i))) |
1655 | goto done; | 1655 | goto done; |
1656 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1656 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1657 | } | 1657 | } |
@@ -1741,7 +1741,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1741 | goto done; | 1741 | goto done; |
1742 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); | 1742 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
1743 | cur->bc_rec.b.br_state = XFS_EXT_NORM; | 1743 | cur->bc_rec.b.br_state = XFS_EXT_NORM; |
1744 | if ((error = xfs_bmbt_insert(cur, &i))) | 1744 | if ((error = xfs_btree_insert(cur, &i))) |
1745 | goto done; | 1745 | goto done; |
1746 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1746 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1747 | } | 1747 | } |
@@ -1789,7 +1789,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1789 | cur->bc_rec.b = PREV; | 1789 | cur->bc_rec.b = PREV; |
1790 | cur->bc_rec.b.br_blockcount = | 1790 | cur->bc_rec.b.br_blockcount = |
1791 | new->br_startoff - PREV.br_startoff; | 1791 | new->br_startoff - PREV.br_startoff; |
1792 | if ((error = xfs_bmbt_insert(cur, &i))) | 1792 | if ((error = xfs_btree_insert(cur, &i))) |
1793 | goto done; | 1793 | goto done; |
1794 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1794 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1795 | /* | 1795 | /* |
@@ -1804,7 +1804,7 @@ xfs_bmap_add_extent_unwritten_real( | |||
1804 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); | 1804 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
1805 | /* new middle extent - newext */ | 1805 | /* new middle extent - newext */ |
1806 | cur->bc_rec.b.br_state = new->br_state; | 1806 | cur->bc_rec.b.br_state = new->br_state; |
1807 | if ((error = xfs_bmbt_insert(cur, &i))) | 1807 | if ((error = xfs_btree_insert(cur, &i))) |
1808 | goto done; | 1808 | goto done; |
1809 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1809 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1810 | } | 1810 | } |
@@ -2264,7 +2264,7 @@ xfs_bmap_add_extent_hole_real( | |||
2264 | goto done; | 2264 | goto done; |
2265 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); | 2265 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
2266 | cur->bc_rec.b.br_state = new->br_state; | 2266 | cur->bc_rec.b.br_state = new->br_state; |
2267 | if ((error = xfs_bmbt_insert(cur, &i))) | 2267 | if ((error = xfs_btree_insert(cur, &i))) |
2268 | goto done; | 2268 | goto done; |
2269 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 2269 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
2270 | } | 2270 | } |
@@ -3303,7 +3303,7 @@ xfs_bmap_del_extent( | |||
3303 | if ((error = xfs_btree_increment(cur, 0, &i))) | 3303 | if ((error = xfs_btree_increment(cur, 0, &i))) |
3304 | goto done; | 3304 | goto done; |
3305 | cur->bc_rec.b = new; | 3305 | cur->bc_rec.b = new; |
3306 | error = xfs_bmbt_insert(cur, &i); | 3306 | error = xfs_btree_insert(cur, &i); |
3307 | if (error && error != ENOSPC) | 3307 | if (error && error != ENOSPC) |
3308 | goto done; | 3308 | goto done; |
3309 | /* | 3309 | /* |