aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_btree.c6
-rw-r--r--fs/xfs/xfs_btree.h2
-rw-r--r--fs/xfs/xfs_ialloc.c6
-rw-r--r--fs/xfs/xfs_ialloc_btree.c38
-rw-r--r--fs/xfs/xfs_ialloc_btree.h19
-rw-r--r--fs/xfs/xfs_itable.c26
6 files changed, 51 insertions, 46 deletions
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index ee2255bd6562..ab6f615d32cb 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -170,7 +170,7 @@ xfs_btree_check_key(
170 170
171 k1 = ak1; 171 k1 = ak1;
172 k2 = ak2; 172 k2 = ak2;
173 ASSERT(INT_GET(k1->ir_startino, ARCH_CONVERT) < INT_GET(k2->ir_startino, ARCH_CONVERT)); 173 ASSERT(be32_to_cpu(k1->ir_startino) < be32_to_cpu(k2->ir_startino));
174 break; 174 break;
175 } 175 }
176 default: 176 default:
@@ -285,8 +285,8 @@ xfs_btree_check_rec(
285 285
286 r1 = ar1; 286 r1 = ar1;
287 r2 = ar2; 287 r2 = ar2;
288 ASSERT(INT_GET(r1->ir_startino, ARCH_CONVERT) + XFS_INODES_PER_CHUNK <= 288 ASSERT(be32_to_cpu(r1->ir_startino) + XFS_INODES_PER_CHUNK <=
289 INT_GET(r2->ir_startino, ARCH_CONVERT)); 289 be32_to_cpu(r2->ir_startino));
290 break; 290 break;
291 } 291 }
292 default: 292 default:
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h
index 44f1bd98064a..2ab156506aca 100644
--- a/fs/xfs/xfs_btree.h
+++ b/fs/xfs/xfs_btree.h
@@ -145,7 +145,7 @@ typedef struct xfs_btree_cur
145 union { 145 union {
146 xfs_alloc_rec_incore_t a; 146 xfs_alloc_rec_incore_t a;
147 xfs_bmbt_irec_t b; 147 xfs_bmbt_irec_t b;
148 xfs_inobt_rec_t i; 148 xfs_inobt_rec_incore_t i;
149 } bc_rec; /* current insert/search record value */ 149 } bc_rec; /* current insert/search record value */
150 struct xfs_buf *bc_bufs[XFS_BTREE_MAXLEVELS]; /* buf ptr per level */ 150 struct xfs_buf *bc_bufs[XFS_BTREE_MAXLEVELS]; /* buf ptr per level */
151 int bc_ptrs[XFS_BTREE_MAXLEVELS]; /* key/record # */ 151 int bc_ptrs[XFS_BTREE_MAXLEVELS]; /* key/record # */
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 33164a85aa9d..1a5e3ff33efd 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -529,10 +529,10 @@ xfs_dialloc(
529 int offset; /* index of inode in chunk */ 529 int offset; /* index of inode in chunk */
530 xfs_agino_t pagino; /* parent's a.g. relative inode # */ 530 xfs_agino_t pagino; /* parent's a.g. relative inode # */
531 xfs_agnumber_t pagno; /* parent's allocation group number */ 531 xfs_agnumber_t pagno; /* parent's allocation group number */
532 xfs_inobt_rec_t rec; /* inode allocation record */ 532 xfs_inobt_rec_incore_t rec; /* inode allocation record */
533 xfs_agnumber_t tagno; /* testing allocation group number */ 533 xfs_agnumber_t tagno; /* testing allocation group number */
534 xfs_btree_cur_t *tcur; /* temp cursor */ 534 xfs_btree_cur_t *tcur; /* temp cursor */
535 xfs_inobt_rec_t trec; /* temp inode allocation record */ 535 xfs_inobt_rec_incore_t trec; /* temp inode allocation record */
536 536
537 537
538 if (*IO_agbp == NULL) { 538 if (*IO_agbp == NULL) {
@@ -945,7 +945,7 @@ xfs_difree(
945 int ilen; /* inodes in an inode cluster */ 945 int ilen; /* inodes in an inode cluster */
946 xfs_mount_t *mp; /* mount structure for filesystem */ 946 xfs_mount_t *mp; /* mount structure for filesystem */
947 int off; /* offset of inode in inode chunk */ 947 int off; /* offset of inode in inode chunk */
948 xfs_inobt_rec_t rec; /* btree record */ 948 xfs_inobt_rec_incore_t rec; /* btree record */
949 949
950 mp = tp->t_mountp; 950 mp = tp->t_mountp;
951 951
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c
index 616eeeb6953e..c848141c597d 100644
--- a/fs/xfs/xfs_ialloc_btree.c
+++ b/fs/xfs/xfs_ialloc_btree.c
@@ -568,7 +568,7 @@ xfs_inobt_insrec(
568 /* 568 /*
569 * Make a key out of the record data to be inserted, and save it. 569 * Make a key out of the record data to be inserted, and save it.
570 */ 570 */
571 key.ir_startino = recp->ir_startino; /* INT_: direct copy */ 571 key.ir_startino = recp->ir_startino;
572 optr = ptr = cur->bc_ptrs[level]; 572 optr = ptr = cur->bc_ptrs[level];
573 /* 573 /*
574 * If we're off the left edge, return failure. 574 * If we're off the left edge, return failure.
@@ -641,7 +641,7 @@ xfs_inobt_insrec(
641 return error; 641 return error;
642#endif 642#endif
643 ptr = cur->bc_ptrs[level]; 643 ptr = cur->bc_ptrs[level];
644 nrec.ir_startino = nkey.ir_startino; /* INT_: direct copy */ 644 nrec.ir_startino = nkey.ir_startino;
645 } else { 645 } else {
646 /* 646 /*
647 * Otherwise the insert fails. 647 * Otherwise the insert fails.
@@ -950,12 +950,12 @@ xfs_inobt_lookup(
950 xfs_inobt_key_t *kkp; 950 xfs_inobt_key_t *kkp;
951 951
952 kkp = kkbase + keyno - 1; 952 kkp = kkbase + keyno - 1;
953 startino = INT_GET(kkp->ir_startino, ARCH_CONVERT); 953 startino = be32_to_cpu(kkp->ir_startino);
954 } else { 954 } else {
955 xfs_inobt_rec_t *krp; 955 xfs_inobt_rec_t *krp;
956 956
957 krp = krbase + keyno - 1; 957 krp = krbase + keyno - 1;
958 startino = INT_GET(krp->ir_startino, ARCH_CONVERT); 958 startino = be32_to_cpu(krp->ir_startino);
959 } 959 }
960 /* 960 /*
961 * Compute difference to get next direction. 961 * Compute difference to get next direction.
@@ -1160,7 +1160,7 @@ xfs_inobt_lshift(
1160 } else { 1160 } else {
1161 memmove(rrp, rrp + 1, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp)); 1161 memmove(rrp, rrp + 1, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1162 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs)); 1162 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1163 key.ir_startino = rrp->ir_startino; /* INT_: direct copy */ 1163 key.ir_startino = rrp->ir_startino;
1164 rkp = &key; 1164 rkp = &key;
1165 } 1165 }
1166 /* 1166 /*
@@ -1301,9 +1301,9 @@ xfs_inobt_newroot(
1301 kp[1] = *XFS_INOBT_KEY_ADDR(right, 1, cur); /* INT_: struct copy */ 1301 kp[1] = *XFS_INOBT_KEY_ADDR(right, 1, cur); /* INT_: struct copy */
1302 } else { 1302 } else {
1303 rp = XFS_INOBT_REC_ADDR(left, 1, cur); 1303 rp = XFS_INOBT_REC_ADDR(left, 1, cur);
1304 INT_COPY(kp[0].ir_startino, rp->ir_startino, ARCH_CONVERT); 1304 kp[0].ir_startino = rp->ir_startino;
1305 rp = XFS_INOBT_REC_ADDR(right, 1, cur); 1305 rp = XFS_INOBT_REC_ADDR(right, 1, cur);
1306 INT_COPY(kp[1].ir_startino, rp->ir_startino, ARCH_CONVERT); 1306 kp[1].ir_startino = rp->ir_startino;
1307 } 1307 }
1308 xfs_inobt_log_keys(cur, nbp, 1, 2); 1308 xfs_inobt_log_keys(cur, nbp, 1, 2);
1309 /* 1309 /*
@@ -1420,7 +1420,7 @@ xfs_inobt_rshift(
1420 memmove(rrp + 1, rrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp)); 1420 memmove(rrp + 1, rrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1421 *rrp = *lrp; 1421 *rrp = *lrp;
1422 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1); 1422 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
1423 key.ir_startino = rrp->ir_startino; /* INT_: direct copy */ 1423 key.ir_startino = rrp->ir_startino;
1424 rkp = &key; 1424 rkp = &key;
1425 } 1425 }
1426 /* 1426 /*
@@ -1559,7 +1559,7 @@ xfs_inobt_split(
1559 rrp = XFS_INOBT_REC_ADDR(right, 1, cur); 1559 rrp = XFS_INOBT_REC_ADDR(right, 1, cur);
1560 memcpy(rrp, lrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp)); 1560 memcpy(rrp, lrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
1561 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs)); 1561 xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
1562 keyp->ir_startino = rrp->ir_startino; /* INT_: direct copy */ 1562 keyp->ir_startino = rrp->ir_startino;
1563 } 1563 }
1564 /* 1564 /*
1565 * Find the left block number by looking in the buffer. 1565 * Find the left block number by looking in the buffer.
@@ -1813,9 +1813,9 @@ xfs_inobt_get_rec(
1813 * Point to the record and extract its data. 1813 * Point to the record and extract its data.
1814 */ 1814 */
1815 rec = XFS_INOBT_REC_ADDR(block, ptr, cur); 1815 rec = XFS_INOBT_REC_ADDR(block, ptr, cur);
1816 *ino = INT_GET(rec->ir_startino, ARCH_CONVERT); 1816 *ino = be32_to_cpu(rec->ir_startino);
1817 *fcnt = INT_GET(rec->ir_freecount, ARCH_CONVERT); 1817 *fcnt = be32_to_cpu(rec->ir_freecount);
1818 *free = INT_GET(rec->ir_free, ARCH_CONVERT); 1818 *free = be64_to_cpu(rec->ir_free);
1819 *stat = 1; 1819 *stat = 1;
1820 return 0; 1820 return 0;
1821} 1821}
@@ -1930,9 +1930,9 @@ xfs_inobt_insert(
1930 1930
1931 level = 0; 1931 level = 0;
1932 nbno = NULLAGBLOCK; 1932 nbno = NULLAGBLOCK;
1933 INT_SET(nrec.ir_startino, ARCH_CONVERT, cur->bc_rec.i.ir_startino); 1933 nrec.ir_startino = cpu_to_be32(cur->bc_rec.i.ir_startino);
1934 INT_SET(nrec.ir_freecount, ARCH_CONVERT, cur->bc_rec.i.ir_freecount); 1934 nrec.ir_freecount = cpu_to_be32(cur->bc_rec.i.ir_freecount);
1935 INT_SET(nrec.ir_free, ARCH_CONVERT, cur->bc_rec.i.ir_free); 1935 nrec.ir_free = cpu_to_be64(cur->bc_rec.i.ir_free);
1936 ncur = (xfs_btree_cur_t *)0; 1936 ncur = (xfs_btree_cur_t *)0;
1937 pcur = cur; 1937 pcur = cur;
1938 /* 1938 /*
@@ -2060,9 +2060,9 @@ xfs_inobt_update(
2060 /* 2060 /*
2061 * Fill in the new contents and log them. 2061 * Fill in the new contents and log them.
2062 */ 2062 */
2063 INT_SET(rp->ir_startino, ARCH_CONVERT, ino); 2063 rp->ir_startino = cpu_to_be32(ino);
2064 INT_SET(rp->ir_freecount, ARCH_CONVERT, fcnt); 2064 rp->ir_freecount = cpu_to_be32(fcnt);
2065 INT_SET(rp->ir_free, ARCH_CONVERT, free); 2065 rp->ir_free = cpu_to_be64(free);
2066 xfs_inobt_log_recs(cur, bp, ptr, ptr); 2066 xfs_inobt_log_recs(cur, bp, ptr, ptr);
2067 /* 2067 /*
2068 * Updating first record in leaf. Pass new key value up to our parent. 2068 * Updating first record in leaf. Pass new key value up to our parent.
@@ -2070,7 +2070,7 @@ xfs_inobt_update(
2070 if (ptr == 1) { 2070 if (ptr == 1) {
2071 xfs_inobt_key_t key; /* key containing [ino] */ 2071 xfs_inobt_key_t key; /* key containing [ino] */
2072 2072
2073 INT_SET(key.ir_startino, ARCH_CONVERT, ino); 2073 key.ir_startino = cpu_to_be32(ino);
2074 if ((error = xfs_inobt_updkey(cur, &key, 1))) 2074 if ((error = xfs_inobt_updkey(cur, &key, 1)))
2075 return error; 2075 return error;
2076 } 2076 }
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h
index ae3904cb1ee8..2c0e49893ff7 100644
--- a/fs/xfs/xfs_ialloc_btree.h
+++ b/fs/xfs/xfs_ialloc_btree.h
@@ -47,19 +47,24 @@ static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
47/* 47/*
48 * Data record structure 48 * Data record structure
49 */ 49 */
50typedef struct xfs_inobt_rec 50typedef struct xfs_inobt_rec {
51{ 51 __be32 ir_startino; /* starting inode number */
52 __be32 ir_freecount; /* count of free inodes (set bits) */
53 __be64 ir_free; /* free inode mask */
54} xfs_inobt_rec_t;
55
56typedef struct xfs_inobt_rec_incore {
52 xfs_agino_t ir_startino; /* starting inode number */ 57 xfs_agino_t ir_startino; /* starting inode number */
53 __int32_t ir_freecount; /* count of free inodes (set bits) */ 58 __int32_t ir_freecount; /* count of free inodes (set bits) */
54 xfs_inofree_t ir_free; /* free inode mask */ 59 xfs_inofree_t ir_free; /* free inode mask */
55} xfs_inobt_rec_t; 60} xfs_inobt_rec_incore_t;
61
56 62
57/* 63/*
58 * Key structure 64 * Key structure
59 */ 65 */
60typedef struct xfs_inobt_key 66typedef struct xfs_inobt_key {
61{ 67 __be32 ir_startino; /* starting inode number */
62 xfs_agino_t ir_startino; /* starting inode number */
63} xfs_inobt_key_t; 68} xfs_inobt_key_t;
64 69
65/* btree pointer type */ 70/* btree pointer type */
@@ -77,7 +82,7 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t;
77#define XFS_INOBT_IS_FREE(rp,i) \ 82#define XFS_INOBT_IS_FREE(rp,i) \
78 (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0) 83 (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
79#define XFS_INOBT_IS_FREE_DISK(rp,i) \ 84#define XFS_INOBT_IS_FREE_DISK(rp,i) \
80 ((INT_GET((rp)->ir_free,ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0) 85 ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
81#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i)) 86#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i))
82#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) 87#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i))
83 88
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 46249e4d1fea..7521f301ee58 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -395,9 +395,9 @@ xfs_bulkstat(
395 gcnt++; 395 gcnt++;
396 } 396 }
397 gfree |= XFS_INOBT_MASKN(0, chunkidx); 397 gfree |= XFS_INOBT_MASKN(0, chunkidx);
398 INT_SET(irbp->ir_startino, ARCH_CONVERT, gino); 398 irbp->ir_startino = cpu_to_be32(gino);
399 INT_SET(irbp->ir_freecount, ARCH_CONVERT, gcnt); 399 irbp->ir_freecount = cpu_to_be32(gcnt);
400 INT_SET(irbp->ir_free, ARCH_CONVERT, gfree); 400 irbp->ir_free = cpu_to_be64(gfree);
401 irbp++; 401 irbp++;
402 agino = gino + XFS_INODES_PER_CHUNK; 402 agino = gino + XFS_INODES_PER_CHUNK;
403 icount = XFS_INODES_PER_CHUNK - gcnt; 403 icount = XFS_INODES_PER_CHUNK - gcnt;
@@ -453,9 +453,9 @@ xfs_bulkstat(
453 * If this chunk has any allocated inodes, save it. 453 * If this chunk has any allocated inodes, save it.
454 */ 454 */
455 if (gcnt < XFS_INODES_PER_CHUNK) { 455 if (gcnt < XFS_INODES_PER_CHUNK) {
456 INT_SET(irbp->ir_startino, ARCH_CONVERT, gino); 456 irbp->ir_startino = cpu_to_be32(gino);
457 INT_SET(irbp->ir_freecount, ARCH_CONVERT, gcnt); 457 irbp->ir_freecount = cpu_to_be32(gcnt);
458 INT_SET(irbp->ir_free, ARCH_CONVERT, gfree); 458 irbp->ir_free = cpu_to_be64(gfree);
459 irbp++; 459 irbp++;
460 icount += XFS_INODES_PER_CHUNK - gcnt; 460 icount += XFS_INODES_PER_CHUNK - gcnt;
461 } 461 }
@@ -488,14 +488,14 @@ xfs_bulkstat(
488 * inodes in that cluster. 488 * inodes in that cluster.
489 */ 489 */
490 for (agbno = XFS_AGINO_TO_AGBNO(mp, 490 for (agbno = XFS_AGINO_TO_AGBNO(mp,
491 INT_GET(irbp[1].ir_startino, ARCH_CONVERT)), 491 be32_to_cpu(irbp[1].ir_startino)),
492 chunkidx = 0; 492 chunkidx = 0;
493 chunkidx < XFS_INODES_PER_CHUNK; 493 chunkidx < XFS_INODES_PER_CHUNK;
494 chunkidx += nicluster, 494 chunkidx += nicluster,
495 agbno += nbcluster) { 495 agbno += nbcluster) {
496 if (XFS_INOBT_MASKN(chunkidx, 496 if (XFS_INOBT_MASKN(chunkidx,
497 nicluster) & 497 nicluster) &
498 ~(INT_GET(irbp[1].ir_free, ARCH_CONVERT))) 498 ~(be64_to_cpu(irbp[1].ir_free)))
499 xfs_btree_reada_bufs(mp, agno, 499 xfs_btree_reada_bufs(mp, agno,
500 agbno, nbcluster); 500 agbno, nbcluster);
501 } 501 }
@@ -503,9 +503,9 @@ xfs_bulkstat(
503 /* 503 /*
504 * Now process this chunk of inodes. 504 * Now process this chunk of inodes.
505 */ 505 */
506 for (agino = INT_GET(irbp->ir_startino, ARCH_CONVERT), chunkidx = 0, clustidx = 0; 506 for (agino = be32_to_cpu(irbp->ir_startino), chunkidx = 0, clustidx = 0;
507 ubleft > 0 && 507 ubleft > 0 &&
508 INT_GET(irbp->ir_freecount, ARCH_CONVERT) < XFS_INODES_PER_CHUNK; 508 be32_to_cpu(irbp->ir_freecount) < XFS_INODES_PER_CHUNK;
509 chunkidx++, clustidx++, agino++) { 509 chunkidx++, clustidx++, agino++) {
510 ASSERT(chunkidx < XFS_INODES_PER_CHUNK); 510 ASSERT(chunkidx < XFS_INODES_PER_CHUNK);
511 /* 511 /*
@@ -525,7 +525,7 @@ xfs_bulkstat(
525 */ 525 */
526 if ((chunkidx & (nicluster - 1)) == 0) { 526 if ((chunkidx & (nicluster - 1)) == 0) {
527 agbno = XFS_AGINO_TO_AGBNO(mp, 527 agbno = XFS_AGINO_TO_AGBNO(mp,
528 INT_GET(irbp->ir_startino, ARCH_CONVERT)) + 528 be32_to_cpu(irbp->ir_startino)) +
529 ((chunkidx & nimask) >> 529 ((chunkidx & nimask) >>
530 mp->m_sb.sb_inopblog); 530 mp->m_sb.sb_inopblog);
531 531
@@ -564,13 +564,13 @@ xfs_bulkstat(
564 /* 564 /*
565 * Skip if this inode is free. 565 * Skip if this inode is free.
566 */ 566 */
567 if (XFS_INOBT_MASK(chunkidx) & INT_GET(irbp->ir_free, ARCH_CONVERT)) 567 if (XFS_INOBT_MASK(chunkidx) & be64_to_cpu(irbp->ir_free))
568 continue; 568 continue;
569 /* 569 /*
570 * Count used inodes as free so we can tell 570 * Count used inodes as free so we can tell
571 * when the chunk is used up. 571 * when the chunk is used up.
572 */ 572 */
573 INT_MOD(irbp->ir_freecount, ARCH_CONVERT, +1); 573 be32_add(&irbp->ir_freecount, 1);
574 ino = XFS_AGINO_TO_INO(mp, agno, agino); 574 ino = XFS_AGINO_TO_INO(mp, agno, agino);
575 bno = XFS_AGB_TO_DADDR(mp, agno, agbno); 575 bno = XFS_AGB_TO_DADDR(mp, agno, agbno);
576 if (flags & BULKSTAT_FG_QUICK) { 576 if (flags & BULKSTAT_FG_QUICK) {