diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_bmap.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_btree.c | 28 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_btree.h | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 12 |
4 files changed, 18 insertions, 43 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index bbef39432be2..9abe93cfb5cc 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -3492,8 +3492,8 @@ xfs_bmap_extents_to_btree( | |||
3492 | for (cnt = i = 0; i < nextents; i++) { | 3492 | for (cnt = i = 0; i < nextents; i++) { |
3493 | ep = xfs_iext_get_ext(ifp, i); | 3493 | ep = xfs_iext_get_ext(ifp, i); |
3494 | if (!ISNULLSTARTBLOCK(xfs_bmbt_get_startblock(ep))) { | 3494 | if (!ISNULLSTARTBLOCK(xfs_bmbt_get_startblock(ep))) { |
3495 | arp->l0 = INT_GET(ep->l0, ARCH_CONVERT); | 3495 | arp->l0 = cpu_to_be64(ep->l0); |
3496 | arp->l1 = INT_GET(ep->l1, ARCH_CONVERT); | 3496 | arp->l1 = cpu_to_be64(ep->l1); |
3497 | arp++; cnt++; | 3497 | arp++; cnt++; |
3498 | } | 3498 | } |
3499 | } | 3499 | } |
@@ -4566,8 +4566,8 @@ xfs_bmap_read_extents( | |||
4566 | start = i; | 4566 | start = i; |
4567 | for (j = 0; j < num_recs; j++, i++, frp++) { | 4567 | for (j = 0; j < num_recs; j++, i++, frp++) { |
4568 | xfs_bmbt_rec_host_t *trp = xfs_iext_get_ext(ifp, i); | 4568 | xfs_bmbt_rec_host_t *trp = xfs_iext_get_ext(ifp, i); |
4569 | trp->l0 = INT_GET(frp->l0, ARCH_CONVERT); | 4569 | trp->l0 = be64_to_cpu(frp->l0); |
4570 | trp->l1 = INT_GET(frp->l1, ARCH_CONVERT); | 4570 | trp->l1 = be64_to_cpu(frp->l1); |
4571 | } | 4571 | } |
4572 | if (exntf == XFS_EXTFMT_NOSTATE) { | 4572 | if (exntf == XFS_EXTFMT_NOSTATE) { |
4573 | /* | 4573 | /* |
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 */ |
1919 | void | 1918 | void |
1920 | xfs_bmbt_disk_get_all( | 1919 | xfs_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 | |||
1936 | xfs_bmbt_disk_get_blockcount( | 1930 | xfs_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 | |||
1946 | xfs_bmbt_disk_get_startoff( | 1940 | xfs_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. |
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h index 92b08b0bd6c2..2d950e975918 100644 --- a/fs/xfs/xfs_bmap_btree.h +++ b/fs/xfs/xfs_bmap_btree.h | |||
@@ -54,7 +54,7 @@ typedef struct xfs_bmbt_rec_32 | |||
54 | } xfs_bmbt_rec_32_t; | 54 | } xfs_bmbt_rec_32_t; |
55 | typedef struct xfs_bmbt_rec_64 | 55 | typedef struct xfs_bmbt_rec_64 |
56 | { | 56 | { |
57 | __uint64_t l0, l1; | 57 | __be64 l0, l1; |
58 | } xfs_bmbt_rec_64_t; | 58 | } xfs_bmbt_rec_64_t; |
59 | 59 | ||
60 | typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ | 60 | typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ |
@@ -264,15 +264,9 @@ extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); | |||
264 | extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_host_t *r); | 264 | extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_host_t *r); |
265 | extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_host_t *r); | 265 | extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_host_t *r); |
266 | 266 | ||
267 | #ifndef XFS_NATIVE_HOST | ||
268 | extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | 267 | extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
269 | extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); | 268 | extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); |
270 | extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); | 269 | extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); |
271 | #else | ||
272 | #define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s) | ||
273 | #define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r) | ||
274 | #define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r) | ||
275 | #endif /* XFS_NATIVE_HOST */ | ||
276 | 270 | ||
277 | extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *); | 271 | extern int xfs_bmbt_increment(struct xfs_btree_cur *, int, int *); |
278 | extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *); | 272 | extern int xfs_bmbt_insert(struct xfs_btree_cur *, int *); |
@@ -298,14 +292,9 @@ extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v); | |||
298 | extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v); | 292 | extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v); |
299 | extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v); | 293 | extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v); |
300 | 294 | ||
301 | #ifndef XFS_NATIVE_HOST | ||
302 | extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | 295 | extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); |
303 | extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, | 296 | extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, |
304 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); | 297 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); |
305 | #else | ||
306 | #define xfs_bmbt_disk_set_all(r, s) xfs_bmbt_set_all(r, s) | ||
307 | #define xfs_bmbt_disk_set_allf(r, o, b, c, v) xfs_bmbt_set_allf(r, o, b, c, v) | ||
308 | #endif /* XFS_NATIVE_HOST */ | ||
309 | 298 | ||
310 | extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int); | 299 | extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int); |
311 | extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t, | 300 | extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t, |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ef8c31a14c92..cebcfcc06a93 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -634,10 +634,8 @@ xfs_iformat_extents( | |||
634 | xfs_validate_extents(ifp, nex, XFS_EXTFMT_INODE(ip)); | 634 | xfs_validate_extents(ifp, nex, XFS_EXTFMT_INODE(ip)); |
635 | for (i = 0; i < nex; i++, dp++) { | 635 | for (i = 0; i < nex; i++, dp++) { |
636 | xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i); | 636 | xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i); |
637 | ep->l0 = INT_GET(get_unaligned((__uint64_t*)&dp->l0), | 637 | ep->l0 = be64_to_cpu(get_unaligned(&dp->l0)); |
638 | ARCH_CONVERT); | 638 | ep->l1 = be64_to_cpu(get_unaligned(&dp->l1)); |
639 | ep->l1 = INT_GET(get_unaligned((__uint64_t*)&dp->l1), | ||
640 | ARCH_CONVERT); | ||
641 | } | 639 | } |
642 | XFS_BMAP_TRACE_EXLIST(ip, nex, whichfork); | 640 | XFS_BMAP_TRACE_EXLIST(ip, nex, whichfork); |
643 | if (whichfork != XFS_DATA_FORK || | 641 | if (whichfork != XFS_DATA_FORK || |
@@ -2916,10 +2914,8 @@ xfs_iextents_copy( | |||
2916 | } | 2914 | } |
2917 | 2915 | ||
2918 | /* Translate to on disk format */ | 2916 | /* Translate to on disk format */ |
2919 | put_unaligned(INT_GET(ep->l0, ARCH_CONVERT), | 2917 | put_unaligned(cpu_to_be64(ep->l0), &dp->l0); |
2920 | (__uint64_t*)&dp->l0); | 2918 | put_unaligned(cpu_to_be64(ep->l1), &dp->l1); |
2921 | put_unaligned(INT_GET(ep->l1, ARCH_CONVERT), | ||
2922 | (__uint64_t*)&dp->l1); | ||
2923 | dp++; | 2919 | dp++; |
2924 | copied++; | 2920 | copied++; |
2925 | } | 2921 | } |