Author: stefan2
Date: Sun Apr 15 14:49:21 2012
New Revision: 1326354
URL: http://svn.apache.org/viewvc?rev=1326354&view=rev
Log:
Disable the revprop cache if our sync. mechanisms are too expensive.
* subversion/include/private/svn_named_atomic.h
(svn_named_atomic__is_efficient): declare new API function
* subversion/libsvn_subr/svn_named_atomic.c
(SYNCHRONIZE_IS_FAST): new constant, set depending on system /
compiler capabilities
(svn_named_atomic__is_efficient): implement new API function
* subversion/libsvn_fs_fs/fs_fs.c
(has_revprop_cache): disable cache if sync is slow
Modified:
subversion/trunk/subversion/include/private/svn_named_atomic.h
subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
subversion/trunk/subversion/libsvn_subr/svn_named_atomic.c
Modified: subversion/trunk/subversion/include/private/svn_named_atomic.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_named_atomic.h?rev=1326354&r1=1326353&r2=1326354&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_named_atomic.h (original)
+++ subversion/trunk/subversion/include/private/svn_named_atomic.h Sun Apr 15
14:49:21 2012
@@ -52,6 +52,14 @@ typedef struct svn_named_atomic__t svn_n
*/
#define SVN_NAMED_ATOMIC__MAX_NAME_LENGTH 30
+/** Returns #TRUE on platforms that don't need expensive synchronization
+ * objects to serialize access to named atomics. If this returns #FALSE,
+ * reading from or modifying a #svn_named_atomic__t may be as expensive
+ * as a file system operation.
+ */
+svn_boolean_t
+svn_named_atomic__is_efficient();
+
/** Create a namespace (i.e. access object) with the given @a name and
* return it in @a *ns. If @a name is @c NULL, return the name of the
* default namespace will be used.
Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1326354&r1=1326353&r2=1326354&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sun Apr 15 14:49:21 2012
@@ -2839,6 +2839,16 @@ has_revprop_cache(svn_fs_t *fs)
if (ffd->revprop_cache == NULL)
return FALSE;
+ /* is it efficient? */
+ if (!svn_named_atomic__is_efficient())
+ {
+ /* access to it would be quite slow
+ * -> disable the revprop cache for good
+ */
+ ffd->revprop_cache = NULL;
+ return FALSE;
+ }
+
/* try to access our SHM-backed infrastructure */
error = ensure_revprop_generation(fs);
if (error)
Modified: subversion/trunk/subversion/libsvn_subr/svn_named_atomic.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/svn_named_atomic.c?rev=1326354&r1=1326353&r2=1326354&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/svn_named_atomic.c (original)
+++ subversion/trunk/subversion/libsvn_subr/svn_named_atomic.c Sun Apr 15
14:49:21 2012
@@ -113,6 +113,7 @@
InterlockedCompareExchange64(mem, value, comperand)
#define SYNCHRONIZE(op) op;
+#define SYNCHRONIZE_IS_FAST TRUE
#elif SVN_HAS_ATOMIC_BUILTINS
@@ -125,6 +126,7 @@
__sync_val_compare_and_swap(mem, comperand, value)
#define SYNCHRONIZE(op) op;
+#define SYNCHRONIZE_IS_FAST TRUE
#else
@@ -168,6 +170,8 @@ synched_cmpxchg(volatile apr_int64_t *me
op;\
SVN_ERR(unlock(SVN_NO_ERROR));
+#define SYNCHRONIZE_IS_FAST FALSE
+
#endif
/* Structure describing a single atomic: its VALUE and NAME.
@@ -373,6 +377,12 @@ validate(svn_named_atomic__t *atomic)
/* Implement API */
+svn_boolean_t
+svn_named_atomic__is_efficient()
+{
+ return SYNCHRONIZE_IS_FAST;
+}
+
svn_error_t *
svn_atomic_namespace__create(svn_atomic_namespace__t **ns,
const char *name,