提交 1d9025e5 编写于 作者: D Dave Chinner 提交者: Ben Myers

xfs: remove struct xfs_dabuf and infrastructure

The struct xfs_dabuf now only tracks a single xfs_buf and all the
information it holds can be gained directly from the xfs_buf. Hence
we can remove the struct dabuf and pass the xfs_buf around
everywhere.

Kill the struct dabuf and the associated infrastructure.
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NBen Myers <bpm@sgi.com>
上级 3605431f
...@@ -893,7 +893,7 @@ STATIC int ...@@ -893,7 +893,7 @@ STATIC int
xfs_attr_leaf_addname(xfs_da_args_t *args) xfs_attr_leaf_addname(xfs_da_args_t *args)
{ {
xfs_inode_t *dp; xfs_inode_t *dp;
xfs_dabuf_t *bp; struct xfs_buf *bp;
int retval, error, committed, forkoff; int retval, error, committed, forkoff;
trace_xfs_attr_leaf_addname(args); trace_xfs_attr_leaf_addname(args);
...@@ -915,11 +915,11 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) ...@@ -915,11 +915,11 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
*/ */
retval = xfs_attr_leaf_lookup_int(bp, args); retval = xfs_attr_leaf_lookup_int(bp, args);
if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) { if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) {
xfs_da_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
return(retval); return(retval);
} else if (retval == EEXIST) { } else if (retval == EEXIST) {
if (args->flags & ATTR_CREATE) { /* pure create op */ if (args->flags & ATTR_CREATE) { /* pure create op */
xfs_da_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
return(retval); return(retval);
} }
...@@ -937,7 +937,6 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) ...@@ -937,7 +937,6 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
* if required. * if required.
*/ */
retval = xfs_attr_leaf_add(bp, args); retval = xfs_attr_leaf_add(bp, args);
xfs_da_buf_done(bp);
if (retval == ENOSPC) { if (retval == ENOSPC) {
/* /*
* Promote the attribute list to the Btree format, then * Promote the attribute list to the Btree format, then
...@@ -1065,8 +1064,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args) ...@@ -1065,8 +1064,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
*/ */
if (committed) if (committed)
xfs_trans_ijoin(args->trans, dp, 0); xfs_trans_ijoin(args->trans, dp, 0);
} else }
xfs_da_buf_done(bp);
/* /*
* Commit the remove and start the next trans in series. * Commit the remove and start the next trans in series.
...@@ -1092,7 +1090,7 @@ STATIC int ...@@ -1092,7 +1090,7 @@ STATIC int
xfs_attr_leaf_removename(xfs_da_args_t *args) xfs_attr_leaf_removename(xfs_da_args_t *args)
{ {
xfs_inode_t *dp; xfs_inode_t *dp;
xfs_dabuf_t *bp; struct xfs_buf *bp;
int error, committed, forkoff; int error, committed, forkoff;
trace_xfs_attr_leaf_removename(args); trace_xfs_attr_leaf_removename(args);
...@@ -1111,7 +1109,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) ...@@ -1111,7 +1109,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
ASSERT(bp != NULL); ASSERT(bp != NULL);
error = xfs_attr_leaf_lookup_int(bp, args); error = xfs_attr_leaf_lookup_int(bp, args);
if (error == ENOATTR) { if (error == ENOATTR) {
xfs_da_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
return(error); return(error);
} }
...@@ -1141,8 +1139,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) ...@@ -1141,8 +1139,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
*/ */
if (committed) if (committed)
xfs_trans_ijoin(args->trans, dp, 0); xfs_trans_ijoin(args->trans, dp, 0);
} else }
xfs_da_buf_done(bp);
return(0); return(0);
} }
...@@ -1155,7 +1152,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args) ...@@ -1155,7 +1152,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
STATIC int STATIC int
xfs_attr_leaf_get(xfs_da_args_t *args) xfs_attr_leaf_get(xfs_da_args_t *args)
{ {
xfs_dabuf_t *bp; struct xfs_buf *bp;
int error; int error;
args->blkno = 0; args->blkno = 0;
...@@ -1167,11 +1164,11 @@ xfs_attr_leaf_get(xfs_da_args_t *args) ...@@ -1167,11 +1164,11 @@ xfs_attr_leaf_get(xfs_da_args_t *args)
error = xfs_attr_leaf_lookup_int(bp, args); error = xfs_attr_leaf_lookup_int(bp, args);
if (error != EEXIST) { if (error != EEXIST) {
xfs_da_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
return(error); return(error);
} }
error = xfs_attr_leaf_getvalue(bp, args); error = xfs_attr_leaf_getvalue(bp, args);
xfs_da_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
if (!error && (args->rmtblkno > 0) && !(args->flags & ATTR_KERNOVAL)) { if (!error && (args->rmtblkno > 0) && !(args->flags & ATTR_KERNOVAL)) {
error = xfs_attr_rmtval_get(args); error = xfs_attr_rmtval_get(args);
} }
...@@ -1186,23 +1183,23 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context) ...@@ -1186,23 +1183,23 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context)
{ {
xfs_attr_leafblock_t *leaf; xfs_attr_leafblock_t *leaf;
int error; int error;
xfs_dabuf_t *bp; struct xfs_buf *bp;
context->cursor->blkno = 0; context->cursor->blkno = 0;
error = xfs_da_read_buf(NULL, context->dp, 0, -1, &bp, XFS_ATTR_FORK); error = xfs_da_read_buf(NULL, context->dp, 0, -1, &bp, XFS_ATTR_FORK);
if (error) if (error)
return XFS_ERROR(error); return XFS_ERROR(error);
ASSERT(bp != NULL); ASSERT(bp != NULL);
leaf = bp->data; leaf = bp->b_addr;
if (unlikely(leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { if (unlikely(leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) {
XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW, XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW,
context->dp->i_mount, leaf); context->dp->i_mount, leaf);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
error = xfs_attr_leaf_list_int(bp, context); error = xfs_attr_leaf_list_int(bp, context);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return XFS_ERROR(error); return XFS_ERROR(error);
} }
...@@ -1489,7 +1486,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) ...@@ -1489,7 +1486,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
xfs_da_state_t *state; xfs_da_state_t *state;
xfs_da_state_blk_t *blk; xfs_da_state_blk_t *blk;
xfs_inode_t *dp; xfs_inode_t *dp;
xfs_dabuf_t *bp; struct xfs_buf *bp;
int retval, error, committed, forkoff; int retval, error, committed, forkoff;
trace_xfs_attr_node_removename(args); trace_xfs_attr_node_removename(args);
...@@ -1601,14 +1598,13 @@ xfs_attr_node_removename(xfs_da_args_t *args) ...@@ -1601,14 +1598,13 @@ xfs_attr_node_removename(xfs_da_args_t *args)
*/ */
ASSERT(state->path.active == 1); ASSERT(state->path.active == 1);
ASSERT(state->path.blk[0].bp); ASSERT(state->path.blk[0].bp);
xfs_da_buf_done(state->path.blk[0].bp);
state->path.blk[0].bp = NULL; state->path.blk[0].bp = NULL;
error = xfs_da_read_buf(args->trans, args->dp, 0, -1, &bp, error = xfs_da_read_buf(args->trans, args->dp, 0, -1, &bp,
XFS_ATTR_FORK); XFS_ATTR_FORK);
if (error) if (error)
goto out; goto out;
ASSERT((((xfs_attr_leafblock_t *)bp->data)->hdr.info.magic) == ASSERT((((xfs_attr_leafblock_t *)bp->b_addr)->hdr.info.magic) ==
cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
...@@ -1635,7 +1631,7 @@ xfs_attr_node_removename(xfs_da_args_t *args) ...@@ -1635,7 +1631,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
if (committed) if (committed)
xfs_trans_ijoin(args->trans, dp, 0); xfs_trans_ijoin(args->trans, dp, 0);
} else } else
xfs_da_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
} }
error = 0; error = 0;
...@@ -1665,8 +1661,7 @@ xfs_attr_fillstate(xfs_da_state_t *state) ...@@ -1665,8 +1661,7 @@ xfs_attr_fillstate(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->bp) { if (blk->bp) {
blk->disk_blkno = xfs_da_blkno(blk->bp); blk->disk_blkno = XFS_BUF_ADDR(blk->bp);
xfs_da_buf_done(blk->bp);
blk->bp = NULL; blk->bp = NULL;
} else { } else {
blk->disk_blkno = 0; blk->disk_blkno = 0;
...@@ -1681,8 +1676,7 @@ xfs_attr_fillstate(xfs_da_state_t *state) ...@@ -1681,8 +1676,7 @@ xfs_attr_fillstate(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->bp) { if (blk->bp) {
blk->disk_blkno = xfs_da_blkno(blk->bp); blk->disk_blkno = XFS_BUF_ADDR(blk->bp);
xfs_da_buf_done(blk->bp);
blk->bp = NULL; blk->bp = NULL;
} else { } else {
blk->disk_blkno = 0; blk->disk_blkno = 0;
...@@ -1792,7 +1786,7 @@ xfs_attr_node_get(xfs_da_args_t *args) ...@@ -1792,7 +1786,7 @@ xfs_attr_node_get(xfs_da_args_t *args)
* If not in a transaction, we have to release all the buffers. * If not in a transaction, we have to release all the buffers.
*/ */
for (i = 0; i < state->path.active; i++) { for (i = 0; i < state->path.active; i++) {
xfs_da_brelse(args->trans, state->path.blk[i].bp); xfs_trans_brelse(args->trans, state->path.blk[i].bp);
state->path.blk[i].bp = NULL; state->path.blk[i].bp = NULL;
} }
...@@ -1808,7 +1802,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1808,7 +1802,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
xfs_da_intnode_t *node; xfs_da_intnode_t *node;
xfs_da_node_entry_t *btree; xfs_da_node_entry_t *btree;
int error, i; int error, i;
xfs_dabuf_t *bp; struct xfs_buf *bp;
cursor = context->cursor; cursor = context->cursor;
cursor->initted = 1; cursor->initted = 1;
...@@ -1825,30 +1819,30 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1825,30 +1819,30 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
if ((error != 0) && (error != EFSCORRUPTED)) if ((error != 0) && (error != EFSCORRUPTED))
return(error); return(error);
if (bp) { if (bp) {
node = bp->data; node = bp->b_addr;
switch (be16_to_cpu(node->hdr.info.magic)) { switch (be16_to_cpu(node->hdr.info.magic)) {
case XFS_DA_NODE_MAGIC: case XFS_DA_NODE_MAGIC:
trace_xfs_attr_list_wrong_blk(context); trace_xfs_attr_list_wrong_blk(context);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
bp = NULL; bp = NULL;
break; break;
case XFS_ATTR_LEAF_MAGIC: case XFS_ATTR_LEAF_MAGIC:
leaf = bp->data; leaf = bp->b_addr;
if (cursor->hashval > be32_to_cpu(leaf->entries[ if (cursor->hashval > be32_to_cpu(leaf->entries[
be16_to_cpu(leaf->hdr.count)-1].hashval)) { be16_to_cpu(leaf->hdr.count)-1].hashval)) {
trace_xfs_attr_list_wrong_blk(context); trace_xfs_attr_list_wrong_blk(context);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
bp = NULL; bp = NULL;
} else if (cursor->hashval <= } else if (cursor->hashval <=
be32_to_cpu(leaf->entries[0].hashval)) { be32_to_cpu(leaf->entries[0].hashval)) {
trace_xfs_attr_list_wrong_blk(context); trace_xfs_attr_list_wrong_blk(context);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
bp = NULL; bp = NULL;
} }
break; break;
default: default:
trace_xfs_attr_list_wrong_blk(context); trace_xfs_attr_list_wrong_blk(context);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
bp = NULL; bp = NULL;
} }
} }
...@@ -1873,7 +1867,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1873,7 +1867,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
context->dp->i_mount); context->dp->i_mount);
return(XFS_ERROR(EFSCORRUPTED)); return(XFS_ERROR(EFSCORRUPTED));
} }
node = bp->data; node = bp->b_addr;
if (node->hdr.info.magic == if (node->hdr.info.magic ==
cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) cpu_to_be16(XFS_ATTR_LEAF_MAGIC))
break; break;
...@@ -1883,7 +1877,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1883,7 +1877,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
XFS_ERRLEVEL_LOW, XFS_ERRLEVEL_LOW,
context->dp->i_mount, context->dp->i_mount,
node); node);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return(XFS_ERROR(EFSCORRUPTED)); return(XFS_ERROR(EFSCORRUPTED));
} }
btree = node->btree; btree = node->btree;
...@@ -1898,10 +1892,10 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1898,10 +1892,10 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
} }
} }
if (i == be16_to_cpu(node->hdr.count)) { if (i == be16_to_cpu(node->hdr.count)) {
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return(0); return(0);
} }
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
} }
} }
ASSERT(bp != NULL); ASSERT(bp != NULL);
...@@ -1912,24 +1906,24 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1912,24 +1906,24 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
* adding the information. * adding the information.
*/ */
for (;;) { for (;;) {
leaf = bp->data; leaf = bp->b_addr;
if (unlikely(leaf->hdr.info.magic != if (unlikely(leaf->hdr.info.magic !=
cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) { cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) {
XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)", XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)",
XFS_ERRLEVEL_LOW, XFS_ERRLEVEL_LOW,
context->dp->i_mount, leaf); context->dp->i_mount, leaf);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return(XFS_ERROR(EFSCORRUPTED)); return(XFS_ERROR(EFSCORRUPTED));
} }
error = xfs_attr_leaf_list_int(bp, context); error = xfs_attr_leaf_list_int(bp, context);
if (error) { if (error) {
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return error; return error;
} }
if (context->seen_enough || leaf->hdr.info.forw == 0) if (context->seen_enough || leaf->hdr.info.forw == 0)
break; break;
cursor->blkno = be32_to_cpu(leaf->hdr.info.forw); cursor->blkno = be32_to_cpu(leaf->hdr.info.forw);
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
error = xfs_da_read_buf(NULL, context->dp, cursor->blkno, -1, error = xfs_da_read_buf(NULL, context->dp, cursor->blkno, -1,
&bp, XFS_ATTR_FORK); &bp, XFS_ATTR_FORK);
if (error) if (error)
...@@ -1941,7 +1935,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1941,7 +1935,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
return(XFS_ERROR(EFSCORRUPTED)); return(XFS_ERROR(EFSCORRUPTED));
} }
} }
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return(0); return(0);
} }
......
此差异已折叠。
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
struct attrlist; struct attrlist;
struct attrlist_cursor_kern; struct attrlist_cursor_kern;
struct xfs_attr_list_context; struct xfs_attr_list_context;
struct xfs_dabuf;
struct xfs_da_args; struct xfs_da_args;
struct xfs_da_state; struct xfs_da_state;
struct xfs_da_state_blk; struct xfs_da_state_blk;
...@@ -215,7 +214,7 @@ int xfs_attr_shortform_getvalue(struct xfs_da_args *args); ...@@ -215,7 +214,7 @@ int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
int xfs_attr_shortform_remove(struct xfs_da_args *args); int xfs_attr_shortform_remove(struct xfs_da_args *args);
int xfs_attr_shortform_list(struct xfs_attr_list_context *context); int xfs_attr_shortform_list(struct xfs_attr_list_context *context);
int xfs_attr_shortform_allfit(struct xfs_dabuf *bp, struct xfs_inode *dp); int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
...@@ -223,7 +222,7 @@ int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); ...@@ -223,7 +222,7 @@ int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
* Internal routines when attribute fork size == XFS_LBSIZE(mp). * Internal routines when attribute fork size == XFS_LBSIZE(mp).
*/ */
int xfs_attr_leaf_to_node(struct xfs_da_args *args); int xfs_attr_leaf_to_node(struct xfs_da_args *args);
int xfs_attr_leaf_to_shortform(struct xfs_dabuf *bp, int xfs_attr_leaf_to_shortform(struct xfs_buf *bp,
struct xfs_da_args *args, int forkoff); struct xfs_da_args *args, int forkoff);
int xfs_attr_leaf_clearflag(struct xfs_da_args *args); int xfs_attr_leaf_clearflag(struct xfs_da_args *args);
int xfs_attr_leaf_setflag(struct xfs_da_args *args); int xfs_attr_leaf_setflag(struct xfs_da_args *args);
...@@ -235,14 +234,14 @@ int xfs_attr_leaf_flipflags(xfs_da_args_t *args); ...@@ -235,14 +234,14 @@ int xfs_attr_leaf_flipflags(xfs_da_args_t *args);
int xfs_attr_leaf_split(struct xfs_da_state *state, int xfs_attr_leaf_split(struct xfs_da_state *state,
struct xfs_da_state_blk *oldblk, struct xfs_da_state_blk *oldblk,
struct xfs_da_state_blk *newblk); struct xfs_da_state_blk *newblk);
int xfs_attr_leaf_lookup_int(struct xfs_dabuf *leaf, int xfs_attr_leaf_lookup_int(struct xfs_buf *leaf,
struct xfs_da_args *args); struct xfs_da_args *args);
int xfs_attr_leaf_getvalue(struct xfs_dabuf *bp, struct xfs_da_args *args); int xfs_attr_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
int xfs_attr_leaf_add(struct xfs_dabuf *leaf_buffer, int xfs_attr_leaf_add(struct xfs_buf *leaf_buffer,
struct xfs_da_args *args); struct xfs_da_args *args);
int xfs_attr_leaf_remove(struct xfs_dabuf *leaf_buffer, int xfs_attr_leaf_remove(struct xfs_buf *leaf_buffer,
struct xfs_da_args *args); struct xfs_da_args *args);
int xfs_attr_leaf_list_int(struct xfs_dabuf *bp, int xfs_attr_leaf_list_int(struct xfs_buf *bp,
struct xfs_attr_list_context *context); struct xfs_attr_list_context *context);
/* /*
...@@ -257,9 +256,9 @@ int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); ...@@ -257,9 +256,9 @@ int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp);
/* /*
* Utility routines. * Utility routines.
*/ */
xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count); xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp, int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
struct xfs_dabuf *leaf2_bp); struct xfs_buf *leaf2_bp);
int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize,
int *local); int *local);
#endif /* __XFS_ATTR_LEAF_H__ */ #endif /* __XFS_ATTR_LEAF_H__ */
此差异已折叠。
...@@ -132,20 +132,6 @@ typedef struct xfs_da_args { ...@@ -132,20 +132,6 @@ typedef struct xfs_da_args {
{ XFS_DA_OP_OKNOENT, "OKNOENT" }, \ { XFS_DA_OP_OKNOENT, "OKNOENT" }, \
{ XFS_DA_OP_CILOOKUP, "CILOOKUP" } { XFS_DA_OP_CILOOKUP, "CILOOKUP" }
/*
* Structure to describe buffer(s) for a block.
* This is needed in the directory version 2 format case, when
* multiple non-contiguous fsblocks might be needed to cover one
* logical directory block.
* If the buffer count is 1 then the data pointer points to the
* same place as the b_addr field for the buffer, else to kmem_alloced memory.
*/
typedef struct xfs_dabuf {
short bbcount; /* how large is data in bbs */
void *data; /* pointer for buffers' data */
struct xfs_buf *bp; /* actually nbuf of these */
} xfs_dabuf_t;
/* /*
* Storage for holding state during Btree searches and split/join ops. * Storage for holding state during Btree searches and split/join ops.
* *
...@@ -154,7 +140,7 @@ typedef struct xfs_dabuf { ...@@ -154,7 +140,7 @@ typedef struct xfs_dabuf {
* which is slightly more than enough. * which is slightly more than enough.
*/ */
typedef struct xfs_da_state_blk { typedef struct xfs_da_state_blk {
xfs_dabuf_t *bp; /* buffer containing block */ struct xfs_buf *bp; /* buffer containing block */
xfs_dablk_t blkno; /* filesystem blkno of buffer */ xfs_dablk_t blkno; /* filesystem blkno of buffer */
xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */ xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */
int index; /* relevant index into block */ int index; /* relevant index into block */
...@@ -207,7 +193,7 @@ struct xfs_nameops { ...@@ -207,7 +193,7 @@ 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_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level,
xfs_dabuf_t **bpp, int whichfork); struct xfs_buf **bpp, int whichfork);
int xfs_da_split(xfs_da_state_t *state); int xfs_da_split(xfs_da_state_t *state);
/* /*
...@@ -237,14 +223,14 @@ int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno, ...@@ -237,14 +223,14 @@ int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno,
int count); int count);
int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp, int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dablk_t bno, xfs_daddr_t mappedbno,
xfs_dabuf_t **bp, int whichfork); struct xfs_buf **bp, int whichfork);
int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp, int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dablk_t bno, xfs_daddr_t mappedbno,
xfs_dabuf_t **bpp, int whichfork); struct xfs_buf **bpp, int whichfork);
xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp, xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,
xfs_dablk_t bno, int whichfork); xfs_dablk_t bno, int whichfork);
int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
xfs_dabuf_t *dead_buf); struct xfs_buf *dead_buf);
uint xfs_da_hashname(const __uint8_t *name_string, int name_length); uint xfs_da_hashname(const __uint8_t *name_string, int name_length);
enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args, enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
...@@ -254,15 +240,7 @@ enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args, ...@@ -254,15 +240,7 @@ enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
xfs_da_state_t *xfs_da_state_alloc(void); xfs_da_state_t *xfs_da_state_alloc(void);
void xfs_da_state_free(xfs_da_state_t *state); void xfs_da_state_free(xfs_da_state_t *state);
void xfs_da_buf_done(xfs_dabuf_t *dabuf);
void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first,
uint last);
void xfs_da_brelse(struct xfs_trans *tp, xfs_dabuf_t *dabuf);
void xfs_da_binval(struct xfs_trans *tp, xfs_dabuf_t *dabuf);
xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *dabuf);
extern struct kmem_zone *xfs_da_state_zone; extern struct kmem_zone *xfs_da_state_zone;
extern struct kmem_zone *xfs_dabuf_zone;
extern const struct xfs_nameops xfs_default_nameops; extern const struct xfs_nameops xfs_default_nameops;
#endif /* __XFS_DA_BTREE_H__ */ #endif /* __XFS_DA_BTREE_H__ */
...@@ -592,7 +592,7 @@ int ...@@ -592,7 +592,7 @@ int
xfs_dir2_shrink_inode( xfs_dir2_shrink_inode(
xfs_da_args_t *args, xfs_da_args_t *args,
xfs_dir2_db_t db, xfs_dir2_db_t db,
xfs_dabuf_t *bp) struct xfs_buf *bp)
{ {
xfs_fileoff_t bno; /* directory file offset */ xfs_fileoff_t bno; /* directory file offset */
xfs_dablk_t da; /* directory file offset */ xfs_dablk_t da; /* directory file offset */
...@@ -634,7 +634,7 @@ xfs_dir2_shrink_inode( ...@@ -634,7 +634,7 @@ xfs_dir2_shrink_inode(
/* /*
* Invalidate the buffer from the transaction. * Invalidate the buffer from the transaction.
*/ */
xfs_da_binval(tp, bp); xfs_trans_binval(tp, bp);
/* /*
* If it's not a data block, we're done. * If it's not a data block, we're done.
*/ */
......
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
/* /*
* Local function prototypes. * Local function prototypes.
*/ */
static void xfs_dir2_block_log_leaf(xfs_trans_t *tp, xfs_dabuf_t *bp, int first, static void xfs_dir2_block_log_leaf(xfs_trans_t *tp, struct xfs_buf *bp,
int last); int first, int last);
static void xfs_dir2_block_log_tail(xfs_trans_t *tp, xfs_dabuf_t *bp); static void xfs_dir2_block_log_tail(xfs_trans_t *tp, struct xfs_buf *bp);
static int xfs_dir2_block_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **bpp, static int xfs_dir2_block_lookup_int(xfs_da_args_t *args, struct xfs_buf **bpp,
int *entno); int *entno);
static int xfs_dir2_block_sort(const void *a, const void *b); static int xfs_dir2_block_sort(const void *a, const void *b);
...@@ -66,7 +66,7 @@ xfs_dir2_block_addname( ...@@ -66,7 +66,7 @@ xfs_dir2_block_addname(
xfs_dir2_data_free_t *bf; /* bestfree table in block */ xfs_dir2_data_free_t *bf; /* bestfree table in block */
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_leaf_entry_t *blp; /* block leaf entries */ xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
xfs_dabuf_t *bp; /* buffer for block */ struct xfs_buf *bp; /* buffer for block */
xfs_dir2_block_tail_t *btp; /* block tail */ xfs_dir2_block_tail_t *btp; /* block tail */
int compact; /* need to compact leaf ents */ int compact; /* need to compact leaf ents */
xfs_dir2_data_entry_t *dep; /* block data entry */ xfs_dir2_data_entry_t *dep; /* block data entry */
...@@ -102,14 +102,14 @@ xfs_dir2_block_addname( ...@@ -102,14 +102,14 @@ xfs_dir2_block_addname(
return error; return error;
} }
ASSERT(bp != NULL); ASSERT(bp != NULL);
hdr = bp->data; hdr = bp->b_addr;
/* /*
* Check the magic number, corrupted if wrong. * Check the magic number, corrupted if wrong.
*/ */
if (unlikely(hdr->magic != cpu_to_be32(XFS_DIR2_BLOCK_MAGIC))) { if (unlikely(hdr->magic != cpu_to_be32(XFS_DIR2_BLOCK_MAGIC))) {
XFS_CORRUPTION_ERROR("xfs_dir2_block_addname", XFS_CORRUPTION_ERROR("xfs_dir2_block_addname",
XFS_ERRLEVEL_LOW, mp, hdr); XFS_ERRLEVEL_LOW, mp, hdr);
xfs_da_brelse(tp, bp); xfs_trans_brelse(tp, bp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
len = xfs_dir2_data_entsize(args->namelen); len = xfs_dir2_data_entsize(args->namelen);
...@@ -212,7 +212,7 @@ xfs_dir2_block_addname( ...@@ -212,7 +212,7 @@ xfs_dir2_block_addname(
* If this isn't a real add, we're done with the buffer. * If this isn't a real add, we're done with the buffer.
*/ */
if (args->op_flags & XFS_DA_OP_JUSTCHECK) if (args->op_flags & XFS_DA_OP_JUSTCHECK)
xfs_da_brelse(tp, bp); xfs_trans_brelse(tp, bp);
/* /*
* If we don't have space for the new entry & leaf ... * If we don't have space for the new entry & leaf ...
*/ */
...@@ -228,7 +228,6 @@ xfs_dir2_block_addname( ...@@ -228,7 +228,6 @@ xfs_dir2_block_addname(
* Then add the new entry in that format. * Then add the new entry in that format.
*/ */
error = xfs_dir2_block_to_leaf(args, bp); error = xfs_dir2_block_to_leaf(args, bp);
xfs_da_buf_done(bp);
if (error) if (error)
return error; return error;
return xfs_dir2_leaf_addname(args); return xfs_dir2_leaf_addname(args);
...@@ -422,7 +421,6 @@ xfs_dir2_block_addname( ...@@ -422,7 +421,6 @@ xfs_dir2_block_addname(
xfs_dir2_block_log_tail(tp, bp); xfs_dir2_block_log_tail(tp, bp);
xfs_dir2_data_log_entry(tp, bp, dep); xfs_dir2_data_log_entry(tp, bp, dep);
xfs_dir2_data_check(dp, bp); xfs_dir2_data_check(dp, bp);
xfs_da_buf_done(bp);
return 0; return 0;
} }
...@@ -437,7 +435,7 @@ xfs_dir2_block_getdents( ...@@ -437,7 +435,7 @@ xfs_dir2_block_getdents(
filldir_t filldir) filldir_t filldir)
{ {
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dabuf_t *bp; /* buffer for block */ struct xfs_buf *bp; /* buffer for block */
xfs_dir2_block_tail_t *btp; /* block tail */ xfs_dir2_block_tail_t *btp; /* block tail */
xfs_dir2_data_entry_t *dep; /* block data entry */ xfs_dir2_data_entry_t *dep; /* block data entry */
xfs_dir2_data_unused_t *dup; /* block unused entry */ xfs_dir2_data_unused_t *dup; /* block unused entry */
...@@ -469,7 +467,7 @@ xfs_dir2_block_getdents( ...@@ -469,7 +467,7 @@ xfs_dir2_block_getdents(
* We'll skip entries before this. * We'll skip entries before this.
*/ */
wantoff = xfs_dir2_dataptr_to_off(mp, *offset); wantoff = xfs_dir2_dataptr_to_off(mp, *offset);
hdr = bp->data; hdr = bp->b_addr;
xfs_dir2_data_check(dp, bp); xfs_dir2_data_check(dp, bp);
/* /*
* Set up values for the loop. * Set up values for the loop.
...@@ -514,7 +512,7 @@ xfs_dir2_block_getdents( ...@@ -514,7 +512,7 @@ xfs_dir2_block_getdents(
cook & 0x7fffffff, be64_to_cpu(dep->inumber), cook & 0x7fffffff, be64_to_cpu(dep->inumber),
DT_UNKNOWN)) { DT_UNKNOWN)) {
*offset = cook & 0x7fffffff; *offset = cook & 0x7fffffff;
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return 0; return 0;
} }
} }
...@@ -525,7 +523,7 @@ xfs_dir2_block_getdents( ...@@ -525,7 +523,7 @@ xfs_dir2_block_getdents(
*/ */
*offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) & *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) &
0x7fffffff; 0x7fffffff;
xfs_da_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
return 0; return 0;
} }
...@@ -535,17 +533,17 @@ xfs_dir2_block_getdents( ...@@ -535,17 +533,17 @@ xfs_dir2_block_getdents(
static void static void
xfs_dir2_block_log_leaf( xfs_dir2_block_log_leaf(
xfs_trans_t *tp, /* transaction structure */ xfs_trans_t *tp, /* transaction structure */
xfs_dabuf_t *bp, /* block buffer */ struct xfs_buf *bp, /* block buffer */
int first, /* index of first logged leaf */ int first, /* index of first logged leaf */
int last) /* index of last logged leaf */ int last) /* index of last logged leaf */
{ {
xfs_dir2_data_hdr_t *hdr = bp->data; xfs_dir2_data_hdr_t *hdr = bp->b_addr;
xfs_dir2_leaf_entry_t *blp; xfs_dir2_leaf_entry_t *blp;
xfs_dir2_block_tail_t *btp; xfs_dir2_block_tail_t *btp;
btp = xfs_dir2_block_tail_p(tp->t_mountp, hdr); btp = xfs_dir2_block_tail_p(tp->t_mountp, hdr);
blp = xfs_dir2_block_leaf_p(btp); blp = xfs_dir2_block_leaf_p(btp);
xfs_da_log_buf(tp, bp, (uint)((char *)&blp[first] - (char *)hdr), xfs_trans_log_buf(tp, bp, (uint)((char *)&blp[first] - (char *)hdr),
(uint)((char *)&blp[last + 1] - (char *)hdr - 1)); (uint)((char *)&blp[last + 1] - (char *)hdr - 1));
} }
...@@ -555,13 +553,13 @@ xfs_dir2_block_log_leaf( ...@@ -555,13 +553,13 @@ xfs_dir2_block_log_leaf(
static void static void
xfs_dir2_block_log_tail( xfs_dir2_block_log_tail(
xfs_trans_t *tp, /* transaction structure */ xfs_trans_t *tp, /* transaction structure */
xfs_dabuf_t *bp) /* block buffer */ struct xfs_buf *bp) /* block buffer */
{ {
xfs_dir2_data_hdr_t *hdr = bp->data; xfs_dir2_data_hdr_t *hdr = bp->b_addr;
xfs_dir2_block_tail_t *btp; xfs_dir2_block_tail_t *btp;
btp = xfs_dir2_block_tail_p(tp->t_mountp, hdr); btp = xfs_dir2_block_tail_p(tp->t_mountp, hdr);
xfs_da_log_buf(tp, bp, (uint)((char *)btp - (char *)hdr), xfs_trans_log_buf(tp, bp, (uint)((char *)btp - (char *)hdr),
(uint)((char *)(btp + 1) - (char *)hdr - 1)); (uint)((char *)(btp + 1) - (char *)hdr - 1));
} }
...@@ -575,7 +573,7 @@ xfs_dir2_block_lookup( ...@@ -575,7 +573,7 @@ xfs_dir2_block_lookup(
{ {
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_leaf_entry_t *blp; /* block leaf entries */ xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
xfs_dabuf_t *bp; /* block buffer */ struct xfs_buf *bp; /* block buffer */
xfs_dir2_block_tail_t *btp; /* block tail */ xfs_dir2_block_tail_t *btp; /* block tail */
xfs_dir2_data_entry_t *dep; /* block data entry */ xfs_dir2_data_entry_t *dep; /* block data entry */
xfs_inode_t *dp; /* incore inode */ xfs_inode_t *dp; /* incore inode */
...@@ -593,7 +591,7 @@ xfs_dir2_block_lookup( ...@@ -593,7 +591,7 @@ xfs_dir2_block_lookup(
return error; return error;
dp = args->dp; dp = args->dp;
mp = dp->i_mount; mp = dp->i_mount;
hdr = bp->data; hdr = bp->b_addr;
xfs_dir2_data_check(dp, bp); xfs_dir2_data_check(dp, bp);
btp = xfs_dir2_block_tail_p(mp, hdr); btp = xfs_dir2_block_tail_p(mp, hdr);
blp = xfs_dir2_block_leaf_p(btp); blp = xfs_dir2_block_leaf_p(btp);
...@@ -607,7 +605,7 @@ xfs_dir2_block_lookup( ...@@ -607,7 +605,7 @@ xfs_dir2_block_lookup(
*/ */
args->inumber = be64_to_cpu(dep->inumber); args->inumber = be64_to_cpu(dep->inumber);
error = xfs_dir_cilookup_result(args, dep->name, dep->namelen); error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
xfs_da_brelse(args->trans, bp); xfs_trans_brelse(args->trans, bp);
return XFS_ERROR(error); return XFS_ERROR(error);
} }
...@@ -617,13 +615,13 @@ xfs_dir2_block_lookup( ...@@ -617,13 +615,13 @@ xfs_dir2_block_lookup(
static int /* error */ static int /* error */
xfs_dir2_block_lookup_int( xfs_dir2_block_lookup_int(
xfs_da_args_t *args, /* dir lookup arguments */ xfs_da_args_t *args, /* dir lookup arguments */
xfs_dabuf_t **bpp, /* returned block buffer */ struct xfs_buf **bpp, /* returned block buffer */
int *entno) /* returned entry number */ int *entno) /* returned entry number */
{ {
xfs_dir2_dataptr_t addr; /* data entry address */ xfs_dir2_dataptr_t addr; /* data entry address */
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_leaf_entry_t *blp; /* block leaf entries */ xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
xfs_dabuf_t *bp; /* block buffer */ struct xfs_buf *bp; /* block buffer */
xfs_dir2_block_tail_t *btp; /* block tail */ xfs_dir2_block_tail_t *btp; /* block tail */
xfs_dir2_data_entry_t *dep; /* block data entry */ xfs_dir2_data_entry_t *dep; /* block data entry */
xfs_inode_t *dp; /* incore inode */ xfs_inode_t *dp; /* incore inode */
...@@ -647,7 +645,7 @@ xfs_dir2_block_lookup_int( ...@@ -647,7 +645,7 @@ xfs_dir2_block_lookup_int(
return error; return error;
} }
ASSERT(bp != NULL); ASSERT(bp != NULL);
hdr = bp->data; hdr = bp->b_addr;
xfs_dir2_data_check(dp, bp); xfs_dir2_data_check(dp, bp);
btp = xfs_dir2_block_tail_p(mp, hdr); btp = xfs_dir2_block_tail_p(mp, hdr);
blp = xfs_dir2_block_leaf_p(btp); blp = xfs_dir2_block_leaf_p(btp);
...@@ -666,7 +664,7 @@ xfs_dir2_block_lookup_int( ...@@ -666,7 +664,7 @@ xfs_dir2_block_lookup_int(
high = mid - 1; high = mid - 1;
if (low > high) { if (low > high) {
ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
xfs_da_brelse(tp, bp); xfs_trans_brelse(tp, bp);
return XFS_ERROR(ENOENT); return XFS_ERROR(ENOENT);
} }
} }
...@@ -714,7 +712,7 @@ xfs_dir2_block_lookup_int( ...@@ -714,7 +712,7 @@ xfs_dir2_block_lookup_int(
/* /*
* No match, release the buffer and return ENOENT. * No match, release the buffer and return ENOENT.
*/ */
xfs_da_brelse(tp, bp); xfs_trans_brelse(tp, bp);
return XFS_ERROR(ENOENT); return XFS_ERROR(ENOENT);
} }
...@@ -728,7 +726,7 @@ xfs_dir2_block_removename( ...@@ -728,7 +726,7 @@ xfs_dir2_block_removename(
{ {
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_leaf_entry_t *blp; /* block leaf pointer */ xfs_dir2_leaf_entry_t *blp; /* block leaf pointer */
xfs_dabuf_t *bp; /* block buffer */ struct xfs_buf *bp; /* block buffer */
xfs_dir2_block_tail_t *btp; /* block tail */ xfs_dir2_block_tail_t *btp; /* block tail */
xfs_dir2_data_entry_t *dep; /* block data entry */ xfs_dir2_data_entry_t *dep; /* block data entry */
xfs_inode_t *dp; /* incore inode */ xfs_inode_t *dp; /* incore inode */
...@@ -753,7 +751,7 @@ xfs_dir2_block_removename( ...@@ -753,7 +751,7 @@ xfs_dir2_block_removename(
dp = args->dp; dp = args->dp;
tp = args->trans; tp = args->trans;
mp = dp->i_mount; mp = dp->i_mount;
hdr = bp->data; hdr = bp->b_addr;
btp = xfs_dir2_block_tail_p(mp, hdr); btp = xfs_dir2_block_tail_p(mp, hdr);
blp = xfs_dir2_block_leaf_p(btp); blp = xfs_dir2_block_leaf_p(btp);
/* /*
...@@ -790,10 +788,9 @@ xfs_dir2_block_removename( ...@@ -790,10 +788,9 @@ xfs_dir2_block_removename(
* See if the size as a shortform is good enough. * See if the size as a shortform is good enough.
*/ */
size = xfs_dir2_block_sfsize(dp, hdr, &sfh); size = xfs_dir2_block_sfsize(dp, hdr, &sfh);
if (size > XFS_IFORK_DSIZE(dp)) { if (size > XFS_IFORK_DSIZE(dp))
xfs_da_buf_done(bp);
return 0; return 0;
}
/* /*
* If it works, do the conversion. * If it works, do the conversion.
*/ */
...@@ -810,7 +807,7 @@ xfs_dir2_block_replace( ...@@ -810,7 +807,7 @@ xfs_dir2_block_replace(
{ {
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_leaf_entry_t *blp; /* block leaf entries */ xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
xfs_dabuf_t *bp; /* block buffer */ struct xfs_buf *bp; /* block buffer */
xfs_dir2_block_tail_t *btp; /* block tail */ xfs_dir2_block_tail_t *btp; /* block tail */
xfs_dir2_data_entry_t *dep; /* block data entry */ xfs_dir2_data_entry_t *dep; /* block data entry */
xfs_inode_t *dp; /* incore inode */ xfs_inode_t *dp; /* incore inode */
...@@ -829,7 +826,7 @@ xfs_dir2_block_replace( ...@@ -829,7 +826,7 @@ xfs_dir2_block_replace(
} }
dp = args->dp; dp = args->dp;
mp = dp->i_mount; mp = dp->i_mount;
hdr = bp->data; hdr = bp->b_addr;
btp = xfs_dir2_block_tail_p(mp, hdr); btp = xfs_dir2_block_tail_p(mp, hdr);
blp = xfs_dir2_block_leaf_p(btp); blp = xfs_dir2_block_leaf_p(btp);
/* /*
...@@ -844,7 +841,6 @@ xfs_dir2_block_replace( ...@@ -844,7 +841,6 @@ xfs_dir2_block_replace(
dep->inumber = cpu_to_be64(args->inumber); dep->inumber = cpu_to_be64(args->inumber);
xfs_dir2_data_log_entry(args->trans, bp, dep); xfs_dir2_data_log_entry(args->trans, bp, dep);
xfs_dir2_data_check(dp, bp); xfs_dir2_data_check(dp, bp);
xfs_da_buf_done(bp);
return 0; return 0;
} }
...@@ -871,8 +867,8 @@ xfs_dir2_block_sort( ...@@ -871,8 +867,8 @@ xfs_dir2_block_sort(
int /* error */ int /* error */
xfs_dir2_leaf_to_block( xfs_dir2_leaf_to_block(
xfs_da_args_t *args, /* operation arguments */ xfs_da_args_t *args, /* operation arguments */
xfs_dabuf_t *lbp, /* leaf buffer */ struct xfs_buf *lbp, /* leaf buffer */
xfs_dabuf_t *dbp) /* data buffer */ struct xfs_buf *dbp) /* data buffer */
{ {
__be16 *bestsp; /* leaf bests table */ __be16 *bestsp; /* leaf bests table */
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
...@@ -898,7 +894,7 @@ xfs_dir2_leaf_to_block( ...@@ -898,7 +894,7 @@ xfs_dir2_leaf_to_block(
dp = args->dp; dp = args->dp;
tp = args->trans; tp = args->trans;
mp = dp->i_mount; mp = dp->i_mount;
leaf = lbp->data; leaf = lbp->b_addr;
ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
ltp = xfs_dir2_leaf_tail_p(mp, leaf); ltp = xfs_dir2_leaf_tail_p(mp, leaf);
/* /*
...@@ -914,11 +910,9 @@ xfs_dir2_leaf_to_block( ...@@ -914,11 +910,9 @@ xfs_dir2_leaf_to_block(
if ((error = if ((error =
xfs_dir2_leaf_trim_data(args, lbp, xfs_dir2_leaf_trim_data(args, lbp,
(xfs_dir2_db_t)(be32_to_cpu(ltp->bestcount) - 1)))) (xfs_dir2_db_t)(be32_to_cpu(ltp->bestcount) - 1))))
goto out; return error;
} else { } else
error = 0; return 0;
goto out;
}
} }
/* /*
* Read the data block if we don't already have it, give up if it fails. * Read the data block if we don't already have it, give up if it fails.
...@@ -926,9 +920,9 @@ xfs_dir2_leaf_to_block( ...@@ -926,9 +920,9 @@ xfs_dir2_leaf_to_block(
if (dbp == NULL && if (dbp == NULL &&
(error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &dbp, (error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &dbp,
XFS_DATA_FORK))) { XFS_DATA_FORK))) {
goto out; return error;
} }
hdr = dbp->data; hdr = dbp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)); ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC));
/* /*
* Size of the "leaf" area in the block. * Size of the "leaf" area in the block.
...@@ -944,10 +938,9 @@ xfs_dir2_leaf_to_block( ...@@ -944,10 +938,9 @@ xfs_dir2_leaf_to_block(
* If it's not free or is too short we can't do it. * If it's not free or is too short we can't do it.
*/ */
if (be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG || if (be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG ||
be16_to_cpu(dup->length) < size) { be16_to_cpu(dup->length) < size)
error = 0; return 0;
goto out;
}
/* /*
* Start converting it to block form. * Start converting it to block form.
*/ */
...@@ -989,25 +982,17 @@ xfs_dir2_leaf_to_block( ...@@ -989,25 +982,17 @@ xfs_dir2_leaf_to_block(
* Pitch the old leaf block. * Pitch the old leaf block.
*/ */
error = xfs_da_shrink_inode(args, mp->m_dirleafblk, lbp); error = xfs_da_shrink_inode(args, mp->m_dirleafblk, lbp);
lbp = NULL; if (error)
if (error) { return error;
goto out;
}
/* /*
* Now see if the resulting block can be shrunken to shortform. * Now see if the resulting block can be shrunken to shortform.
*/ */
size = xfs_dir2_block_sfsize(dp, hdr, &sfh); size = xfs_dir2_block_sfsize(dp, hdr, &sfh);
if (size > XFS_IFORK_DSIZE(dp)) { if (size > XFS_IFORK_DSIZE(dp))
error = 0; return 0;
goto out;
}
return xfs_dir2_block_to_sf(args, dbp, size, &sfh); return xfs_dir2_block_to_sf(args, dbp, size, &sfh);
out:
if (lbp)
xfs_da_buf_done(lbp);
if (dbp)
xfs_da_buf_done(dbp);
return error;
} }
/* /*
...@@ -1020,7 +1005,7 @@ xfs_dir2_sf_to_block( ...@@ -1020,7 +1005,7 @@ xfs_dir2_sf_to_block(
xfs_dir2_db_t blkno; /* dir-relative block # (0) */ xfs_dir2_db_t blkno; /* dir-relative block # (0) */
xfs_dir2_data_hdr_t *hdr; /* block header */ xfs_dir2_data_hdr_t *hdr; /* block header */
xfs_dir2_leaf_entry_t *blp; /* block leaf entries */ xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
xfs_dabuf_t *bp; /* block buffer */ struct xfs_buf *bp; /* block buffer */
xfs_dir2_block_tail_t *btp; /* block tail pointer */ xfs_dir2_block_tail_t *btp; /* block tail pointer */
xfs_dir2_data_entry_t *dep; /* data entry pointer */ xfs_dir2_data_entry_t *dep; /* data entry pointer */
xfs_inode_t *dp; /* incore directory inode */ xfs_inode_t *dp; /* incore directory inode */
...@@ -1088,7 +1073,7 @@ xfs_dir2_sf_to_block( ...@@ -1088,7 +1073,7 @@ xfs_dir2_sf_to_block(
kmem_free(sfp); kmem_free(sfp);
return error; return error;
} }
hdr = bp->data; hdr = bp->b_addr;
hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC); hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC);
/* /*
* Compute size of block "tail" area. * Compute size of block "tail" area.
...@@ -1217,6 +1202,5 @@ xfs_dir2_sf_to_block( ...@@ -1217,6 +1202,5 @@ xfs_dir2_sf_to_block(
xfs_dir2_block_log_leaf(tp, bp, 0, be32_to_cpu(btp->count) - 1); xfs_dir2_block_log_leaf(tp, bp, 0, be32_to_cpu(btp->count) - 1);
xfs_dir2_block_log_tail(tp, bp); xfs_dir2_block_log_tail(tp, bp);
xfs_dir2_data_check(dp, bp); xfs_dir2_data_check(dp, bp);
xfs_da_buf_done(bp);
return 0; return 0;
} }
...@@ -42,8 +42,8 @@ xfs_dir2_data_freefind(xfs_dir2_data_hdr_t *hdr, xfs_dir2_data_unused_t *dup); ...@@ -42,8 +42,8 @@ xfs_dir2_data_freefind(xfs_dir2_data_hdr_t *hdr, xfs_dir2_data_unused_t *dup);
*/ */
void void
xfs_dir2_data_check( xfs_dir2_data_check(
xfs_inode_t *dp, /* incore inode pointer */ struct xfs_inode *dp, /* incore inode pointer */
xfs_dabuf_t *bp) /* data block's buffer */ struct xfs_buf *bp) /* data block's buffer */
{ {
xfs_dir2_dataptr_t addr; /* addr for leaf lookup */ xfs_dir2_dataptr_t addr; /* addr for leaf lookup */
xfs_dir2_data_free_t *bf; /* bestfree table */ xfs_dir2_data_free_t *bf; /* bestfree table */
...@@ -65,7 +65,7 @@ xfs_dir2_data_check( ...@@ -65,7 +65,7 @@ xfs_dir2_data_check(
struct xfs_name name; struct xfs_name name;
mp = dp->i_mount; mp = dp->i_mount;
hdr = bp->data; hdr = bp->b_addr;
bf = hdr->bestfree; bf = hdr->bestfree;
p = (char *)(hdr + 1); p = (char *)(hdr + 1);
...@@ -389,9 +389,9 @@ int /* error */ ...@@ -389,9 +389,9 @@ int /* error */
xfs_dir2_data_init( xfs_dir2_data_init(
xfs_da_args_t *args, /* directory operation args */ xfs_da_args_t *args, /* directory operation args */
xfs_dir2_db_t blkno, /* logical dir block number */ xfs_dir2_db_t blkno, /* logical dir block number */
xfs_dabuf_t **bpp) /* output block buffer */ struct xfs_buf **bpp) /* output block buffer */
{ {
xfs_dabuf_t *bp; /* block buffer */ struct xfs_buf *bp; /* block buffer */
xfs_dir2_data_hdr_t *hdr; /* data block header */ xfs_dir2_data_hdr_t *hdr; /* data block header */
xfs_inode_t *dp; /* incore directory inode */ xfs_inode_t *dp; /* incore directory inode */
xfs_dir2_data_unused_t *dup; /* unused entry pointer */ xfs_dir2_data_unused_t *dup; /* unused entry pointer */
...@@ -417,7 +417,7 @@ xfs_dir2_data_init( ...@@ -417,7 +417,7 @@ xfs_dir2_data_init(
/* /*
* Initialize the header. * Initialize the header.
*/ */
hdr = bp->data; hdr = bp->b_addr;
hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC); hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC);
hdr->bestfree[0].offset = cpu_to_be16(sizeof(*hdr)); hdr->bestfree[0].offset = cpu_to_be16(sizeof(*hdr));
for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) {
...@@ -449,16 +449,16 @@ xfs_dir2_data_init( ...@@ -449,16 +449,16 @@ xfs_dir2_data_init(
*/ */
void void
xfs_dir2_data_log_entry( xfs_dir2_data_log_entry(
xfs_trans_t *tp, /* transaction pointer */ struct xfs_trans *tp,
xfs_dabuf_t *bp, /* block buffer */ struct xfs_buf *bp,
xfs_dir2_data_entry_t *dep) /* data entry pointer */ xfs_dir2_data_entry_t *dep) /* data entry pointer */
{ {
xfs_dir2_data_hdr_t *hdr = bp->data; xfs_dir2_data_hdr_t *hdr = bp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
xfs_da_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr), xfs_trans_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr),
(uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) - (uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) -
(char *)hdr - 1)); (char *)hdr - 1));
} }
...@@ -468,15 +468,15 @@ xfs_dir2_data_log_entry( ...@@ -468,15 +468,15 @@ xfs_dir2_data_log_entry(
*/ */
void void
xfs_dir2_data_log_header( xfs_dir2_data_log_header(
xfs_trans_t *tp, /* transaction pointer */ struct xfs_trans *tp,
xfs_dabuf_t *bp) /* block buffer */ struct xfs_buf *bp)
{ {
xfs_dir2_data_hdr_t *hdr = bp->data; xfs_dir2_data_hdr_t *hdr = bp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
xfs_da_log_buf(tp, bp, 0, sizeof(*hdr) - 1); xfs_trans_log_buf(tp, bp, 0, sizeof(*hdr) - 1);
} }
/* /*
...@@ -484,11 +484,11 @@ xfs_dir2_data_log_header( ...@@ -484,11 +484,11 @@ xfs_dir2_data_log_header(
*/ */
void void
xfs_dir2_data_log_unused( xfs_dir2_data_log_unused(
xfs_trans_t *tp, /* transaction pointer */ struct xfs_trans *tp,
xfs_dabuf_t *bp, /* block buffer */ struct xfs_buf *bp,
xfs_dir2_data_unused_t *dup) /* data unused pointer */ xfs_dir2_data_unused_t *dup) /* data unused pointer */
{ {
xfs_dir2_data_hdr_t *hdr = bp->data; xfs_dir2_data_hdr_t *hdr = bp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
...@@ -496,13 +496,13 @@ xfs_dir2_data_log_unused( ...@@ -496,13 +496,13 @@ xfs_dir2_data_log_unused(
/* /*
* Log the first part of the unused entry. * Log the first part of the unused entry.
*/ */
xfs_da_log_buf(tp, bp, (uint)((char *)dup - (char *)hdr), xfs_trans_log_buf(tp, bp, (uint)((char *)dup - (char *)hdr),
(uint)((char *)&dup->length + sizeof(dup->length) - (uint)((char *)&dup->length + sizeof(dup->length) -
1 - (char *)hdr)); 1 - (char *)hdr));
/* /*
* Log the end (tag) of the unused entry. * Log the end (tag) of the unused entry.
*/ */
xfs_da_log_buf(tp, bp, xfs_trans_log_buf(tp, bp,
(uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr), (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr),
(uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr + (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr +
sizeof(xfs_dir2_data_off_t) - 1)); sizeof(xfs_dir2_data_off_t) - 1));
...@@ -514,8 +514,8 @@ xfs_dir2_data_log_unused( ...@@ -514,8 +514,8 @@ xfs_dir2_data_log_unused(
*/ */
void void
xfs_dir2_data_make_free( xfs_dir2_data_make_free(
xfs_trans_t *tp, /* transaction pointer */ struct xfs_trans *tp,
xfs_dabuf_t *bp, /* block buffer */ struct xfs_buf *bp,
xfs_dir2_data_aoff_t offset, /* starting byte offset */ xfs_dir2_data_aoff_t offset, /* starting byte offset */
xfs_dir2_data_aoff_t len, /* length in bytes */ xfs_dir2_data_aoff_t len, /* length in bytes */
int *needlogp, /* out: log header */ int *needlogp, /* out: log header */
...@@ -531,7 +531,7 @@ xfs_dir2_data_make_free( ...@@ -531,7 +531,7 @@ xfs_dir2_data_make_free(
xfs_dir2_data_unused_t *prevdup; /* unused entry before us */ xfs_dir2_data_unused_t *prevdup; /* unused entry before us */
mp = tp->t_mountp; mp = tp->t_mountp;
hdr = bp->data; hdr = bp->b_addr;
/* /*
* Figure out where the end of the data area is. * Figure out where the end of the data area is.
...@@ -696,8 +696,8 @@ xfs_dir2_data_make_free( ...@@ -696,8 +696,8 @@ xfs_dir2_data_make_free(
*/ */
void void
xfs_dir2_data_use_free( xfs_dir2_data_use_free(
xfs_trans_t *tp, /* transaction pointer */ struct xfs_trans *tp,
xfs_dabuf_t *bp, /* data block buffer */ struct xfs_buf *bp,
xfs_dir2_data_unused_t *dup, /* unused entry */ xfs_dir2_data_unused_t *dup, /* unused entry */
xfs_dir2_data_aoff_t offset, /* starting offset to use */ xfs_dir2_data_aoff_t offset, /* starting offset to use */
xfs_dir2_data_aoff_t len, /* length to use */ xfs_dir2_data_aoff_t len, /* length to use */
...@@ -713,7 +713,7 @@ xfs_dir2_data_use_free( ...@@ -713,7 +713,7 @@ xfs_dir2_data_use_free(
xfs_dir2_data_unused_t *newdup2; /* another new unused entry */ xfs_dir2_data_unused_t *newdup2; /* another new unused entry */
int oldlen; /* old unused entry's length */ int oldlen; /* old unused entry's length */
hdr = bp->data; hdr = bp->b_addr;
ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC)); hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG); ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG);
......
此差异已折叠。
此差异已折叠。
...@@ -25,7 +25,7 @@ extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r); ...@@ -25,7 +25,7 @@ extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space, extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
xfs_dir2_db_t *dbp); xfs_dir2_db_t *dbp);
extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db, extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
struct xfs_dabuf *bp); struct xfs_buf *bp);
extern int xfs_dir_cilookup_result(struct xfs_da_args *args, extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
const unsigned char *name, int len); const unsigned char *name, int len);
...@@ -37,11 +37,11 @@ extern int xfs_dir2_block_lookup(struct xfs_da_args *args); ...@@ -37,11 +37,11 @@ extern int xfs_dir2_block_lookup(struct xfs_da_args *args);
extern int xfs_dir2_block_removename(struct xfs_da_args *args); extern int xfs_dir2_block_removename(struct xfs_da_args *args);
extern int xfs_dir2_block_replace(struct xfs_da_args *args); extern int xfs_dir2_block_replace(struct xfs_da_args *args);
extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args, extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
struct xfs_dabuf *lbp, struct xfs_dabuf *dbp); struct xfs_buf *lbp, struct xfs_buf *dbp);
/* xfs_dir2_data.c */ /* xfs_dir2_data.c */
#ifdef DEBUG #ifdef DEBUG
extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp); extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_buf *bp);
#else #else
#define xfs_dir2_data_check(dp,bp) #define xfs_dir2_data_check(dp,bp)
#endif #endif
...@@ -51,43 +51,43 @@ xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr, ...@@ -51,43 +51,43 @@ xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr,
extern void xfs_dir2_data_freescan(struct xfs_mount *mp, extern void xfs_dir2_data_freescan(struct xfs_mount *mp,
struct xfs_dir2_data_hdr *hdr, int *loghead); struct xfs_dir2_data_hdr *hdr, int *loghead);
extern int xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno, extern int xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
struct xfs_dabuf **bpp); struct xfs_buf **bpp);
extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp, extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_buf *bp,
struct xfs_dir2_data_entry *dep); struct xfs_dir2_data_entry *dep);
extern void xfs_dir2_data_log_header(struct xfs_trans *tp, extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
struct xfs_dabuf *bp); struct xfs_buf *bp);
extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp, extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp,
struct xfs_dir2_data_unused *dup); struct xfs_dir2_data_unused *dup);
extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp, extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_buf *bp,
xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len, xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
int *needlogp, int *needscanp); int *needlogp, int *needscanp);
extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp, extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_buf *bp,
struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset, struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset,
xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp); xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
/* xfs_dir2_leaf.c */ /* xfs_dir2_leaf.c */
extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args, extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,
struct xfs_dabuf *dbp); struct xfs_buf *dbp);
extern int xfs_dir2_leaf_addname(struct xfs_da_args *args); extern int xfs_dir2_leaf_addname(struct xfs_da_args *args);
extern void xfs_dir2_leaf_compact(struct xfs_da_args *args, extern void xfs_dir2_leaf_compact(struct xfs_da_args *args,
struct xfs_dabuf *bp); struct xfs_buf *bp);
extern void xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp, extern void xfs_dir2_leaf_compact_x1(struct xfs_buf *bp, int *indexp,
int *lowstalep, int *highstalep, int *lowlogp, int *highlogp); int *lowstalep, int *highstalep, int *lowlogp, int *highlogp);
extern int xfs_dir2_leaf_getdents(struct xfs_inode *dp, void *dirent, extern int xfs_dir2_leaf_getdents(struct xfs_inode *dp, void *dirent,
size_t bufsize, xfs_off_t *offset, filldir_t filldir); size_t bufsize, xfs_off_t *offset, filldir_t filldir);
extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno, extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno,
struct xfs_dabuf **bpp, int magic); struct xfs_buf **bpp, int magic);
extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp, extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_buf *bp,
int first, int last); int first, int last);
extern void xfs_dir2_leaf_log_header(struct xfs_trans *tp, extern void xfs_dir2_leaf_log_header(struct xfs_trans *tp,
struct xfs_dabuf *bp); struct xfs_buf *bp);
extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args); extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args);
extern int xfs_dir2_leaf_removename(struct xfs_da_args *args); extern int xfs_dir2_leaf_removename(struct xfs_da_args *args);
extern int xfs_dir2_leaf_replace(struct xfs_da_args *args); extern int xfs_dir2_leaf_replace(struct xfs_da_args *args);
extern int xfs_dir2_leaf_search_hash(struct xfs_da_args *args, extern int xfs_dir2_leaf_search_hash(struct xfs_da_args *args,
struct xfs_dabuf *lbp); struct xfs_buf *lbp);
extern int xfs_dir2_leaf_trim_data(struct xfs_da_args *args, extern int xfs_dir2_leaf_trim_data(struct xfs_da_args *args,
struct xfs_dabuf *lbp, xfs_dir2_db_t db); struct xfs_buf *lbp, xfs_dir2_db_t db);
extern struct xfs_dir2_leaf_entry * extern struct xfs_dir2_leaf_entry *
xfs_dir2_leaf_find_entry(struct xfs_dir2_leaf *leaf, int index, int compact, xfs_dir2_leaf_find_entry(struct xfs_dir2_leaf *leaf, int index, int compact,
int lowstale, int highstale, int lowstale, int highstale,
...@@ -96,13 +96,13 @@ extern int xfs_dir2_node_to_leaf(struct xfs_da_state *state); ...@@ -96,13 +96,13 @@ extern int xfs_dir2_node_to_leaf(struct xfs_da_state *state);
/* xfs_dir2_node.c */ /* xfs_dir2_node.c */
extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args, extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
struct xfs_dabuf *lbp); struct xfs_buf *lbp);
extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count); extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_buf *bp, int *count);
extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp, extern int xfs_dir2_leafn_lookup_int(struct xfs_buf *bp,
struct xfs_da_args *args, int *indexp, struct xfs_da_args *args, int *indexp,
struct xfs_da_state *state); struct xfs_da_state *state);
extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp, extern int xfs_dir2_leafn_order(struct xfs_buf *leaf1_bp,
struct xfs_dabuf *leaf2_bp); struct xfs_buf *leaf2_bp);
extern int xfs_dir2_leafn_split(struct xfs_da_state *state, extern int xfs_dir2_leafn_split(struct xfs_da_state *state,
struct xfs_da_state_blk *oldblk, struct xfs_da_state_blk *newblk); struct xfs_da_state_blk *oldblk, struct xfs_da_state_blk *newblk);
extern int xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action); extern int xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
...@@ -122,7 +122,7 @@ extern xfs_ino_t xfs_dir2_sfe_get_ino(struct xfs_dir2_sf_hdr *sfp, ...@@ -122,7 +122,7 @@ extern xfs_ino_t xfs_dir2_sfe_get_ino(struct xfs_dir2_sf_hdr *sfp,
struct xfs_dir2_sf_entry *sfep); struct xfs_dir2_sf_entry *sfep);
extern int xfs_dir2_block_sfsize(struct xfs_inode *dp, extern int xfs_dir2_block_sfsize(struct xfs_inode *dp,
struct xfs_dir2_data_hdr *block, struct xfs_dir2_sf_hdr *sfhp); struct xfs_dir2_data_hdr *block, struct xfs_dir2_sf_hdr *sfhp);
extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp, extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp,
int size, xfs_dir2_sf_hdr_t *sfhp); int size, xfs_dir2_sf_hdr_t *sfhp);
extern int xfs_dir2_sf_addname(struct xfs_da_args *args); extern int xfs_dir2_sf_addname(struct xfs_da_args *args);
extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino); extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
......
...@@ -222,7 +222,7 @@ xfs_dir2_block_sfsize( ...@@ -222,7 +222,7 @@ xfs_dir2_block_sfsize(
int /* error */ int /* error */
xfs_dir2_block_to_sf( xfs_dir2_block_to_sf(
xfs_da_args_t *args, /* operation arguments */ xfs_da_args_t *args, /* operation arguments */
xfs_dabuf_t *bp, /* block buffer */ struct xfs_buf *bp,
int size, /* shortform directory size */ int size, /* shortform directory size */
xfs_dir2_sf_hdr_t *sfhp) /* shortform directory hdr */ xfs_dir2_sf_hdr_t *sfhp) /* shortform directory hdr */
{ {
...@@ -249,7 +249,7 @@ xfs_dir2_block_to_sf( ...@@ -249,7 +249,7 @@ xfs_dir2_block_to_sf(
* and add local data. * and add local data.
*/ */
hdr = kmem_alloc(mp->m_dirblksize, KM_SLEEP); hdr = kmem_alloc(mp->m_dirblksize, KM_SLEEP);
memcpy(hdr, bp->data, mp->m_dirblksize); memcpy(hdr, bp->b_addr, mp->m_dirblksize);
logflags = XFS_ILOG_CORE; logflags = XFS_ILOG_CORE;
if ((error = xfs_dir2_shrink_inode(args, mp->m_dirdatablk, bp))) { if ((error = xfs_dir2_shrink_inode(args, mp->m_dirdatablk, bp))) {
ASSERT(error != ENOSPC); ASSERT(error != ENOSPC);
......
...@@ -1491,13 +1491,9 @@ xfs_init_zones(void) ...@@ -1491,13 +1491,9 @@ xfs_init_zones(void)
if (!xfs_da_state_zone) if (!xfs_da_state_zone)
goto out_destroy_btree_cur_zone; goto out_destroy_btree_cur_zone;
xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf");
if (!xfs_dabuf_zone)
goto out_destroy_da_state_zone;
xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork"); xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork");
if (!xfs_ifork_zone) if (!xfs_ifork_zone)
goto out_destroy_dabuf_zone; goto out_destroy_da_state_zone;
xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans"); xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans");
if (!xfs_trans_zone) if (!xfs_trans_zone)
...@@ -1560,8 +1556,6 @@ xfs_init_zones(void) ...@@ -1560,8 +1556,6 @@ xfs_init_zones(void)
kmem_zone_destroy(xfs_trans_zone); kmem_zone_destroy(xfs_trans_zone);
out_destroy_ifork_zone: out_destroy_ifork_zone:
kmem_zone_destroy(xfs_ifork_zone); kmem_zone_destroy(xfs_ifork_zone);
out_destroy_dabuf_zone:
kmem_zone_destroy(xfs_dabuf_zone);
out_destroy_da_state_zone: out_destroy_da_state_zone:
kmem_zone_destroy(xfs_da_state_zone); kmem_zone_destroy(xfs_da_state_zone);
out_destroy_btree_cur_zone: out_destroy_btree_cur_zone:
...@@ -1589,7 +1583,6 @@ xfs_destroy_zones(void) ...@@ -1589,7 +1583,6 @@ xfs_destroy_zones(void)
kmem_zone_destroy(xfs_log_item_desc_zone); kmem_zone_destroy(xfs_log_item_desc_zone);
kmem_zone_destroy(xfs_trans_zone); kmem_zone_destroy(xfs_trans_zone);
kmem_zone_destroy(xfs_ifork_zone); kmem_zone_destroy(xfs_ifork_zone);
kmem_zone_destroy(xfs_dabuf_zone);
kmem_zone_destroy(xfs_da_state_zone); kmem_zone_destroy(xfs_da_state_zone);
kmem_zone_destroy(xfs_btree_cur_zone); kmem_zone_destroy(xfs_btree_cur_zone);
kmem_zone_destroy(xfs_bmap_free_item_zone); kmem_zone_destroy(xfs_bmap_free_item_zone);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册