public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] de-duplicate calls to xfs_attr_trace_enter
@ 2008-04-12  2:56 Eric Sandeen
  2008-04-12  3:01 ` Josef 'Jeff' Sipek
  2008-05-20  2:04 ` Eric Sandeen
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2008-04-12  2:56 UTC (permalink / raw)
  To: xfs-oss

Every call to xfs_attr_trace_enter() shares the exact 
same 16 args in the middle... just send in the context
pointer and let the next level down split it into the
ktrace.

Compile tested only.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

 xfs_attr.c    |  106 +++++++++++++---------------------------------------------
 xfs_attr_sf.h |   10 +----
 2 files changed, 28 insertions(+), 88 deletions(-)


Index: linux-2.6-xfs/fs/xfs/xfs_attr.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_attr.c
+++ linux-2.6-xfs/fs/xfs/xfs_attr.c
@@ -2286,23 +2286,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *ar
 void
 xfs_attr_trace_l_c(char *where, struct xfs_attr_list_context *context)
 {
-	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_C, where,
-		(__psunsigned_t)context->dp,
-		(__psunsigned_t)context->cursor->hashval,
-		(__psunsigned_t)context->cursor->blkno,
-		(__psunsigned_t)context->cursor->offset,
-		(__psunsigned_t)context->alist,
-		(__psunsigned_t)context->bufsize,
-		(__psunsigned_t)context->count,
-		(__psunsigned_t)context->firstu,
-		(__psunsigned_t)
-			((context->count > 0) &&
-			!(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-				? (ATTR_ENTRY(context->alist,
-					      context->count-1)->a_valuelen)
-				: 0,
-		(__psunsigned_t)context->dupcnt,
-		(__psunsigned_t)context->flags,
+	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_C, where, context,
 		(__psunsigned_t)NULL,
 		(__psunsigned_t)NULL,
 		(__psunsigned_t)NULL);
@@ -2315,23 +2299,7 @@ void
 xfs_attr_trace_l_cn(char *where, struct xfs_attr_list_context *context,
 			 struct xfs_da_intnode *node)
 {
-	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CN, where,
-		(__psunsigned_t)context->dp,
-		(__psunsigned_t)context->cursor->hashval,
-		(__psunsigned_t)context->cursor->blkno,
-		(__psunsigned_t)context->cursor->offset,
-		(__psunsigned_t)context->alist,
-		(__psunsigned_t)context->bufsize,
-		(__psunsigned_t)context->count,
-		(__psunsigned_t)context->firstu,
-		(__psunsigned_t)
-			((context->count > 0) &&
-			!(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-				? (ATTR_ENTRY(context->alist,
-					      context->count-1)->a_valuelen)
-				: 0,
-		(__psunsigned_t)context->dupcnt,
-		(__psunsigned_t)context->flags,
+	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CN, where, context,
 		(__psunsigned_t)be16_to_cpu(node->hdr.count),
 		(__psunsigned_t)be32_to_cpu(node->btree[0].hashval),
 		(__psunsigned_t)be32_to_cpu(node->btree[
@@ -2345,23 +2313,7 @@ void
 xfs_attr_trace_l_cb(char *where, struct xfs_attr_list_context *context,
 			  struct xfs_da_node_entry *btree)
 {
-	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CB, where,
-		(__psunsigned_t)context->dp,
-		(__psunsigned_t)context->cursor->hashval,
-		(__psunsigned_t)context->cursor->blkno,
-		(__psunsigned_t)context->cursor->offset,
-		(__psunsigned_t)context->alist,
-		(__psunsigned_t)context->bufsize,
-		(__psunsigned_t)context->count,
-		(__psunsigned_t)context->firstu,
-		(__psunsigned_t)
-			((context->count > 0) &&
-			!(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-				? (ATTR_ENTRY(context->alist,
-					      context->count-1)->a_valuelen)
-				: 0,
-		(__psunsigned_t)context->dupcnt,
-		(__psunsigned_t)context->flags,
+	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CB, where, context,
 		(__psunsigned_t)be32_to_cpu(btree->hashval),
 		(__psunsigned_t)be32_to_cpu(btree->before),
 		(__psunsigned_t)NULL);
@@ -2374,23 +2326,7 @@ void
 xfs_attr_trace_l_cl(char *where, struct xfs_attr_list_context *context,
 			      struct xfs_attr_leafblock *leaf)
 {
-	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CL, where,
-		(__psunsigned_t)context->dp,
-		(__psunsigned_t)context->cursor->hashval,
-		(__psunsigned_t)context->cursor->blkno,
-		(__psunsigned_t)context->cursor->offset,
-		(__psunsigned_t)context->alist,
-		(__psunsigned_t)context->bufsize,
-		(__psunsigned_t)context->count,
-		(__psunsigned_t)context->firstu,
-		(__psunsigned_t)
-			((context->count > 0) &&
-			!(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
-				? (ATTR_ENTRY(context->alist,
-					      context->count-1)->a_valuelen)
-				: 0,
-		(__psunsigned_t)context->dupcnt,
-		(__psunsigned_t)context->flags,
+	xfs_attr_trace_enter(XFS_ATTR_KTRACE_L_CL, where, context,
 		(__psunsigned_t)be16_to_cpu(leaf->hdr.count),
 		(__psunsigned_t)be32_to_cpu(leaf->entries[0].hashval),
 		(__psunsigned_t)be32_to_cpu(leaf->entries[
@@ -2403,22 +2339,30 @@ xfs_attr_trace_l_cl(char *where, struct 
  */
 void
 xfs_attr_trace_enter(int type, char *where,
-			 __psunsigned_t a2, __psunsigned_t a3,
-			 __psunsigned_t a4, __psunsigned_t a5,
-			 __psunsigned_t a6, __psunsigned_t a7,
-			 __psunsigned_t a8, __psunsigned_t a9,
-			 __psunsigned_t a10, __psunsigned_t a11,
-			 __psunsigned_t a12, __psunsigned_t a13,
-			 __psunsigned_t a14, __psunsigned_t a15)
+			 struct xfs_attr_list_context *context,
+			 __psunsigned_t a13, __psunsigned_t a14,
+			 __psunsigned_t a15)
 {
 	ASSERT(xfs_attr_trace_buf);
 	ktrace_enter(xfs_attr_trace_buf, (void *)((__psunsigned_t)type),
-					 (void *)where,
-					 (void *)a2,  (void *)a3,  (void *)a4,
-					 (void *)a5,  (void *)a6,  (void *)a7,
-					 (void *)a8,  (void *)a9,  (void *)a10,
-					 (void *)a11, (void *)a12, (void *)a13,
-					 (void *)a14, (void *)a15);
+		(void *)((__psunsigned_t)where),
+		(void *)((__psunsigned_t)context->dp),
+		(void *)((__psunsigned_t)context->cursor->hashval),
+		(void *)((__psunsigned_t)context->cursor->blkno),
+		(void *)((__psunsigned_t)context->cursor->offset),
+		(void *)((__psunsigned_t)context->alist),
+		(void *)((__psunsigned_t)context->bufsize),
+		(void *)((__psunsigned_t)context->count),
+		(void *)((__psunsigned_t)context->firstu),
+		(void *)((__psunsigned_t)
+			(((context->count > 0) &&
+			!(context->flags & (ATTR_KERNAMELS|ATTR_KERNOVAL)))
+				? (ATTR_ENTRY(context->alist,
+					      context->count-1)->a_valuelen)
+				: 0)),
+		(void *)((__psunsigned_t)context->dupcnt),
+		(void *)((__psunsigned_t)context->flags),
+		(void *)a13, (void *)a14, (void *)a15);
 }
 #endif	/* XFS_ATTR_TRACE */
 
Index: linux-2.6-xfs/fs/xfs/xfs_attr_sf.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_attr_sf.h
+++ linux-2.6-xfs/fs/xfs/xfs_attr_sf.h
@@ -97,13 +97,9 @@ void xfs_attr_trace_l_cb(char *where, st
 void xfs_attr_trace_l_cl(char *where, struct xfs_attr_list_context *context,
 			      struct xfs_attr_leafblock *leaf);
 void xfs_attr_trace_enter(int type, char *where,
-			     __psunsigned_t a2, __psunsigned_t a3,
-			     __psunsigned_t a4, __psunsigned_t a5,
-			     __psunsigned_t a6, __psunsigned_t a7,
-			     __psunsigned_t a8, __psunsigned_t a9,
-			     __psunsigned_t a10, __psunsigned_t a11,
-			     __psunsigned_t a12, __psunsigned_t a13,
-			     __psunsigned_t a14, __psunsigned_t a15);
+			     struct xfs_attr_list_context *context,
+			     __psunsigned_t a13, __psunsigned_t a14,
+			     __psunsigned_t a15);
 #else
 #define	xfs_attr_trace_l_c(w,c)
 #define	xfs_attr_trace_l_cn(w,c,n)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] de-duplicate calls to xfs_attr_trace_enter
  2008-04-12  2:56 [PATCH] de-duplicate calls to xfs_attr_trace_enter Eric Sandeen
@ 2008-04-12  3:01 ` Josef 'Jeff' Sipek
  2008-05-20  2:04 ` Eric Sandeen
  1 sibling, 0 replies; 4+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-04-12  3:01 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Fri, Apr 11, 2008 at 09:56:12PM -0500, Eric Sandeen wrote:
> Every call to xfs_attr_trace_enter() shares the exact 
> same 16 args in the middle... just send in the context
> pointer and let the next level down split it into the
> ktrace.
> 
> Compile tested only.
 
Very nice.

Josef 'Jeff' Sipek.

-- 
I think there is a world market for maybe five computers.
		- Thomas Watson, chairman of IBM, 1943.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] de-duplicate calls to xfs_attr_trace_enter
  2008-04-12  2:56 [PATCH] de-duplicate calls to xfs_attr_trace_enter Eric Sandeen
  2008-04-12  3:01 ` Josef 'Jeff' Sipek
@ 2008-05-20  2:04 ` Eric Sandeen
  2008-05-20  4:25   ` Timothy Shimmin
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2008-05-20  2:04 UTC (permalink / raw)
  To: xfs-oss

Eric Sandeen wrote:
> Every call to xfs_attr_trace_enter() shares the exact 
> same 16 args in the middle... just send in the context
> pointer and let the next level down split it into the
> ktrace.

Ping?  worth doing?

Thanks,

-Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] de-duplicate calls to xfs_attr_trace_enter
  2008-05-20  2:04 ` Eric Sandeen
@ 2008-05-20  4:25   ` Timothy Shimmin
  0 siblings, 0 replies; 4+ messages in thread
From: Timothy Shimmin @ 2008-05-20  4:25 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

Eric Sandeen wrote:
> Eric Sandeen wrote:
>> Every call to xfs_attr_trace_enter() shares the exact 
>> same 16 args in the middle... just send in the context
>> pointer and let the next level down split it into the
>> ktrace.
> 
> Ping?  worth doing?
> 
Yeah, that sounded reasonable as it was pretty messy.
I'll take it...

--Tim

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-20  4:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-12  2:56 [PATCH] de-duplicate calls to xfs_attr_trace_enter Eric Sandeen
2008-04-12  3:01 ` Josef 'Jeff' Sipek
2008-05-20  2:04 ` Eric Sandeen
2008-05-20  4:25   ` Timothy Shimmin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox