]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
OpenBSD: don't use AFS_GLOBAL_SUNLOCK on single processor system
authorAntoine Verheijen <antoine@ualberta.ca>
Mon, 8 Feb 2010 21:57:51 +0000 (14:57 -0700)
committerDerrick Brashear <shadow@dementia.org>
Tue, 9 Feb 2010 17:21:53 +0000 (09:21 -0800)
Put back the header directives that only turns on AFS_GLOBAL_SUNLOCK
when compiling for multiprocessors system. When enabled on a single
processor OpenBSD system, it is possible to put the entire system
into a lengthy (minutes) lock state when performing multiple AFS
activities. The system behaves MUCH better when AFS_GLOBAL_SUNLOCK
is not set (no problems encopuntered). This whole locking mechanism
needs a bit more examination on OpenBSD before this is useful in
single processor mode.

Change-Id: I19813b78ad8d705b4f043ccb3a38c83e278972e9
Reviewed-on: http://gerrit.openafs.org/1276
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 6219c84243706ed46b922c2e037cceab2684d645)
Change-Id: I9891c469aae9de3ca1b7a334d3f54757c97ddc5f
Reviewed-on: http://gerrit.openafs.org/1257

src/afs/OBSD/osi_machdep.h
src/config/param.i386_obsd44.h
src/config/param.i386_obsd45.h

index 229e27f82ec93863e44b1599d14257d7addaea6d..3864ff1dcb1d4a84f5157ffa213e785b40fdeee3 100644 (file)
@@ -153,70 +153,70 @@ extern int afs_vget();
 extern struct lock afs_global_lock;
 extern struct proc *afs_global_owner;
 
-#ifdef AFS_GLOBAL_SUNLOCK
+# ifdef AFS_GLOBAL_SUNLOCK
 
-#if defined(LOCKDEBUG)
+#  if defined(LOCKDEBUG)
 
-#define AFS_GLOCK() \
+#   define AFS_GLOCK() \
   do { \
   _lockmgr(&afs_global_lock, LK_EXCLUSIVE, NULL, __FILE__, __LINE__); \
   } while(0);
-#define AFS_GUNLOCK() \
+#   define AFS_GUNLOCK() \
   do { \
   _lockmgr(&afs_global_lock, LK_RELEASE, NULL, __FILE__, __LINE__); \
   } while(0);
 
-#else
+#  else /* LOCKDEBUG */
 
-#define AFS_GLOCK() \
+#   define AFS_GLOCK() \
   do { \
   lockmgr(&afs_global_lock, LK_EXCLUSIVE, NULL); \
   } while(0);
-#define AFS_GUNLOCK() \
+#   define AFS_GUNLOCK() \
   do { \
   lockmgr(&afs_global_lock, LK_RELEASE, NULL); \
   } while(0);
-#endif /* LOCKDEBUG */
-#define ISAFS_GLOCK() (lockstatus(&afs_global_lock) == LK_EXCLUSIVE)
-#else
+#  endif /* LOCKDEBUG */
+#  define ISAFS_GLOCK() (lockstatus(&afs_global_lock) == LK_EXCLUSIVE)
+# else /* AFS_GLOBAL_SUNLOCK */
 extern struct lock afs_global_lock;
-#define AFS_GLOCKP(p)
-#define AFS_GUNLOCKP(p)
-#define AFS_ASSERT_GLOCK()
-#define ISAFS_GLOCK() 1
-#endif
+#  define AFS_GLOCK()
+#  define AFS_GUNLOCK()
+#  define AFS_ASSERT_GLOCK()
+#  define ISAFS_GLOCK() 1
+# endif
 
-#else
+#else /* AFS_OBSD44_ENV */
 /* I don't see doing locks this way for older kernels, either,
  * but, smart folks wrote this
  */
 #define AFS_GLOCK() AFS_GLOCKP(curproc)
 #define AFS_GUNLOCK() AFS_GUNLOCKP(curproc)
-#ifdef AFS_GLOBAL_SUNLOCK
+# ifdef AFS_GLOBAL_SUNLOCK
 extern struct proc *afs_global_owner;
 extern struct lock afs_global_lock;
-#define AFS_GLOCKP(p) \
+#  define AFS_GLOCKP(p) \
     do { \
         osi_Assert(p); \
        afs_osi_lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, (p)); \
         osi_Assert(afs_global_owner == NULL); \
        afs_global_owner = (p); \
     } while (0)
-#define AFS_GUNLOCKP(p) \
+#  define AFS_GUNLOCKP(p) \
     do { \
         osi_Assert(p); \
        osi_Assert(afs_global_owner == (p)); \
         afs_global_owner = NULL; \
         afs_osi_lockmgr(&afs_global_lock, LK_RELEASE, 0, (p)); \
     } while(0)
-#define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
-#else
+#  define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
+# else /* AFS_GLOBAL_SUNLOCK */
 extern struct lock afs_global_lock;
-#define AFS_GLOCKP(p)
-#define AFS_GUNLOCKP(p)
-#define AFS_ASSERT_GLOCK()
-#define ISAFS_GLOCK() 1
-#endif
+#  define AFS_GLOCKP(p)
+#  define AFS_GUNLOCKP(p)
+#  define AFS_ASSERT_GLOCK()
+#  define ISAFS_GLOCK() 1
+# endif
 
 #endif /* AFS_OBSD44_ENV */
 
index 25866ba168126b62f21a33bf44c40df5c238bb74..ed6b5592e8697e628d2631b6893b36f112e87d03 100644 (file)
@@ -53,7 +53,9 @@
 
 /* Extra kernel definitions (from kdefs file) */
 #ifdef _KERNEL
+#ifdef MULTIPROCESSOR
 #define AFS_GLOBAL_SUNLOCK     1
+#endif
 #define        AFS_SHORTGID            0       /* are group id's short? */
 
 #if    !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
index 766415755020b414f10111710e24f89934361be8..c6da6d597389979bfe67c375376c333d048989d3 100644 (file)
@@ -54,7 +54,9 @@
 
 /* Extra kernel definitions (from kdefs file) */
 #ifdef _KERNEL
+#ifdef MULTIPROCESSOR
 #define AFS_GLOBAL_SUNLOCK     1
+#endif
 #define        AFS_SHORTGID            0       /* are group id's short? */
 
 #if    !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)