Merge commit 'ccbf62d8a284cf181ac28c8e8407dd077d90dd4b' into for-next
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_da_btree.c
index 70b934392f7369990b19ff4396475703839503ce..a514ab616650cd247013ffbb6cd2a4dbbfbc0c75 100644 (file)
@@ -167,8 +167,8 @@ xfs_da3_node_verify(
         * we don't know if the node is for and attribute or directory tree,
         * so only fail if the count is outside both bounds
         */
-       if (ichdr.count > mp->m_dir_node_ents &&
-           ichdr.count > mp->m_attr_node_ents)
+       if (ichdr.count > mp->m_dir_geo->node_ents &&
+           ichdr.count > mp->m_attr_geo->node_ents)
                return false;
 
        /* XXX: hash order check? */
@@ -663,7 +663,7 @@ xfs_da3_node_split(
        /*
         * Do we have to split the node?
         */
-       if (nodehdr.count + newcount > state->node_ents) {
+       if (nodehdr.count + newcount > state->args->geo->node_ents) {
                /*
                 * Allocate a new node, add to the doubly linked chain of
                 * nodes, then move some of our excess entries into it.
@@ -1089,14 +1089,15 @@ xfs_da3_root_join(
         * that could occur. For dir3 blocks we also need to update the block
         * number in the buffer header.
         */
-       memcpy(root_blk->bp->b_addr, bp->b_addr, state->blocksize);
+       memcpy(root_blk->bp->b_addr, bp->b_addr, args->geo->blksize);
        root_blk->bp->b_ops = bp->b_ops;
        xfs_trans_buf_copy_type(root_blk->bp, bp);
        if (oldroothdr.magic == XFS_DA3_NODE_MAGIC) {
                struct xfs_da3_blkinfo *da3 = root_blk->bp->b_addr;
                da3->blkno = cpu_to_be64(root_blk->bp->b_bn);
        }
-       xfs_trans_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1);
+       xfs_trans_log_buf(args->trans, root_blk->bp, 0,
+                         args->geo->blksize - 1);
        error = xfs_da_shrink_inode(args, child, bp);
        return(error);
 }
@@ -1139,7 +1140,7 @@ xfs_da3_node_toosmall(
        info = blk->bp->b_addr;
        node = (xfs_da_intnode_t *)info;
        dp->d_ops->node_hdr_from_disk(&nodehdr, node);
-       if (nodehdr.count > (state->node_ents >> 1)) {
+       if (nodehdr.count > (state->args->geo->node_ents >> 1)) {
                *action = 0;    /* blk over 50%, don't try to join */
                return(0);      /* blk over 50%, don't try to join */
        }
@@ -1176,8 +1177,8 @@ xfs_da3_node_toosmall(
         * We prefer coalescing with the lower numbered sibling so as
         * to shrink a directory over time.
         */
-       count  = state->node_ents;
-       count -= state->node_ents >> 2;
+       count  = state->args->geo->node_ents;
+       count -= state->args->geo->node_ents >> 2;
        count -= nodehdr.count;
 
        /* start with smaller blk num */
@@ -2169,8 +2170,8 @@ xfs_da3_swap_lastblock(
        /*
         * Copy the last block into the dead buffer and log it.
         */
-       memcpy(dead_buf->b_addr, last_buf->b_addr, mp->m_dirblksize);
-       xfs_trans_log_buf(tp, dead_buf, 0, mp->m_dirblksize - 1);
+       memcpy(dead_buf->b_addr, last_buf->b_addr, args->geo->blksize);
+       xfs_trans_log_buf(tp, dead_buf, 0, args->geo->blksize - 1);
        dead_info = dead_buf->b_addr;
        /*
         * Get values from the moved block.
@@ -2616,47 +2617,6 @@ xfs_da_read_buf(
                xfs_buf_set_ref(bp, XFS_ATTR_BTREE_REF);
        else
                xfs_buf_set_ref(bp, XFS_DIR_BTREE_REF);
-
-       /*
-        * This verification code will be moved to a CRC verification callback
-        * function so just leave it here unchanged until then.
-        */
-       {
-               xfs_dir2_data_hdr_t     *hdr = bp->b_addr;
-               xfs_dir2_free_t         *free = bp->b_addr;
-               xfs_da_blkinfo_t        *info = bp->b_addr;
-               uint                    magic, magic1;
-               struct xfs_mount        *mp = dp->i_mount;
-
-               magic = be16_to_cpu(info->magic);
-               magic1 = be32_to_cpu(hdr->magic);
-               if (unlikely(
-                   XFS_TEST_ERROR((magic != XFS_DA_NODE_MAGIC) &&
-                                  (magic != XFS_DA3_NODE_MAGIC) &&
-                                  (magic != XFS_ATTR_LEAF_MAGIC) &&
-                                  (magic != XFS_ATTR3_LEAF_MAGIC) &&
-                                  (magic != XFS_DIR2_LEAF1_MAGIC) &&
-                                  (magic != XFS_DIR3_LEAF1_MAGIC) &&
-                                  (magic != XFS_DIR2_LEAFN_MAGIC) &&
-                                  (magic != XFS_DIR3_LEAFN_MAGIC) &&
-                                  (magic1 != XFS_DIR2_BLOCK_MAGIC) &&
-                                  (magic1 != XFS_DIR3_BLOCK_MAGIC) &&
-                                  (magic1 != XFS_DIR2_DATA_MAGIC) &&
-                                  (magic1 != XFS_DIR3_DATA_MAGIC) &&
-                                  (free->hdr.magic !=
-                                       cpu_to_be32(XFS_DIR2_FREE_MAGIC)) &&
-                                  (free->hdr.magic !=
-                                       cpu_to_be32(XFS_DIR3_FREE_MAGIC)),
-                               mp, XFS_ERRTAG_DA_READ_BUF,
-                               XFS_RANDOM_DA_READ_BUF))) {
-                       trace_xfs_da_btree_corrupt(bp, _RET_IP_);
-                       XFS_CORRUPTION_ERROR("xfs_da_do_buf(2)",
-                                            XFS_ERRLEVEL_LOW, mp, info);
-                       error = XFS_ERROR(EFSCORRUPTED);
-                       xfs_trans_brelse(trans, bp);
-                       goto out_free;
-               }
-       }
        *bpp = bp;
 out_free:
        if (mapp != &map)