xfs: require 64-bit sector_t
authorChristoph Hellwig <hch@lst.de>
Tue, 29 Jul 2014 23:12:05 +0000 (09:12 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 29 Jul 2014 23:12:05 +0000 (09:12 +1000)
Trying to support tiny disks only and saving a bit memory might have
made sense on an SGI O2 15 years ago, but is pretty pointless today.

Remove the rarely tested codepath that uses various smaller in-memory
types to reduce our test matrix and make the codebase a little bit
smaller and less complicated.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
20 files changed:
fs/xfs/Kconfig
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_bmap_btree.c
fs/xfs/libxfs/xfs_btree.c
fs/xfs/libxfs/xfs_btree.h
fs/xfs/libxfs/xfs_da_btree.c
fs/xfs/libxfs/xfs_dir2_sf.c
fs/xfs/libxfs/xfs_format.h
fs/xfs/libxfs/xfs_inode_fork.c
fs/xfs/libxfs/xfs_inum.h
fs/xfs/libxfs/xfs_log_format.h
fs/xfs/libxfs/xfs_sb.h
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_fs.h
fs/xfs/xfs_linux.h
fs/xfs/xfs_mount.c
fs/xfs/xfs_rtalloc.c
fs/xfs/xfs_super.c
fs/xfs/xfs_super.h
fs/xfs/xfs_types.h

index 399e8ce..5d47b4d 100644 (file)
@@ -1,6 +1,7 @@
 config XFS_FS
        tristate "XFS filesystem support"
        depends on BLOCK
+       depends on (64BIT || LBDAF)
        select EXPORTFS
        select LIBCRC32C
        help
index 72a110e..224963b 100644 (file)
@@ -392,7 +392,7 @@ xfs_bmap_check_leaf_extents(
        pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes);
        bno = be64_to_cpu(*pp);
 
-       ASSERT(bno != NULLDFSBNO);
+       ASSERT(bno != NULLFSBLOCK);
        ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
        ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
 
@@ -1299,7 +1299,7 @@ xfs_bmap_read_extents(
        ASSERT(level > 0);
        pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes);
        bno = be64_to_cpu(*pp);
-       ASSERT(bno != NULLDFSBNO);
+       ASSERT(bno != NULLFSBLOCK);
        ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
        ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
        /*
@@ -1429,11 +1429,7 @@ xfs_bmap_search_multi_extents(
        gotp->br_startoff = 0xffa5a5a5a5a5a5a5LL;
        gotp->br_blockcount = 0xa55a5a5a5a5a5a5aLL;
        gotp->br_state = XFS_EXT_INVALID;
-#if XFS_BIG_BLKNOS
        gotp->br_startblock = 0xffffa5a5a5a5a5a5LL;
-#else
-       gotp->br_startblock = 0xffffa5a5;
-#endif
        prevp->br_startoff = NULLFILEOFF;
 
        ep = xfs_iext_bno_to_ext(ifp, bno, &lastx);
index a388de4..fba7533 100644 (file)
@@ -111,23 +111,8 @@ __xfs_bmbt_get_all(
        ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN));
        s->br_startoff = ((xfs_fileoff_t)l0 &
                           xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
-#if XFS_BIG_BLKNOS
        s->br_startblock = (((xfs_fsblock_t)l0 & xfs_mask64lo(9)) << 43) |
                           (((xfs_fsblock_t)l1) >> 21);
-#else
-#ifdef DEBUG
-       {
-               xfs_dfsbno_t    b;
-
-               b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) |
-                   (((xfs_dfsbno_t)l1) >> 21);
-               ASSERT((b >> 32) == 0 || isnulldstartblock(b));
-               s->br_startblock = (xfs_fsblock_t)b;
-       }
-#else  /* !DEBUG */
-       s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21);
-#endif /* DEBUG */
-#endif /* XFS_BIG_BLKNOS */
        s->br_blockcount = (xfs_filblks_t)(l1 & xfs_mask64lo(21));
        /* This is xfs_extent_state() in-line */
        if (ext_flag) {
@@ -163,21 +148,8 @@ xfs_fsblock_t
 xfs_bmbt_get_startblock(
        xfs_bmbt_rec_host_t     *r)
 {
-#if XFS_BIG_BLKNOS
        return (((xfs_fsblock_t)r->l0 & xfs_mask64lo(9)) << 43) |
               (((xfs_fsblock_t)r->l1) >> 21);
-#else
-#ifdef DEBUG
-       xfs_dfsbno_t    b;
-
-       b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) |
-           (((xfs_dfsbno_t)r->l1) >> 21);
-       ASSERT((b >> 32) == 0 || isnulldstartblock(b));
-       return (xfs_fsblock_t)b;
-#else  /* !DEBUG */
-       return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21);
-#endif /* DEBUG */
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -241,7 +213,6 @@ xfs_bmbt_set_allf(
        ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
        ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
 
-#if XFS_BIG_BLKNOS
        ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
 
        r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
@@ -250,23 +221,6 @@ xfs_bmbt_set_allf(
        r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
                ((xfs_bmbt_rec_base_t)blockcount &
                (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-#else  /* !XFS_BIG_BLKNOS */
-       if (isnullstartblock(startblock)) {
-               r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                       ((xfs_bmbt_rec_base_t)startoff << 9) |
-                        (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
-               r->l1 = xfs_mask64hi(11) |
-                         ((xfs_bmbt_rec_base_t)startblock << 21) |
-                         ((xfs_bmbt_rec_base_t)blockcount &
-                          (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       } else {
-               r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                       ((xfs_bmbt_rec_base_t)startoff << 9);
-               r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
-                        ((xfs_bmbt_rec_base_t)blockcount &
-                        (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       }
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -298,8 +252,6 @@ xfs_bmbt_disk_set_allf(
        ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
        ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
        ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
-
-#if XFS_BIG_BLKNOS
        ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
 
        r->l0 = cpu_to_be64(
@@ -310,26 +262,6 @@ xfs_bmbt_disk_set_allf(
                ((xfs_bmbt_rec_base_t)startblock << 21) |
                 ((xfs_bmbt_rec_base_t)blockcount &
                  (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
-#else  /* !XFS_BIG_BLKNOS */
-       if (isnullstartblock(startblock)) {
-               r->l0 = cpu_to_be64(
-                       ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                        ((xfs_bmbt_rec_base_t)startoff << 9) |
-                         (xfs_bmbt_rec_base_t)xfs_mask64lo(9));
-               r->l1 = cpu_to_be64(xfs_mask64hi(11) |
-                         ((xfs_bmbt_rec_base_t)startblock << 21) |
-                         ((xfs_bmbt_rec_base_t)blockcount &
-                          (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
-       } else {
-               r->l0 = cpu_to_be64(
-                       ((xfs_bmbt_rec_base_t)extent_flag << 63) |
-                        ((xfs_bmbt_rec_base_t)startoff << 9));
-               r->l1 = cpu_to_be64(
-                       ((xfs_bmbt_rec_base_t)startblock << 21) |
-                        ((xfs_bmbt_rec_base_t)blockcount &
-                         (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
-       }
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -365,24 +297,11 @@ xfs_bmbt_set_startblock(
        xfs_bmbt_rec_host_t *r,
        xfs_fsblock_t   v)
 {
-#if XFS_BIG_BLKNOS
        ASSERT((v & xfs_mask64hi(12)) == 0);
        r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64hi(55)) |
                  (xfs_bmbt_rec_base_t)(v >> 43);
        r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) |
                  (xfs_bmbt_rec_base_t)(v << 21);
-#else  /* !XFS_BIG_BLKNOS */
-       if (isnullstartblock(v)) {
-               r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
-               r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) |
-                         ((xfs_bmbt_rec_base_t)v << 21) |
-                         (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       } else {
-               r->l0 &= ~(xfs_bmbt_rec_base_t)xfs_mask64lo(9);
-               r->l1 = ((xfs_bmbt_rec_base_t)v << 21) |
-                         (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
-       }
-#endif /* XFS_BIG_BLKNOS */
 }
 
 /*
@@ -438,8 +357,8 @@ xfs_bmbt_to_bmdr(
                       cpu_to_be64(XFS_BUF_DADDR_NULL));
        } else
                ASSERT(rblock->bb_magic == cpu_to_be32(XFS_BMAP_MAGIC));
-       ASSERT(rblock->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO));
-       ASSERT(rblock->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO));
+       ASSERT(rblock->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK));
+       ASSERT(rblock->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK));
        ASSERT(rblock->bb_level != 0);
        dblock->bb_level = rblock->bb_level;
        dblock->bb_numrecs = rblock->bb_numrecs;
@@ -763,11 +682,11 @@ xfs_bmbt_verify(
 
        /* sibling pointer verification */
        if (!block->bb_u.l.bb_leftsib ||
-           (block->bb_u.l.bb_leftsib != cpu_to_be64(NULLDFSBNO) &&
+           (block->bb_u.l.bb_leftsib != cpu_to_be64(NULLFSBLOCK) &&
             !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_leftsib))))
                return false;
        if (!block->bb_u.l.bb_rightsib ||
-           (block->bb_u.l.bb_rightsib != cpu_to_be64(NULLDFSBNO) &&
+           (block->bb_u.l.bb_rightsib != cpu_to_be64(NULLFSBLOCK) &&
             !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_rightsib))))
                return false;
 
index 0097c42..2435928 100644 (file)
@@ -77,11 +77,11 @@ xfs_btree_check_lblock(
                be16_to_cpu(block->bb_numrecs) <=
                        cur->bc_ops->get_maxrecs(cur, level) &&
                block->bb_u.l.bb_leftsib &&
-               (block->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO) ||
+               (block->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK) ||
                 XFS_FSB_SANITY_CHECK(mp,
                        be64_to_cpu(block->bb_u.l.bb_leftsib))) &&
                block->bb_u.l.bb_rightsib &&
-               (block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO) ||
+               (block->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK) ||
                 XFS_FSB_SANITY_CHECK(mp,
                        be64_to_cpu(block->bb_u.l.bb_rightsib)));
 
@@ -166,12 +166,12 @@ xfs_btree_check_block(
 int                                    /* error (0 or EFSCORRUPTED) */
 xfs_btree_check_lptr(
        struct xfs_btree_cur    *cur,   /* btree cursor */
-       xfs_dfsbno_t            bno,    /* btree block disk address */
+       xfs_fsblock_t           bno,    /* btree block disk address */
        int                     level)  /* btree block level */
 {
        XFS_WANT_CORRUPTED_RETURN(
                level > 0 &&
-               bno != NULLDFSBNO &&
+               bno != NULLFSBLOCK &&
                XFS_FSB_SANITY_CHECK(cur->bc_mp, bno));
        return 0;
 }
@@ -594,7 +594,7 @@ xfs_btree_islastblock(
        block = xfs_btree_get_block(cur, level, &bp);
        xfs_btree_check_block(cur, block, level, bp);
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
-               return block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO);
+               return block->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK);
        else
                return block->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK);
 }
@@ -770,16 +770,16 @@ xfs_btree_readahead_lblock(
        struct xfs_btree_block  *block)
 {
        int                     rval = 0;
-       xfs_dfsbno_t            left = be64_to_cpu(block->bb_u.l.bb_leftsib);
-       xfs_dfsbno_t            right = be64_to_cpu(block->bb_u.l.bb_rightsib);
+       xfs_fsblock_t           left = be64_to_cpu(block->bb_u.l.bb_leftsib);
+       xfs_fsblock_t           right = be64_to_cpu(block->bb_u.l.bb_rightsib);
 
-       if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) {
+       if ((lr & XFS_BTCUR_LEFTRA) && left != NULLFSBLOCK) {
                xfs_btree_reada_bufl(cur->bc_mp, left, 1,
                                     cur->bc_ops->buf_ops);
                rval++;
        }
 
-       if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLDFSBNO) {
+       if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLFSBLOCK) {
                xfs_btree_reada_bufl(cur->bc_mp, right, 1,
                                     cur->bc_ops->buf_ops);
                rval++;
@@ -851,7 +851,7 @@ xfs_btree_ptr_to_daddr(
        union xfs_btree_ptr     *ptr)
 {
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
-               ASSERT(ptr->l != cpu_to_be64(NULLDFSBNO));
+               ASSERT(ptr->l != cpu_to_be64(NULLFSBLOCK));
 
                return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l));
        } else {
@@ -899,9 +899,9 @@ xfs_btree_setbuf(
 
        b = XFS_BUF_TO_BLOCK(bp);
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
-               if (b->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO))
+               if (b->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK))
                        cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
-               if (b->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO))
+               if (b->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK))
                        cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;
        } else {
                if (b->bb_u.s.bb_leftsib == cpu_to_be32(NULLAGBLOCK))
@@ -917,7 +917,7 @@ xfs_btree_ptr_is_null(
        union xfs_btree_ptr     *ptr)
 {
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
-               return ptr->l == cpu_to_be64(NULLDFSBNO);
+               return ptr->l == cpu_to_be64(NULLFSBLOCK);
        else
                return ptr->s == cpu_to_be32(NULLAGBLOCK);
 }
@@ -928,7 +928,7 @@ xfs_btree_set_ptr_null(
        union xfs_btree_ptr     *ptr)
 {
        if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
-               ptr->l = cpu_to_be64(NULLDFSBNO);
+               ptr->l = cpu_to_be64(NULLFSBLOCK);
        else
                ptr->s = cpu_to_be32(NULLAGBLOCK);
 }
@@ -996,8 +996,8 @@ xfs_btree_init_block_int(
        buf->bb_numrecs = cpu_to_be16(numrecs);
 
        if (flags & XFS_BTREE_LONG_PTRS) {
-               buf->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO);
-               buf->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO);
+               buf->bb_u.l.bb_leftsib = cpu_to_be64(NULLFSBLOCK);
+               buf->bb_u.l.bb_rightsib = cpu_to_be64(NULLFSBLOCK);
                if (flags & XFS_BTREE_CRC_BLOCKS) {
                        buf->bb_u.l.bb_blkno = cpu_to_be64(blkno);
                        buf->bb_u.l.bb_owner = cpu_to_be64(owner);
index a04b694..8f18bab 100644 (file)
@@ -258,7 +258,7 @@ xfs_btree_check_block(
 int                                    /* error (0 or EFSCORRUPTED) */
 xfs_btree_check_lptr(
        struct xfs_btree_cur    *cur,   /* btree cursor */
-       xfs_dfsbno_t            ptr,    /* btree block disk address */
+       xfs_fsblock_t           ptr,    /* btree block disk address */
        int                     level); /* btree block level */
 
 /*
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/xfs/xfs_fs.h
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge