public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] optimize dmapi event tests w/o dmapi config
Date: Sun, 19 Aug 2007 01:05:10 -0500	[thread overview]
Message-ID: <46C7DD96.6030001@sandeen.net> (raw)

Defining XFS_DM_EVENT* macros to 0 in the absence of 
CONFIG_XFS_DMAPI allows gcc to optimize away tests that 
should never be true. Also wrap one hunk of xfs_unmount 
in #ifdef CONFIG_XFS_DMAPI

Stack deltas on x86, gcc 4.1:

xfs_create		-16
xfs_free_file_space	-4
xfs_getbmap		+4
xfs_link		-8
xfs_mkidr		-20
xfs_read		-24
xfs_remove		-12
xfs_rename		-8
xfs_rmdir		-16
xfs_setattr		-20
xfs_splice_read		-20
xfs_splice_write	-20
xfs_unmount		-48
xfs_write		-20

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

Index: linux-2.6.22.i386/fs/xfs/xfs_dmapi.h
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_dmapi.h
+++ linux-2.6.22.i386/fs/xfs/xfs_dmapi.h
@@ -66,6 +66,7 @@ typedef enum {
 } dm_right_t;
 #define HAVE_DM_RIGHT_T
 
+#ifdef CONFIG_XFS_DMAPI
 /* Defines for determining if an event message should be sent. */
 #define	DM_EVENT_ENABLED(vfsp, ip, event) ( \
 	unlikely ((vfsp)->vfs_flag & VFS_DMI) && \
@@ -78,6 +79,11 @@ typedef enum {
 		( ((io)->io_dmevmask & (1 << event)) || \
 		  ((io)->io_mount->m_dmevmask & (1 << event)) ) \
 	)
+#else
+#define DM_EVENT_ENABLED(vfsp, ip, event) (0)
+#define DM_EVENT_ENABLED_IO(vfsp, io, event) (0)
+#endif
+
 
 #define DM_XFS_VALID_FS_EVENTS		( \
 	(1 << DM_EVENT_PREUNMOUNT)	| \
Index: linux-2.6.22.i386/fs/xfs/xfs_vfsops.c
===================================================================
--- linux-2.6.22.i386.orig/fs/xfs/xfs_vfsops.c
+++ linux-2.6.22.i386/fs/xfs/xfs_vfsops.c
@@ -568,6 +568,7 @@ xfs_unmount(
 	rip = mp->m_rootip;
 	rvp = XFS_ITOV(rip);
 
+#ifdef CONFIG_XFS_DMAPI
 	if (vfsp->vfs_flag & VFS_DMI) {
 		error = XFS_SEND_PREUNMOUNT(mp, vfsp,
 				rvp, DM_RIGHT_NULL, rvp, DM_RIGHT_NULL,
@@ -580,7 +581,7 @@ xfs_unmount(
 		unmount_event_flags = (mp->m_dmevmask & (1<<DM_EVENT_UNMOUNT))?
 					0 : DM_FLAGS_UNWANTED;
 	}
-
+#endif
 	/*
 	 * First blow any referenced inode from this file system
 	 * out of the reference cache, and delete the timer.

             reply	other threads:[~2007-08-19  6:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-19  6:05 Eric Sandeen [this message]
2007-08-19 19:07 ` [PATCH] optimize dmapi event tests w/o dmapi config Christoph Hellwig
2007-08-19 23:48 ` Vlad Apostolov
2007-08-20  3:37   ` Eric Sandeen
2007-08-20  5:22     ` Vlad Apostolov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46C7DD96.6030001@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox