aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-16 02:24:15 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-15 02:26:44 -0400
commitcd8b0a97bd9216578a44a9bf82188cd901295964 (patch)
tree36ae580e2f8b1e05747a387c50b852db7f929798 /fs/xfs/xfs_bmap_btree.c
parente05596643d4bb5ab7d813d1ac5724178ca4c7134 (diff)
[XFS] endianess annotations for xfs_bmbt_rec_t
SGI-PV: 968563 SGI-Modid: xfs-linux-melb:xfs-kern:29321a 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.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index abe35553969b..41092a2ea917 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -1914,19 +1914,13 @@ xfs_bmbt_get_state(
1914 ext_flag); 1914 ext_flag);
1915} 1915}
1916 1916
1917#ifndef XFS_NATIVE_HOST
1918/* Endian flipping versions of the bmbt extraction functions */ 1917/* Endian flipping versions of the bmbt extraction functions */
1919void 1918void
1920xfs_bmbt_disk_get_all( 1919xfs_bmbt_disk_get_all(
1921 xfs_bmbt_rec_t *r, 1920 xfs_bmbt_rec_t *r,
1922 xfs_bmbt_irec_t *s) 1921 xfs_bmbt_irec_t *s)
1923{ 1922{
1924 __uint64_t l0, l1; 1923 __xfs_bmbt_get_all(be64_to_cpu(r->l0), be64_to_cpu(r->l1), s);
1925
1926 l0 = INT_GET(r->l0, ARCH_CONVERT);
1927 l1 = INT_GET(r->l1, ARCH_CONVERT);
1928
1929 __xfs_bmbt_get_all(l0, l1, s);
1930} 1924}
1931 1925
1932/* 1926/*
@@ -1936,7 +1930,7 @@ xfs_filblks_t
1936xfs_bmbt_disk_get_blockcount( 1930xfs_bmbt_disk_get_blockcount(
1937 xfs_bmbt_rec_t *r) 1931 xfs_bmbt_rec_t *r)
1938{ 1932{
1939 return (xfs_filblks_t)(INT_GET(r->l1, ARCH_CONVERT) & XFS_MASK64LO(21)); 1933 return (xfs_filblks_t)(be64_to_cpu(r->l1) & XFS_MASK64LO(21));
1940} 1934}
1941 1935
1942/* 1936/*
@@ -1946,11 +1940,9 @@ xfs_fileoff_t
1946xfs_bmbt_disk_get_startoff( 1940xfs_bmbt_disk_get_startoff(
1947 xfs_bmbt_rec_t *r) 1941 xfs_bmbt_rec_t *r)
1948{ 1942{
1949 return ((xfs_fileoff_t)INT_GET(r->l0, ARCH_CONVERT) & 1943 return ((xfs_fileoff_t)be64_to_cpu(r->l0) &
1950 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 1944 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
1951} 1945}
1952#endif /* XFS_NATIVE_HOST */
1953
1954 1946
1955/* 1947/*
1956 * Increment cursor by one record at the level. 1948 * Increment cursor by one record at the level.
@@ -2348,7 +2340,6 @@ xfs_bmbt_set_all(
2348} 2340}
2349 2341
2350 2342
2351#ifndef XFS_NATIVE_HOST
2352/* 2343/*
2353 * Set all the fields in a disk format bmap extent record from the arguments. 2344 * Set all the fields in a disk format bmap extent record from the arguments.
2354 */ 2345 */
@@ -2369,29 +2360,29 @@ xfs_bmbt_disk_set_allf(
2369#if XFS_BIG_BLKNOS 2360#if XFS_BIG_BLKNOS
2370 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0); 2361 ASSERT((startblock & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
2371 2362
2372 INT_SET(r->l0, ARCH_CONVERT, 2363 r->l0 = cpu_to_be64(
2373 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2364 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2374 ((xfs_bmbt_rec_base_t)startoff << 9) | 2365 ((xfs_bmbt_rec_base_t)startoff << 9) |
2375 ((xfs_bmbt_rec_base_t)startblock >> 43)); 2366 ((xfs_bmbt_rec_base_t)startblock >> 43));
2376 INT_SET(r->l1, ARCH_CONVERT, 2367 r->l1 = cpu_to_be64(
2377 ((xfs_bmbt_rec_base_t)startblock << 21) | 2368 ((xfs_bmbt_rec_base_t)startblock << 21) |
2378 ((xfs_bmbt_rec_base_t)blockcount & 2369 ((xfs_bmbt_rec_base_t)blockcount &
2379 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 2370 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2380#else /* !XFS_BIG_BLKNOS */ 2371#else /* !XFS_BIG_BLKNOS */
2381 if (ISNULLSTARTBLOCK(b)) { 2372 if (ISNULLSTARTBLOCK(b)) {
2382 INT_SET(r->l0, ARCH_CONVERT, 2373 r->l0 = cpu_to_be64(
2383 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2374 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2384 ((xfs_bmbt_rec_base_t)startoff << 9) | 2375 ((xfs_bmbt_rec_base_t)startoff << 9) |
2385 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9)); 2376 (xfs_bmbt_rec_base_t)XFS_MASK64LO(9));
2386 INT_SET(r->l1, ARCH_CONVERT, XFS_MASK64HI(11) | 2377 r->l1 = cpu_to_be64(XFS_MASK64HI(11) |
2387 ((xfs_bmbt_rec_base_t)startblock << 21) | 2378 ((xfs_bmbt_rec_base_t)startblock << 21) |
2388 ((xfs_bmbt_rec_base_t)blockcount & 2379 ((xfs_bmbt_rec_base_t)blockcount &
2389 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 2380 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
2390 } else { 2381 } else {
2391 INT_SET(r->l0, ARCH_CONVERT, 2382 r->l0 = cpu_to_be64(
2392 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 2383 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
2393 ((xfs_bmbt_rec_base_t)startoff << 9)); 2384 ((xfs_bmbt_rec_base_t)startoff << 9));
2394 INT_SET(r->l1, ARCH_CONVERT, 2385 r->l1 = cpu_to_be64(
2395 ((xfs_bmbt_rec_base_t)startblock << 21) | 2386 ((xfs_bmbt_rec_base_t)startblock << 21) |
2396 ((xfs_bmbt_rec_base_t)blockcount & 2387 ((xfs_bmbt_rec_base_t)blockcount &
2397 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21))); 2388 (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
@@ -2410,7 +2401,6 @@ xfs_bmbt_disk_set_all(
2410 xfs_bmbt_disk_set_allf(r, s->br_startoff, s->br_startblock, 2401 xfs_bmbt_disk_set_allf(r, s->br_startoff, s->br_startblock,
2411 s->br_blockcount, s->br_state); 2402 s->br_blockcount, s->br_state);
2412} 2403}
2413#endif /* XFS_NATIVE_HOST */
2414 2404
2415/* 2405/*
2416 * Set the blockcount field in a bmap extent record. 2406 * Set the blockcount field in a bmap extent record.