Commit 0b1b213f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent 6ef35544
...@@ -26,6 +26,8 @@ endif ...@@ -26,6 +26,8 @@ endif
obj-$(CONFIG_XFS_FS) += xfs.o obj-$(CONFIG_XFS_FS) += xfs.o
xfs-y += linux-2.6/xfs_trace.o
xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \ xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \
xfs_dquot.o \ xfs_dquot.o \
xfs_dquot_item.o \ xfs_dquot_item.o \
...@@ -90,8 +92,7 @@ xfs-y += xfs_alloc.o \ ...@@ -90,8 +92,7 @@ xfs-y += xfs_alloc.o \
xfs_rw.o \ xfs_rw.o \
xfs_dmops.o xfs_dmops.o
xfs-$(CONFIG_XFS_TRACE) += xfs_btree_trace.o \ xfs-$(CONFIG_XFS_TRACE) += xfs_btree_trace.o
xfs_dir2_trace.o
# Objects in linux/ # Objects in linux/
xfs-y += $(addprefix $(XFS_LINUX)/, \ xfs-y += $(addprefix $(XFS_LINUX)/, \
...@@ -113,6 +114,3 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \ ...@@ -113,6 +114,3 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
xfs-y += $(addprefix support/, \ xfs-y += $(addprefix support/, \
debug.o \ debug.o \
uuid.o) uuid.o)
xfs-$(CONFIG_XFS_TRACE) += support/ktrace.o
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_vnodeops.h" #include "xfs_vnodeops.h"
#include "xfs_trace.h"
#include <linux/xattr.h> #include <linux/xattr.h>
#include <linux/posix_acl_xattr.h> #include <linux/posix_acl_xattr.h>
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_iomap.h" #include "xfs_iomap.h"
#include "xfs_vnodeops.h" #include "xfs_vnodeops.h"
#include "xfs_trace.h"
#include <linux/mpage.h> #include <linux/mpage.h>
#include <linux/pagevec.h> #include <linux/pagevec.h>
#include <linux/writeback.h> #include <linux/writeback.h>
...@@ -76,7 +77,7 @@ xfs_ioend_wake( ...@@ -76,7 +77,7 @@ xfs_ioend_wake(
wake_up(to_ioend_wq(ip)); wake_up(to_ioend_wq(ip));
} }
STATIC void void
xfs_count_page_state( xfs_count_page_state(
struct page *page, struct page *page,
int *delalloc, int *delalloc,
...@@ -98,48 +99,6 @@ xfs_count_page_state( ...@@ -98,48 +99,6 @@ xfs_count_page_state(
} while ((bh = bh->b_this_page) != head); } while ((bh = bh->b_this_page) != head);
} }
#if defined(XFS_RW_TRACE)
void
xfs_page_trace(
int tag,
struct inode *inode,
struct page *page,
unsigned long pgoff)
{
xfs_inode_t *ip;
loff_t isize = i_size_read(inode);
loff_t offset = page_offset(page);
int delalloc = -1, unmapped = -1, unwritten = -1;
if (page_has_buffers(page))
xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
ip = XFS_I(inode);
if (!ip->i_rwtrace)
return;
ktrace_enter(ip->i_rwtrace,
(void *)((unsigned long)tag),
(void *)ip,
(void *)inode,
(void *)page,
(void *)pgoff,
(void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
(void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
(void *)((unsigned long)((isize >> 32) & 0xffffffff)),
(void *)((unsigned long)(isize & 0xffffffff)),
(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
(void *)((unsigned long)(offset & 0xffffffff)),
(void *)((unsigned long)delalloc),
(void *)((unsigned long)unmapped),
(void *)((unsigned long)unwritten),
(void *)((unsigned long)current_pid()),
(void *)NULL);
}
#else
#define xfs_page_trace(tag, inode, page, pgoff)
#endif
STATIC struct block_device * STATIC struct block_device *
xfs_find_bdev_for_inode( xfs_find_bdev_for_inode(
struct xfs_inode *ip) struct xfs_inode *ip)
...@@ -1202,7 +1161,7 @@ xfs_vm_writepage( ...@@ -1202,7 +1161,7 @@ xfs_vm_writepage(
int delalloc, unmapped, unwritten; int delalloc, unmapped, unwritten;
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
xfs_page_trace(XFS_WRITEPAGE_ENTER, inode, page, 0); trace_xfs_writepage(inode, page, 0);
/* /*
* We need a transaction if: * We need a transaction if:
...@@ -1307,7 +1266,7 @@ xfs_vm_releasepage( ...@@ -1307,7 +1266,7 @@ xfs_vm_releasepage(
.nr_to_write = 1, .nr_to_write = 1,
}; };
xfs_page_trace(XFS_RELEASEPAGE_ENTER, inode, page, 0); trace_xfs_releasepage(inode, page, 0);
if (!page_has_buffers(page)) if (!page_has_buffers(page))
return 0; return 0;
...@@ -1587,8 +1546,7 @@ xfs_vm_invalidatepage( ...@@ -1587,8 +1546,7 @@ xfs_vm_invalidatepage(
struct page *page, struct page *page,
unsigned long offset) unsigned long offset)
{ {
xfs_page_trace(XFS_INVALIDPAGE_ENTER, trace_xfs_invalidatepage(page->mapping->host, page, offset);
page->mapping->host, page, offset);
block_invalidatepage(page, offset); block_invalidatepage(page, offset);
} }
......
...@@ -45,4 +45,6 @@ extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int); ...@@ -45,4 +45,6 @@ extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int);
extern void xfs_ioend_init(void); extern void xfs_ioend_init(void);
extern void xfs_ioend_wait(struct xfs_inode *); extern void xfs_ioend_wait(struct xfs_inode *);
extern void xfs_count_page_state(struct page *, int *, int *, int *);
#endif /* __XFS_AOPS_H__ */ #endif /* __XFS_AOPS_H__ */
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_dmapi.h" #include "xfs_dmapi.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_trace.h"
static kmem_zone_t *xfs_buf_zone; static kmem_zone_t *xfs_buf_zone;
STATIC int xfsbufd(void *); STATIC int xfsbufd(void *);
...@@ -53,34 +54,6 @@ static struct workqueue_struct *xfslogd_workqueue; ...@@ -53,34 +54,6 @@ static struct workqueue_struct *xfslogd_workqueue;
struct workqueue_struct *xfsdatad_workqueue; struct workqueue_struct *xfsdatad_workqueue;
struct workqueue_struct *xfsconvertd_workqueue; struct workqueue_struct *xfsconvertd_workqueue;
#ifdef XFS_BUF_TRACE
void
xfs_buf_trace(
xfs_buf_t *bp,
char *id,
void *data,
void *ra)
{
ktrace_enter(xfs_buf_trace_buf,
bp, id,
(void *)(unsigned long)bp->b_flags,
(void *)(unsigned long)bp->b_hold.counter,
(void *)(unsigned long)bp->b_sema.count,
(void *)current,
data, ra,
(void *)(unsigned long)((bp->b_file_offset>>32) & 0xffffffff),
(void *)(unsigned long)(bp->b_file_offset & 0xffffffff),
(void *)(unsigned long)bp->b_buffer_length,
NULL, NULL, NULL, NULL, NULL);
}
ktrace_t *xfs_buf_trace_buf;
#define XFS_BUF_TRACE_SIZE 4096
#define XB_TRACE(bp, id, data) \
xfs_buf_trace(bp, id, (void *)data, (void *)__builtin_return_address(0))
#else
#define XB_TRACE(bp, id, data) do { } while (0)
#endif
#ifdef XFS_BUF_LOCK_TRACKING #ifdef XFS_BUF_LOCK_TRACKING
# define XB_SET_OWNER(bp) ((bp)->b_last_holder = current->pid) # define XB_SET_OWNER(bp) ((bp)->b_last_holder = current->pid)
# define XB_CLEAR_OWNER(bp) ((bp)->b_last_holder = -1) # define XB_CLEAR_OWNER(bp) ((bp)->b_last_holder = -1)
...@@ -279,7 +252,8 @@ _xfs_buf_initialize( ...@@ -279,7 +252,8 @@ _xfs_buf_initialize(
init_waitqueue_head(&bp->b_waiters); init_waitqueue_head(&bp->b_waiters);
XFS_STATS_INC(xb_create); XFS_STATS_INC(xb_create);
XB_TRACE(bp, "initialize", target);
trace_xfs_buf_init(bp, _RET_IP_);
} }
/* /*
...@@ -332,7 +306,7 @@ void ...@@ -332,7 +306,7 @@ void
xfs_buf_free( xfs_buf_free(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
XB_TRACE(bp, "free", 0); trace_xfs_buf_free(bp, _RET_IP_);
ASSERT(list_empty(&bp->b_hash_list)); ASSERT(list_empty(&bp->b_hash_list));
...@@ -445,7 +419,6 @@ _xfs_buf_lookup_pages( ...@@ -445,7 +419,6 @@ _xfs_buf_lookup_pages(
if (page_count == bp->b_page_count) if (page_count == bp->b_page_count)
bp->b_flags |= XBF_DONE; bp->b_flags |= XBF_DONE;
XB_TRACE(bp, "lookup_pages", (long)page_count);
return error; return error;
} }
...@@ -548,7 +521,6 @@ _xfs_buf_find( ...@@ -548,7 +521,6 @@ _xfs_buf_find(
if (down_trylock(&bp->b_sema)) { if (down_trylock(&bp->b_sema)) {
if (!(flags & XBF_TRYLOCK)) { if (!(flags & XBF_TRYLOCK)) {
/* wait for buffer ownership */ /* wait for buffer ownership */
XB_TRACE(bp, "get_lock", 0);
xfs_buf_lock(bp); xfs_buf_lock(bp);
XFS_STATS_INC(xb_get_locked_waited); XFS_STATS_INC(xb_get_locked_waited);
} else { } else {
...@@ -571,7 +543,8 @@ _xfs_buf_find( ...@@ -571,7 +543,8 @@ _xfs_buf_find(
ASSERT((bp->b_flags & _XBF_DELWRI_Q) == 0); ASSERT((bp->b_flags & _XBF_DELWRI_Q) == 0);
bp->b_flags &= XBF_MAPPED; bp->b_flags &= XBF_MAPPED;
} }
XB_TRACE(bp, "got_lock", 0);
trace_xfs_buf_find(bp, flags, _RET_IP_);
XFS_STATS_INC(xb_get_locked); XFS_STATS_INC(xb_get_locked);
return bp; return bp;
} }
...@@ -627,7 +600,7 @@ xfs_buf_get( ...@@ -627,7 +600,7 @@ xfs_buf_get(
bp->b_bn = ioff; bp->b_bn = ioff;
bp->b_count_desired = bp->b_buffer_length; bp->b_count_desired = bp->b_buffer_length;
XB_TRACE(bp, "get", (unsigned long)flags); trace_xfs_buf_get(bp, flags, _RET_IP_);
return bp; return bp;
no_buffer: no_buffer:
...@@ -644,8 +617,6 @@ _xfs_buf_read( ...@@ -644,8 +617,6 @@ _xfs_buf_read(
{ {
int status; int status;
XB_TRACE(bp, "_xfs_buf_read", (unsigned long)flags);
ASSERT(!(flags & (XBF_DELWRI|XBF_WRITE))); ASSERT(!(flags & (XBF_DELWRI|XBF_WRITE)));
ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL); ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL);
...@@ -673,19 +644,18 @@ xfs_buf_read( ...@@ -673,19 +644,18 @@ xfs_buf_read(
bp = xfs_buf_get(target, ioff, isize, flags); bp = xfs_buf_get(target, ioff, isize, flags);
if (bp) { if (bp) {
trace_xfs_buf_read(bp, flags, _RET_IP_);
if (!XFS_BUF_ISDONE(bp)) { if (!XFS_BUF_ISDONE(bp)) {
XB_TRACE(bp, "read", (unsigned long)flags);
XFS_STATS_INC(xb_get_read); XFS_STATS_INC(xb_get_read);
_xfs_buf_read(bp, flags); _xfs_buf_read(bp, flags);
} else if (flags & XBF_ASYNC) { } else if (flags & XBF_ASYNC) {
XB_TRACE(bp, "read_async", (unsigned long)flags);
/* /*
* Read ahead call which is already satisfied, * Read ahead call which is already satisfied,
* drop the buffer * drop the buffer
*/ */
goto no_buffer; goto no_buffer;
} else { } else {
XB_TRACE(bp, "read_done", (unsigned long)flags);
/* We do not want read in the flags */ /* We do not want read in the flags */
bp->b_flags &= ~XBF_READ; bp->b_flags &= ~XBF_READ;
} }
...@@ -823,7 +793,7 @@ xfs_buf_get_noaddr( ...@@ -823,7 +793,7 @@ xfs_buf_get_noaddr(
xfs_buf_unlock(bp); xfs_buf_unlock(bp);
XB_TRACE(bp, "no_daddr", len); trace_xfs_buf_get_noaddr(bp, _RET_IP_);
return bp; return bp;
fail_free_mem: fail_free_mem:
...@@ -845,8 +815,8 @@ void ...@@ -845,8 +815,8 @@ void
xfs_buf_hold( xfs_buf_hold(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
trace_xfs_buf_hold(bp, _RET_IP_);
atomic_inc(&bp->b_hold); atomic_inc(&bp->b_hold);
XB_TRACE(bp, "hold", 0);
} }
/* /*
...@@ -859,7 +829,7 @@ xfs_buf_rele( ...@@ -859,7 +829,7 @@ xfs_buf_rele(
{ {
xfs_bufhash_t *hash = bp->b_hash; xfs_bufhash_t *hash = bp->b_hash;
XB_TRACE(bp, "rele", bp->b_relse); trace_xfs_buf_rele(bp, _RET_IP_);
if (unlikely(!hash)) { if (unlikely(!hash)) {
ASSERT(!bp->b_relse); ASSERT(!bp->b_relse);
...@@ -909,21 +879,19 @@ xfs_buf_cond_lock( ...@@ -909,21 +879,19 @@ xfs_buf_cond_lock(
int locked; int locked;
locked = down_trylock(&bp->b_sema) == 0; locked = down_trylock(&bp->b_sema) == 0;
if (locked) { if (locked)
XB_SET_OWNER(bp); XB_SET_OWNER(bp);
}
XB_TRACE(bp, "cond_lock", (long)locked); trace_xfs_buf_cond_lock(bp, _RET_IP_);
return locked ? 0 : -EBUSY; return locked ? 0 : -EBUSY;
} }
#if defined(DEBUG) || defined(XFS_BLI_TRACE)
int int
xfs_buf_lock_value( xfs_buf_lock_value(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
return bp->b_sema.count; return bp->b_sema.count;
} }
#endif
/* /*
* Locks a buffer object. * Locks a buffer object.
...@@ -935,12 +903,14 @@ void ...@@ -935,12 +903,14 @@ void
xfs_buf_lock( xfs_buf_lock(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
XB_TRACE(bp, "lock", 0); trace_xfs_buf_lock(bp, _RET_IP_);
if (atomic_read(&bp->b_io_remaining)) if (atomic_read(&bp->b_io_remaining))
blk_run_address_space(bp->b_target->bt_mapping); blk_run_address_space(bp->b_target->bt_mapping);
down(&bp->b_sema); down(&bp->b_sema);
XB_SET_OWNER(bp); XB_SET_OWNER(bp);
XB_TRACE(bp, "locked", 0);
trace_xfs_buf_lock_done(bp, _RET_IP_);
} }
/* /*
...@@ -962,7 +932,8 @@ xfs_buf_unlock( ...@@ -962,7 +932,8 @@ xfs_buf_unlock(
XB_CLEAR_OWNER(bp); XB_CLEAR_OWNER(bp);
up(&bp->b_sema); up(&bp->b_sema);
XB_TRACE(bp, "unlock", 0);
trace_xfs_buf_unlock(bp, _RET_IP_);
} }
...@@ -974,17 +945,18 @@ void ...@@ -974,17 +945,18 @@ void
xfs_buf_pin( xfs_buf_pin(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
trace_xfs_buf_pin(bp, _RET_IP_);
atomic_inc(&bp->b_pin_count); atomic_inc(&bp->b_pin_count);
XB_TRACE(bp, "pin", (long)bp->b_pin_count.counter);
} }
void void
xfs_buf_unpin( xfs_buf_unpin(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
trace_xfs_buf_unpin(bp, _RET_IP_);
if (atomic_dec_and_test(&bp->b_pin_count)) if (atomic_dec_and_test(&bp->b_pin_count))
wake_up_all(&bp->b_waiters); wake_up_all(&bp->b_waiters);
XB_TRACE(bp, "unpin", (long)bp->b_pin_count.counter);
} }
int int
...@@ -1035,7 +1007,7 @@ xfs_buf_iodone_work( ...@@ -1035,7 +1007,7 @@ xfs_buf_iodone_work(
*/ */
if ((bp->b_error == EOPNOTSUPP) && if ((bp->b_error == EOPNOTSUPP) &&
(bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) { (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
XB_TRACE(bp, "ordered_retry", bp->b_iodone); trace_xfs_buf_ordered_retry(bp, _RET_IP_);
bp->b_flags &= ~XBF_ORDERED; bp->b_flags &= ~XBF_ORDERED;
bp->b_flags |= _XFS_BARRIER_FAILED; bp->b_flags |= _XFS_BARRIER_FAILED;
xfs_buf_iorequest(bp); xfs_buf_iorequest(bp);
...@@ -1050,12 +1022,12 @@ xfs_buf_ioend( ...@@ -1050,12 +1022,12 @@ xfs_buf_ioend(
xfs_buf_t *bp, xfs_buf_t *bp,
int schedule) int schedule)
{ {
trace_xfs_buf_iodone(bp, _RET_IP_);
bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD); bp->b_flags &= ~(XBF_READ | XBF_WRITE | XBF_READ_AHEAD);
if (bp->b_error == 0) if (bp->b_error == 0)
bp->b_flags |= XBF_DONE; bp->b_flags |= XBF_DONE;
XB_TRACE(bp, "iodone", bp->b_iodone);
if ((bp->b_iodone) || (bp->b_flags & XBF_ASYNC)) { if ((bp->b_iodone) || (bp->b_flags & XBF_ASYNC)) {
if (schedule) { if (schedule) {
INIT_WORK(&bp->b_iodone_work, xfs_buf_iodone_work); INIT_WORK(&bp->b_iodone_work, xfs_buf_iodone_work);
...@@ -1075,7 +1047,7 @@ xfs_buf_ioerror( ...@@ -1075,7 +1047,7 @@ xfs_buf_ioerror(
{ {
ASSERT(error >= 0 && error <= 0xffff); ASSERT(error >= 0 && error <= 0xffff);
bp->b_error = (unsigned short)error; bp->b_error = (unsigned short)error;
XB_TRACE(bp, "ioerror", (unsigned long)error); trace_xfs_buf_ioerror(bp, error, _RET_IP_);
} }
int int
...@@ -1083,7 +1055,7 @@ xfs_bawrite( ...@@ -1083,7 +1055,7 @@ xfs_bawrite(
void *mp, void *mp,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
XB_TRACE(bp, "bawrite", 0); trace_xfs_buf_bawrite(bp, _RET_IP_);
ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL); ASSERT(bp->b_bn != XFS_BUF_DADDR_NULL);
...@@ -1102,7 +1074,7 @@ xfs_bdwrite( ...@@ -1102,7 +1074,7 @@ xfs_bdwrite(
void *mp, void *mp,
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
XB_TRACE(bp, "bdwrite", 0); trace_xfs_buf_bdwrite(bp, _RET_IP_);
bp->b_strat = xfs_bdstrat_cb; bp->b_strat = xfs_bdstrat_cb;
bp->b_mount = mp; bp->b_mount = mp;
...@@ -1253,7 +1225,7 @@ int ...@@ -1253,7 +1225,7 @@ int
xfs_buf_iorequest( xfs_buf_iorequest(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
XB_TRACE(bp, "iorequest", 0); trace_xfs_buf_iorequest(bp, _RET_IP_);
if (bp->b_flags & XBF_DELWRI) { if (bp->b_flags & XBF_DELWRI) {
xfs_buf_delwri_queue(bp, 1); xfs_buf_delwri_queue(bp, 1);
...@@ -1287,11 +1259,13 @@ int ...@@ -1287,11 +1259,13 @@ int
xfs_buf_iowait( xfs_buf_iowait(
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
XB_TRACE(bp, "iowait", 0); trace_xfs_buf_iowait(bp, _RET_IP_);
if (atomic_read(&bp->b_io_remaining)) if (atomic_read(&bp->b_io_remaining))
blk_run_address_space(bp->b_target->bt_mapping); blk_run_address_space(bp->b_target->bt_mapping);
wait_for_completion(&bp->b_iowait); wait_for_completion(&bp->b_iowait);
XB_TRACE(bp, "iowaited", (long)bp->b_error);
trace_xfs_buf_iowait_done(bp, _RET_IP_);
return bp->b_error; return bp->b_error;
} }
...@@ -1604,7 +1578,8 @@ xfs_buf_delwri_queue( ...@@ -1604,7 +1578,8 @@ xfs_buf_delwri_queue(
struct list_head *dwq = &bp->b_target->bt_delwrite_queue; struct list_head *dwq = &bp->b_target->bt_delwrite_queue;
spinlock_t *dwlk = &bp->b_target->bt_delwrite_lock; spinlock_t *dwlk = &bp->b_target->bt_delwrite_lock;
XB_TRACE(bp, "delwri_q", (long)unlock); trace_xfs_buf_delwri_queue(bp, _RET_IP_);
ASSERT((bp->b_flags&(XBF_DELWRI|XBF_ASYNC)) == (XBF_DELWRI|XBF_ASYNC)); ASSERT((bp->b_flags&(XBF_DELWRI|XBF_ASYNC)) == (XBF_DELWRI|XBF_ASYNC));
spin_lock(dwlk); spin_lock(dwlk);
...@@ -1644,7 +1619,7 @@ xfs_buf_delwri_dequeue( ...@@ -1644,7 +1619,7 @@ xfs_buf_delwri_dequeue(
if (dequeued) if (dequeued)
xfs_buf_rele(bp); xfs_buf_rele(bp);
XB_TRACE(bp, "delwri_dq", (long)dequeued); trace_xfs_buf_delwri_dequeue(bp, _RET_IP_);
} }
STATIC void STATIC void
...@@ -1692,7 +1667,7 @@ xfs_buf_delwri_split( ...@@ -1692,7 +1667,7 @@ xfs_buf_delwri_split(
INIT_LIST_HEAD(list); INIT_LIST_HEAD(list);
spin_lock(dwlk); spin_lock(dwlk);
list_for_each_entry_safe(bp, n, dwq, b_list) { list_for_each_entry_safe(bp, n, dwq, b_list) {
XB_TRACE(bp, "walkq1", (long)xfs_buf_ispin(bp)); trace_xfs_buf_delwri_split(bp, _RET_IP_);
ASSERT(bp->b_flags & XBF_DELWRI); ASSERT(bp->b_flags & XBF_DELWRI);
if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) { if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) {
...@@ -1816,14 +1791,10 @@ xfs_flush_buftarg( ...@@ -1816,14 +1791,10 @@ xfs_flush_buftarg(
int __init int __init
xfs_buf_init(void) xfs_buf_init(void)
{ {
#ifdef XFS_BUF_TRACE
xfs_buf_trace_buf = ktrace_alloc(XFS_BUF_TRACE_SIZE, KM_NOFS);
#endif
xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf", xfs_buf_zone = kmem_zone_init_flags(sizeof(xfs_buf_t), "xfs_buf",
KM_ZONE_HWALIGN, NULL); KM_ZONE_HWALIGN, NULL);
if (!xfs_buf_zone) if (!xfs_buf_zone)
goto out_free_trace_buf; goto out;
xfslogd_workqueue = create_workqueue("xfslogd"); xfslogd_workqueue = create_workqueue("xfslogd");
if (!xfslogd_workqueue) if (!xfslogd_workqueue)
...@@ -1846,10 +1817,7 @@ xfs_buf_init(void) ...@@ -1846,10 +1817,7 @@ xfs_buf_init(void)
destroy_workqueue(xfslogd_workqueue); destroy_workqueue(xfslogd_workqueue);
out_free_buf_zone: out_free_buf_zone:
kmem_zone_destroy(xfs_buf_zone); kmem_zone_destroy(xfs_buf_zone);
out_free_trace_buf: out:
#ifdef XFS_BUF_TRACE
ktrace_free(xfs_buf_trace_buf);
#endif
return -ENOMEM; return -ENOMEM;
} }
...@@ -1861,9 +1829,6 @@ xfs_buf_terminate(void) ...@@ -1861,9 +1829,6 @@ xfs_buf_terminate(void)
destroy_workqueue(xfsdatad_workqueue); destroy_workqueue(xfsdatad_workqueue);
destroy_workqueue(xfslogd_workqueue); destroy_workqueue(xfslogd_workqueue);
kmem_zone_destroy(xfs_buf_zone); kmem_zone_destroy(xfs_buf_zone);
#ifdef XFS_BUF_TRACE
ktrace_free(xfs_buf_trace_buf);
#endif
} }
#ifdef CONFIG_KDB_MODULES #ifdef CONFIG_KDB_MODULES
......
...@@ -95,6 +95,28 @@ typedef enum { ...@@ -95,6 +95,28 @@ typedef enum {
_XFS_BARRIER_FAILED = (1 << 23), _XFS_BARRIER_FAILED = (1 << 23),
} xfs_buf_flags_t; } xfs_buf_flags_t;
#define XFS_BUF_FLAGS \
{ XBF_READ, "READ" }, \
{ XBF_WRITE, "WRITE" }, \
{ XBF_MAPPED, "MAPPED" }, \
{ XBF_ASYNC, "ASYNC" }, \
{ XBF_DONE, "DONE" }, \
{ XBF_DELWRI, "DELWRI" }, \
{ XBF_STALE, "STALE" }, \
{ XBF_FS_MANAGED, "FS_MANAGED" }, \
{ XBF_ORDERED, "ORDERED" }, \
{ XBF_READ_AHEAD, "READ_AHEAD" }, \
{ XBF_LOCK, "LOCK" }, /* should never be set */\
{ XBF_TRYLOCK, "TRYLOCK" }, /* ditto */\
{ XBF_DONT_BLOCK, "DONT_BLOCK" }, /* ditto */\
{ _XBF_PAGE_CACHE, "PAGE_CACHE" }, \
{ _XBF_PAGES, "PAGES" }, \
{ _XBF_RUN_QUEUES, "RUN_QUEUES" }, \
{ _XBF_DELWRI_Q, "DELWRI_Q" }, \
{ _XBF_PAGE_LOCKED, "PAGE_LOCKED" }, \
{ _XFS_BARRIER_FAILED, "BARRIER_FAILED" }
typedef enum { typedef enum {
XBT_FORCE_SLEEP = 0, XBT_FORCE_SLEEP = 0,
XBT_FORCE_FLUSH = 1, XBT_FORCE_FLUSH = 1,
...@@ -243,13 +265,6 @@ extern void xfs_buf_delwri_dequeue(xfs_buf_t *); ...@@ -243,13 +265,6 @@ extern void xfs_buf_delwri_dequeue(xfs_buf_t *);
extern int xfs_buf_init(void); extern int xfs_buf_init(void);
extern void xfs_buf_terminate(void); extern void xfs_buf_terminate(void);
#ifdef XFS_BUF_TRACE
extern ktrace_t *xfs_buf_trace_buf;
extern void xfs_buf_trace(xfs_buf_t *, char *, void *, void *);
#else
#define xfs_buf_trace(bp,id,ptr,ra) do { } while (0)
#endif
#define xfs_buf_target_name(target) \ #define xfs_buf_target_name(target) \
({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; }) ({ char __b[BDEVNAME_SIZE]; bdevname((target)->bt_bdev, __b); __b; })
...@@ -365,10 +380,6 @@ static inline void xfs_buf_relse(xfs_buf_t *bp) ...@@ -365,10 +380,6 @@ static inline void xfs_buf_relse(xfs_buf_t *bp)
#define xfs_bpin(bp) xfs_buf_pin(bp) #define xfs_bpin(bp) xfs_buf_pin(bp)
#define xfs_bunpin(bp) xfs_buf_unpin(bp) #define xfs_bunpin(bp) xfs_buf_unpin(bp)
#define xfs_buftrace(id, bp) \
xfs_buf_trace(bp, id, NULL, (void *)__builtin_return_address(0))
#define xfs_biodone(bp) xfs_buf_ioend(bp, 0) #define xfs_biodone(bp) xfs_buf_ioend(bp, 0)
#define xfs_biomove(bp, off, len, data, rw) \ #define xfs_biomove(bp, off, len, data, rw) \
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "xfs_vnodeops.h" #include "xfs_vnodeops.h"
#include "xfs_bmap_btree.h" #include "xfs_bmap_btree.h"
#include "xfs_inode.h" #include "xfs_inode.h"
#include "xfs_trace.h"
int fs_noerr(void) { return 0; } int fs_noerr(void) { return 0; }
int fs_nosys(void) { return ENOSYS; } int fs_nosys(void) { return ENOSYS; }
...@@ -51,6 +52,8 @@ xfs_flushinval_pages( ...@@ -51,6 +52,8 @@ xfs_flushinval_pages(
struct address_space *mapping = VFS_I(ip)->i_mapping; struct address_space *mapping = VFS_I(ip)->i_mapping;
int ret = 0; int ret = 0;
trace_xfs_pagecache_inval(ip, first, last);
if (mapping->nrpages) { if (mapping->nrpages) {
xfs_iflags_clear(ip, XFS_ITRUNCATED); xfs_iflags_clear(ip, XFS_ITRUNCATED);
ret = filemap_write_and_wait(mapping); ret = filemap_write_and_wait(mapping);
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_inode_item.h" #include "xfs_inode_item.h"
#include "xfs_export.h" #include "xfs_export.h"
#include "xfs_trace.h"
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/dcache.h> #include <linux/dcache.h>
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "xfs_attr.h" #include "xfs_attr.h"
#include "xfs_ioctl.h" #include "xfs_ioctl.h"
#include "xfs_ioctl32.h" #include "xfs_ioctl32.h"
#include "xfs_trace.h"
#define _NATIVE_IOC(cmd, type) \ #define _NATIVE_IOC(cmd, type) \
_IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type)) _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_vnodeops.h" #include "xfs_vnodeops.h"
#include "xfs_trace.h"
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/xattr.h> #include <linux/xattr.h>
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include <sv.h> #include <sv.h>
#include <time.h> #include <time.h>
#include <support/ktrace.h>
#include <support/debug.h> #include <support/debug.h>
#include <support/uuid.h> #include <support/uuid.h>
......
...@@ -48,73 +48,12 @@ ...@@ -48,73 +48,12 @@
#include "xfs_utils.h" #include "xfs_utils.h"
#include "xfs_iomap.h" #include "xfs_iomap.h"
#include "xfs_vnodeops.h" #include "xfs_vnodeops.h"
#include "xfs_trace.h"
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/writeback.h> #include <linux/writeback.h>
#if defined(XFS_RW_TRACE)
void
xfs_rw_enter_trace(
int tag,
xfs_inode_t *ip,
void *data,
size_t segs,
loff_t offset,
int ioflags)
{
if (ip->i_rwtrace == NULL)
return;
ktrace_enter(ip->i_rwtrace,
(void *)(unsigned long)tag,
(void *)ip,
(void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
(void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
(void *)data,
(void *)((unsigned long)segs),
(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
(void *)((unsigned long)(offset & 0xffffffff)),
(void *)((unsigned long)ioflags),
(void *)((unsigned long)((ip->i_new_size >> 32) & 0xffffffff)),
(void *)((unsigned long)(ip->i_new_size & 0xffffffff)),
(void *)((unsigned long)current_pid()),
(void *)NULL,
(void *)NULL,
(void *)NULL,
(void *)NULL);
}
void
xfs_inval_cached_trace(
xfs_inode_t *ip,
xfs_off_t offset,
xfs_off_t len,
xfs_off_t first,
xfs_off_t last)
{
if (ip->i_rwtrace == NULL)
return;
ktrace_enter(ip->i_rwtrace,
(void *)(__psint_t)XFS_INVAL_CACHED,
(void *)ip,
(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
(void *)((unsigned long)(offset & 0xffffffff)),
(void *)((unsigned long)((len >> 32) & 0xffffffff)),
(void *)((unsigned long)(len & 0xffffffff)),
(void *)((unsigned long)((first >> 32) & 0xffffffff)),
(void *)((unsigned long)(first & 0xffffffff)),
(void *)((unsigned long)((last >> 32) & 0xffffffff)),
(void *)((unsigned long)(last & 0xffffffff)),
(void *)((unsigned long)current_pid()),
(void *)NULL,
(void *)NULL,
(void *)NULL,
(void *)NULL,
(void *)NULL);
}
#endif
/* /*
* xfs_iozero * xfs_iozero
* *
...@@ -250,8 +189,7 @@ xfs_read( ...@@ -250,8 +189,7 @@ xfs_read(
} }
} }
xfs_rw_enter_trace(XFS_READ_ENTER, ip, trace_xfs_file_read(ip, size, *offset, ioflags);
(void *)iovp, segs, *offset, ioflags);
iocb->ki_pos = *offset; iocb->ki_pos = *offset;
ret = generic_file_aio_read(iocb, iovp, segs, *offset); ret = generic_file_aio_read(iocb, iovp, segs, *offset);
...@@ -292,8 +230,9 @@ xfs_splice_read( ...@@ -292,8 +230,9 @@ xfs_splice_read(
return -error; return -error;
} }
} }
xfs_rw_enter_trace(XFS_SPLICE_READ_ENTER, ip,
pipe, count, *ppos, ioflags); trace_xfs_file_splice_read(ip, count, *ppos, ioflags);
ret = generic_file_splice_read(infilp, ppos, pipe, count, flags); ret = generic_file_splice_read(infilp, ppos, pipe, count, flags);
if (ret > 0) if (ret > 0)
XFS_STATS_ADD(xs_read_bytes, ret); XFS_STATS_ADD(xs_read_bytes, ret);
...@@ -342,8 +281,8 @@ xfs_splice_write( ...@@ -342,8 +281,8 @@ xfs_splice_write(
ip->i_new_size = new_size; ip->i_new_size = new_size;
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
xfs_rw_enter_trace(XFS_SPLICE_WRITE_ENTER, ip, trace_xfs_file_splice_write(ip, count, *ppos, ioflags);
pipe, count, *ppos, ioflags);
ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags); ret = generic_file_splice_write(pipe, outfilp, ppos, count, flags);
if (ret > 0) if (ret > 0)
XFS_STATS_ADD(xs_write_bytes, ret); XFS_STATS_ADD(xs_write_bytes, ret);
...@@ -710,8 +649,6 @@ xfs_write( ...@@ -710,8 +649,6 @@ xfs_write(
if ((ioflags & IO_ISDIRECT)) { if ((ioflags & IO_ISDIRECT)) {
if (mapping->nrpages) { if (mapping->nrpages) {
WARN_ON(need_i_mutex == 0); WARN_ON(need_i_mutex == 0);
xfs_inval_cached_trace(xip, pos, -1,
(pos & PAGE_CACHE_MASK), -1);
error = xfs_flushinval_pages(xip, error = xfs_flushinval_pages(xip,
(pos & PAGE_CACHE_MASK), (pos & PAGE_CACHE_MASK),
-1, FI_REMAPF_LOCKED); -1, FI_REMAPF_LOCKED);
...@@ -728,8 +665,7 @@ xfs_write( ...@@ -728,8 +665,7 @@ xfs_write(
need_i_mutex = 0; need_i_mutex = 0;
} }
xfs_rw_enter_trace(XFS_DIOWR_ENTER, xip, (void *)iovp, segs, trace_xfs_file_direct_write(xip, count, *offset, ioflags);
*offset, ioflags);
ret = generic_file_direct_write(iocb, iovp, ret = generic_file_direct_write(iocb, iovp,
&segs, pos, offset, count, ocount); &segs, pos, offset, count, ocount);
...@@ -752,8 +688,7 @@ xfs_write( ...@@ -752,8 +688,7 @@ xfs_write(
ssize_t ret2 = 0; ssize_t ret2 = 0;
write_retry: write_retry:
xfs_rw_enter_trace(XFS_WRITE_ENTER, xip, (void *)iovp, segs, trace_xfs_file_buffered_write(xip, count, *offset, ioflags);
*offset, ioflags);
ret2 = generic_file_buffered_write(iocb, iovp, segs, ret2 = generic_file_buffered_write(iocb, iovp, segs,
pos, offset, count, ret); pos, offset, count, ret);
/* /*
...@@ -858,7 +793,7 @@ int ...@@ -858,7 +793,7 @@ int
xfs_bdstrat_cb(struct xfs_buf *bp) xfs_bdstrat_cb(struct xfs_buf *bp)
{ {
if (XFS_FORCED_SHUTDOWN(bp->b_mount)) { if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
xfs_buftrace("XFS__BDSTRAT IOERROR", bp); trace_xfs_bdstrat_shut(bp, _RET_IP_);
/* /*
* Metadata write that didn't get logged but * Metadata write that didn't get logged but
* written delayed anyway. These aren't associated * written delayed anyway. These aren't associated
...@@ -891,7 +826,7 @@ xfsbdstrat( ...@@ -891,7 +826,7 @@ xfsbdstrat(
return; return;
} }
xfs_buftrace("XFSBDSTRAT IOERROR", bp); trace_xfs_bdstrat_shut(bp, _RET_IP_);
xfs_bioerror_relse(bp); xfs_bioerror_relse(bp);
} }
......
...@@ -20,52 +20,7 @@ ...@@ -20,52 +20,7 @@
struct xfs_mount; struct xfs_mount;
struct xfs_inode; struct xfs_inode;
struct xfs_bmbt_irec;
struct xfs_buf; struct xfs_buf;
struct xfs_iomap;
#if defined(XFS_RW_TRACE)
/*
* Defines for the trace mechanisms in xfs_lrw.c.
*/
#define XFS_RW_KTRACE_SIZE 128
#define XFS_READ_ENTER 1
#define XFS_WRITE_ENTER 2
#define XFS_IOMAP_READ_ENTER 3
#define XFS_IOMAP_WRITE_ENTER 4
#define XFS_IOMAP_READ_MAP 5
#define XFS_IOMAP_WRITE_MAP 6
#define XFS_IOMAP_WRITE_NOSPACE 7
#define XFS_ITRUNC_START 8
#define XFS_ITRUNC_FINISH1 9
#define XFS_ITRUNC_FINISH2 10
#define XFS_CTRUNC1 11
#define XFS_CTRUNC2 12
#define XFS_CTRUNC3 13
#define XFS_CTRUNC4 14
#define XFS_CTRUNC5 15
#define XFS_CTRUNC6 16
#define XFS_BUNMAP 17
#define XFS_INVAL_CACHED 18
#define XFS_DIORD_ENTER 19
#define XFS_DIOWR_ENTER 20
#define XFS_WRITEPAGE_ENTER 22
#define XFS_RELEASEPAGE_ENTER 23
#define XFS_INVALIDPAGE_ENTER 24
#define XFS_IOMAP_ALLOC_ENTER 25
#define XFS_IOMAP_ALLOC_MAP 26
#define XFS_IOMAP_UNWRITTEN 27
#define XFS_SPLICE_READ_ENTER 28
#define XFS_SPLICE_WRITE_ENTER 29
extern void xfs_rw_enter_trace(int, struct xfs_inode *,
void *, size_t, loff_t, int);
extern void xfs_inval_cached_trace(struct xfs_inode *,
xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t);
#else
#define xfs_rw_enter_trace(tag, ip, data, size, offset, ioflags)
#define xfs_inval_cached_trace(ip, offset, len, first, last)
#endif
/* errors from xfsbdstrat() must be extracted from the buffer */ /* errors from xfsbdstrat() must be extracted from the buffer */
extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *); extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "xfs.h" #include "xfs.h"
#include "xfs_bit.h" #include "xfs_bit.h"
#include "xfs_log.h" #include "xfs_log.h"
...@@ -52,11 +53,11 @@ ...@@ -52,11 +53,11 @@
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
#include "xfs_filestream.h" #include "xfs_filestream.h"
#include "xfs_da_btree.h" #include "xfs_da_btree.h"
#include "xfs_dir2_trace.h"
#include "xfs_extfree_item.h" #include "xfs_extfree_item.h"
#include "xfs_mru_cache.h" #include "xfs_mru_cache.h"
#include "xfs_inode_item.h" #include "xfs_inode_item.h"
#include "xfs_sync.h" #include "xfs_sync.h"
#include "xfs_trace.h"
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -1525,8 +1526,6 @@ xfs_fs_fill_super( ...@@ -1525,8 +1526,6 @@ xfs_fs_fill_super(
goto fail_vnrele; goto fail_vnrele;
kfree(mtpt); kfree(mtpt);
xfs_itrace_exit(XFS_I(sb->s_root->d_inode));
return 0; return 0;
out_filestream_unmount: out_filestream_unmount:
...@@ -1601,94 +1600,6 @@ static struct file_system_type xfs_fs_type = { ...@@ -1601,94 +1600,6 @@ static struct file_system_type xfs_fs_type = {
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
STATIC int __init
xfs_alloc_trace_bufs(void)
{
#ifdef XFS_ALLOC_TRACE
xfs_alloc_trace_buf = ktrace_alloc(XFS_ALLOC_TRACE_SIZE, KM_MAYFAIL);
if (!xfs_alloc_trace_buf)
goto out;
#endif
#ifdef XFS_BMAP_TRACE
xfs_bmap_trace_buf = ktrace_alloc(XFS_BMAP_TRACE_SIZE, KM_MAYFAIL);
if (!xfs_bmap_trace_buf)
goto out_free_alloc_trace;
#endif
#ifdef XFS_BTREE_TRACE
xfs_allocbt_trace_buf = ktrace_alloc(XFS_ALLOCBT_TRACE_SIZE,
KM_MAYFAIL);
if (!xfs_allocbt_trace_buf)
goto out_free_bmap_trace;
xfs_inobt_trace_buf = ktrace_alloc(XFS_INOBT_TRACE_SIZE, KM_MAYFAIL);
if (!xfs_inobt_trace_buf)
goto out_free_allocbt_trace;
xfs_bmbt_trace_buf = ktrace_alloc(XFS_BMBT_TRACE_SIZE, KM_MAYFAIL);
if (!xfs_bmbt_trace_buf)
goto out_free_inobt_trace;
#endif
#ifdef XFS_ATTR_TRACE
xfs_attr_trace_buf = ktrace_alloc(XFS_ATTR_TRACE_SIZE, KM_MAYFAIL);
if (!xfs_attr_trace_buf)
goto out_free_bmbt_trace;
#endif
#ifdef XFS_DIR2_TRACE
xfs_dir2_trace_buf = ktrace_alloc(XFS_DIR2_GTRACE_SIZE, KM_MAYFAIL);
if (!xfs_dir2_trace_buf)
goto out_free_attr_trace;
#endif
return 0;
#ifdef XFS_DIR2_TRACE
out_free_attr_trace:
#endif
#ifdef XFS_ATTR_TRACE
ktrace_free(xfs_attr_trace_buf);
out_free_bmbt_trace:
#endif
#ifdef XFS_BTREE_TRACE
ktrace_free(xfs_bmbt_trace_buf);
out_free_inobt_trace:
ktrace_free(xfs_inobt_trace_buf);
out_free_allocbt_trace:
ktrace_free(xfs_allocbt_trace_buf);
out_free_bmap_trace:
#endif
#ifdef XFS_BMAP_TRACE
ktrace_free(xfs_bmap_trace_buf);
out_free_alloc_trace:
#endif
#ifdef XFS_ALLOC_TRACE
ktrace_free(xfs_alloc_trace_buf);
out:
#endif
return -ENOMEM;
}
STATIC void
xfs_free_trace_bufs(void)
{
#ifdef XFS_DIR2_TRACE
ktrace_free(xfs_dir2_trace_buf);
#endif
#ifdef XFS_ATTR_TRACE
ktrace_free(xfs_attr_trace_buf);
#endif
#ifdef XFS_BTREE_TRACE
ktrace_free(xfs_bmbt_trace_buf);
ktrace_free(xfs_inobt_trace_buf);
ktrace_free(xfs_allocbt_trace_buf);
#endif
#ifdef XFS_BMAP_TRACE
ktrace_free(xfs_bmap_trace_buf);
#endif
#ifdef XFS_ALLOC_TRACE
ktrace_free(xfs_alloc_trace_buf);
#endif
}
STATIC int __init STATIC int __init
xfs_init_zones(void) xfs_init_zones(void)
{ {
...@@ -1830,7 +1741,6 @@ init_xfs_fs(void) ...@@ -1830,7 +1741,6 @@ init_xfs_fs(void)
printk(KERN_INFO XFS_VERSION_STRING " with " printk(KERN_INFO XFS_VERSION_STRING " with "
XFS_BUILD_OPTIONS " enabled\n"); XFS_BUILD_OPTIONS " enabled\n");
ktrace_init(64);
xfs_ioend_init(); xfs_ioend_init();
xfs_dir_startup(); xfs_dir_startup();
...@@ -1838,13 +1748,9 @@ init_xfs_fs(void) ...@@ -1838,13 +1748,9 @@ init_xfs_fs(void)
if (error) if (error)
goto out; goto out;
error = xfs_alloc_trace_bufs();
if (error)
goto out_destroy_zones;
error = xfs_mru_cache_init(); error = xfs_mru_cache_init();
if (error) if (error)
goto out_free_trace_buffers; goto out_destroy_zones;
error = xfs_filestream_init(); error = xfs_filestream_init();
if (error) if (error)
...@@ -1879,8 +1785,6 @@ init_xfs_fs(void) ...@@ -1879,8 +1785,6 @@ init_xfs_fs(void)
xfs_filestream_uninit(); xfs_filestream_uninit();
out_mru_cache_uninit: out_mru_cache_uninit:
xfs_mru_cache_uninit(); xfs_mru_cache_uninit();
out_free_trace_buffers:
xfs_free_trace_bufs();
out_destroy_zones: out_destroy_zones:
xfs_destroy_zones(); xfs_destroy_zones();
out: out:
...@@ -1897,9 +1801,7 @@ exit_xfs_fs(void) ...@@ -1897,9 +1801,7 @@ exit_xfs_fs(void)
xfs_buf_terminate(); xfs_buf_terminate();
xfs_filestream_uninit(); xfs_filestream_uninit();
xfs_mru_cache_uninit(); xfs_mru_cache_uninit();
xfs_free_trace_bufs();
xfs_destroy_zones(); xfs_destroy_zones();
ktrace_uninit();
} }
module_init(init_xfs_fs); module_init(init_xfs_fs);
......
...@@ -56,12 +56,6 @@ extern void xfs_qm_exit(void); ...@@ -56,12 +56,6 @@ extern void xfs_qm_exit(void);
# define XFS_BIGFS_STRING # define XFS_BIGFS_STRING
#endif #endif
#ifdef CONFIG_XFS_TRACE
# define XFS_TRACE_STRING "tracing, "
#else
# define XFS_TRACE_STRING
#endif
#ifdef CONFIG_XFS_DMAPI #ifdef CONFIG_XFS_DMAPI
# define XFS_DMAPI_STRING "dmapi support, " # define XFS_DMAPI_STRING "dmapi support, "
#else #else
...@@ -78,7 +72,6 @@ extern void xfs_qm_exit(void); ...@@ -78,7 +72,6 @@ extern void xfs_qm_exit(void);
XFS_SECURITY_STRING \ XFS_SECURITY_STRING \
XFS_REALTIME_STRING \ XFS_REALTIME_STRING \
XFS_BIGFS_STRING \ XFS_BIGFS_STRING \
XFS_TRACE_STRING \
XFS_DMAPI_STRING \ XFS_DMAPI_STRING \
XFS_DBG_STRING /* DBG must be last */ XFS_DBG_STRING /* DBG must be last */
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "xfs_inode_item.h" #include "xfs_inode_item.h"
#include "xfs_rw.h" #include "xfs_rw.h"
#include "xfs_quota.h" #include "xfs_quota.h"
#include "xfs_trace.h"
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/freezer.h> #include <linux/freezer.h>
......
/* /*
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. * Copyright (c) 2009, Christoph Hellwig
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -15,71 +15,61 @@ ...@@ -15,71 +15,61 @@
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef __XFS_SUPPORT_KTRACE_H__ #include "xfs.h"
#define __XFS_SUPPORT_KTRACE_H__ #include "xfs_fs.h"
#include "xfs_types.h"
#include "xfs_bit.h"
#include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir2.h"
#include "xfs_da_btree.h"
#include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h"
#include "xfs_dir2_sf.h"
#include "xfs_attr_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
#include "xfs_btree.h"
#include "xfs_dmapi.h"
#include "xfs_mount.h"
#include "xfs_ialloc.h"
#include "xfs_itable.h"
#include "xfs_alloc.h"
#include "xfs_bmap.h"
#include "xfs_attr.h"
#include "xfs_attr_sf.h"
#include "xfs_attr_leaf.h"
#include "xfs_log_priv.h"
#include "xfs_buf_item.h"
#include "xfs_quota.h"
#include "xfs_iomap.h"
#include "xfs_aops.h"
#include "quota/xfs_dquot_item.h"
#include "quota/xfs_dquot.h"
/* /*
* Trace buffer entry structure. * Format fsblock number into a static buffer & return it.
*/ */
typedef struct ktrace_entry { STATIC char *xfs_fmtfsblock(xfs_fsblock_t bno)
void *val[16]; {
} ktrace_entry_t; static char rval[50];
/* if (bno == NULLFSBLOCK)
* Trace buffer header structure. sprintf(rval, "NULLFSBLOCK");
*/ else if (isnullstartblock(bno))
typedef struct ktrace { sprintf(rval, "NULLSTARTBLOCK(%lld)", startblockval(bno));
int kt_nentries; /* number of entries in trace buf */ else
atomic_t kt_index; /* current index in entries */ sprintf(rval, "%lld", (xfs_dfsbno_t)bno);
unsigned int kt_index_mask; return rval;
int kt_rollover; }
ktrace_entry_t *kt_entries; /* buffer of entries */
} ktrace_t;
/* /*
* Trace buffer snapshot structure. * We include this last to have the helpers above available for the trace
* event implementations.
*/ */
typedef struct ktrace_snap { #define CREATE_TRACE_POINTS
int ks_start; /* kt_index at time of snap */ #include "xfs_trace.h"
int ks_index; /* current index */
} ktrace_snap_t;
#ifdef CONFIG_XFS_TRACE
extern void ktrace_init(int zentries);
extern void ktrace_uninit(void);
extern ktrace_t *ktrace_alloc(int, unsigned int __nocast);
extern void ktrace_free(ktrace_t *);
extern void ktrace_enter(
ktrace_t *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *,
void *);
extern ktrace_entry_t *ktrace_first(ktrace_t *, ktrace_snap_t *);
extern int ktrace_nentries(ktrace_t *);
extern ktrace_entry_t *ktrace_next(ktrace_t *, ktrace_snap_t *);
extern ktrace_entry_t *ktrace_skip(ktrace_t *, int, ktrace_snap_t *);
#else
#define ktrace_init(x) do { } while (0)
#define ktrace_uninit() do { } while (0)
#endif /* CONFIG_XFS_TRACE */
#endif /* __XFS_SUPPORT_KTRACE_H__ */
This diff is collapsed.
...@@ -39,6 +39,10 @@ struct attrlist_cursor_kern; ...@@ -39,6 +39,10 @@ struct attrlist_cursor_kern;
#define IO_ISDIRECT 0x00004 /* bypass page cache */ #define IO_ISDIRECT 0x00004 /* bypass page cache */
#define IO_INVIS 0x00020 /* don't update inode timestamps */ #define IO_INVIS 0x00020 /* don't update inode timestamps */
#define XFS_IO_FLAGS \
{ IO_ISDIRECT, "DIRECT" }, \
{ IO_INVIS, "INVIS"}
/* /*
* Flush/Invalidate options for vop_toss/flush/flushinval_pages. * Flush/Invalidate options for vop_toss/flush/flushinval_pages.
*/ */
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_trans_priv.h" #include "xfs_trans_priv.h"
#include "xfs_qm.h" #include "xfs_qm.h"
#include "xfs_trace.h"
/* /*
...@@ -112,10 +113,7 @@ xfs_qm_dqinit( ...@@ -112,10 +113,7 @@ xfs_qm_dqinit(
init_completion(&dqp->q_flush); init_completion(&dqp->q_flush);
complete(&dqp->q_flush); complete(&dqp->q_flush);
#ifdef XFS_DQUOT_TRACE trace_xfs_dqinit(dqp);
dqp->q_trace = ktrace_alloc(DQUOT_TRACE_SIZE, KM_NOFS);
xfs_dqtrace_entry(dqp, "DQINIT");
#endif
} else { } else {
/* /*
* Only the q_core portion was zeroed in dqreclaim_one(). * Only the q_core portion was zeroed in dqreclaim_one().
...@@ -136,10 +134,7 @@ xfs_qm_dqinit( ...@@ -136,10 +134,7 @@ xfs_qm_dqinit(
dqp->q_hash = NULL; dqp->q_hash = NULL;
ASSERT(dqp->dq_flnext == dqp->dq_flprev); ASSERT(dqp->dq_flnext == dqp->dq_flprev);
#ifdef XFS_DQUOT_TRACE trace_xfs_dqreuse(dqp);
ASSERT(dqp->q_trace);
xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT");
#endif
} }
/* /*
...@@ -167,13 +162,8 @@ xfs_qm_dqdestroy( ...@@ -167,13 +162,8 @@ xfs_qm_dqdestroy(
mutex_destroy(&dqp->q_qlock); mutex_destroy(&dqp->q_qlock);
sv_destroy(&dqp->q_pinwait); sv_destroy(&dqp->q_pinwait);
#ifdef XFS_DQUOT_TRACE
if (dqp->q_trace)
ktrace_free(dqp->q_trace);
dqp->q_trace = NULL;
#endif
kmem_zone_free(xfs_Gqm->qm_dqzone, dqp); kmem_zone_free(xfs_Gqm->qm_dqzone, dqp);
atomic_dec(&xfs_Gqm->qm_totaldquots); atomic_dec(&xfs_Gqm->qm_totaldquots);
} }
...@@ -195,49 +185,6 @@ xfs_qm_dqinit_core( ...@@ -195,49 +185,6 @@ xfs_qm_dqinit_core(
d->dd_diskdq.d_flags = type; d->dd_diskdq.d_flags = type;
} }
#ifdef XFS_DQUOT_TRACE
/*
* Dquot tracing for debugging.
*/
/* ARGSUSED */
void
__xfs_dqtrace_entry(
xfs_dquot_t *dqp,
char *func,
void *retaddr,
xfs_inode_t *ip)
{
xfs_dquot_t *udqp = NULL;
xfs_ino_t ino = 0;
ASSERT(dqp->q_trace);
if (ip) {
ino = ip->i_ino;
udqp = ip->i_udquot;
}
ktrace_enter(dqp->q_trace,
(void *)(__psint_t)DQUOT_KTRACE_ENTRY,
(void *)func,
(void *)(__psint_t)dqp->q_nrefs,
(void *)(__psint_t)dqp->dq_flags,
(void *)(__psint_t)dqp->q_res_bcount,
(void *)(__psint_t)be64_to_cpu(dqp->q_core.d_bcount),
(void *)(__psint_t)be64_to_cpu(dqp->q_core.d_icount),
(void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_hardlimit),
(void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_softlimit),
(void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_hardlimit),
(void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_softlimit),
(void *)(__psint_t)be32_to_cpu(dqp->q_core.d_id),
(void *)(__psint_t)current_pid(),
(void *)(__psint_t)ino,
(void *)(__psint_t)retaddr,
(void *)(__psint_t)udqp);
return;
}
#endif
/* /*
* If default limits are in force, push them into the dquot now. * If default limits are in force, push them into the dquot now.
* We overwrite the dquot limits only if they are zero and this * We overwrite the dquot limits only if they are zero and this
...@@ -425,7 +372,8 @@ xfs_qm_dqalloc( ...@@ -425,7 +372,8 @@ xfs_qm_dqalloc(
xfs_trans_t *tp = *tpp; xfs_trans_t *tp = *tpp;
ASSERT(tp != NULL); ASSERT(tp != NULL);
xfs_dqtrace_entry(dqp, "DQALLOC");
trace_xfs_dqalloc(dqp);
/* /*
* Initialize the bmap freelist prior to calling bmapi code. * Initialize the bmap freelist prior to calling bmapi code.
...@@ -612,7 +560,8 @@ xfs_qm_dqtobp( ...@@ -612,7 +560,8 @@ xfs_qm_dqtobp(
* (in which case we already have the buf). * (in which case we already have the buf).
*/ */
if (! newdquot) { if (! newdquot) {
xfs_dqtrace_entry(dqp, "DQTOBP READBUF"); trace_xfs_dqtobp_read(dqp);
if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, if ((error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
dqp->q_blkno, dqp->q_blkno,
XFS_QI_DQCHUNKLEN(mp), XFS_QI_DQCHUNKLEN(mp),
...@@ -670,11 +619,12 @@ xfs_qm_dqread( ...@@ -670,11 +619,12 @@ xfs_qm_dqread(
ASSERT(tpp); ASSERT(tpp);
trace_xfs_dqread(dqp);
/* /*
* get a pointer to the on-disk dquot and the buffer containing it * get a pointer to the on-disk dquot and the buffer containing it
* dqp already knows its own type (GROUP/USER). * dqp already knows its own type (GROUP/USER).
*/ */
xfs_dqtrace_entry(dqp, "DQREAD");
if ((error = xfs_qm_dqtobp(tpp, dqp, &ddqp, &bp, flags))) { if ((error = xfs_qm_dqtobp(tpp, dqp, &ddqp, &bp, flags))) {
return (error); return (error);
} }
...@@ -763,7 +713,7 @@ xfs_qm_idtodq( ...@@ -763,7 +713,7 @@ xfs_qm_idtodq(
* or if the dquot didn't exist on disk and we ask to * or if the dquot didn't exist on disk and we ask to
* allocate (ENOENT). * allocate (ENOENT).
*/ */
xfs_dqtrace_entry(dqp, "DQREAD FAIL"); trace_xfs_dqread_fail(dqp);
cancelflags |= XFS_TRANS_ABORT; cancelflags |= XFS_TRANS_ABORT;
goto error0; goto error0;
} }
...@@ -817,7 +767,8 @@ xfs_qm_dqlookup( ...@@ -817,7 +767,8 @@ xfs_qm_dqlookup(
* id can't be modified without the hashlock anyway. * id can't be modified without the hashlock anyway.
*/ */
if (be32_to_cpu(dqp->q_core.d_id) == id && dqp->q_mount == mp) { if (be32_to_cpu(dqp->q_core.d_id) == id && dqp->q_mount == mp) {
xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP"); trace_xfs_dqlookup_found(dqp);
/* /*
* All in core dquots must be on the dqlist of mp * All in core dquots must be on the dqlist of mp
*/ */
...@@ -827,7 +778,7 @@ xfs_qm_dqlookup( ...@@ -827,7 +778,7 @@ xfs_qm_dqlookup(
if (dqp->q_nrefs == 0) { if (dqp->q_nrefs == 0) {
ASSERT (XFS_DQ_IS_ON_FREELIST(dqp)); ASSERT (XFS_DQ_IS_ON_FREELIST(dqp));
if (! xfs_qm_freelist_lock_nowait(xfs_Gqm)) { if (! xfs_qm_freelist_lock_nowait(xfs_Gqm)) {
xfs_dqtrace_entry(dqp, "DQLOOKUP: WANT"); trace_xfs_dqlookup_want(dqp);
/* /*
* We may have raced with dqreclaim_one() * We may have raced with dqreclaim_one()
...@@ -857,8 +808,7 @@ xfs_qm_dqlookup( ...@@ -857,8 +808,7 @@ xfs_qm_dqlookup(
/* /*
* take it off the freelist * take it off the freelist
*/ */
xfs_dqtrace_entry(dqp, trace_xfs_dqlookup_freelist(dqp);
"DQLOOKUP: TAKEOFF FL");
XQM_FREELIST_REMOVE(dqp); XQM_FREELIST_REMOVE(dqp);
/* xfs_qm_freelist_print(&(xfs_Gqm-> /* xfs_qm_freelist_print(&(xfs_Gqm->
qm_dqfreelist), qm_dqfreelist),
...@@ -878,8 +828,7 @@ xfs_qm_dqlookup( ...@@ -878,8 +828,7 @@ xfs_qm_dqlookup(
*/ */
ASSERT(mutex_is_locked(&qh->qh_lock)); ASSERT(mutex_is_locked(&qh->qh_lock));
if (dqp->HL_PREVP != &qh->qh_next) { if (dqp->HL_PREVP != &qh->qh_next) {
xfs_dqtrace_entry(dqp, trace_xfs_dqlookup_move(dqp);
"DQLOOKUP: HASH MOVETOFRONT");
if ((d = dqp->HL_NEXT)) if ((d = dqp->HL_NEXT))
d->HL_PREVP = dqp->HL_PREVP; d->HL_PREVP = dqp->HL_PREVP;
*(dqp->HL_PREVP) = d; *(dqp->HL_PREVP) = d;
...@@ -889,7 +838,7 @@ xfs_qm_dqlookup( ...@@ -889,7 +838,7 @@ xfs_qm_dqlookup(
dqp->HL_PREVP = &qh->qh_next; dqp->HL_PREVP = &qh->qh_next;
qh->qh_next = dqp; qh->qh_next = dqp;
} }
xfs_dqtrace_entry(dqp, "LOOKUP END"); trace_xfs_dqlookup_done(dqp);
*O_dqpp = dqp; *O_dqpp = dqp;
ASSERT(mutex_is_locked(&qh->qh_lock)); ASSERT(mutex_is_locked(&qh->qh_lock));
return (0); return (0);
...@@ -971,7 +920,7 @@ xfs_qm_dqget( ...@@ -971,7 +920,7 @@ xfs_qm_dqget(
ASSERT(*O_dqpp); ASSERT(*O_dqpp);
ASSERT(XFS_DQ_IS_LOCKED(*O_dqpp)); ASSERT(XFS_DQ_IS_LOCKED(*O_dqpp));
mutex_unlock(&h->qh_lock); mutex_unlock(&h->qh_lock);
xfs_dqtrace_entry(*O_dqpp, "DQGET DONE (FROM CACHE)"); trace_xfs_dqget_hit(*O_dqpp);
return (0); /* success */ return (0); /* success */
} }
XQM_STATS_INC(xqmstats.xs_qm_dqcachemisses); XQM_STATS_INC(xqmstats.xs_qm_dqcachemisses);
...@@ -1104,7 +1053,7 @@ xfs_qm_dqget( ...@@ -1104,7 +1053,7 @@ xfs_qm_dqget(
mutex_unlock(&h->qh_lock); mutex_unlock(&h->qh_lock);
dqret: dqret:
ASSERT((ip == NULL) || xfs_isilocked(ip, XFS_ILOCK_EXCL)); ASSERT((ip == NULL) || xfs_isilocked(ip, XFS_ILOCK_EXCL));
xfs_dqtrace_entry(dqp, "DQGET DONE"); trace_xfs_dqget_miss(dqp);
*O_dqpp = dqp; *O_dqpp = dqp;
return (0); return (0);
} }
...@@ -1124,7 +1073,8 @@ xfs_qm_dqput( ...@@ -1124,7 +1073,8 @@ xfs_qm_dqput(
ASSERT(dqp->q_nrefs > 0); ASSERT(dqp->q_nrefs > 0);
ASSERT(XFS_DQ_IS_LOCKED(dqp)); ASSERT(XFS_DQ_IS_LOCKED(dqp));
xfs_dqtrace_entry(dqp, "DQPUT");
trace_xfs_dqput(dqp);
if (dqp->q_nrefs != 1) { if (dqp->q_nrefs != 1) {
dqp->q_nrefs--; dqp->q_nrefs--;
...@@ -1137,7 +1087,7 @@ xfs_qm_dqput( ...@@ -1137,7 +1087,7 @@ xfs_qm_dqput(
* in the right order; but try to get it out-of-order first * in the right order; but try to get it out-of-order first
*/ */
if (! xfs_qm_freelist_lock_nowait(xfs_Gqm)) { if (! xfs_qm_freelist_lock_nowait(xfs_Gqm)) {
xfs_dqtrace_entry(dqp, "DQPUT: FLLOCK-WAIT"); trace_xfs_dqput_wait(dqp);
xfs_dqunlock(dqp); xfs_dqunlock(dqp);
xfs_qm_freelist_lock(xfs_Gqm); xfs_qm_freelist_lock(xfs_Gqm);
xfs_dqlock(dqp); xfs_dqlock(dqp);
...@@ -1148,7 +1098,8 @@ xfs_qm_dqput( ...@@ -1148,7 +1098,8 @@ xfs_qm_dqput(
/* We can't depend on nrefs being == 1 here */ /* We can't depend on nrefs being == 1 here */
if (--dqp->q_nrefs == 0) { if (--dqp->q_nrefs == 0) {
xfs_dqtrace_entry(dqp, "DQPUT: ON FREELIST"); trace_xfs_dqput_free(dqp);
/* /*
* insert at end of the freelist. * insert at end of the freelist.
*/ */
...@@ -1196,7 +1147,7 @@ xfs_qm_dqrele( ...@@ -1196,7 +1147,7 @@ xfs_qm_dqrele(
if (!dqp) if (!dqp)
return; return;
xfs_dqtrace_entry(dqp, "DQRELE"); trace_xfs_dqrele(dqp);
xfs_dqlock(dqp); xfs_dqlock(dqp);
/* /*
...@@ -1229,7 +1180,7 @@ xfs_qm_dqflush( ...@@ -1229,7 +1180,7 @@ xfs_qm_dqflush(
ASSERT(XFS_DQ_IS_LOCKED(dqp)); ASSERT(XFS_DQ_IS_LOCKED(dqp));
ASSERT(!completion_done(&dqp->q_flush)); ASSERT(!completion_done(&dqp->q_flush));
xfs_dqtrace_entry(dqp, "DQFLUSH"); trace_xfs_dqflush(dqp);
/* /*
* If not dirty, or it's pinned and we are not supposed to * If not dirty, or it's pinned and we are not supposed to
...@@ -1259,7 +1210,6 @@ xfs_qm_dqflush( ...@@ -1259,7 +1210,6 @@ xfs_qm_dqflush(
* the ondisk-dquot has already been allocated for. * the ondisk-dquot has already been allocated for.
*/ */
if ((error = xfs_qm_dqtobp(NULL, dqp, &ddqp, &bp, XFS_QMOPT_DOWARN))) { if ((error = xfs_qm_dqtobp(NULL, dqp, &ddqp, &bp, XFS_QMOPT_DOWARN))) {
xfs_dqtrace_entry(dqp, "DQTOBP FAIL");
ASSERT(error != ENOENT); ASSERT(error != ENOENT);
/* /*
* Quotas could have gotten turned off (ESRCH) * Quotas could have gotten turned off (ESRCH)
...@@ -1297,7 +1247,7 @@ xfs_qm_dqflush( ...@@ -1297,7 +1247,7 @@ xfs_qm_dqflush(
* get stuck waiting in the write for too long. * get stuck waiting in the write for too long.
*/ */
if (XFS_BUF_ISPINNED(bp)) { if (XFS_BUF_ISPINNED(bp)) {
xfs_dqtrace_entry(dqp, "DQFLUSH LOG FORCE"); trace_xfs_dqflush_force(dqp);
xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
} }
...@@ -1308,7 +1258,9 @@ xfs_qm_dqflush( ...@@ -1308,7 +1258,9 @@ xfs_qm_dqflush(
} else { } else {
error = xfs_bwrite(mp, bp); error = xfs_bwrite(mp, bp);
} }
xfs_dqtrace_entry(dqp, "DQFLUSH END");
trace_xfs_dqflush_done(dqp);
/* /*
* dqp is still locked, but caller is free to unlock it now. * dqp is still locked, but caller is free to unlock it now.
*/ */
...@@ -1483,7 +1435,7 @@ xfs_qm_dqpurge( ...@@ -1483,7 +1435,7 @@ xfs_qm_dqpurge(
*/ */
if (XFS_DQ_IS_DIRTY(dqp)) { if (XFS_DQ_IS_DIRTY(dqp)) {
int error; int error;
xfs_dqtrace_entry(dqp, "DQPURGE ->DQFLUSH: DQDIRTY");
/* dqflush unlocks dqflock */ /* dqflush unlocks dqflock */
/* /*
* Given that dqpurge is a very rare occurrence, it is OK * Given that dqpurge is a very rare occurrence, it is OK
......
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