Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 9 | * This program is distributed in the hope that it would be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write the Free Software Foundation, |
| 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include "xfs.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 19 | #include "xfs_fs.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include "xfs_types.h" |
| 21 | #include "xfs_inum.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include "xfs_dir2.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 23 | #include "xfs_da_btree.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include "xfs_bmap_btree.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include "xfs_dir2_sf.h" |
Nathan Scott | a844f45 | 2005-11-02 14:38:42 +1100 | [diff] [blame] | 26 | #include "xfs_attr_sf.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #include "xfs_dinode.h" |
| 28 | #include "xfs_inode.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include "xfs_dir2_trace.h" |
| 30 | |
| 31 | #ifdef XFS_DIR2_TRACE |
| 32 | ktrace_t *xfs_dir2_trace_buf; |
| 33 | |
| 34 | /* |
| 35 | * Enter something in the trace buffers. |
| 36 | */ |
| 37 | static void |
| 38 | xfs_dir2_trace_enter( |
| 39 | xfs_inode_t *dp, |
| 40 | int type, |
| 41 | char *where, |
| 42 | char *name, |
| 43 | int namelen, |
| 44 | void *a0, |
| 45 | void *a1, |
| 46 | void *a2, |
| 47 | void *a3, |
| 48 | void *a4, |
| 49 | void *a5, |
| 50 | void *a6, |
| 51 | void *a7) |
| 52 | { |
| 53 | void *n[5]; |
| 54 | |
| 55 | ASSERT(xfs_dir2_trace_buf); |
| 56 | ASSERT(dp->i_dir_trace); |
| 57 | if (name) |
| 58 | memcpy(n, name, min((int)sizeof(n), namelen)); |
| 59 | else |
| 60 | memset((char *)n, 0, sizeof(n)); |
| 61 | ktrace_enter(xfs_dir2_trace_buf, |
| 62 | (void *)(long)type, (void *)where, |
| 63 | (void *)a0, (void *)a1, (void *)a2, (void *)a3, |
| 64 | (void *)a4, (void *)a5, (void *)a6, (void *)a7, |
| 65 | (void *)(long)namelen, |
| 66 | (void *)n[0], (void *)n[1], (void *)n[2], |
| 67 | (void *)n[3], (void *)n[4]); |
| 68 | ktrace_enter(dp->i_dir_trace, |
| 69 | (void *)(long)type, (void *)where, |
| 70 | (void *)a0, (void *)a1, (void *)a2, (void *)a3, |
| 71 | (void *)a4, (void *)a5, (void *)a6, (void *)a7, |
| 72 | (void *)(long)namelen, |
| 73 | (void *)n[0], (void *)n[1], (void *)n[2], |
| 74 | (void *)n[3], (void *)n[4]); |
| 75 | } |
| 76 | |
| 77 | void |
| 78 | xfs_dir2_trace_args( |
| 79 | char *where, |
| 80 | xfs_da_args_t *args) |
| 81 | { |
| 82 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS, where, |
| 83 | (char *)args->name, (int)args->namelen, |
| 84 | (void *)(unsigned long)args->hashval, |
| 85 | (void *)((unsigned long)(args->inumber >> 32)), |
| 86 | (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), |
| 87 | (void *)args->dp, (void *)args->trans, |
Barry Naujok | 6a17810 | 2008-05-21 16:42:05 +1000 | [diff] [blame] | 88 | (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK), |
| 89 | NULL, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | void |
| 93 | xfs_dir2_trace_args_b( |
| 94 | char *where, |
| 95 | xfs_da_args_t *args, |
| 96 | xfs_dabuf_t *bp) |
| 97 | { |
| 98 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_B, where, |
| 99 | (char *)args->name, (int)args->namelen, |
| 100 | (void *)(unsigned long)args->hashval, |
| 101 | (void *)((unsigned long)(args->inumber >> 32)), |
| 102 | (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), |
| 103 | (void *)args->dp, (void *)args->trans, |
Barry Naujok | 6a17810 | 2008-05-21 16:42:05 +1000 | [diff] [blame] | 104 | (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | (void *)(bp ? bp->bps[0] : NULL), NULL); |
| 106 | } |
| 107 | |
| 108 | void |
| 109 | xfs_dir2_trace_args_bb( |
| 110 | char *where, |
| 111 | xfs_da_args_t *args, |
| 112 | xfs_dabuf_t *lbp, |
| 113 | xfs_dabuf_t *dbp) |
| 114 | { |
| 115 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BB, where, |
| 116 | (char *)args->name, (int)args->namelen, |
| 117 | (void *)(unsigned long)args->hashval, |
| 118 | (void *)((unsigned long)(args->inumber >> 32)), |
| 119 | (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), |
| 120 | (void *)args->dp, (void *)args->trans, |
Barry Naujok | 6a17810 | 2008-05-21 16:42:05 +1000 | [diff] [blame] | 121 | (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | (void *)(lbp ? lbp->bps[0] : NULL), |
| 123 | (void *)(dbp ? dbp->bps[0] : NULL)); |
| 124 | } |
| 125 | |
| 126 | void |
| 127 | xfs_dir2_trace_args_bibii( |
| 128 | char *where, |
| 129 | xfs_da_args_t *args, |
| 130 | xfs_dabuf_t *bs, |
| 131 | int ss, |
| 132 | xfs_dabuf_t *bd, |
| 133 | int sd, |
| 134 | int c) |
| 135 | { |
| 136 | xfs_buf_t *bpbs = bs ? bs->bps[0] : NULL; |
| 137 | xfs_buf_t *bpbd = bd ? bd->bps[0] : NULL; |
| 138 | |
| 139 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BIBII, where, |
| 140 | (char *)args->name, (int)args->namelen, |
| 141 | (void *)args->dp, (void *)args->trans, |
| 142 | (void *)bpbs, (void *)(long)ss, (void *)bpbd, (void *)(long)sd, |
| 143 | (void *)(long)c, NULL); |
| 144 | } |
| 145 | |
| 146 | void |
| 147 | xfs_dir2_trace_args_db( |
| 148 | char *where, |
| 149 | xfs_da_args_t *args, |
| 150 | xfs_dir2_db_t db, |
| 151 | xfs_dabuf_t *bp) |
| 152 | { |
| 153 | xfs_buf_t *dbp = bp ? bp->bps[0] : NULL; |
| 154 | |
| 155 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_DB, where, |
| 156 | (char *)args->name, (int)args->namelen, |
| 157 | (void *)(unsigned long)args->hashval, |
| 158 | (void *)((unsigned long)(args->inumber >> 32)), |
| 159 | (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), |
| 160 | (void *)args->dp, (void *)args->trans, |
Barry Naujok | 6a17810 | 2008-05-21 16:42:05 +1000 | [diff] [blame] | 161 | (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK), |
| 162 | (void *)(long)db, (void *)dbp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | void |
| 166 | xfs_dir2_trace_args_i( |
| 167 | char *where, |
| 168 | xfs_da_args_t *args, |
| 169 | xfs_ino_t i) |
| 170 | { |
| 171 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_I, where, |
| 172 | (char *)args->name, (int)args->namelen, |
| 173 | (void *)(unsigned long)args->hashval, |
| 174 | (void *)((unsigned long)(args->inumber >> 32)), |
| 175 | (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), |
| 176 | (void *)args->dp, (void *)args->trans, |
Barry Naujok | 6a17810 | 2008-05-21 16:42:05 +1000 | [diff] [blame] | 177 | (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | (void *)((unsigned long)(i >> 32)), |
| 179 | (void *)((unsigned long)(i & 0xFFFFFFFF))); |
| 180 | } |
| 181 | |
| 182 | void |
| 183 | xfs_dir2_trace_args_s( |
| 184 | char *where, |
| 185 | xfs_da_args_t *args, |
| 186 | int s) |
| 187 | { |
| 188 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_S, where, |
| 189 | (char *)args->name, (int)args->namelen, |
| 190 | (void *)(unsigned long)args->hashval, |
| 191 | (void *)((unsigned long)(args->inumber >> 32)), |
| 192 | (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), |
| 193 | (void *)args->dp, (void *)args->trans, |
Barry Naujok | 6a17810 | 2008-05-21 16:42:05 +1000 | [diff] [blame] | 194 | (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK), |
| 195 | (void *)(long)s, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | void |
| 199 | xfs_dir2_trace_args_sb( |
| 200 | char *where, |
| 201 | xfs_da_args_t *args, |
| 202 | int s, |
| 203 | xfs_dabuf_t *bp) |
| 204 | { |
| 205 | xfs_buf_t *dbp = bp ? bp->bps[0] : NULL; |
| 206 | |
| 207 | xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_SB, where, |
| 208 | (char *)args->name, (int)args->namelen, |
| 209 | (void *)(unsigned long)args->hashval, |
| 210 | (void *)((unsigned long)(args->inumber >> 32)), |
| 211 | (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)), |
| 212 | (void *)args->dp, (void *)args->trans, |
Barry Naujok | 6a17810 | 2008-05-21 16:42:05 +1000 | [diff] [blame] | 213 | (void *)(unsigned long)(args->op_flags & XFS_DA_OP_JUSTCHECK), |
| 214 | (void *)(long)s, (void *)dbp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | } |
| 216 | #endif /* XFS_DIR2_TRACE */ |