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" |
Christoph Hellwig | 739bfb2 | 2007-08-29 10:58:01 +1000 | [diff] [blame] | 19 | #include "xfs_vnodeops.h" |
| 20 | #include "xfs_bmap_btree.h" |
| 21 | #include "xfs_inode.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | |
Christoph Hellwig | b677c21 | 2007-08-29 11:46:28 +1000 | [diff] [blame] | 23 | /* |
| 24 | * And this gunk is needed for xfs_mount.h" |
| 25 | */ |
| 26 | #include "xfs_log.h" |
| 27 | #include "xfs_trans.h" |
| 28 | #include "xfs_sb.h" |
| 29 | #include "xfs_dmapi.h" |
| 30 | #include "xfs_inum.h" |
| 31 | #include "xfs_ag.h" |
| 32 | #include "xfs_mount.h" |
| 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 35 | #ifdef XFS_INODE_TRACE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Christoph Hellwig | 1543d79 | 2007-08-29 11:46:47 +1000 | [diff] [blame] | 37 | #define KTRACE_ENTER(ip, vk, s, line, ra) \ |
| 38 | ktrace_enter( (ip)->i_trace, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | /* 0 */ (void *)(__psint_t)(vk), \ |
| 40 | /* 1 */ (void *)(s), \ |
| 41 | /* 2 */ (void *)(__psint_t) line, \ |
David Chinner | bf90424 | 2008-10-30 17:36:14 +1100 | [diff] [blame] | 42 | /* 3 */ (void *)(__psint_t)atomic_read(&VFS_I(ip)->i_count), \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* 4 */ (void *)(ra), \ |
Christoph Hellwig | b3aea4e | 2007-08-29 11:44:37 +1000 | [diff] [blame] | 44 | /* 5 */ NULL, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | /* 6 */ (void *)(__psint_t)current_cpu(), \ |
| 46 | /* 7 */ (void *)(__psint_t)current_pid(), \ |
| 47 | /* 8 */ (void *)__return_address, \ |
Christoph Hellwig | 02de1f0 | 2005-06-21 15:33:48 +1000 | [diff] [blame] | 48 | /* 9 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 50 | /* |
| 51 | * Vnode tracing code. |
| 52 | */ |
| 53 | void |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 54 | _xfs_itrace_entry(xfs_inode_t *ip, const char *func, inst_t *ra) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | { |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 56 | KTRACE_ENTER(ip, INODE_KTRACE_ENTRY, func, 0, ra); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | void |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 60 | _xfs_itrace_exit(xfs_inode_t *ip, const char *func, inst_t *ra) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | { |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 62 | KTRACE_ENTER(ip, INODE_KTRACE_EXIT, func, 0, ra); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | void |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 66 | xfs_itrace_hold(xfs_inode_t *ip, char *file, int line, inst_t *ra) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | { |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 68 | KTRACE_ENTER(ip, INODE_KTRACE_HOLD, file, line, ra); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | void |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 72 | _xfs_itrace_ref(xfs_inode_t *ip, char *file, int line, inst_t *ra) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | { |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 74 | KTRACE_ENTER(ip, INODE_KTRACE_REF, file, line, ra); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 78 | xfs_itrace_rele(xfs_inode_t *ip, char *file, int line, inst_t *ra) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | { |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 80 | KTRACE_ENTER(ip, INODE_KTRACE_RELE, file, line, ra); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | } |
Lachlan McIlroy | cf441ee | 2008-02-07 16:42:19 +1100 | [diff] [blame] | 82 | #endif /* XFS_INODE_TRACE */ |