Commit bfaa1ea4 authored by Nathan Scott's avatar Nathan Scott

[XFS] Fix build with tracing enabled, couple of portability macros, move externs into headers.

SGI Modid: 2.5.x-xfs:slinx:160245a
parent 1e31c07b
...@@ -100,6 +100,11 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) ...@@ -100,6 +100,11 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh)
#define xfs_inherit_nodump xfs_params.inherit_nodump.val #define xfs_inherit_nodump xfs_params.inherit_nodump.val
#define xfs_inherit_noatime xfs_params.inherit_noatim.val #define xfs_inherit_noatime xfs_params.inherit_noatim.val
#define current_cpu() smp_processor_id()
#define current_pid() (current->pid)
#define current_fsuid(cred) (current->fsuid)
#define current_fsgid(cred) (current->fsgid)
#define NBPP PAGE_SIZE #define NBPP PAGE_SIZE
#define DPPSHFT (PAGE_SHIFT - 9) #define DPPSHFT (PAGE_SHIFT - 9)
#define NDPP (1 << (PAGE_SHIFT - 9)) #define NDPP (1 << (PAGE_SHIFT - 9))
......
...@@ -54,13 +54,6 @@ ...@@ -54,13 +54,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#if defined(DEBUG)
/*
* Allocation tracing.
*/
ktrace_t *xfs_alloc_trace_buf;
#endif
#define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b))) #define XFS_ABSDIFF(a,b) (((a) <= (b)) ? ((b) - (a)) : ((a) - (b)))
#define XFSA_FIXUP_BNO_OK 1 #define XFSA_FIXUP_BNO_OK 1
...@@ -73,6 +66,8 @@ xfs_alloc_search_busy(xfs_trans_t *tp, ...@@ -73,6 +66,8 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
xfs_extlen_t len); xfs_extlen_t len);
#if defined(XFS_ALLOC_TRACE) #if defined(XFS_ALLOC_TRACE)
ktrace_t *xfs_alloc_trace_buf;
#define TRACE_ALLOC(s,a) \ #define TRACE_ALLOC(s,a) \
xfs_alloc_trace_alloc(fname, s, a, __LINE__) xfs_alloc_trace_alloc(fname, s, a, __LINE__)
#define TRACE_FREE(s,a,b,x,f) \ #define TRACE_FREE(s,a,b,x,f) \
...@@ -85,8 +80,6 @@ xfs_alloc_search_busy(xfs_trans_t *tp, ...@@ -85,8 +80,6 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
xfs_alloc_trace_busy(fname, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__) xfs_alloc_trace_busy(fname, s, mp, ag, -1, -1, sl, tp, XFS_ALLOC_KTRACE_UNBUSY, __LINE__)
#define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) \ #define TRACE_BUSYSEARCH(fname,s,ag,agb,l,sl,tp) \
xfs_alloc_trace_busy(fname, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__) xfs_alloc_trace_busy(fname, s, mp, ag, agb, l, sl, tp, XFS_ALLOC_KTRACE_BUSYSEARCH, __LINE__)
#else #else
#define TRACE_ALLOC(s,a) #define TRACE_ALLOC(s,a)
#define TRACE_FREE(s,a,b,x,f) #define TRACE_FREE(s,a,b,x,f)
......
...@@ -95,6 +95,13 @@ typedef struct xfs_alloc_arg { ...@@ -95,6 +95,13 @@ typedef struct xfs_alloc_arg {
#ifdef __KERNEL__ #ifdef __KERNEL__
#if defined(XFS_ALLOC_TRACE)
/*
* Allocation tracing buffer size.
*/
#define XFS_ALLOC_TRACE_SIZE 4096
extern ktrace_t *xfs_alloc_trace_buf;
/* /*
* Types for alloc tracing. * Types for alloc tracing.
*/ */
...@@ -104,25 +111,8 @@ typedef struct xfs_alloc_arg { ...@@ -104,25 +111,8 @@ typedef struct xfs_alloc_arg {
#define XFS_ALLOC_KTRACE_BUSY 4 #define XFS_ALLOC_KTRACE_BUSY 4
#define XFS_ALLOC_KTRACE_UNBUSY 5 #define XFS_ALLOC_KTRACE_UNBUSY 5
#define XFS_ALLOC_KTRACE_BUSYSEARCH 6 #define XFS_ALLOC_KTRACE_BUSYSEARCH 6
/*
* Allocation tracing buffer size.
*/
#define XFS_ALLOC_TRACE_SIZE 4096
#ifdef XFS_ALL_TRACE
#define XFS_ALLOC_TRACE
#endif
#if !defined(DEBUG)
#undef XFS_ALLOC_TRACE
#endif #endif
/*
* Prototypes for visible xfs_alloc.c routines
*/
/* /*
* Compute and fill in value of m_ag_maxlevels. * Compute and fill in value of m_ag_maxlevels.
*/ */
......
...@@ -45,15 +45,6 @@ ...@@ -45,15 +45,6 @@
* as possible so as to fit into the literal area of the inode. * as possible so as to fit into the literal area of the inode.
*/ */
#ifdef XFS_ALL_TRACE
#define XFS_ATTR_TRACE
#endif
#if !defined(DEBUG)
#undef XFS_ATTR_TRACE
#endif
/*======================================================================== /*========================================================================
* External interfaces * External interfaces
*========================================================================*/ *========================================================================*/
......
...@@ -104,14 +104,7 @@ int xfs_attr_sf_totsize(struct xfs_inode *dp); ...@@ -104,14 +104,7 @@ int xfs_attr_sf_totsize(struct xfs_inode *dp);
(INT_GET(((xfs_attr_shortform_t *)((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT)) (INT_GET(((xfs_attr_shortform_t *)((dp)->i_afp->if_u1.if_data))->hdr.totsize, ARCH_CONVERT))
#endif #endif
#ifdef XFS_ALL_TRACE #if defined(XFS_ATTR_TRACE)
#define XFS_ATTR_TRACE
#endif
#if !defined(DEBUG)
#undef XFS_ATTR_TRACE
#endif
/* /*
* Kernel tracing support for attribute lists * Kernel tracing support for attribute lists
*/ */
...@@ -121,6 +114,7 @@ struct xfs_da_node_entry; ...@@ -121,6 +114,7 @@ struct xfs_da_node_entry;
struct xfs_attr_leafblock; struct xfs_attr_leafblock;
#define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */ #define XFS_ATTR_TRACE_SIZE 4096 /* size of global trace buffer */
extern ktrace_t *xfs_attr_trace_buf;
/* /*
* Trace record types. * Trace record types.
...@@ -130,8 +124,6 @@ struct xfs_attr_leafblock; ...@@ -130,8 +124,6 @@ struct xfs_attr_leafblock;
#define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */ #define XFS_ATTR_KTRACE_L_CB 3 /* context, btree */
#define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */ #define XFS_ATTR_KTRACE_L_CL 4 /* context, leaf */
#if defined(XFS_ATTR_TRACE)
void xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context); void xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context);
void xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context, void xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context,
struct xfs_da_intnode *node); struct xfs_da_intnode *node);
......
...@@ -68,9 +68,6 @@ ...@@ -68,9 +68,6 @@
#include "xfs_trans_space.h" #include "xfs_trans_space.h"
#include "xfs_buf_item.h" #include "xfs_buf_item.h"
#ifdef DEBUG
ktrace_t *xfs_bmap_trace_buf;
#endif
#ifdef XFSDEBUG #ifdef XFSDEBUG
STATIC void STATIC void
...@@ -404,7 +401,7 @@ xfs_bmap_validate_ret( ...@@ -404,7 +401,7 @@ xfs_bmap_validate_ret(
#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap) #define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
#endif /* DEBUG */ #endif /* DEBUG */
#if defined(DEBUG) && defined(XFS_RW_TRACE) #if defined(XFS_RW_TRACE)
STATIC void STATIC void
xfs_bunmap_trace( xfs_bunmap_trace(
xfs_inode_t *ip, xfs_inode_t *ip,
...@@ -414,7 +411,7 @@ xfs_bunmap_trace( ...@@ -414,7 +411,7 @@ xfs_bunmap_trace(
inst_t *ra); inst_t *ra);
#else #else
#define xfs_bunmap_trace(ip, bno, len, flags, ra) #define xfs_bunmap_trace(ip, bno, len, flags, ra)
#endif /* DEBUG && XFS_RW_TRACE */ #endif /* XFS_RW_TRACE */
STATIC int STATIC int
xfs_bmap_count_tree( xfs_bmap_count_tree(
...@@ -3543,6 +3540,8 @@ xfs_bmap_search_extents( ...@@ -3543,6 +3540,8 @@ xfs_bmap_search_extents(
#ifdef XFS_BMAP_TRACE #ifdef XFS_BMAP_TRACE
ktrace_t *xfs_bmap_trace_buf;
/* /*
* Add a bmap trace buffer entry. Base routine for the others. * Add a bmap trace buffer entry. Base routine for the others.
*/ */
...@@ -3722,7 +3721,7 @@ xfs_bmap_worst_indlen( ...@@ -3722,7 +3721,7 @@ xfs_bmap_worst_indlen(
return rval; return rval;
} }
#if defined(DEBUG) && defined(XFS_RW_TRACE) #if defined(XFS_RW_TRACE)
STATIC void STATIC void
xfs_bunmap_trace( xfs_bunmap_trace(
xfs_inode_t *ip, xfs_inode_t *ip,
...@@ -3742,7 +3741,7 @@ xfs_bunmap_trace( ...@@ -3742,7 +3741,7 @@ xfs_bunmap_trace(
(void *)(__psint_t)((xfs_dfiloff_t)bno & 0xffffffff), (void *)(__psint_t)((xfs_dfiloff_t)bno & 0xffffffff),
(void *)(__psint_t)len, (void *)(__psint_t)len,
(void *)(__psint_t)flags, (void *)(__psint_t)flags,
(void *)(__psint_t)private.p_cpuid, (void *)current_cpu(),
(void *)ra, (void *)ra,
(void *)0, (void *)0,
(void *)0, (void *)0,
......
...@@ -81,6 +81,13 @@ STATIC int xfs_bmbt_updkey(xfs_btree_cur_t *, xfs_bmbt_key_t *, int); ...@@ -81,6 +81,13 @@ STATIC int xfs_bmbt_updkey(xfs_btree_cur_t *, xfs_bmbt_key_t *, int);
#if defined(XFS_BMBT_TRACE) #if defined(XFS_BMBT_TRACE)
static char ARGS[] = "args";
static char ENTRY[] = "entry";
static char ERROR[] = "error";
#undef EXIT
static char EXIT[] = "exit";
/* /*
* Add a trace buffer entry for the arguments given to the routine, * Add a trace buffer entry for the arguments given to the routine,
* generic form. * generic form.
...@@ -305,11 +312,6 @@ xfs_bmbt_trace_cursor( ...@@ -305,11 +312,6 @@ xfs_bmbt_trace_cursor(
xfs_bmbt_trace_argik(fname, c, i, k, __LINE__) xfs_bmbt_trace_argik(fname, c, i, k, __LINE__)
#define XFS_BMBT_TRACE_CURSOR(c,s) \ #define XFS_BMBT_TRACE_CURSOR(c,s) \
xfs_bmbt_trace_cursor(fname, c, s, __LINE__) xfs_bmbt_trace_cursor(fname, c, s, __LINE__)
static char ARGS[] = "args";
static char ENTRY[] = "entry";
static char ERROR[] = "error";
#undef EXIT
static char EXIT[] = "exit";
#else #else
#define XFS_BMBT_TRACE_ARGBI(c,b,i) #define XFS_BMBT_TRACE_ARGBI(c,b,i)
#define XFS_BMBT_TRACE_ARGBII(c,b,i,j) #define XFS_BMBT_TRACE_ARGBII(c,b,i,j)
......
...@@ -435,6 +435,10 @@ int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb, ...@@ -435,6 +435,10 @@ int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb,
INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0]) INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= (mp)->m_bmap_dmxr[(level) != 0])
#endif #endif
#ifdef __KERNEL__
#if defined(XFS_BMBT_TRACE)
/* /*
* Trace buffer entry types. * Trace buffer entry types.
*/ */
...@@ -449,18 +453,9 @@ int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb, ...@@ -449,18 +453,9 @@ int xfs_bmap_sanity_check(struct xfs_mount *mp, xfs_bmbt_block_t *bb,
#define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */ #define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */
#define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */ #define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */
extern ktrace_t *xfs_bmbt_trace_buf;
#if defined(XFS_ALL_TRACE)
#define XFS_BMBT_TRACE
#endif #endif
#if !defined(DEBUG)
#undef XFS_BMBT_TRACE
#endif
#ifdef __KERNEL__
/* /*
* Prototypes for xfs_bmap.c to call. * Prototypes for xfs_bmap.c to call.
*/ */
......
...@@ -1207,13 +1207,14 @@ xfs_buf_item_trace( ...@@ -1207,13 +1207,14 @@ xfs_buf_item_trace(
(void *)((unsigned long)bip->bli_flags), (void *)((unsigned long)bip->bli_flags),
(void *)((unsigned long)bip->bli_recur), (void *)((unsigned long)bip->bli_recur),
(void *)((unsigned long)atomic_read(&bip->bli_refcount)), (void *)((unsigned long)atomic_read(&bip->bli_refcount)),
(void *)XFS_BUF_ADDR(bp), (void *)((unsigned long)
(0xFFFFFFFF & XFS_BUF_ADDR(bp) >> 32)),
(void *)((unsigned long)(0xFFFFFFFF & XFS_BUF_ADDR(bp))),
(void *)((unsigned long)XFS_BUF_COUNT(bp)), (void *)((unsigned long)XFS_BUF_COUNT(bp)),
(void *)((unsigned long)(0xFFFFFFFF & (XFS_BFLAGS(bp) >> 32))), (void *)((unsigned long)XFS_BUF_BFLAGS(bp)),
(void *)((unsigned long)(0xFFFFFFFF & XFS_BFLAGS(bp))),
XFS_BUF_FSPRIVATE(bp, void *), XFS_BUF_FSPRIVATE(bp, void *),
XFS_BUF_FSPRIVATE2(bp, void *), XFS_BUF_FSPRIVATE2(bp, void *),
(void *)((unsigned long)bp->b_pincount), (void *)XFS_BUF_ISPINNED(bp),
(void *)XFS_BUF_IODONE_FUNC(bp), (void *)XFS_BUF_IODONE_FUNC(bp),
(void *)((unsigned long)(XFS_BUF_VALUSEMA(bp))), (void *)((unsigned long)(XFS_BUF_VALUSEMA(bp))),
(void *)bip->bli_item.li_desc, (void *)bip->bli_item.li_desc,
......
...@@ -104,6 +104,15 @@ typedef struct xfs_buf_log_format_t { ...@@ -104,6 +104,15 @@ typedef struct xfs_buf_log_format_t {
struct xfs_buf; struct xfs_buf;
struct ktrace; struct ktrace;
struct xfs_mount; struct xfs_mount;
struct xfs_buf_log_item;
#if defined(XFS_BLI_TRACE)
#define XFS_BLI_TRACE_SIZE 32
void xfs_buf_item_trace(char *, struct xfs_buf_log_item *);
#else
#define xfs_buf_item_trace(id, bip)
#endif
/* /*
* This is the in core log item structure used to track information * This is the in core log item structure used to track information
...@@ -116,7 +125,7 @@ typedef struct xfs_buf_log_item { ...@@ -116,7 +125,7 @@ typedef struct xfs_buf_log_item {
unsigned int bli_flags; /* misc flags */ unsigned int bli_flags; /* misc flags */
unsigned int bli_recur; /* lock recursion count */ unsigned int bli_recur; /* lock recursion count */
atomic_t bli_refcount; /* cnt of tp refs */ atomic_t bli_refcount; /* cnt of tp refs */
#ifdef DEBUG #ifdef XFS_BLI_TRACE
struct ktrace *bli_trace; /* event trace buf */ struct ktrace *bli_trace; /* event trace buf */
#endif #endif
#ifdef XFS_TRANS_DEBUG #ifdef XFS_TRANS_DEBUG
...@@ -137,23 +146,6 @@ typedef struct xfs_buf_cancel { ...@@ -137,23 +146,6 @@ typedef struct xfs_buf_cancel {
struct xfs_buf_cancel *bc_next; struct xfs_buf_cancel *bc_next;
} xfs_buf_cancel_t; } xfs_buf_cancel_t;
#define XFS_BLI_TRACE_SIZE 32
#if defined(XFS_ALL_TRACE)
#define XFS_BLI_TRACE
#endif
#if !defined(DEBUG)
#undef XFS_BLI_TRACE
#endif
#if defined(XFS_BLI_TRACE)
void xfs_buf_item_trace(char *, xfs_buf_log_item_t *);
#else
#define xfs_buf_item_trace(id, bip)
#endif
void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
void xfs_buf_item_relse(struct xfs_buf *); void xfs_buf_item_relse(struct xfs_buf *);
void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint); void xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint);
......
...@@ -66,13 +66,6 @@ ...@@ -66,13 +66,6 @@
#include "xfs_error.h" #include "xfs_error.h"
#include "xfs_bit.h" #include "xfs_bit.h"
#if defined(XFSDEBUG) && defined(CONFIG_KDB)
#undef xfs_buftrace
#define xfs_buftrace(A,B) \
printk(" xfs_buftrace : %s (0x%p)\n", A, B); \
BUG();
#endif
/* /*
* xfs_da_btree.c * xfs_da_btree.c
* *
......
...@@ -153,12 +153,12 @@ xfs_swapext( ...@@ -153,12 +153,12 @@ xfs_swapext(
if ((error = _MAC_XFS_IACCESS(tip, MACWRITE, NULL))) { if ((error = _MAC_XFS_IACCESS(tip, MACWRITE, NULL))) {
goto error0; goto error0;
} }
if ((current->fsuid != ip->i_d.di_uid) && if ((current_fsuid(cred) != ip->i_d.di_uid) &&
(error = xfs_iaccess(ip, S_IWUSR, NULL)) && (error = xfs_iaccess(ip, S_IWUSR, NULL)) &&
!capable_cred(NULL, CAP_FOWNER)) { !capable_cred(NULL, CAP_FOWNER)) {
goto error0; goto error0;
} }
if ((current->fsuid != tip->i_d.di_uid) && if ((current_fsuid(cred) != tip->i_d.di_uid) &&
(error = xfs_iaccess(tip, S_IWUSR, NULL)) && (error = xfs_iaccess(tip, S_IWUSR, NULL)) &&
!capable_cred(NULL, CAP_FOWNER)) { !capable_cred(NULL, CAP_FOWNER)) {
goto error0; goto error0;
......
...@@ -1093,10 +1093,10 @@ void ...@@ -1093,10 +1093,10 @@ void
xfs_dir_trace_g_du(char *where, xfs_inode_t *dp, uio_t *uio) xfs_dir_trace_g_du(char *where, xfs_inode_t *dp, uio_t *uio)
{ {
xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DU, where, xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DU, where,
(__psunsigned_t)dp, (__psunsigned_t)dp->i_mount, (void *)dp, (void *)dp->i_mount,
(__psunsigned_t)(uio->uio_offset >> 32), (void *)((unsigned long)(uio->uio_offset >> 32)),
(__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF), (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
(__psunsigned_t)uio->uio_resid, (void *)uio->uio_resid,
NULL, NULL, NULL, NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL, NULL, NULL, NULL);
} }
...@@ -1107,11 +1107,11 @@ void ...@@ -1107,11 +1107,11 @@ void
xfs_dir_trace_g_dub(char *where, xfs_inode_t *dp, uio_t *uio, xfs_dablk_t bno) xfs_dir_trace_g_dub(char *where, xfs_inode_t *dp, uio_t *uio, xfs_dablk_t bno)
{ {
xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUB, where, xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUB, where,
(__psunsigned_t)dp, (__psunsigned_t)dp->i_mount, (void *)dp, (void *)dp->i_mount,
(__psunsigned_t)(uio->uio_offset >> 32), (void *)((unsigned long)(uio->uio_offset >> 32)),
(__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF), (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
(__psunsigned_t)uio->uio_resid, (void *)uio->uio_resid,
(__psunsigned_t)bno, (void *)bno,
NULL, NULL, NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL, NULL, NULL);
} }
...@@ -1122,15 +1122,17 @@ void ...@@ -1122,15 +1122,17 @@ void
xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio, xfs_dir_trace_g_dun(char *where, xfs_inode_t *dp, uio_t *uio,
xfs_da_intnode_t *node) xfs_da_intnode_t *node)
{ {
int last = INT_GET(node->hdr.count, ARCH_CONVERT) - 1;
xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUN, where, xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUN, where,
(__psunsigned_t)dp, (__psunsigned_t)dp->i_mount, (void *)dp, (void *)dp->i_mount,
(__psunsigned_t)(uio->uio_offset >> 32), (void *)((unsigned long)(uio->uio_offset >> 32)),
(__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF), (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
(__psunsigned_t)uio->uio_resid, (void *)uio->uio_resid,
(__psunsigned_t)INT_GET(node->hdr.info.forw, ARCH_CONVERT), (void *)INT_GET(node->hdr.info.forw, ARCH_CONVERT),
(__psunsigned_t)INT_GET(node->hdr.count, ARCH_CONVERT), (void *)INT_GET(node->hdr.count, ARCH_CONVERT),
(__psunsigned_t)INT_GET(node->btree[0].hashval, ARCH_CONVERT), (void *)INT_GET(node->btree[0].hashval, ARCH_CONVERT),
(__psunsigned_t)INT_GET(node->btree[INT_GET(node->hdr.count, ARCH_CONVERT)-1].hashval, ARCH_CONVERT), (void *)INT_GET(node->btree[last].hashval, ARCH_CONVERT),
NULL, NULL, NULL); NULL, NULL, NULL);
} }
...@@ -1141,15 +1143,17 @@ void ...@@ -1141,15 +1143,17 @@ void
xfs_dir_trace_g_dul(char *where, xfs_inode_t *dp, uio_t *uio, xfs_dir_trace_g_dul(char *where, xfs_inode_t *dp, uio_t *uio,
xfs_dir_leafblock_t *leaf) xfs_dir_leafblock_t *leaf)
{ {
int last = INT_GET(leaf->hdr.count, ARCH_CONVERT) - 1;
xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUL, where, xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUL, where,
(__psunsigned_t)dp, (__psunsigned_t)dp->i_mount, (void *)dp, (void *)dp->i_mount,
(__psunsigned_t)(uio->uio_offset >> 32), (void *)((unsigned long)(uio->uio_offset >> 32)),
(__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF), (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
(__psunsigned_t)uio->uio_resid, (void *)uio->uio_resid,
(__psunsigned_t)INT_GET(leaf->hdr.info.forw, ARCH_CONVERT), (void *)INT_GET(leaf->hdr.info.forw, ARCH_CONVERT),
(__psunsigned_t)INT_GET(leaf->hdr.count, ARCH_CONVERT), (void *)INT_GET(leaf->hdr.count, ARCH_CONVERT),
(__psunsigned_t)INT_GET(leaf->entries[0].hashval, ARCH_CONVERT), (void *)INT_GET(leaf->entries[0].hashval, ARCH_CONVERT),
(__psunsigned_t)INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT), (void *)INT_GET(leaf->entries[last].hashval, ARCH_CONVERT),
NULL, NULL, NULL); NULL, NULL, NULL);
} }
...@@ -1161,11 +1165,11 @@ xfs_dir_trace_g_due(char *where, xfs_inode_t *dp, uio_t *uio, ...@@ -1161,11 +1165,11 @@ xfs_dir_trace_g_due(char *where, xfs_inode_t *dp, uio_t *uio,
xfs_dir_leaf_entry_t *entry) xfs_dir_leaf_entry_t *entry)
{ {
xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUE, where, xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUE, where,
(__psunsigned_t)dp, (__psunsigned_t)dp->i_mount, (void *)dp, (void *)dp->i_mount,
(__psunsigned_t)(uio->uio_offset >> 32), (void *)((unsigned long)(uio->uio_offset >> 32)),
(__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF), (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
(__psunsigned_t)uio->uio_resid, (void *)uio->uio_resid,
(__psunsigned_t)INT_GET(entry->hashval, ARCH_CONVERT), (void *)INT_GET(entry->hashval, ARCH_CONVERT),
NULL, NULL, NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL, NULL, NULL);
} }
...@@ -1176,12 +1180,12 @@ void ...@@ -1176,12 +1180,12 @@ void
xfs_dir_trace_g_duc(char *where, xfs_inode_t *dp, uio_t *uio, xfs_off_t cookie) xfs_dir_trace_g_duc(char *where, xfs_inode_t *dp, uio_t *uio, xfs_off_t cookie)
{ {
xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUC, where, xfs_dir_trace_enter(XFS_DIR_KTRACE_G_DUC, where,
(__psunsigned_t)dp, (__psunsigned_t)dp->i_mount, (void *)dp, (void *)dp->i_mount,
(__psunsigned_t)(uio->uio_offset >> 32), (void *)((unsigned long)(uio->uio_offset >> 32)),
(__psunsigned_t)(uio->uio_offset & 0xFFFFFFFF), (void *)((unsigned long)(uio->uio_offset & 0xFFFFFFFF)),
(__psunsigned_t)uio->uio_resid, (void *)uio->uio_resid,
(__psunsigned_t)(cookie >> 32), (void *)((unsigned long)(cookie >> 32)),
(__psunsigned_t)(cookie & 0xFFFFFFFF), (void *)((unsigned long)(cookie & 0xFFFFFFFF)),
NULL, NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL, NULL);
} }
...@@ -1191,15 +1195,15 @@ xfs_dir_trace_g_duc(char *where, xfs_inode_t *dp, uio_t *uio, xfs_off_t cookie) ...@@ -1191,15 +1195,15 @@ xfs_dir_trace_g_duc(char *where, xfs_inode_t *dp, uio_t *uio, xfs_off_t cookie)
*/ */
void void
xfs_dir_trace_enter(int type, char *where, xfs_dir_trace_enter(int type, char *where,
__psunsigned_t a0, __psunsigned_t a1, void * a0, void * a1,
__psunsigned_t a2, __psunsigned_t a3, void * a2, void * a3,
__psunsigned_t a4, __psunsigned_t a5, void * a4, void * a5,
__psunsigned_t a6, __psunsigned_t a7, void * a6, void * a7,
__psunsigned_t a8, __psunsigned_t a9, void * a8, void * a9,
__psunsigned_t a10, __psunsigned_t a11) void * a10, void * a11)
{ {
ASSERT(xfs_dir_trace_buf); ASSERT(xfs_dir_trace_buf);
ktrace_enter(xfs_dir_trace_buf, (void *)((__psunsigned_t)type), ktrace_enter(xfs_dir_trace_buf, (void *)((void *)type),
(void *)where, (void *)where,
(void *)a0, (void *)a1, (void *)a2, (void *)a0, (void *)a1, (void *)a2,
(void *)a3, (void *)a4, (void *)a5, (void *)a3, (void *)a4, (void *)a5,
......
...@@ -43,14 +43,6 @@ ...@@ -43,14 +43,6 @@
* as possible so as to fit into the literal area of the inode. * as possible so as to fit into the literal area of the inode.
*/ */
#ifdef XFS_ALL_TRACE
#define XFS_DIR_TRACE
#endif
#if !defined(DEBUG)
#undef XFS_DIR_TRACE
#endif
/*======================================================================== /*========================================================================
* Function prototypes for the kernel. * Function prototypes for the kernel.
*========================================================================*/ *========================================================================*/
......
...@@ -64,36 +64,37 @@ xfs_dir2_trace_enter( ...@@ -64,36 +64,37 @@ xfs_dir2_trace_enter(
char *where, char *where,
char *name, char *name,
int namelen, int namelen,
__psunsigned_t a0, void *a0,
__psunsigned_t a1, void *a1,
__psunsigned_t a2, void *a2,
__psunsigned_t a3, void *a3,
__psunsigned_t a4, void *a4,
__psunsigned_t a5, void *a5,
__psunsigned_t a6) void *a6,
void *a7)
{ {
__psunsigned_t n[6]; void *n[5];
ASSERT(xfs_dir2_trace_buf); ASSERT(xfs_dir2_trace_buf);
ASSERT(dp->i_dir_trace); ASSERT(dp->i_dir_trace);
if (name) if (name)
memcpy(n, name, min(sizeof(n), namelen)); memcpy(n, name, min((int)sizeof(n), namelen));
else else
memset((char *)n, 0, sizeof(n)); memset((char *)n, 0, sizeof(n));
ktrace_enter(xfs_dir2_trace_buf, ktrace_enter(xfs_dir2_trace_buf,
(void *)(__psunsigned_t)type, (void *)where, (void *)type, (void *)where,
(void *)a0, (void *)a1, (void *)a2, (void *)a3, (void *)a0, (void *)a1, (void *)a2, (void *)a3,
(void *)a4, (void *)a5, (void *)a6, (void *)a4, (void *)a5, (void *)a6, (void *)a7,
(void *)(__psunsigned_t)namelen, (void *)namelen,
(void *)n[0], (void *)n[1], (void *)n[2], (void *)n[0], (void *)n[1], (void *)n[2],
(void *)n[3], (void *)n[4], (void *)n[5]); (void *)n[3], (void *)n[4]);
ktrace_enter(dp->i_dir_trace, ktrace_enter(dp->i_dir_trace,
(void *)(__psunsigned_t)type, (void *)where, (void *)type, (void *)where,
(void *)a0, (void *)a1, (void *)a2, (void *)a3, (void *)a0, (void *)a1, (void *)a2, (void *)a3,
(void *)a4, (void *)a5, (void *)a6, (void *)a4, (void *)a5, (void *)a6, (void *)a7,
(void *)(__psunsigned_t)namelen, (void *)namelen,
(void *)n[0], (void *)n[1], (void *)n[2], (void *)n[0], (void *)n[1], (void *)n[2],
(void *)n[3], (void *)n[4], (void *)n[5]); (void *)n[3], (void *)n[4]);
} }
void void
...@@ -103,9 +104,11 @@ xfs_dir2_trace_args( ...@@ -103,9 +104,11 @@ xfs_dir2_trace_args(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber, (void *)args->hashval,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)((unsigned long)(args->inumber >> 32)),
(__psunsigned_t)args->justcheck, 0, 0); (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, NULL, NULL);
} }
void void
...@@ -116,10 +119,12 @@ xfs_dir2_trace_args_b( ...@@ -116,10 +119,12 @@ xfs_dir2_trace_args_b(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_B, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_B, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber, (void *)args->hashval,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)((unsigned long)(args->inumber >> 32)),
(__psunsigned_t)args->justcheck, (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(__psunsigned_t)(bp ? bp->bps[0] : NULL), 0); (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck,
(void *)(bp ? bp->bps[0] : NULL), NULL);
} }
void void
...@@ -131,11 +136,13 @@ xfs_dir2_trace_args_bb( ...@@ -131,11 +136,13 @@ xfs_dir2_trace_args_bb(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BB, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BB, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber, (void *)args->hashval,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)((unsigned long)(args->inumber >> 32)),
(__psunsigned_t)args->justcheck, (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(__psunsigned_t)(lbp ? lbp->bps[0] : NULL), (void *)args->dp, (void *)args->trans,
(__psunsigned_t)(dbp ? dbp->bps[0] : NULL)); (void *)(unsigned long)args->justcheck,
(void *)(lbp ? lbp->bps[0] : NULL),
(void *)(dbp ? dbp->bps[0] : NULL));
} }
void void
...@@ -150,10 +157,10 @@ xfs_dir2_trace_args_bibii( ...@@ -150,10 +157,10 @@ xfs_dir2_trace_args_bibii(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BIBII, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BIBII, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)args->dp, (void *)args->trans,
(__psunsigned_t)(bs ? bs->bps[0] : NULL), (__psunsigned_t)ss, (void *)(bs ? bs->bps[0] : NULL), (void *)ss,
(__psunsigned_t)(bd ? bd->bps[0] : NULL), (__psunsigned_t)sd, (void *)(bd ? bd->bps[0] : NULL), (void *)sd,
(__psunsigned_t)c); (void *)c, NULL);
} }
void void
...@@ -165,10 +172,12 @@ xfs_dir2_trace_args_db( ...@@ -165,10 +172,12 @@ xfs_dir2_trace_args_db(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_DB, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_DB, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber, (void *)args->hashval,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)((unsigned long)(args->inumber >> 32)),
(__psunsigned_t)args->justcheck, (__psunsigned_t)db, (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(__psunsigned_t)(bp ? bp->bps[0] : NULL)); (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)db,
(void *)(bp ? bp->bps[0] : NULL));
} }
void void
...@@ -179,9 +188,13 @@ xfs_dir2_trace_args_i( ...@@ -179,9 +188,13 @@ xfs_dir2_trace_args_i(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_I, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_I, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber, (void *)args->hashval,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)((unsigned long)(args->inumber >> 32)),
(__psunsigned_t)args->justcheck, (__psunsigned_t)i, 0); (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck,
(void *)((unsigned long)(i >> 32)),
(void *)((unsigned long)(i & 0xFFFFFFFF)));
} }
void void
...@@ -192,9 +205,11 @@ xfs_dir2_trace_args_s( ...@@ -192,9 +205,11 @@ xfs_dir2_trace_args_s(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_S, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_S, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber, (void *)args->hashval,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)((unsigned long)(args->inumber >> 32)),
(__psunsigned_t)args->justcheck, (__psunsigned_t)s, 0); (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)s, 0);
} }
void void
...@@ -206,9 +221,11 @@ xfs_dir2_trace_args_sb( ...@@ -206,9 +221,11 @@ xfs_dir2_trace_args_sb(
{ {
xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_SB, where, xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_SB, where,
(char *)args->name, (int)args->namelen, (char *)args->name, (int)args->namelen,
(__psunsigned_t)args->hashval, (__psunsigned_t)args->inumber, (void *)args->hashval,
(__psunsigned_t)args->dp, (__psunsigned_t)args->trans, (void *)((unsigned long)(args->inumber >> 32)),
(__psunsigned_t)args->justcheck, (__psunsigned_t)s, (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
(__psunsigned_t)(bp ? bp->bps[0] : NULL)); (void *)args->dp, (void *)args->trans,
(void *)(unsigned long)args->justcheck, (void *)s,
(void *)(bp ? bp->bps[0] : NULL));
} }
#endif /* XFS_DIR2_TRACE */ #endif /* XFS_DIR2_TRACE */
...@@ -36,20 +36,15 @@ ...@@ -36,20 +36,15 @@
* Tracing for xfs v2 directories. * Tracing for xfs v2 directories.
*/ */
#if defined(XFS_DIR2_TRACE)
struct ktrace; struct ktrace;
struct xfs_dabuf; struct xfs_dabuf;
struct xfs_da_args; struct xfs_da_args;
#ifdef XFS_ALL_TRACE
#define XFS_DIR2_TRACE
#endif /* XFS_ALL_TRACE */
#if !defined(DEBUG)
#undef XFS_DIR2_TRACE
#endif /* !DEBUG */
#define XFS_DIR2_GTRACE_SIZE 4096 /* global buffer */ #define XFS_DIR2_GTRACE_SIZE 4096 /* global buffer */
#define XFS_DIR2_KTRACE_SIZE 32 /* per-inode buffer */ #define XFS_DIR2_KTRACE_SIZE 32 /* per-inode buffer */
extern struct ktrace *xfs_dir2_trace_buf;
#define XFS_DIR2_KTRACE_ARGS 1 /* args only */ #define XFS_DIR2_KTRACE_ARGS 1 /* args only */
#define XFS_DIR2_KTRACE_ARGS_B 2 /* args + buffer */ #define XFS_DIR2_KTRACE_ARGS_B 2 /* args + buffer */
...@@ -60,8 +55,6 @@ struct xfs_da_args; ...@@ -60,8 +55,6 @@ struct xfs_da_args;
#define XFS_DIR2_KTRACE_ARGS_SB 7 /* args, int, buffer */ #define XFS_DIR2_KTRACE_ARGS_SB 7 /* args, int, buffer */
#define XFS_DIR2_KTRACE_ARGS_BIBII 8 /* args, buf/int/buf/int/int */ #define XFS_DIR2_KTRACE_ARGS_BIBII 8 /* args, buf/int/buf/int/int */
#ifdef XFS_DIR2_TRACE
void xfs_dir2_trace_args(char *where, struct xfs_da_args *args); void xfs_dir2_trace_args(char *where, struct xfs_da_args *args);
void xfs_dir2_trace_args_b(char *where, struct xfs_da_args *args, void xfs_dir2_trace_args_b(char *where, struct xfs_da_args *args,
struct xfs_dabuf *bp); struct xfs_dabuf *bp);
...@@ -90,6 +83,4 @@ void xfs_dir2_trace_args_sb(char *where, struct xfs_da_args *args, int s, ...@@ -90,6 +83,4 @@ void xfs_dir2_trace_args_sb(char *where, struct xfs_da_args *args, int s,
#endif /* XFS_DIR2_TRACE */ #endif /* XFS_DIR2_TRACE */
extern struct ktrace *xfs_dir2_trace_buf;
#endif /* __XFS_DIR2_TRACE_H__ */ #endif /* __XFS_DIR2_TRACE_H__ */
...@@ -126,13 +126,7 @@ int xfs_dir_sf_allfit(int count, int totallen); ...@@ -126,13 +126,7 @@ int xfs_dir_sf_allfit(int count, int totallen);
((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen)) ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen))
#endif #endif
#ifdef XFS_ALL_TRACE #if defined(XFS_DIR_TRACE)
#define XFS_DIR_TRACE
#endif
#if !defined(DEBUG)
#undef XFS_DIR_TRACE
#endif
/* /*
* Kernel tracing support for directories. * Kernel tracing support for directories.
...@@ -145,6 +139,7 @@ struct xfs_dir_leafblock; ...@@ -145,6 +139,7 @@ struct xfs_dir_leafblock;
struct xfs_dir_leaf_entry; struct xfs_dir_leaf_entry;
#define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */ #define XFS_DIR_TRACE_SIZE 4096 /* size of global trace buffer */
extern ktrace_t *xfs_dir_trace_buf;
/* /*
* Trace record types. * Trace record types.
...@@ -156,8 +151,6 @@ struct xfs_dir_leaf_entry; ...@@ -156,8 +151,6 @@ struct xfs_dir_leaf_entry;
#define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */ #define XFS_DIR_KTRACE_G_DUE 5 /* dp, uio, leaf entry */
#define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */ #define XFS_DIR_KTRACE_G_DUC 6 /* dp, uio, cookie */
#if defined(XFS_DIR_TRACE)
void xfs_dir_trace_g_du(char *where, struct xfs_inode *dp, struct uio *uio); void xfs_dir_trace_g_du(char *where, struct xfs_inode *dp, struct uio *uio);
void xfs_dir_trace_g_dub(char *where, struct xfs_inode *dp, struct uio *uio, void xfs_dir_trace_g_dub(char *where, struct xfs_inode *dp, struct uio *uio,
xfs_dablk_t bno); xfs_dablk_t bno);
...@@ -170,12 +163,9 @@ void xfs_dir_trace_g_due(char *where, struct xfs_inode *dp, struct uio *uio, ...@@ -170,12 +163,9 @@ void xfs_dir_trace_g_due(char *where, struct xfs_inode *dp, struct uio *uio,
void xfs_dir_trace_g_duc(char *where, struct xfs_inode *dp, struct uio *uio, void xfs_dir_trace_g_duc(char *where, struct xfs_inode *dp, struct uio *uio,
xfs_off_t cookie); xfs_off_t cookie);
void xfs_dir_trace_enter(int type, char *where, void xfs_dir_trace_enter(int type, char *where,
__psunsigned_t a0, __psunsigned_t a1, void *a0, void *a1, void *a2, void *a3,
__psunsigned_t a2, __psunsigned_t a3, void *a4, void *a5, void *a6, void *a7,
__psunsigned_t a4, __psunsigned_t a5, void *a8, void *a9, void *a10, void *a11);
__psunsigned_t a6, __psunsigned_t a7,
__psunsigned_t a8, __psunsigned_t a9,
__psunsigned_t a10, __psunsigned_t a11);
#else #else
#define xfs_dir_trace_g_du(w,d,u) #define xfs_dir_trace_g_du(w,d,u)
#define xfs_dir_trace_g_dub(w,d,u,b) #define xfs_dir_trace_g_dub(w,d,u,b)
......
...@@ -506,9 +506,6 @@ xfs_inode_lock_init( ...@@ -506,9 +506,6 @@ xfs_inode_lock_init(
mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER, mrlock_init(&ip->i_lock, MRLOCK_ALLOW_EQUAL_PRI|MRLOCK_BARRIER,
"xfsino", (long)vp->v_number); "xfsino", (long)vp->v_number);
mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", vp->v_number); mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", vp->v_number);
#ifdef NOTYET
mutex_init(&ip->i_range_lock.r_spinlock, MUTEX_SPIN, "xrange");
#endif /* NOTYET */
init_waitqueue_head(&ip->i_ipin_wait); init_waitqueue_head(&ip->i_ipin_wait);
atomic_set(&ip->i_pincount, 0); atomic_set(&ip->i_pincount, 0);
init_sema(&ip->i_flock, 1, "xfsfino", vp->v_number); init_sema(&ip->i_flock, 1, "xfsfino", vp->v_number);
...@@ -830,9 +827,7 @@ xfs_ilock(xfs_inode_t *ip, ...@@ -830,9 +827,7 @@ xfs_ilock(xfs_inode_t *ip,
} else if (lock_flags & XFS_ILOCK_SHARED) { } else if (lock_flags & XFS_ILOCK_SHARED) {
mraccess(&ip->i_lock); mraccess(&ip->i_lock);
} }
#ifdef XFS_ILOCK_TRACE xfs_ilock_trace(ip, 1, lock_flags, (inst_t *)__return_address);
xfs_ilock_trace(ip, 1, lock_flags, (inst_t *)return_address);
#endif
} }
/* /*
...@@ -895,9 +890,7 @@ xfs_ilock_nowait(xfs_inode_t *ip, ...@@ -895,9 +890,7 @@ xfs_ilock_nowait(xfs_inode_t *ip,
return 0; return 0;
} }
} }
#ifdef XFS_ILOCK_TRACE
xfs_ilock_trace(ip, 2, lock_flags, (inst_t *)__return_address); xfs_ilock_trace(ip, 2, lock_flags, (inst_t *)__return_address);
#endif
return 1; return 1;
} }
...@@ -955,9 +948,7 @@ xfs_iunlock(xfs_inode_t *ip, ...@@ -955,9 +948,7 @@ xfs_iunlock(xfs_inode_t *ip,
(xfs_log_item_t*)(ip->i_itemp)); (xfs_log_item_t*)(ip->i_itemp));
} }
} }
#ifdef XFS_ILOCK_TRACE
xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address); xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address);
#endif
} }
/* /*
......
...@@ -908,9 +908,6 @@ xfs_iread( ...@@ -908,9 +908,6 @@ xfs_iread(
#ifdef XFS_RW_TRACE #ifdef XFS_RW_TRACE
ip->i_rwtrace = ktrace_alloc(XFS_RW_KTRACE_SIZE, KM_SLEEP); ip->i_rwtrace = ktrace_alloc(XFS_RW_KTRACE_SIZE, KM_SLEEP);
#endif #endif
#ifdef XFS_STRAT_TRACE
ip->i_strat_trace = ktrace_alloc(XFS_STRAT_KTRACE_SIZE, KM_SLEEP);
#endif
#ifdef XFS_ILOCK_TRACE #ifdef XFS_ILOCK_TRACE
ip->i_lock_trace = ktrace_alloc(XFS_ILOCK_KTRACE_SIZE, KM_SLEEP); ip->i_lock_trace = ktrace_alloc(XFS_ILOCK_KTRACE_SIZE, KM_SLEEP);
#endif #endif
...@@ -1144,8 +1141,8 @@ xfs_ialloc( ...@@ -1144,8 +1141,8 @@ xfs_ialloc(
ip->i_d.di_onlink = 0; ip->i_d.di_onlink = 0;
ip->i_d.di_nlink = nlink; ip->i_d.di_nlink = nlink;
ASSERT(ip->i_d.di_nlink == nlink); ASSERT(ip->i_d.di_nlink == nlink);
ip->i_d.di_uid = current->fsuid; ip->i_d.di_uid = current_fsuid(cr);
ip->i_d.di_gid = current->fsgid; ip->i_d.di_gid = current_fsgid(cr);
ip->i_d.di_projid = prid; ip->i_d.di_projid = prid;
memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
...@@ -1362,16 +1359,16 @@ xfs_itrunc_trace( ...@@ -1362,16 +1359,16 @@ xfs_itrunc_trace(
ktrace_enter(ip->i_rwtrace, ktrace_enter(ip->i_rwtrace,
(void*)((long)tag), (void*)((long)tag),
(void*)ip, (void*)ip,
(void*)((ip->i_d.di_size >> 32) & 0xffffffff), (void*)(unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff),
(void*)(ip->i_d.di_size & 0xffffffff), (void*)(unsigned long)(ip->i_d.di_size & 0xffffffff),
(void*)((long)flag), (void*)((long)flag),
(void*)((new_size >> 32) & 0xffffffff), (void*)(unsigned long)((new_size >> 32) & 0xffffffff),
(void*)(new_size & 0xffffffff), (void*)(unsigned long)(new_size & 0xffffffff),
(void*)((toss_start >> 32) & 0xffffffff), (void*)(unsigned long)((toss_start >> 32) & 0xffffffff),
(void*)(toss_start & 0xffffffff), (void*)(unsigned long)(toss_start & 0xffffffff),
(void*)((toss_finish >> 32) & 0xffffffff), (void*)(unsigned long)((toss_finish >> 32) & 0xffffffff),
(void*)(toss_finish & 0xffffffff), (void*)(unsigned long)(toss_finish & 0xffffffff),
(void*)((long)private.p_cpuid), (void*)current_cpu(),
(void*)0, (void*)0,
(void*)0, (void*)0,
(void*)0, (void*)0,
...@@ -2755,17 +2752,8 @@ xfs_idestroy( ...@@ -2755,17 +2752,8 @@ xfs_idestroy(
} }
if (ip->i_afp) if (ip->i_afp)
xfs_idestroy_fork(ip, XFS_ATTR_FORK); xfs_idestroy_fork(ip, XFS_ATTR_FORK);
#ifdef NOTYET
if (ip->i_range_lock.r_sleep != NULL) {
freesema(ip->i_range_lock.r_sleep);
kmem_free(ip->i_range_lock.r_sleep, sizeof(sema_t));
}
#endif /* NOTYET */
mrfree(&ip->i_lock); mrfree(&ip->i_lock);
mrfree(&ip->i_iolock); mrfree(&ip->i_iolock);
#ifdef NOTYET
mutex_destroy(&ip->i_range_lock.r_spinlock);
#endif /* NOTYET */
freesema(&ip->i_flock); freesema(&ip->i_flock);
#ifdef XFS_BMAP_TRACE #ifdef XFS_BMAP_TRACE
ktrace_free(ip->i_xtrace); ktrace_free(ip->i_xtrace);
...@@ -2776,9 +2764,6 @@ xfs_idestroy( ...@@ -2776,9 +2764,6 @@ xfs_idestroy(
#ifdef XFS_RW_TRACE #ifdef XFS_RW_TRACE
ktrace_free(ip->i_rwtrace); ktrace_free(ip->i_rwtrace);
#endif #endif
#ifdef XFS_STRAT_TRACE
ktrace_free(ip->i_strat_trace);
#endif
#ifdef XFS_ILOCK_TRACE #ifdef XFS_ILOCK_TRACE
ktrace_free(ip->i_lock_trace); ktrace_free(ip->i_lock_trace);
#endif #endif
...@@ -3707,7 +3692,7 @@ xfs_iaccess( ...@@ -3707,7 +3692,7 @@ xfs_iaccess(
if ((error = _ACL_XFS_IACCESS(ip, mode, cr)) != -1) if ((error = _ACL_XFS_IACCESS(ip, mode, cr)) != -1)
return error ? XFS_ERROR(error) : 0; return error ? XFS_ERROR(error) : 0;
if (current->fsuid != ip->i_d.di_uid) { if (current_fsuid(cr) != ip->i_d.di_uid) {
mode >>= 3; mode >>= 3;
if (!in_group_p((gid_t)ip->i_d.di_gid)) if (!in_group_p((gid_t)ip->i_d.di_gid))
mode >>= 3; mode >>= 3;
...@@ -3859,17 +3844,18 @@ xfs_ichgtime(xfs_inode_t *ip, ...@@ -3859,17 +3844,18 @@ xfs_ichgtime(xfs_inode_t *ip,
} }
#ifdef XFS_ILOCK_TRACE #ifdef XFS_ILOCK_TRACE
ktrace_t *xfs_ilock_trace_buf;
void void
xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra) xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra)
{ {
ktrace_enter(ip->i_lock_trace, ktrace_enter(ip->i_lock_trace,
(void *)ip, (void *)ip,
(void *)(__psint_t)lock, /* 1 = LOCK, 3=UNLOCK, etc */ (void *)lock, /* 1 = LOCK, 3=UNLOCK, etc */
(void *)(__psint_t)lockflags, /* XFS_ILOCK_EXCL etc */ (void *)lockflags, /* XFS_ILOCK_EXCL etc */
(void *)ra, /* caller of ilock */ (void *)ra, /* caller of ilock */
(void *)(__psint_t)cpuid(), (void *)current_cpu(),
(void *)(__psint_t)current_pid(), (void *)current_pid(),
0,0,0,0,0,0,0,0,0,0); 0,0,0,0,0,0,0,0,0,0);
} }
#endif /* ILOCK_TRACE */ #endif
...@@ -99,6 +99,13 @@ struct xfs_mount; ...@@ -99,6 +99,13 @@ struct xfs_mount;
struct xfs_trans; struct xfs_trans;
struct xfs_dquot; struct xfs_dquot;
#if defined(XFS_ILOCK_TRACE)
#define XFS_ILOCK_KTRACE_SIZE 32
extern ktrace_t *xfs_ilock_trace_buf;
extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
#else
#define xfs_ilock_trace(i,n,f,ra)
#endif
/* /*
* This structure is used to communicate which extents of a file * This structure is used to communicate which extents of a file
...@@ -280,15 +287,22 @@ typedef struct xfs_inode { ...@@ -280,15 +287,22 @@ typedef struct xfs_inode {
struct xfs_inode *i_cnext; /* cluster hash link forward */ struct xfs_inode *i_cnext; /* cluster hash link forward */
struct xfs_inode *i_cprev; /* cluster hash link backward */ struct xfs_inode *i_cprev; /* cluster hash link backward */
#ifdef DEBUG
/* Trace buffers per inode. */ /* Trace buffers per inode. */
#ifdef XFS_BMAP_TRACE
struct ktrace *i_xtrace; /* inode extent list trace */ struct ktrace *i_xtrace; /* inode extent list trace */
#endif
#ifdef XFS_BMBT_TRACE
struct ktrace *i_btrace; /* inode bmap btree trace */ struct ktrace *i_btrace; /* inode bmap btree trace */
#endif
#ifdef XFS_RW_TRACE
struct ktrace *i_rwtrace; /* inode read/write trace */ struct ktrace *i_rwtrace; /* inode read/write trace */
struct ktrace *i_strat_trace; /* inode strat_write trace */ #endif
#ifdef XFS_ILOCK_TRACE
struct ktrace *i_lock_trace; /* inode lock/unlock trace */ struct ktrace *i_lock_trace; /* inode lock/unlock trace */
#endif
#ifdef XFS_DIR2_TRACE
struct ktrace *i_dir_trace; /* inode directory trace */ struct ktrace *i_dir_trace; /* inode directory trace */
#endif /* DEBUG */ #endif
} xfs_inode_t; } xfs_inode_t;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
...@@ -536,12 +550,6 @@ extern struct kmem_zone *xfs_inode_zone; ...@@ -536,12 +550,6 @@ extern struct kmem_zone *xfs_inode_zone;
extern struct kmem_zone *xfs_ili_zone; extern struct kmem_zone *xfs_ili_zone;
extern struct vnodeops xfs_vnodeops; extern struct vnodeops xfs_vnodeops;
#ifdef XFS_ILOCK_TRACE
#define XFS_ILOCK_KTRACE_SIZE 32
void xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags,
inst_t *ra);
#endif
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* __XFS_INODE_H__ */ #endif /* __XFS_INODE_H__ */
...@@ -74,24 +74,11 @@ STATIC int xfs_sync(bhv_desc_t *, int, cred_t *); ...@@ -74,24 +74,11 @@ STATIC int xfs_sync(bhv_desc_t *, int, cred_t *);
int int
xfs_init(void) xfs_init(void)
{ {
extern kmem_zone_t *xfs_da_state_zone;
extern kmem_zone_t *xfs_bmap_free_item_zone; extern kmem_zone_t *xfs_bmap_free_item_zone;
extern kmem_zone_t *xfs_btree_cur_zone; extern kmem_zone_t *xfs_btree_cur_zone;
extern kmem_zone_t *xfs_inode_zone;
extern kmem_zone_t *xfs_chashlist_zone;
extern kmem_zone_t *xfs_trans_zone; extern kmem_zone_t *xfs_trans_zone;
extern kmem_zone_t *xfs_buf_item_zone; extern kmem_zone_t *xfs_buf_item_zone;
extern kmem_zone_t *xfs_efd_zone;
extern kmem_zone_t *xfs_efi_zone;
extern kmem_zone_t *xfs_dabuf_zone; extern kmem_zone_t *xfs_dabuf_zone;
#ifdef DEBUG_NOT
extern ktrace_t *xfs_alloc_trace_buf;
extern ktrace_t *xfs_bmap_trace_buf;
extern ktrace_t *xfs_bmbt_trace_buf;
extern ktrace_t *xfs_dir_trace_buf;
extern ktrace_t *xfs_attr_trace_buf;
extern ktrace_t *xfs_dir2_trace_buf;
#endif /* DEBUG */
#ifdef XFS_DABUF_DEBUG #ifdef XFS_DABUF_DEBUG
extern lock_t xfs_dabuf_global_lock; extern lock_t xfs_dabuf_global_lock;
spinlock_init(&xfs_dabuf_global_lock, "xfsda"); spinlock_init(&xfs_dabuf_global_lock, "xfsda");
......
...@@ -430,7 +430,7 @@ xfs_setattr( ...@@ -430,7 +430,7 @@ xfs_setattr(
} }
/* boolean: are we the file owner? */ /* boolean: are we the file owner? */
file_owner = (current->fsuid == ip->i_d.di_uid); file_owner = (current_fsuid(credp) == ip->i_d.di_uid);
/* /*
* Change various properties of a file. * Change various properties of a file.
...@@ -2000,7 +2000,8 @@ xfs_create( ...@@ -2000,7 +2000,8 @@ xfs_create(
/* /*
* Make sure that we have allocated dquot(s) on disk. * Make sure that we have allocated dquot(s) on disk.
*/ */
error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid, error = XFS_QM_DQVOPALLOC(mp, dp,
current_fsuid(credp), current_fsgid(credp),
XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp); XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp);
if (error) if (error)
goto std_return; goto std_return;
...@@ -2895,7 +2896,8 @@ xfs_mkdir( ...@@ -2895,7 +2896,8 @@ xfs_mkdir(
/* /*
* Make sure that we have allocated dquot(s) on disk. * Make sure that we have allocated dquot(s) on disk.
*/ */
error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid, error = XFS_QM_DQVOPALLOC(mp, dp,
current_fsuid(credp), current_fsgid(credp),
XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
if (error) if (error)
goto std_return; goto std_return;
...@@ -3452,7 +3454,8 @@ xfs_symlink( ...@@ -3452,7 +3454,8 @@ xfs_symlink(
/* /*
* Make sure that we have allocated dquot(s) on disk. * Make sure that we have allocated dquot(s) on disk.
*/ */
error = XFS_QM_DQVOPALLOC(mp, dp, current->fsuid, current->fsgid, error = XFS_QM_DQVOPALLOC(mp, dp,
current_fsuid(credp), current_fsgid(credp),
XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
if (error) if (error)
goto std_return; goto std_return;
......
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