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

xfs: add more attribute tree trace points.

Added when debugging recent attribute tree problems to more finely
trace code execution through the maze of twisty passages that makes
up the attr code.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 37eb17e6
...@@ -1155,6 +1155,8 @@ xfs_attr_leaf_get(xfs_da_args_t *args) ...@@ -1155,6 +1155,8 @@ xfs_attr_leaf_get(xfs_da_args_t *args)
struct xfs_buf *bp; struct xfs_buf *bp;
int error; int error;
trace_xfs_attr_leaf_get(args);
args->blkno = 0; args->blkno = 0;
error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp, error = xfs_da_read_buf(args->trans, args->dp, args->blkno, -1, &bp,
XFS_ATTR_FORK); XFS_ATTR_FORK);
...@@ -1185,6 +1187,8 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context) ...@@ -1185,6 +1187,8 @@ xfs_attr_leaf_list(xfs_attr_list_context_t *context)
int error; int error;
struct xfs_buf *bp; struct xfs_buf *bp;
trace_xfs_attr_leaf_list(context);
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)
...@@ -1653,6 +1657,8 @@ xfs_attr_fillstate(xfs_da_state_t *state) ...@@ -1653,6 +1657,8 @@ xfs_attr_fillstate(xfs_da_state_t *state)
xfs_da_state_blk_t *blk; xfs_da_state_blk_t *blk;
int level; int level;
trace_xfs_attr_fillstate(state->args);
/* /*
* Roll down the "path" in the state structure, storing the on-disk * Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path". * block number for those buffers in the "path".
...@@ -1699,6 +1705,8 @@ xfs_attr_refillstate(xfs_da_state_t *state) ...@@ -1699,6 +1705,8 @@ xfs_attr_refillstate(xfs_da_state_t *state)
xfs_da_state_blk_t *blk; xfs_da_state_blk_t *blk;
int level, error; int level, error;
trace_xfs_attr_refillstate(state->args);
/* /*
* Roll down the "path" in the state structure, storing the on-disk * Roll down the "path" in the state structure, storing the on-disk
* block number for those buffers in the "path". * block number for those buffers in the "path".
...@@ -1755,6 +1763,8 @@ xfs_attr_node_get(xfs_da_args_t *args) ...@@ -1755,6 +1763,8 @@ xfs_attr_node_get(xfs_da_args_t *args)
int error, retval; int error, retval;
int i; int i;
trace_xfs_attr_node_get(args);
state = xfs_da_state_alloc(); state = xfs_da_state_alloc();
state->args = args; state->args = args;
state->mp = args->dp->i_mount; state->mp = args->dp->i_mount;
...@@ -1804,6 +1814,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) ...@@ -1804,6 +1814,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context)
int error, i; int error, i;
struct xfs_buf *bp; struct xfs_buf *bp;
trace_xfs_attr_node_list(context);
cursor = context->cursor; cursor = context->cursor;
cursor->initted = 1; cursor->initted = 1;
...@@ -1959,6 +1971,8 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) ...@@ -1959,6 +1971,8 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
int nmap, error, tmp, valuelen, blkcnt, i; int nmap, error, tmp, valuelen, blkcnt, i;
xfs_dablk_t lblkno; xfs_dablk_t lblkno;
trace_xfs_attr_rmtval_get(args);
ASSERT(!(args->flags & ATTR_KERNOVAL)); ASSERT(!(args->flags & ATTR_KERNOVAL));
mp = args->dp->i_mount; mp = args->dp->i_mount;
...@@ -2014,6 +2028,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) ...@@ -2014,6 +2028,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
xfs_dablk_t lblkno; xfs_dablk_t lblkno;
int blkcnt, valuelen, nmap, error, tmp, committed; int blkcnt, valuelen, nmap, error, tmp, committed;
trace_xfs_attr_rmtval_set(args);
dp = args->dp; dp = args->dp;
mp = dp->i_mount; mp = dp->i_mount;
src = args->value; src = args->value;
...@@ -2143,6 +2159,8 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) ...@@ -2143,6 +2159,8 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
xfs_dablk_t lblkno; xfs_dablk_t lblkno;
int valuelen, blkcnt, nmap, error, done, committed; int valuelen, blkcnt, nmap, error, done, committed;
trace_xfs_attr_rmtval_remove(args);
mp = args->dp->i_mount; mp = args->dp->i_mount;
/* /*
......
...@@ -57,7 +57,8 @@ STATIC int xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t which_block, ...@@ -57,7 +57,8 @@ STATIC int xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t which_block,
struct xfs_buf **bpp); struct xfs_buf **bpp);
STATIC int xfs_attr_leaf_add_work(struct xfs_buf *leaf_buffer, STATIC int xfs_attr_leaf_add_work(struct xfs_buf *leaf_buffer,
xfs_da_args_t *args, int freemap_index); xfs_da_args_t *args, int freemap_index);
STATIC void xfs_attr_leaf_compact(xfs_trans_t *tp, struct xfs_buf *leaf_buffer); STATIC void xfs_attr_leaf_compact(struct xfs_da_args *args,
struct xfs_buf *leaf_buffer);
STATIC void xfs_attr_leaf_rebalance(xfs_da_state_t *state, STATIC void xfs_attr_leaf_rebalance(xfs_da_state_t *state,
xfs_da_state_blk_t *blk1, xfs_da_state_blk_t *blk1,
xfs_da_state_blk_t *blk2); xfs_da_state_blk_t *blk2);
...@@ -1071,7 +1072,7 @@ xfs_attr_leaf_add( ...@@ -1071,7 +1072,7 @@ xfs_attr_leaf_add(
* Compact the entries to coalesce free space. * Compact the entries to coalesce free space.
* This may change the hdr->count via dropping INCOMPLETE entries. * This may change the hdr->count via dropping INCOMPLETE entries.
*/ */
xfs_attr_leaf_compact(args->trans, bp); xfs_attr_leaf_compact(args, bp);
/* /*
* After compaction, the block is guaranteed to have only one * After compaction, the block is guaranteed to have only one
...@@ -1102,6 +1103,8 @@ xfs_attr_leaf_add_work( ...@@ -1102,6 +1103,8 @@ xfs_attr_leaf_add_work(
xfs_mount_t *mp; xfs_mount_t *mp;
int tmp, i; int tmp, i;
trace_xfs_attr_leaf_add_work(args);
leaf = bp->b_addr; leaf = bp->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));
hdr = &leaf->hdr; hdr = &leaf->hdr;
...@@ -1214,15 +1217,17 @@ xfs_attr_leaf_add_work( ...@@ -1214,15 +1217,17 @@ xfs_attr_leaf_add_work(
*/ */
STATIC void STATIC void
xfs_attr_leaf_compact( xfs_attr_leaf_compact(
struct xfs_trans *trans, struct xfs_da_args *args,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
xfs_attr_leafblock_t *leaf_s, *leaf_d; xfs_attr_leafblock_t *leaf_s, *leaf_d;
xfs_attr_leaf_hdr_t *hdr_s, *hdr_d; xfs_attr_leaf_hdr_t *hdr_s, *hdr_d;
xfs_mount_t *mp; struct xfs_trans *trans = args->trans;
struct xfs_mount *mp = trans->t_mountp;
char *tmpbuffer; char *tmpbuffer;
mp = trans->t_mountp; trace_xfs_attr_leaf_compact(args);
tmpbuffer = kmem_alloc(XFS_LBSIZE(mp), KM_SLEEP); tmpbuffer = kmem_alloc(XFS_LBSIZE(mp), KM_SLEEP);
ASSERT(tmpbuffer != NULL); ASSERT(tmpbuffer != NULL);
memcpy(tmpbuffer, bp->b_addr, XFS_LBSIZE(mp)); memcpy(tmpbuffer, bp->b_addr, XFS_LBSIZE(mp));
...@@ -1345,9 +1350,8 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, ...@@ -1345,9 +1350,8 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
max = be16_to_cpu(hdr2->firstused) max = be16_to_cpu(hdr2->firstused)
- sizeof(xfs_attr_leaf_hdr_t); - sizeof(xfs_attr_leaf_hdr_t);
max -= be16_to_cpu(hdr2->count) * sizeof(xfs_attr_leaf_entry_t); max -= be16_to_cpu(hdr2->count) * sizeof(xfs_attr_leaf_entry_t);
if (space > max) { if (space > max)
xfs_attr_leaf_compact(args->trans, blk2->bp); xfs_attr_leaf_compact(args, blk2->bp);
}
/* /*
* Move high entries from leaf1 to low end of leaf2. * Move high entries from leaf1 to low end of leaf2.
...@@ -1378,9 +1382,8 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, ...@@ -1378,9 +1382,8 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1,
max = be16_to_cpu(hdr1->firstused) max = be16_to_cpu(hdr1->firstused)
- sizeof(xfs_attr_leaf_hdr_t); - sizeof(xfs_attr_leaf_hdr_t);
max -= be16_to_cpu(hdr1->count) * sizeof(xfs_attr_leaf_entry_t); max -= be16_to_cpu(hdr1->count) * sizeof(xfs_attr_leaf_entry_t);
if (space > max) { if (space > max)
xfs_attr_leaf_compact(args->trans, blk1->bp); xfs_attr_leaf_compact(args, blk1->bp);
}
/* /*
* Move low entries from leaf2 to high end of leaf1. * Move low entries from leaf2 to high end of leaf1.
...@@ -1577,6 +1580,8 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action) ...@@ -1577,6 +1580,8 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action)
xfs_dablk_t blkno; xfs_dablk_t blkno;
struct xfs_buf *bp; struct xfs_buf *bp;
trace_xfs_attr_leaf_toosmall(state->args);
/* /*
* Check for the degenerate case of the block being over 50% full. * Check for the degenerate case of the block being over 50% full.
* If so, it's not worth even looking to see if we might be able * If so, it's not worth even looking to see if we might be able
...@@ -1702,6 +1707,8 @@ xfs_attr_leaf_remove( ...@@ -1702,6 +1707,8 @@ xfs_attr_leaf_remove(
int tablesize, tmp, i; int tablesize, tmp, i;
xfs_mount_t *mp; xfs_mount_t *mp;
trace_xfs_attr_leaf_remove(args);
leaf = bp->b_addr; leaf = bp->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));
hdr = &leaf->hdr; hdr = &leaf->hdr;
......
...@@ -779,6 +779,8 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) ...@@ -779,6 +779,8 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action)
xfs_dablk_t blkno; xfs_dablk_t blkno;
struct xfs_buf *bp; struct xfs_buf *bp;
trace_xfs_da_node_toosmall(state->args);
/* /*
* Check for the degenerate case of the block being over 50% full. * Check for the degenerate case of the block being over 50% full.
* If so, it's not worth even looking to see if we might be able * If so, it's not worth even looking to see if we might be able
...@@ -900,6 +902,8 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path) ...@@ -900,6 +902,8 @@ xfs_da_fixhashpath(xfs_da_state_t *state, xfs_da_state_path_t *path)
xfs_dahash_t lasthash=0; xfs_dahash_t lasthash=0;
int level, count; int level, count;
trace_xfs_da_fixhashpath(state->args);
level = path->active-1; level = path->active-1;
blk = &path->blk[ level ]; blk = &path->blk[ level ];
switch (blk->magic) { switch (blk->magic) {
...@@ -1417,6 +1421,8 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path, ...@@ -1417,6 +1421,8 @@ xfs_da_path_shift(xfs_da_state_t *state, xfs_da_state_path_t *path,
xfs_dablk_t blkno=0; xfs_dablk_t blkno=0;
int level, error; int level, error;
trace_xfs_da_path_shift(state->args);
/* /*
* Roll up the Btree looking for the first block where our * Roll up the Btree looking for the first block where our
* current index is not at the edge of the block. Note that * current index is not at the edge of the block. Note that
......
...@@ -96,6 +96,8 @@ DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full); ...@@ -96,6 +96,8 @@ DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add); DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk); DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound); DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
DECLARE_EVENT_CLASS(xfs_perag_class, DECLARE_EVENT_CLASS(xfs_perag_class,
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
...@@ -1502,8 +1504,42 @@ DEFINE_DIR2_EVENT(xfs_dir2_node_replace); ...@@ -1502,8 +1504,42 @@ DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
DEFINE_DIR2_EVENT(xfs_dir2_node_removename); DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf); DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
DECLARE_EVENT_CLASS(xfs_attr_class,
TP_PROTO(struct xfs_da_args *args),
TP_ARGS(args),
TP_STRUCT__entry(
__field(dev_t, dev)
__field(xfs_ino_t, ino)
__dynamic_array(char, name, args->namelen)
__field(int, namelen)
__field(int, valuelen)
__field(xfs_dahash_t, hashval)
__field(int, op_flags)
),
TP_fast_assign(
__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
__entry->ino = args->dp->i_ino;
if (args->namelen)
memcpy(__get_str(name), args->name, args->namelen);
__entry->namelen = args->namelen;
__entry->valuelen = args->valuelen;
__entry->hashval = args->hashval;
__entry->op_flags = args->op_flags;
),
TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
"hashval 0x%x op_flags %s",
MAJOR(__entry->dev), MINOR(__entry->dev),
__entry->ino,
__entry->namelen,
__entry->namelen ? __get_str(name) : NULL,
__entry->namelen,
__entry->valuelen,
__entry->hashval,
__print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
)
#define DEFINE_ATTR_EVENT(name) \ #define DEFINE_ATTR_EVENT(name) \
DEFINE_EVENT(xfs_da_class, name, \ DEFINE_EVENT(xfs_attr_class, name, \
TP_PROTO(struct xfs_da_args *args), \ TP_PROTO(struct xfs_da_args *args), \
TP_ARGS(args)) TP_ARGS(args))
DEFINE_ATTR_EVENT(xfs_attr_sf_add); DEFINE_ATTR_EVENT(xfs_attr_sf_add);
...@@ -1517,10 +1553,14 @@ DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf); ...@@ -1517,10 +1553,14 @@ DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
DEFINE_ATTR_EVENT(xfs_attr_leaf_add); DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old); DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new); DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
DEFINE_ATTR_EVENT(xfs_attr_leaf_addname); DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
DEFINE_ATTR_EVENT(xfs_attr_leaf_create); DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup); DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
DEFINE_ATTR_EVENT(xfs_attr_leaf_replace); DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
DEFINE_ATTR_EVENT(xfs_attr_leaf_removename); DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
DEFINE_ATTR_EVENT(xfs_attr_leaf_split); DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before); DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
...@@ -1532,12 +1572,21 @@ DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf); ...@@ -1532,12 +1572,21 @@ DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node); DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance); DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance); DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
DEFINE_ATTR_EVENT(xfs_attr_node_addname); DEFINE_ATTR_EVENT(xfs_attr_node_addname);
DEFINE_ATTR_EVENT(xfs_attr_node_get);
DEFINE_ATTR_EVENT(xfs_attr_node_lookup); DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
DEFINE_ATTR_EVENT(xfs_attr_node_replace); DEFINE_ATTR_EVENT(xfs_attr_node_replace);
DEFINE_ATTR_EVENT(xfs_attr_node_removename); DEFINE_ATTR_EVENT(xfs_attr_node_removename);
DEFINE_ATTR_EVENT(xfs_attr_fillstate);
DEFINE_ATTR_EVENT(xfs_attr_refillstate);
DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
#define DEFINE_DA_EVENT(name) \ #define DEFINE_DA_EVENT(name) \
DEFINE_EVENT(xfs_da_class, name, \ DEFINE_EVENT(xfs_da_class, name, \
TP_PROTO(struct xfs_da_args *args), \ TP_PROTO(struct xfs_da_args *args), \
...@@ -1556,9 +1605,12 @@ DEFINE_DA_EVENT(xfs_da_node_split); ...@@ -1556,9 +1605,12 @@ DEFINE_DA_EVENT(xfs_da_node_split);
DEFINE_DA_EVENT(xfs_da_node_remove); DEFINE_DA_EVENT(xfs_da_node_remove);
DEFINE_DA_EVENT(xfs_da_node_rebalance); DEFINE_DA_EVENT(xfs_da_node_rebalance);
DEFINE_DA_EVENT(xfs_da_node_unbalance); DEFINE_DA_EVENT(xfs_da_node_unbalance);
DEFINE_DA_EVENT(xfs_da_node_toosmall);
DEFINE_DA_EVENT(xfs_da_swap_lastblock); DEFINE_DA_EVENT(xfs_da_swap_lastblock);
DEFINE_DA_EVENT(xfs_da_grow_inode); DEFINE_DA_EVENT(xfs_da_grow_inode);
DEFINE_DA_EVENT(xfs_da_shrink_inode); DEFINE_DA_EVENT(xfs_da_shrink_inode);
DEFINE_DA_EVENT(xfs_da_fixhashpath);
DEFINE_DA_EVENT(xfs_da_path_shift);
DECLARE_EVENT_CLASS(xfs_dir2_space_class, DECLARE_EVENT_CLASS(xfs_dir2_space_class,
TP_PROTO(struct xfs_da_args *args, int idx), TP_PROTO(struct xfs_da_args *args, int idx),
......
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