aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-16 02:23:40 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-15 02:25:51 -0400
commita6f64d4aea0d0c8483e910c7dd2d1ee48e42245c (patch)
treef3fb20bb6d816f6d674bd4c8bfa687b013443eaf /fs/xfs/xfs_bmap_btree.c
parentd580ef6eaae6eaaef1e06c7d689fc9949faee9da (diff)
[XFS] split ondisk vs incore versions of xfs_bmbt_rec_t
currently xfs_bmbt_rec_t is used both for ondisk extents as well as host-endian ones. This patch adds a new xfs_bmbt_rec_host_t for the native endian ones and cleans up the fallout. There have been various endianess issues in the tracing / debug printf code that are fixed by this patch. SGI-PV: 968563 SGI-Modid: xfs-linux-melb:xfs-kern:29318a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.c')
-rw-r--r--fs/xfs/xfs_bmap_btree.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 08184cc399be..e54c71e20e0e 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -260,13 +260,14 @@ xfs_bmbt_trace_cursor(
260 char *s, 260 char *s,
261 int line) 261 int line)
262{ 262{
263 xfs_bmbt_rec_t r; 263 xfs_bmbt_rec_host_t r;
264 264
265 xfs_bmbt_set_all(&r, &cur->bc_rec.b); 265 xfs_bmbt_set_all(&r, &cur->bc_rec.b);
266 xfs_bmbt_trace_enter(func, cur, s, XFS_BMBT_KTRACE_CUR, line, 266 xfs_bmbt_trace_enter(func, cur, s, XFS_BMBT_KTRACE_CUR, line,
267 (cur->bc_nlevels << 24) | (cur->bc_private.b.flags << 16) | 267 (cur->bc_nlevels << 24) | (cur->bc_private.b.flags << 16) |
268 cur->bc_private.b.allocated, 268 cur->bc_private.b.allocated,
269 INT_GET(r.l0, ARCH_CONVERT) >> 32, (int)INT_GET(r.l0, ARCH_CONVERT), INT_GET(r.l1, ARCH_CONVERT) >> 32, (int)INT_GET(r.l1, ARCH_CONVERT), 269 r.l0 >> 32, (int)r.l0,
270 r.l1 >> 32, (int)r.l1,
270 (unsigned long)cur->bc_bufs[0], (unsigned long)cur->bc_bufs[1], 271 (unsigned long)cur->bc_bufs[0], (unsigned long)cur->bc_bufs[1],
271 (unsigned long)cur->bc_bufs[2], (unsigned long)cur->bc_bufs[3], 272 (unsigned long)cur->bc_bufs[2], (unsigned long)cur->bc_bufs[3],
272 (cur->bc_ptrs[0] << 16) | cur->bc_ptrs[1], 273 (cur->bc_ptrs[0] << 16) | cur->bc_ptrs[1],
@@ -1826,7 +1827,7 @@ __xfs_bmbt_get_all(
1826 1827
1827void 1828void
1828xfs_bmbt_get_all( 1829xfs_bmbt_get_all(
1829 xfs_bmbt_rec_t *r, 1830 xfs_bmbt_rec_host_t *r,
1830 xfs_bmbt_irec_t *s) 1831 xfs_bmbt_irec_t *s)
1831{ 1832{
1832 __xfs_bmbt_get_all(r->l0, r->l1, s); 1833 __xfs_bmbt_get_all(r->l0, r->l1, s);
@@ -1862,7 +1863,7 @@ xfs_bmbt_get_block(
1862 */ 1863 */
1863xfs_filblks_t 1864xfs_filblks_t
1864xfs_bmbt_get_blockcount( 1865xfs_bmbt_get_blockcount(
1865 xfs_bmbt_rec_t *r) 1866 xfs_bmbt_rec_host_t *r)
1866{ 1867{
1867 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21)); 1868 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21));
1868} 1869}
@@ -1872,7 +1873,7 @@ xfs_bmbt_get_blockcount(
1872 */ 1873 */
1873xfs_fsblock_t 1874xfs_fsblock_t
1874xfs_bmbt_get_startblock( 1875xfs_bmbt_get_startblock(
1875 xfs_bmbt_rec_t *r) 1876 xfs_bmbt_rec_host_t *r)
1876{ 1877{
1877#if XFS_BIG_BLKNOS 1878#if XFS_BIG_BLKNOS
1878 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) | 1879 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) |
@@ -1896,7 +1897,7 @@ xfs_bmbt_get_startblock(
1896 */ 1897 */
1897xfs_fileoff_t 1898xfs_fileoff_t
1898xfs_bmbt_get_startoff( 1899xfs_bmbt_get_startoff(
1899 xfs_bmbt_rec_t *r) 1900 xfs_bmbt_rec_host_t *r)
1900{ 1901{
1901 return ((xfs_fileoff_t)r->l0 & 1902 return ((xfs_fileoff_t)r->l0 &
1902 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 1903 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
@@ -1904,7 +1905,7 @@ xfs_bmbt_get_startoff(
1904 1905
1905xfs_exntst_t 1906xfs_exntst_t
1906xfs_bmbt_get_state( 1907xfs_bmbt_get_state(
1907 xfs_bmbt_rec_t *r) 1908 xfs_bmbt_rec_host_t *r)
1908{ 1909{
1909 int ext_flag; 1910 int ext_flag;
1910 1911
@@ -2294,7 +2295,7 @@ xfs_bmbt_newroot(
2294 */ 2295 */
2295void 2296void
2296xfs_bmbt_set_all( 2297xfs_bmbt_set_all(
2297 xfs_bmbt_rec_t *r, 2298 xfs_bmbt_rec_host_t *r,
2298 xfs_bmbt_irec_t *s) 2299 xfs_bmbt_irec_t *s)
2299{ 2300{
2300 int extent_flag; 2301 int extent_flag;
@@ -2336,7 +2337,7 @@ xfs_bmbt_set_all(
2336 */ 2337 */
2337void 2338void
2338xfs_bmbt_set_allf( 2339xfs_bmbt_set_allf(
2339 xfs_bmbt_rec_t *r, 2340 xfs_bmbt_rec_host_t *r,
2340 xfs_fileoff_t o, 2341 xfs_fileoff_t o,
2341 xfs_fsblock_t b, 2342 xfs_fsblock_t b,
2342 xfs_filblks_t c, 2343 xfs_filblks_t c,
@@ -2468,7 +2469,7 @@ xfs_bmbt_disk_set_allf(
2468 */ 2469 */
2469void 2470void
2470xfs_bmbt_set_blockcount( 2471xfs_bmbt_set_blockcount(
2471 xfs_bmbt_rec_t *r, 2472 xfs_bmbt_rec_host_t *r,
2472 xfs_filblks_t v) 2473 xfs_filblks_t v)
2473{ 2474{
2474 ASSERT((v & XFS_MASK64HI(43)) == 0); 2475 ASSERT((v & XFS_MASK64HI(43)) == 0);
@@ -2481,7 +2482,7 @@ xfs_bmbt_set_blockcount(
2481 */ 2482 */
2482void 2483void
2483xfs_bmbt_set_startblock( 2484xfs_bmbt_set_startblock(
2484 xfs_bmbt_rec_t *r, 2485 xfs_bmbt_rec_host_t *r,
2485 xfs_fsblock_t v) 2486 xfs_fsblock_t v)
2486{ 2487{
2487#if XFS_BIG_BLKNOS 2488#if XFS_BIG_BLKNOS
@@ -2509,7 +2510,7 @@ xfs_bmbt_set_startblock(
2509 */ 2510 */
2510void 2511void
2511xfs_bmbt_set_startoff( 2512xfs_bmbt_set_startoff(
2512 xfs_bmbt_rec_t *r, 2513 xfs_bmbt_rec_host_t *r,
2513 xfs_fileoff_t v) 2514 xfs_fileoff_t v)
2514{ 2515{
2515 ASSERT((v & XFS_MASK64HI(9)) == 0); 2516 ASSERT((v & XFS_MASK64HI(9)) == 0);
@@ -2523,7 +2524,7 @@ xfs_bmbt_set_startoff(
2523 */ 2524 */
2524void 2525void
2525xfs_bmbt_set_state( 2526xfs_bmbt_set_state(
2526 xfs_bmbt_rec_t *r, 2527 xfs_bmbt_rec_host_t *r,
2527 xfs_exntst_t v) 2528 xfs_exntst_t v)
2528{ 2529{
2529 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN); 2530 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN);
@@ -2624,10 +2625,8 @@ xfs_check_nostate_extents(
2624 xfs_extnum_t idx, 2625 xfs_extnum_t idx,
2625 xfs_extnum_t num) 2626 xfs_extnum_t num)
2626{ 2627{
2627 xfs_bmbt_rec_t *ep;
2628
2629 for (; num > 0; num--, idx++) { 2628 for (; num > 0; num--, idx++) {
2630 ep = xfs_iext_get_ext(ifp, idx); 2629 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx);
2631 if ((ep->l0 >> 2630 if ((ep->l0 >>
2632 (64 - BMBT_EXNTFLAG_BITLEN)) != 0) { 2631 (64 - BMBT_EXNTFLAG_BITLEN)) != 0) {
2633 ASSERT(0); 2632 ASSERT(0);