svn commit: samba r16884 - in trunk/source/locking: .
jra at samba.org
jra at samba.org
Sat Jul 8 20:49:00 GMT 2006
Author: jra
Date: 2006-07-08 20:49:00 +0000 (Sat, 08 Jul 2006)
New Revision: 16884
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16884
Log:
Do the lock merging more agressively for CIFS POSIX
locks. There were cases where we weren't merging
together two adjacent locks of the same type. This
should reduce the number of locks records in this
case.
Jeremy.
Modified:
trunk/source/locking/brlock.c
Changeset:
Modified: trunk/source/locking/brlock.c
===================================================================
--- trunk/source/locking/brlock.c 2006-07-08 20:16:35 UTC (rev 16883)
+++ trunk/source/locking/brlock.c 2006-07-08 20:49:00 UTC (rev 16884)
@@ -391,27 +391,27 @@
+---------+
| ex |
+---------+
- +-------+
- | plock |
- +-------+
+ +-------+
+ | plock |
+ +-------+
OR....
+---------+
| ex |
+---------+
**********************************************/
- if ( (ex->start >= (plock->start + plock->size)) ||
- (plock->start >= (ex->start + ex->size))) {
+ if ( (ex->start > (plock->start + plock->size)) ||
+ (plock->start > (ex->start + ex->size))) {
/* No overlap with this lock - copy existing. */
memcpy(&lck_arr[0], ex, sizeof(struct lock_struct));
return 1;
}
/*********************************************
- +---------+
- | ex |
- +---------+
+---------------------------+
+ | ex |
+ +---------------------------+
+ +---------------------------+
| plock | -> replace with plock.
+---------------------------+
**********************************************/
@@ -424,24 +424,32 @@
}
/*********************************************
- +---------------+
- | ex |
- +---------------+
+ +-----------------------+
+ | ex |
+ +-----------------------+
+---------------+
| plock |
+---------------+
+OR....
+ +-------+
+ | ex |
+ +-------+
+ +---------------+
+ | plock |
+ +---------------+
+
BECOMES....
+---------------+-------+
| plock | ex | - different lock types.
+---------------+-------+
-OR....
+OR.... (merge)
+-----------------------+
| ex | - same lock type.
+-----------------------+
**********************************************/
if ( (ex->start >= plock->start) &&
- (ex->start < plock->start + plock->size) &&
+ (ex->start <= plock->start + plock->size) &&
(ex->start + ex->size > plock->start + plock->size) ) {
*lock_was_added = True;
@@ -468,18 +476,25 @@
}
/*********************************************
- +---------------+
- | ex |
- +---------------+
+ +-----------------------+
+ | ex |
+ +-----------------------+
+---------------+
| plock |
+---------------+
+OR....
+ +-------+
+ | ex |
+ +-------+
+ +---------------+
+ | plock |
+ +---------------+
BECOMES....
+-------+---------------+
| ex | plock | - different lock types
+-------+---------------+
-OR
+OR.... (merge)
+-----------------------+
| ex | - same lock type.
+-----------------------+
@@ -487,7 +502,7 @@
**********************************************/
if ( (ex->start < plock->start) &&
- (ex->start + ex->size > plock->start) &&
+ (ex->start + ex->size >= plock->start) &&
(ex->start + ex->size <= plock->start + plock->size) ) {
*lock_was_added = True;
More information about the samba-cvs
mailing list