diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 107 |
1 files changed, 9 insertions, 98 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 8fe6f6b78a4a..e953b6cfb2a8 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "xfs_trans_space.h" | 47 | #include "xfs_trans_space.h" |
48 | #include "xfs_rw.h" | 48 | #include "xfs_rw.h" |
49 | #include "xfs_vnodeops.h" | 49 | #include "xfs_vnodeops.h" |
50 | #include "xfs_trace.h" | ||
50 | 51 | ||
51 | /* | 52 | /* |
52 | * xfs_attr.c | 53 | * xfs_attr.c |
@@ -89,10 +90,6 @@ STATIC int xfs_attr_rmtval_remove(xfs_da_args_t *args); | |||
89 | 90 | ||
90 | #define ATTR_RMTVALUE_MAPSIZE 1 /* # of map entries at once */ | 91 | #define ATTR_RMTVALUE_MAPSIZE 1 /* # of map entries at once */ |
91 | 92 | ||
92 | #if defined(XFS_ATTR_TRACE) | ||
93 | ktrace_t *xfs_attr_trace_buf; | ||
94 | #endif | ||
95 | |||
96 | STATIC int | 93 | STATIC int |
97 | xfs_attr_name_to_xname( | 94 | xfs_attr_name_to_xname( |
98 | struct xfs_name *xname, | 95 | struct xfs_name *xname, |
@@ -640,7 +637,6 @@ xfs_attr_list_int(xfs_attr_list_context_t *context) | |||
640 | return EIO; | 637 | return EIO; |
641 | 638 | ||
642 | xfs_ilock(dp, XFS_ILOCK_SHARED); | 639 | xfs_ilock(dp, XFS_ILOCK_SHARED); |
643 | xfs_attr_trace_l_c("syscall start", context); | ||
644 | 640 | ||
645 | /* | 641 | /* |
646 | * Decide on what work routines to call based on the inode size. | 642 | * Decide on what work routines to call based on the inode size. |
@@ -656,7 +652,6 @@ xfs_attr_list_int(xfs_attr_list_context_t *context) | |||
656 | } | 652 | } |
657 | 653 | ||
658 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | 654 | xfs_iunlock(dp, XFS_ILOCK_SHARED); |
659 | xfs_attr_trace_l_c("syscall end", context); | ||
660 | 655 | ||
661 | return error; | 656 | return error; |
662 | } | 657 | } |
@@ -702,7 +697,7 @@ xfs_attr_put_listent(xfs_attr_list_context_t *context, int flags, | |||
702 | context->count * sizeof(alist->al_offset[0]); | 697 | context->count * sizeof(alist->al_offset[0]); |
703 | context->firstu -= ATTR_ENTSIZE(namelen); | 698 | context->firstu -= ATTR_ENTSIZE(namelen); |
704 | if (context->firstu < arraytop) { | 699 | if (context->firstu < arraytop) { |
705 | xfs_attr_trace_l_c("buffer full", context); | 700 | trace_xfs_attr_list_full(context); |
706 | alist->al_more = 1; | 701 | alist->al_more = 1; |
707 | context->seen_enough = 1; | 702 | context->seen_enough = 1; |
708 | return 1; | 703 | return 1; |
@@ -714,7 +709,7 @@ xfs_attr_put_listent(xfs_attr_list_context_t *context, int flags, | |||
714 | aep->a_name[namelen] = 0; | 709 | aep->a_name[namelen] = 0; |
715 | alist->al_offset[context->count++] = context->firstu; | 710 | alist->al_offset[context->count++] = context->firstu; |
716 | alist->al_count = context->count; | 711 | alist->al_count = context->count; |
717 | xfs_attr_trace_l_c("add", context); | 712 | trace_xfs_attr_list_add(context); |
718 | return 0; | 713 | return 0; |
719 | } | 714 | } |
720 | 715 | ||
@@ -1853,7 +1848,7 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1853 | node = bp->data; | 1848 | node = bp->data; |
1854 | switch (be16_to_cpu(node->hdr.info.magic)) { | 1849 | switch (be16_to_cpu(node->hdr.info.magic)) { |
1855 | case XFS_DA_NODE_MAGIC: | 1850 | case XFS_DA_NODE_MAGIC: |
1856 | xfs_attr_trace_l_cn("wrong blk", context, node); | 1851 | trace_xfs_attr_list_wrong_blk(context); |
1857 | xfs_da_brelse(NULL, bp); | 1852 | xfs_da_brelse(NULL, bp); |
1858 | bp = NULL; | 1853 | bp = NULL; |
1859 | break; | 1854 | break; |
@@ -1861,20 +1856,18 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1861 | leaf = bp->data; | 1856 | leaf = bp->data; |
1862 | if (cursor->hashval > be32_to_cpu(leaf->entries[ | 1857 | if (cursor->hashval > be32_to_cpu(leaf->entries[ |
1863 | be16_to_cpu(leaf->hdr.count)-1].hashval)) { | 1858 | be16_to_cpu(leaf->hdr.count)-1].hashval)) { |
1864 | xfs_attr_trace_l_cl("wrong blk", | 1859 | trace_xfs_attr_list_wrong_blk(context); |
1865 | context, leaf); | ||
1866 | xfs_da_brelse(NULL, bp); | 1860 | xfs_da_brelse(NULL, bp); |
1867 | bp = NULL; | 1861 | bp = NULL; |
1868 | } else if (cursor->hashval <= | 1862 | } else if (cursor->hashval <= |
1869 | be32_to_cpu(leaf->entries[0].hashval)) { | 1863 | be32_to_cpu(leaf->entries[0].hashval)) { |
1870 | xfs_attr_trace_l_cl("maybe wrong blk", | 1864 | trace_xfs_attr_list_wrong_blk(context); |
1871 | context, leaf); | ||
1872 | xfs_da_brelse(NULL, bp); | 1865 | xfs_da_brelse(NULL, bp); |
1873 | bp = NULL; | 1866 | bp = NULL; |
1874 | } | 1867 | } |
1875 | break; | 1868 | break; |
1876 | default: | 1869 | default: |
1877 | xfs_attr_trace_l_c("wrong blk - ??", context); | 1870 | trace_xfs_attr_list_wrong_blk(context); |
1878 | xfs_da_brelse(NULL, bp); | 1871 | xfs_da_brelse(NULL, bp); |
1879 | bp = NULL; | 1872 | bp = NULL; |
1880 | } | 1873 | } |
@@ -1919,8 +1912,8 @@ xfs_attr_node_list(xfs_attr_list_context_t *context) | |||
1919 | if (cursor->hashval | 1912 | if (cursor->hashval |
1920 | <= be32_to_cpu(btree->hashval)) { | 1913 | <= be32_to_cpu(btree->hashval)) { |
1921 | cursor->blkno = be32_to_cpu(btree->before); | 1914 | cursor->blkno = be32_to_cpu(btree->before); |
1922 | xfs_attr_trace_l_cb("descending", | 1915 | trace_xfs_attr_list_node_descend(context, |
1923 | context, btree); | 1916 | btree); |
1924 | break; | 1917 | break; |
1925 | } | 1918 | } |
1926 | } | 1919 | } |
@@ -2270,85 +2263,3 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args) | |||
2270 | } | 2263 | } |
2271 | return(0); | 2264 | return(0); |
2272 | } | 2265 | } |
2273 | |||
2274 | #if defined(XFS_ATTR_TRACE) | ||
2275 | /* | ||
2276 | * Add a trace buffer entry for an attr_list context structure. | ||
2277 | */ | ||
2278 | void | ||
2279 | xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context) | ||
2280 | { | ||
2281 | xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_C, where, context, | ||
2282 | (__psunsigned_t)NULL, | ||
2283 | (__psunsigned_t)NULL, | ||
2284 | (__psunsigned_t)NULL); | ||
2285 | } | ||
2286 | |||
2287 | /* | ||
2288 | * Add a trace buffer entry for a context structure and a Btree node. | ||
2289 | */ | ||
2290 | void | ||
2291 | xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context, | ||
2292 | struct xfs_da_intnode *node) | ||
2293 | { | ||
2294 | xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CN, where, context, | ||
2295 | (__psunsigned_t)be16_to_cpu(node->hdr.count), | ||
2296 | (__psunsigned_t)be32_to_cpu(node->btree[0].hashval), | ||
2297 | (__psunsigned_t)be32_to_cpu(node->btree[ | ||
2298 | be16_to_cpu(node->hdr.count)-1].hashval)); | ||
2299 | } | ||
2300 | |||
2301 | /* | ||
2302 | * Add a trace buffer entry for a context structure and a Btree element. | ||
2303 | */ | ||
2304 | void | ||
2305 | xfs_attr_trace_l_cb(char *where, struct xfs_attr_list_context *context, | ||
2306 | struct xfs_da_node_entry *btree) | ||
2307 | { | ||
2308 | xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CB, where, context, | ||
2309 | (__psunsigned_t)be32_to_cpu(btree->hashval), | ||
2310 | (__psunsigned_t)be32_to_cpu(btree->before), | ||
2311 | (__psunsigned_t)NULL); | ||
2312 | } | ||
2313 | |||
2314 | /* | ||
2315 | * Add a trace buffer entry for a context structure and a leaf block. | ||
2316 | */ | ||
2317 | void | ||
2318 | xfs_attr_trace_l_cl(char *where, struct xfs_attr_list_context *context, | ||
2319 | struct xfs_attr_leafblock *leaf) | ||
2320 | { | ||
2321 | xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CL, where, context, | ||
2322 | (__psunsigned_t)be16_to_cpu(leaf->hdr.count), | ||
2323 | (__psunsigned_t)be32_to_cpu(leaf->entries[0].hashval), | ||
2324 | (__psunsigned_t)be32_to_cpu(leaf->entries[ | ||
2325 | be16_to_cpu(leaf->hdr.count)-1].hashval)); | ||
2326 | } | ||
2327 | |||
2328 | /* | ||
2329 | * Add a trace buffer entry for the arguments given to the routine, | ||
2330 | * generic form. | ||
2331 | */ | ||
2332 | void | ||
2333 | xfs_attr_trace_enter(int type, char *where, | ||
2334 | struct xfs_attr_list_context *context, | ||
2335 | __psunsigned_t a13, __psunsigned_t a14, | ||
2336 | __psunsigned_t a15) | ||
2337 | { | ||
2338 | ASSERT(xfs_attr_trace_buf); | ||
2339 | ktrace_enter(xfs_attr_trace_buf, (void *)((__psunsigned_t)type), | ||
2340 | (void *)((__psunsigned_t)where), | ||
2341 | (void *)((__psunsigned_t)context->dp), | ||
2342 | (void *)((__psunsigned_t)context->cursor->hashval), | ||
2343 | (void *)((__psunsigned_t)context->cursor->blkno), | ||
2344 | (void *)((__psunsigned_t)context->cursor->offset), | ||
2345 | (void *)((__psunsigned_t)context->alist), | ||
2346 | (void *)((__psunsigned_t)context->bufsize), | ||
2347 | (void *)((__psunsigned_t)context->count), | ||
2348 | (void *)((__psunsigned_t)context->firstu), | ||
2349 | NULL, | ||
2350 | (void *)((__psunsigned_t)context->dupcnt), | ||
2351 | (void *)((__psunsigned_t)context->flags), | ||
2352 | (void *)a13, (void *)a14, (void *)a15); | ||
2353 | } | ||
2354 | #endif /* XFS_ATTR_TRACE */ | ||