Commit f5ea1100 authored by Dave Chinner's avatar Dave Chinner Committed by Ben Myers

xfs: add CRCs to dir2/da node blocks

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 6b2647a1
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_fs.h" #include "xfs_fs.h"
#include "xfs_types.h" #include "xfs_types.h"
...@@ -1236,7 +1235,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1236,7 +1235,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
* Search to see if name already exists, and get back a pointer * Search to see if name already exists, and get back a pointer
* to where it should go. * to where it should go.
*/ */
error = xfs_da_node_lookup_int(state, &retval); error = xfs_da3_node_lookup_int(state, &retval);
if (error) if (error)
goto out; goto out;
blk = &state->path.blk[ state->path.active-1 ]; blk = &state->path.blk[ state->path.active-1 ];
...@@ -1307,7 +1306,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1307,7 +1306,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
* in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields. * in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields.
*/ */
xfs_bmap_init(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da_split(state); error = xfs_da3_split(state);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
&committed); &committed);
...@@ -1329,7 +1328,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1329,7 +1328,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
/* /*
* Addition succeeded, update Btree hashvals. * Addition succeeded, update Btree hashvals.
*/ */
xfs_da_fixhashpath(state, &state->path); xfs_da3_fixhashpath(state, &state->path);
} }
/* /*
...@@ -1400,7 +1399,7 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1400,7 +1399,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
state->blocksize = state->mp->m_sb.sb_blocksize; state->blocksize = state->mp->m_sb.sb_blocksize;
state->node_ents = state->mp->m_attr_node_ents; state->node_ents = state->mp->m_attr_node_ents;
state->inleaf = 0; state->inleaf = 0;
error = xfs_da_node_lookup_int(state, &retval); error = xfs_da3_node_lookup_int(state, &retval);
if (error) if (error)
goto out; goto out;
...@@ -1410,14 +1409,14 @@ xfs_attr_node_addname(xfs_da_args_t *args) ...@@ -1410,14 +1409,14 @@ xfs_attr_node_addname(xfs_da_args_t *args)
blk = &state->path.blk[ state->path.active-1 ]; blk = &state->path.blk[ state->path.active-1 ];
ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
error = xfs_attr_leaf_remove(blk->bp, args); error = xfs_attr_leaf_remove(blk->bp, args);
xfs_da_fixhashpath(state, &state->path); xfs_da3_fixhashpath(state, &state->path);
/* /*
* Check to see if the tree needs to be collapsed. * Check to see if the tree needs to be collapsed.
*/ */
if (retval && (state->path.active > 1)) { if (retval && (state->path.active > 1)) {
xfs_bmap_init(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da_join(state); error = xfs_da3_join(state);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, error = xfs_bmap_finish(&args->trans,
args->flist, args->flist,
...@@ -1495,7 +1494,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) ...@@ -1495,7 +1494,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
/* /*
* Search to see if name exists, and get back a pointer to it. * Search to see if name exists, and get back a pointer to it.
*/ */
error = xfs_da_node_lookup_int(state, &retval); error = xfs_da3_node_lookup_int(state, &retval);
if (error || (retval != EEXIST)) { if (error || (retval != EEXIST)) {
if (error == 0) if (error == 0)
error = retval; error = retval;
...@@ -1546,14 +1545,14 @@ xfs_attr_node_removename(xfs_da_args_t *args) ...@@ -1546,14 +1545,14 @@ xfs_attr_node_removename(xfs_da_args_t *args)
blk = &state->path.blk[ state->path.active-1 ]; blk = &state->path.blk[ state->path.active-1 ];
ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
retval = xfs_attr_leaf_remove(blk->bp, args); retval = xfs_attr_leaf_remove(blk->bp, args);
xfs_da_fixhashpath(state, &state->path); xfs_da3_fixhashpath(state, &state->path);
/* /*
* Check to see if the tree needs to be collapsed. * Check to see if the tree needs to be collapsed.
*/ */
if (retval && (state->path.active > 1)) { if (retval && (state->path.active > 1)) {
xfs_bmap_init(args->flist, args->firstblock); xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da_join(state); error = xfs_da3_join(state);
if (!error) { if (!error) {
error = xfs_bmap_finish(&args->trans, args->flist, error = xfs_bmap_finish(&args->trans, args->flist,
&committed); &committed);
...@@ -1699,7 +1698,7 @@ xfs_attr_refillstate(xfs_da_state_t *state) ...@@ -1699,7 +1698,7 @@ xfs_attr_refillstate(xfs_da_state_t *state)
ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH)); ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
for (blk = path->blk, level = 0; level < path->active; blk++, level++) { for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
if (blk->disk_blkno) { if (blk->disk_blkno) {
error = xfs_da_node_read(state->args->trans, error = xfs_da3_node_read(state->args->trans,
state->args->dp, state->args->dp,
blk->blkno, blk->disk_blkno, blk->blkno, blk->disk_blkno,
&blk->bp, XFS_ATTR_FORK); &blk->bp, XFS_ATTR_FORK);
...@@ -1718,7 +1717,7 @@ xfs_attr_refillstate(xfs_da_state_t *state) ...@@ -1718,7 +1717,7 @@ xfs_attr_refillstate(xfs_da_state_t *state)
ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH)); ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
for (blk = path->blk, level = 0; level < path->active; blk++, level++) { for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
if (blk->disk_blkno) { if (blk->disk_blkno) {
error = xfs_da_node_read(state->args->trans, error = xfs_da3_node_read(state->args->trans,
state->args->dp, state->args->dp,
blk->blkno, blk->disk_blkno, blk->blkno, blk->disk_blkno,
&blk->bp, XFS_ATTR_FORK); &blk->bp, XFS_ATTR_FORK);
...@@ -1758,7 +1757,7 @@ xfs_attr_node_get(xfs_da_args_t *args) ...@@ -1758,7 +1757,7 @@ xfs_attr_node_get(xfs_da_args_t *args)
/* /*
* Search to see if name exists, and get back a pointer to it. * Search to see if name exists, and get back a pointer to it.
*/ */
error = xfs_da_node_lookup_int(state, &retval); error = xfs_da3_node_lookup_int(state, &retval);
if (error) { if (error) {
retval = error; retval = error;
} else if (retval == EEXIST) { } else if (retval == EEXIST) {
...@@ -1810,7 +1809,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1810,7 +1809,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
*/ */
bp = NULL; bp = NULL;
if (cursor->blkno > 0) { if (cursor->blkno > 0) {
error = xfs_da_node_read(NULL, context->dp, cursor->blkno, -1, error = xfs_da3_node_read(NULL, context->dp, cursor->blkno, -1,
&bp, XFS_ATTR_FORK); &bp, XFS_ATTR_FORK);
if ((error != 0) && (error != EFSCORRUPTED)) if ((error != 0) && (error != EFSCORRUPTED))
return(error); return(error);
...@@ -1852,7 +1851,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1852,7 +1851,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
if (bp == NULL) { if (bp == NULL) {
cursor->blkno = 0; cursor->blkno = 0;
for (;;) { for (;;) {
error = xfs_da_node_read(NULL, context->dp, error = xfs_da3_node_read(NULL, context->dp,
cursor->blkno, -1, &bp, cursor->blkno, -1, &bp,
XFS_ATTR_FORK); XFS_ATTR_FORK);
if (error) if (error)
...@@ -1870,7 +1869,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1870,7 +1869,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
xfs_trans_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return(XFS_ERROR(EFSCORRUPTED)); return(XFS_ERROR(EFSCORRUPTED));
} }
btree = node->btree; btree = xfs_da3_node_tree_p(node);
for (i = 0; i < be16_to_cpu(node->hdr.count); for (i = 0; i < be16_to_cpu(node->hdr.count);
btree++, i++) { btree++, i++) {
if (cursor->hashval if (cursor->hashval
......
...@@ -910,6 +910,7 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args) ...@@ -910,6 +910,7 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args)
struct xfs_buf *bp1, *bp2; struct xfs_buf *bp1, *bp2;
xfs_dablk_t blkno; xfs_dablk_t blkno;
int error; int error;
struct xfs_da_node_entry *btree;
trace_xfs_attr_leaf_to_node(args); trace_xfs_attr_leaf_to_node(args);
...@@ -935,16 +936,16 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args) ...@@ -935,16 +936,16 @@ xfs_attr_leaf_to_node(xfs_da_args_t *args)
/* /*
* Set up the new root node. * Set up the new root node.
*/ */
error = xfs_da_node_create(args, 0, 1, &bp1, XFS_ATTR_FORK); error = xfs_da3_node_create(args, 0, 1, &bp1, XFS_ATTR_FORK);
if (error) if (error)
goto out; goto out;
node = bp1->b_addr; node = bp1->b_addr;
leaf = bp2->b_addr; leaf = bp2->b_addr;
ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
/* both on-disk, don't endian-flip twice */ /* both on-disk, don't endian-flip twice */
node->btree[0].hashval = btree = xfs_da3_node_tree_p(node);
leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval; btree[0].hashval = leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval;
node->btree[0].before = cpu_to_be32(blkno); btree[0].before = cpu_to_be32(blkno);
node->hdr.count = cpu_to_be16(1); node->hdr.count = cpu_to_be16(1);
xfs_trans_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1); xfs_trans_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1);
error = 0; error = 0;
...@@ -1032,7 +1033,7 @@ xfs_attr_leaf_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, ...@@ -1032,7 +1033,7 @@ xfs_attr_leaf_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk,
* NOTE: rebalance() currently depends on the 2nd block being empty. * NOTE: rebalance() currently depends on the 2nd block being empty.
*/ */
xfs_attr_leaf_rebalance(state, oldblk, newblk); xfs_attr_leaf_rebalance(state, oldblk, newblk);
error = xfs_da_blk_link(state, oldblk, newblk); error = xfs_da3_blk_link(state, oldblk, newblk);
if (error) if (error)
return(error); return(error);
...@@ -1660,7 +1661,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) ...@@ -1660,7 +1661,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action)
*/ */
forward = (info->forw != 0); forward = (info->forw != 0);
memcpy(&state->altpath, &state->path, sizeof(state->path)); memcpy(&state->altpath, &state->path, sizeof(state->path));
error = xfs_da_path_shift(state, &state->altpath, forward, error = xfs_da3_path_shift(state, &state->altpath, forward,
0, &retval); 0, &retval);
if (error) if (error)
return(error); return(error);
...@@ -1717,10 +1718,10 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) ...@@ -1717,10 +1718,10 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action)
*/ */
memcpy(&state->altpath, &state->path, sizeof(state->path)); memcpy(&state->altpath, &state->path, sizeof(state->path));
if (blkno < blk->blkno) { if (blkno < blk->blkno) {
error = xfs_da_path_shift(state, &state->altpath, forward, error = xfs_da3_path_shift(state, &state->altpath, forward,
0, &retval); 0, &retval);
} else { } else {
error = xfs_da_path_shift(state, &state->path, forward, error = xfs_da3_path_shift(state, &state->path, forward,
0, &retval); 0, &retval);
} }
if (error) if (error)
...@@ -2783,7 +2784,7 @@ xfs_attr_root_inactive(xfs_trans_t **trans, xfs_inode_t *dp) ...@@ -2783,7 +2784,7 @@ xfs_attr_root_inactive(xfs_trans_t **trans, xfs_inode_t *dp)
* the extents in reverse order the extent containing * the extents in reverse order the extent containing
* block 0 must still be there. * block 0 must still be there.
*/ */
error = xfs_da_node_read(*trans, dp, 0, -1, &bp, XFS_ATTR_FORK); error = xfs_da3_node_read(*trans, dp, 0, -1, &bp, XFS_ATTR_FORK);
if (error) if (error)
return(error); return(error);
blkno = XFS_BUF_ADDR(bp); blkno = XFS_BUF_ADDR(bp);
...@@ -2836,6 +2837,7 @@ xfs_attr_node_inactive( ...@@ -2836,6 +2837,7 @@ xfs_attr_node_inactive(
xfs_daddr_t parent_blkno, child_blkno; xfs_daddr_t parent_blkno, child_blkno;
int error, count, i; int error, count, i;
struct xfs_buf *child_bp; struct xfs_buf *child_bp;
struct xfs_da_node_entry *btree;
/* /*
* Since this code is recursive (gasp!) we must protect ourselves. * Since this code is recursive (gasp!) we must protect ourselves.
...@@ -2853,7 +2855,8 @@ xfs_attr_node_inactive( ...@@ -2853,7 +2855,8 @@ xfs_attr_node_inactive(
xfs_trans_brelse(*trans, bp); xfs_trans_brelse(*trans, bp);
return(0); return(0);
} }
child_fsb = be32_to_cpu(node->btree[0].before); btree = xfs_da3_node_tree_p(node);
child_fsb = be32_to_cpu(btree[0].before);
xfs_trans_brelse(*trans, bp); /* no locks for later trans */ xfs_trans_brelse(*trans, bp); /* no locks for later trans */
/* /*
...@@ -2868,7 +2871,7 @@ xfs_attr_node_inactive( ...@@ -2868,7 +2871,7 @@ xfs_attr_node_inactive(
* traversal of the tree so we may deal with many blocks * traversal of the tree so we may deal with many blocks
* before we come back to this one. * before we come back to this one.
*/ */
error = xfs_da_node_read(*trans, dp, child_fsb, -2, &child_bp, error = xfs_da3_node_read(*trans, dp, child_fsb, -2, &child_bp,
XFS_ATTR_FORK); XFS_ATTR_FORK);
if (error) if (error)
return(error); return(error);
...@@ -2909,11 +2912,11 @@ xfs_attr_node_inactive( ...@@ -2909,11 +2912,11 @@ xfs_attr_node_inactive(
* child block number. * child block number.
*/ */
if ((i+1) < count) { if ((i+1) < count) {
error = xfs_da_node_read(*trans, dp, 0, parent_blkno, error = xfs_da3_node_read(*trans, dp, 0, parent_blkno,
&bp, XFS_ATTR_FORK); &bp, XFS_ATTR_FORK);
if (error) if (error)
return(error); return(error);
child_fsb = be32_to_cpu(node->btree[i+1].before); child_fsb = be32_to_cpu(btree[i+1].before);
xfs_trans_brelse(*trans, bp); xfs_trans_brelse(*trans, bp);
} }
/* /*
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dir2.h" #include "xfs_dir2.h"
#include "xfs_mount.h"
#include "xfs_da_btree.h" #include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
......
This diff is collapsed.
/* /*
* Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc.
* Copyright (c) 2013 Red Hat, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -20,7 +21,6 @@ ...@@ -20,7 +21,6 @@
struct xfs_bmap_free; struct xfs_bmap_free;
struct xfs_inode; struct xfs_inode;
struct xfs_mount;
struct xfs_trans; struct xfs_trans;
struct zone; struct zone;
...@@ -50,8 +50,11 @@ typedef struct xfs_da_blkinfo { ...@@ -50,8 +50,11 @@ typedef struct xfs_da_blkinfo {
* CRC enabled directory structure types * CRC enabled directory structure types
* *
* The headers change size for the additional verification information, but * The headers change size for the additional verification information, but
* otherwise the tree layouts and contents are unchanged. * otherwise the tree layouts and contents are unchanged. Hence the da btree
* code can use the struct xfs_da_blkinfo for manipulating the tree links and
* magic numbers without modification for both v2 and v3 nodes.
*/ */
#define XFS_DA3_NODE_MAGIC 0x3ebe /* magic number: non-leaf blocks */
#define XFS_DIR3_LEAF1_MAGIC 0x3df1 /* magic number: v2 dirlf single blks */ #define XFS_DIR3_LEAF1_MAGIC 0x3df1 /* magic number: v2 dirlf single blks */
#define XFS_DIR3_LEAFN_MAGIC 0x3dff /* magic number: v2 dirlf multi blks */ #define XFS_DIR3_LEAFN_MAGIC 0x3dff /* magic number: v2 dirlf multi blks */
...@@ -80,19 +83,76 @@ struct xfs_da3_blkinfo { ...@@ -80,19 +83,76 @@ struct xfs_da3_blkinfo {
*/ */
#define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */ #define XFS_DA_NODE_MAXDEPTH 5 /* max depth of Btree */
typedef struct xfs_da_intnode { typedef struct xfs_da_node_hdr {
struct xfs_da_node_hdr { /* constant-structure header block */ struct xfs_da_blkinfo info; /* block type, links, etc. */
xfs_da_blkinfo_t info; /* block type, links, etc. */ __be16 count; /* count of active entries */
__be16 __level; /* level above leaves (leaf == 0) */
} xfs_da_node_hdr_t;
struct xfs_da3_node_hdr {
struct xfs_da3_blkinfo info; /* block type, links, etc. */
__be16 count; /* count of active entries */ __be16 count; /* count of active entries */
__be16 level; /* level above leaves (leaf == 0) */ __be16 __level; /* level above leaves (leaf == 0) */
} hdr; __be32 __pad32;
struct xfs_da_node_entry { };
#define XFS_DA3_NODE_CRC_OFF (offsetof(struct xfs_da3_node_hdr, info.crc))
typedef struct xfs_da_node_entry {
__be32 hashval; /* hash value for this descendant */ __be32 hashval; /* hash value for this descendant */
__be32 before; /* Btree block before this key */ __be32 before; /* Btree block before this key */
} btree[1]; /* variable sized array of keys */ } xfs_da_node_entry_t;
typedef struct xfs_da_intnode {
struct xfs_da_node_hdr hdr;
struct xfs_da_node_entry __btree[];
} xfs_da_intnode_t; } xfs_da_intnode_t;
typedef struct xfs_da_node_hdr xfs_da_node_hdr_t;
typedef struct xfs_da_node_entry xfs_da_node_entry_t; struct xfs_da3_intnode {
struct xfs_da3_node_hdr hdr;
struct xfs_da_node_entry __btree[];
};
/*
* In-core version of the node header to abstract the differences in the v2 and
* v3 disk format of the headers. Callers need to convert to/from disk format as
* appropriate.
*/
struct xfs_da3_icnode_hdr {
__uint32_t forw;
__uint32_t back;
__uint16_t magic;
__uint16_t count;
__uint16_t level;
};
extern void xfs_da3_node_hdr_from_disk(struct xfs_da3_icnode_hdr *to,
struct xfs_da_intnode *from);
extern void xfs_da3_node_hdr_to_disk(struct xfs_da_intnode *to,
struct xfs_da3_icnode_hdr *from);
static inline int
xfs_da3_node_hdr_size(struct xfs_da_intnode *dap)
{
if (dap->hdr.info.magic == cpu_to_be16(XFS_DA3_NODE_MAGIC))
return sizeof(struct xfs_da3_node_hdr);
return sizeof(struct xfs_da_node_hdr);
}
static inline struct xfs_da_node_entry *
xfs_da3_node_tree_p(struct xfs_da_intnode *dap)
{
if (dap->hdr.info.magic == cpu_to_be16(XFS_DA3_NODE_MAGIC)) {
struct xfs_da3_intnode *dap3 = (struct xfs_da3_intnode *)dap;
return dap3->__btree;
}
return dap->__btree;
}
extern void xfs_da3_intnode_from_disk(struct xfs_da3_icnode_hdr *to,
struct xfs_da_intnode *from);
extern void xfs_da3_intnode_to_disk(struct xfs_da_intnode *to,
struct xfs_da3_icnode_hdr *from);
#define XFS_LBSIZE(mp) (mp)->m_sb.sb_blocksize #define XFS_LBSIZE(mp) (mp)->m_sb.sb_blocksize
...@@ -214,29 +274,29 @@ struct xfs_nameops { ...@@ -214,29 +274,29 @@ struct xfs_nameops {
/* /*
* Routines used for growing the Btree. * Routines used for growing the Btree.
*/ */
int xfs_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level, int xfs_da3_node_create(struct xfs_da_args *args, xfs_dablk_t blkno,
struct xfs_buf **bpp, int whichfork); int level, struct xfs_buf **bpp, int whichfork);
int xfs_da_split(xfs_da_state_t *state); int xfs_da3_split(xfs_da_state_t *state);
/* /*
* Routines used for shrinking the Btree. * Routines used for shrinking the Btree.
*/ */
int xfs_da_join(xfs_da_state_t *state); int xfs_da3_join(xfs_da_state_t *state);
void xfs_da_fixhashpath(xfs_da_state_t *state, void xfs_da3_fixhashpath(struct xfs_da_state *state,
xfs_da_state_path_t *path_to_to_fix); struct xfs_da_state_path *path_to_to_fix);
/* /*
* Routines used for finding things in the Btree. * Routines used for finding things in the Btree.
*/ */
int xfs_da_node_lookup_int(xfs_da_state_t *state, int *result); int xfs_da3_node_lookup_int(xfs_da_state_t *state, int *result);
int xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, int xfs_da3_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
int forward, int release, int *result); int forward, int release, int *result);
/* /*
* Utility routines. * Utility routines.
*/ */
int xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, int xfs_da3_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk,
xfs_da_state_blk_t *new_blk); xfs_da_state_blk_t *new_blk);
int xfs_da_node_read(struct xfs_trans *tp, struct xfs_inode *dp, int xfs_da3_node_read(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dablk_t bno, xfs_daddr_t mappedbno,
struct xfs_buf **bpp, int which_fork); struct xfs_buf **bpp, int which_fork);
......
...@@ -1371,7 +1371,7 @@ xfs_dir2_leafn_split( ...@@ -1371,7 +1371,7 @@ xfs_dir2_leafn_split(
* block into the leaves. * block into the leaves.
*/ */
xfs_dir2_leafn_rebalance(state, oldblk, newblk); xfs_dir2_leafn_rebalance(state, oldblk, newblk);
error = xfs_da_blk_link(state, oldblk, newblk); error = xfs_da3_blk_link(state, oldblk, newblk);
if (error) { if (error) {
return error; return error;
} }
...@@ -1452,7 +1452,7 @@ xfs_dir2_leafn_toosmall( ...@@ -1452,7 +1452,7 @@ xfs_dir2_leafn_toosmall(
*/ */
forward = (leafhdr.forw != 0); forward = (leafhdr.forw != 0);
memcpy(&state->altpath, &state->path, sizeof(state->path)); memcpy(&state->altpath, &state->path, sizeof(state->path));
error = xfs_da_path_shift(state, &state->altpath, forward, 0, error = xfs_da3_path_shift(state, &state->altpath, forward, 0,
&rval); &rval);
if (error) if (error)
return error; return error;
...@@ -1514,10 +1514,10 @@ xfs_dir2_leafn_toosmall( ...@@ -1514,10 +1514,10 @@ xfs_dir2_leafn_toosmall(
*/ */
memcpy(&state->altpath, &state->path, sizeof(state->path)); memcpy(&state->altpath, &state->path, sizeof(state->path));
if (blkno < blk->blkno) if (blkno < blk->blkno)
error = xfs_da_path_shift(state, &state->altpath, forward, 0, error = xfs_da3_path_shift(state, &state->altpath, forward, 0,
&rval); &rval);
else else
error = xfs_da_path_shift(state, &state->path, forward, 0, error = xfs_da3_path_shift(state, &state->path, forward, 0,
&rval); &rval);
if (error) { if (error) {
return error; return error;
...@@ -1614,7 +1614,7 @@ xfs_dir2_node_addname( ...@@ -1614,7 +1614,7 @@ xfs_dir2_node_addname(
* Look up the name. We're not supposed to find it, but * Look up the name. We're not supposed to find it, but
* this gives us the insertion point. * this gives us the insertion point.
*/ */
error = xfs_da_node_lookup_int(state, &rval); error = xfs_da3_node_lookup_int(state, &rval);
if (error) if (error)
rval = error; rval = error;
if (rval != ENOENT) { if (rval != ENOENT) {
...@@ -1640,7 +1640,7 @@ xfs_dir2_node_addname( ...@@ -1640,7 +1640,7 @@ xfs_dir2_node_addname(
* It worked, fix the hash values up the btree. * It worked, fix the hash values up the btree.
*/ */
if (!(args->op_flags & XFS_DA_OP_JUSTCHECK)) if (!(args->op_flags & XFS_DA_OP_JUSTCHECK))
xfs_da_fixhashpath(state, &state->path); xfs_da3_fixhashpath(state, &state->path);
} else { } else {
/* /*
* It didn't work, we need to split the leaf block. * It didn't work, we need to split the leaf block.
...@@ -1652,7 +1652,7 @@ xfs_dir2_node_addname( ...@@ -1652,7 +1652,7 @@ xfs_dir2_node_addname(
/* /*
* Split the leaf block and insert the new entry. * Split the leaf block and insert the new entry.
*/ */
rval = xfs_da_split(state); rval = xfs_da3_split(state);
} }
done: done:
xfs_da_state_free(state); xfs_da_state_free(state);
...@@ -2030,7 +2030,7 @@ xfs_dir2_node_addname_int( ...@@ -2030,7 +2030,7 @@ xfs_dir2_node_addname_int(
/* /*
* Lookup an entry in a node-format directory. * Lookup an entry in a node-format directory.
* All the real work happens in xfs_da_node_lookup_int. * All the real work happens in xfs_da3_node_lookup_int.
* The only real output is the inode number of the entry. * The only real output is the inode number of the entry.
*/ */
int /* error */ int /* error */
...@@ -2055,7 +2055,7 @@ xfs_dir2_node_lookup( ...@@ -2055,7 +2055,7 @@ xfs_dir2_node_lookup(
/* /*
* Fill in the path to the entry in the cursor. * Fill in the path to the entry in the cursor.
*/ */
error = xfs_da_node_lookup_int(state, &rval); error = xfs_da3_node_lookup_int(state, &rval);
if (error) if (error)
rval = error; rval = error;
else if (rval == ENOENT && args->cmpresult == XFS_CMP_CASE) { else if (rval == ENOENT && args->cmpresult == XFS_CMP_CASE) {
...@@ -2110,7 +2110,7 @@ xfs_dir2_node_removename( ...@@ -2110,7 +2110,7 @@ xfs_dir2_node_removename(
/* /*
* Look up the entry we're deleting, set up the cursor. * Look up the entry we're deleting, set up the cursor.
*/ */
error = xfs_da_node_lookup_int(state, &rval); error = xfs_da3_node_lookup_int(state, &rval);
if (error) if (error)
rval = error; rval = error;
/* /*
...@@ -2134,12 +2134,12 @@ xfs_dir2_node_removename( ...@@ -2134,12 +2134,12 @@ xfs_dir2_node_removename(
/* /*
* Fix the hash values up the btree. * Fix the hash values up the btree.
*/ */
xfs_da_fixhashpath(state, &state->path); xfs_da3_fixhashpath(state, &state->path);
/* /*
* If we need to join leaf blocks, do it. * If we need to join leaf blocks, do it.
*/ */
if (rval && state->path.active > 1) if (rval && state->path.active > 1)
error = xfs_da_join(state); error = xfs_da3_join(state);
/* /*
* If no errors so far, try conversion to leaf format. * If no errors so far, try conversion to leaf format.
*/ */
...@@ -2181,7 +2181,7 @@ xfs_dir2_node_replace( ...@@ -2181,7 +2181,7 @@ xfs_dir2_node_replace(
/* /*
* Lookup the entry to change in the btree. * Lookup the entry to change in the btree.
*/ */
error = xfs_da_node_lookup_int(state, &rval); error = xfs_da3_node_lookup_int(state, &rval);
if (error) { if (error) {
rval = error; rval = error;
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "xfs_trans.h" #include "xfs_trans.h"
#include "xfs_sb.h" #include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h" #include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h" #include "xfs_ialloc_btree.h"
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_btree.h" #include "xfs_btree.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_da_btree.h"
#include "xfs_ialloc.h" #include "xfs_ialloc.h"
#include "xfs_itable.h" #include "xfs_itable.h"
#include "xfs_alloc.h" #include "xfs_alloc.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment