aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2009-12-14 18:14:59 -0500
committerAlex Elder <aelder@sgi.com>2009-12-15 00:08:16 -0500
commit0b1b213fcf3a8486ada99a2bab84ab8c6f51b264 (patch)
tree661fd8da7487231224c77b95c33986cb7d7b41ef /fs/xfs/linux-2.6/xfs_super.c
parent6ef3554422e2c7e7aa424ba63737da498881dff4 (diff)
xfs: event tracing support
Convert the old xfs tracing support that could only be used with the out of tree kdb and xfsidbg patches to use the generic event tracer. To use it make sure CONFIG_EVENT_TRACING is enabled and then enable all xfs trace channels by: echo 1 > /sys/kernel/debug/tracing/events/xfs/enable or alternatively enable single events by just doing the same in one event subdirectory, e.g. echo 1 > /sys/kernel/debug/tracing/events/xfs/xfs_ihold/enable or set more complex filters, etc. In Documentation/trace/events.txt all this is desctribed in more detail. To reads the events do a cat /sys/kernel/debug/tracing/trace Compared to the last posting this patch converts the tracing mostly to the one tracepoint per callsite model that other users of the new tracing facility also employ. This allows a very fine-grained control of the tracing, a cleaner output of the traces and also enables the perf tool to use each tracepoint as a virtual performance counter, allowing us to e.g. count how often certain workloads git various spots in XFS. Take a look at http://lwn.net/Articles/346470/ for some examples. Also the btree tracing isn't included at all yet, as it will require additional core tracing features not in mainline yet, I plan to deliver it later. And the really nice thing about this patch is that it actually removes many lines of code while adding this nice functionality: fs/xfs/Makefile | 8 fs/xfs/linux-2.6/xfs_acl.c | 1 fs/xfs/linux-2.6/xfs_aops.c | 52 - fs/xfs/linux-2.6/xfs_aops.h | 2 fs/xfs/linux-2.6/xfs_buf.c | 117 +-- fs/xfs/linux-2.6/xfs_buf.h | 33 fs/xfs/linux-2.6/xfs_fs_subr.c | 3 fs/xfs/linux-2.6/xfs_ioctl.c | 1 fs/xfs/linux-2.6/xfs_ioctl32.c | 1 fs/xfs/linux-2.6/xfs_iops.c | 1 fs/xfs/linux-2.6/xfs_linux.h | 1 fs/xfs/linux-2.6/xfs_lrw.c | 87 -- fs/xfs/linux-2.6/xfs_lrw.h | 45 - fs/xfs/linux-2.6/xfs_super.c | 104 --- fs/xfs/linux-2.6/xfs_super.h | 7 fs/xfs/linux-2.6/xfs_sync.c | 1 fs/xfs/linux-2.6/xfs_trace.c | 75 ++ fs/xfs/linux-2.6/xfs_trace.h | 1369 +++++++++++++++++++++++++++++++++++++++++ fs/xfs/linux-2.6/xfs_vnode.h | 4 fs/xfs/quota/xfs_dquot.c | 110 --- fs/xfs/quota/xfs_dquot.h | 21 fs/xfs/quota/xfs_qm.c | 40 - fs/xfs/quota/xfs_qm_syscalls.c | 4 fs/xfs/support/ktrace.c | 323 --------- fs/xfs/support/ktrace.h | 85 -- fs/xfs/xfs.h | 16 fs/xfs/xfs_ag.h | 14 fs/xfs/xfs_alloc.c | 230 +----- fs/xfs/xfs_alloc.h | 27 fs/xfs/xfs_alloc_btree.c | 1 fs/xfs/xfs_attr.c | 107 --- fs/xfs/xfs_attr.h | 10 fs/xfs/xfs_attr_leaf.c | 14 fs/xfs/xfs_attr_sf.h | 40 - fs/xfs/xfs_bmap.c | 507 +++------------ fs/xfs/xfs_bmap.h | 49 - fs/xfs/xfs_bmap_btree.c | 6 fs/xfs/xfs_btree.c | 5 fs/xfs/xfs_btree_trace.h | 17 fs/xfs/xfs_buf_item.c | 87 -- fs/xfs/xfs_buf_item.h | 20 fs/xfs/xfs_da_btree.c | 3 fs/xfs/xfs_da_btree.h | 7 fs/xfs/xfs_dfrag.c | 2 fs/xfs/xfs_dir2.c | 8 fs/xfs/xfs_dir2_block.c | 20 fs/xfs/xfs_dir2_leaf.c | 21 fs/xfs/xfs_dir2_node.c | 27 fs/xfs/xfs_dir2_sf.c | 26 fs/xfs/xfs_dir2_trace.c | 216 ------ fs/xfs/xfs_dir2_trace.h | 72 -- fs/xfs/xfs_filestream.c | 8 fs/xfs/xfs_fsops.c | 2 fs/xfs/xfs_iget.c | 111 --- fs/xfs/xfs_inode.c | 67 -- fs/xfs/xfs_inode.h | 76 -- fs/xfs/xfs_inode_item.c | 5 fs/xfs/xfs_iomap.c | 85 -- fs/xfs/xfs_iomap.h | 8 fs/xfs/xfs_log.c | 181 +---- fs/xfs/xfs_log_priv.h | 20 fs/xfs/xfs_log_recover.c | 1 fs/xfs/xfs_mount.c | 2 fs/xfs/xfs_quota.h | 8 fs/xfs/xfs_rename.c | 1 fs/xfs/xfs_rtalloc.c | 1 fs/xfs/xfs_rw.c | 3 fs/xfs/xfs_trans.h | 47 + fs/xfs/xfs_trans_buf.c | 62 - fs/xfs/xfs_vnodeops.c | 8 70 files changed, 2151 insertions(+), 2592 deletions(-) Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c104
1 files changed, 3 insertions, 101 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 1bfb0e980193..09783cc444ac 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -15,6 +15,7 @@
15 * along with this program; if not, write the Free Software Foundation, 15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18
18#include "xfs.h" 19#include "xfs.h"
19#include "xfs_bit.h" 20#include "xfs_bit.h"
20#include "xfs_log.h" 21#include "xfs_log.h"
@@ -52,11 +53,11 @@
52#include "xfs_trans_priv.h" 53#include "xfs_trans_priv.h"
53#include "xfs_filestream.h" 54#include "xfs_filestream.h"
54#include "xfs_da_btree.h" 55#include "xfs_da_btree.h"
55#include "xfs_dir2_trace.h"
56#include "xfs_extfree_item.h" 56#include "xfs_extfree_item.h"
57#include "xfs_mru_cache.h" 57#include "xfs_mru_cache.h"
58#include "xfs_inode_item.h" 58#include "xfs_inode_item.h"
59#include "xfs_sync.h" 59#include "xfs_sync.h"
60#include "xfs_trace.h"
60 61
61#include <linux/namei.h> 62#include <linux/namei.h>
62#include <linux/init.h> 63#include <linux/init.h>
@@ -1525,8 +1526,6 @@ xfs_fs_fill_super(
1525 goto fail_vnrele; 1526 goto fail_vnrele;
1526 1527
1527 kfree(mtpt); 1528 kfree(mtpt);
1528
1529 xfs_itrace_exit(XFS_I(sb->s_root->d_inode));
1530 return 0; 1529 return 0;
1531 1530
1532 out_filestream_unmount: 1531 out_filestream_unmount:
@@ -1602,94 +1601,6 @@ static struct file_system_type xfs_fs_type = {
1602}; 1601};
1603 1602
1604STATIC int __init 1603STATIC int __init
1605xfs_alloc_trace_bufs(void)
1606{
1607#ifdef XFS_ALLOC_TRACE
1608 xfs_alloc_trace_buf = ktrace_alloc(XFS_ALLOC_TRACE_SIZE, KM_MAYFAIL);
1609 if (!xfs_alloc_trace_buf)
1610 goto out;
1611#endif
1612#ifdef XFS_BMAP_TRACE
1613 xfs_bmap_trace_buf = ktrace_alloc(XFS_BMAP_TRACE_SIZE, KM_MAYFAIL);
1614 if (!xfs_bmap_trace_buf)
1615 goto out_free_alloc_trace;
1616#endif
1617#ifdef XFS_BTREE_TRACE
1618 xfs_allocbt_trace_buf = ktrace_alloc(XFS_ALLOCBT_TRACE_SIZE,
1619 KM_MAYFAIL);
1620 if (!xfs_allocbt_trace_buf)
1621 goto out_free_bmap_trace;
1622
1623 xfs_inobt_trace_buf = ktrace_alloc(XFS_INOBT_TRACE_SIZE, KM_MAYFAIL);
1624 if (!xfs_inobt_trace_buf)
1625 goto out_free_allocbt_trace;
1626
1627 xfs_bmbt_trace_buf = ktrace_alloc(XFS_BMBT_TRACE_SIZE, KM_MAYFAIL);
1628 if (!xfs_bmbt_trace_buf)
1629 goto out_free_inobt_trace;
1630#endif
1631#ifdef XFS_ATTR_TRACE
1632 xfs_attr_trace_buf = ktrace_alloc(XFS_ATTR_TRACE_SIZE, KM_MAYFAIL);
1633 if (!xfs_attr_trace_buf)
1634 goto out_free_bmbt_trace;
1635#endif
1636#ifdef XFS_DIR2_TRACE
1637 xfs_dir2_trace_buf = ktrace_alloc(XFS_DIR2_GTRACE_SIZE, KM_MAYFAIL);
1638 if (!xfs_dir2_trace_buf)
1639 goto out_free_attr_trace;
1640#endif
1641
1642 return 0;
1643
1644#ifdef XFS_DIR2_TRACE
1645 out_free_attr_trace:
1646#endif
1647#ifdef XFS_ATTR_TRACE
1648 ktrace_free(xfs_attr_trace_buf);
1649 out_free_bmbt_trace:
1650#endif
1651#ifdef XFS_BTREE_TRACE
1652 ktrace_free(xfs_bmbt_trace_buf);
1653 out_free_inobt_trace:
1654 ktrace_free(xfs_inobt_trace_buf);
1655 out_free_allocbt_trace:
1656 ktrace_free(xfs_allocbt_trace_buf);
1657 out_free_bmap_trace:
1658#endif
1659#ifdef XFS_BMAP_TRACE
1660 ktrace_free(xfs_bmap_trace_buf);
1661 out_free_alloc_trace:
1662#endif
1663#ifdef XFS_ALLOC_TRACE
1664 ktrace_free(xfs_alloc_trace_buf);
1665 out:
1666#endif
1667 return -ENOMEM;
1668}
1669
1670STATIC void
1671xfs_free_trace_bufs(void)
1672{
1673#ifdef XFS_DIR2_TRACE
1674 ktrace_free(xfs_dir2_trace_buf);
1675#endif
1676#ifdef XFS_ATTR_TRACE
1677 ktrace_free(xfs_attr_trace_buf);
1678#endif
1679#ifdef XFS_BTREE_TRACE
1680 ktrace_free(xfs_bmbt_trace_buf);
1681 ktrace_free(xfs_inobt_trace_buf);
1682 ktrace_free(xfs_allocbt_trace_buf);
1683#endif
1684#ifdef XFS_BMAP_TRACE
1685 ktrace_free(xfs_bmap_trace_buf);
1686#endif
1687#ifdef XFS_ALLOC_TRACE
1688 ktrace_free(xfs_alloc_trace_buf);
1689#endif
1690}
1691
1692STATIC int __init
1693xfs_init_zones(void) 1604xfs_init_zones(void)
1694{ 1605{
1695 1606
@@ -1830,7 +1741,6 @@ init_xfs_fs(void)
1830 printk(KERN_INFO XFS_VERSION_STRING " with " 1741 printk(KERN_INFO XFS_VERSION_STRING " with "
1831 XFS_BUILD_OPTIONS " enabled\n"); 1742 XFS_BUILD_OPTIONS " enabled\n");
1832 1743
1833 ktrace_init(64);
1834 xfs_ioend_init(); 1744 xfs_ioend_init();
1835 xfs_dir_startup(); 1745 xfs_dir_startup();
1836 1746
@@ -1838,13 +1748,9 @@ init_xfs_fs(void)
1838 if (error) 1748 if (error)
1839 goto out; 1749 goto out;
1840 1750
1841 error = xfs_alloc_trace_bufs();
1842 if (error)
1843 goto out_destroy_zones;
1844
1845 error = xfs_mru_cache_init(); 1751 error = xfs_mru_cache_init();
1846 if (error) 1752 if (error)
1847 goto out_free_trace_buffers; 1753 goto out_destroy_zones;
1848 1754
1849 error = xfs_filestream_init(); 1755 error = xfs_filestream_init();
1850 if (error) 1756 if (error)
@@ -1879,8 +1785,6 @@ init_xfs_fs(void)
1879 xfs_filestream_uninit(); 1785 xfs_filestream_uninit();
1880 out_mru_cache_uninit: 1786 out_mru_cache_uninit:
1881 xfs_mru_cache_uninit(); 1787 xfs_mru_cache_uninit();
1882 out_free_trace_buffers:
1883 xfs_free_trace_bufs();
1884 out_destroy_zones: 1788 out_destroy_zones:
1885 xfs_destroy_zones(); 1789 xfs_destroy_zones();
1886 out: 1790 out:
@@ -1897,9 +1801,7 @@ exit_xfs_fs(void)
1897 xfs_buf_terminate(); 1801 xfs_buf_terminate();
1898 xfs_filestream_uninit(); 1802 xfs_filestream_uninit();
1899 xfs_mru_cache_uninit(); 1803 xfs_mru_cache_uninit();
1900 xfs_free_trace_bufs();
1901 xfs_destroy_zones(); 1804 xfs_destroy_zones();
1902 ktrace_uninit();
1903} 1805}
1904 1806
1905module_init(init_xfs_fs); 1807module_init(init_xfs_fs);