svn commit: r231700 - stable/9/sbin/hastd
Mikolaj Golub
trociny at FreeBSD.org
Tue Feb 14 19:08:22 UTC 2012
Author: trociny
Date: Tue Feb 14 19:08:21 2012
New Revision: 231700
URL: http://svn.freebsd.org/changeset/base/231700
Log:
MFC r231525 (pjd):
Nice range comparison.
Modified:
stable/9/sbin/hastd/rangelock.c
Directory Properties:
stable/9/sbin/hastd/ (props changed)
Modified: stable/9/sbin/hastd/rangelock.c
==============================================================================
--- stable/9/sbin/hastd/rangelock.c Tue Feb 14 18:57:10 2012 (r231699)
+++ stable/9/sbin/hastd/rangelock.c Tue Feb 14 19:08:21 2012 (r231700)
@@ -128,15 +128,13 @@ bool
rangelock_islocked(struct rangelocks *rls, off_t offset, off_t length)
{
struct rlock *rl;
+ off_t end;
PJDLOG_ASSERT(rls->rls_magic == RANGELOCKS_MAGIC);
+ end = offset + length;
TAILQ_FOREACH(rl, &rls->rls_locks, rl_next) {
- if (rl->rl_start >= offset && rl->rl_start < offset + length)
- break;
- else if (rl->rl_end > offset && rl->rl_end <= offset + length)
- break;
- else if (rl->rl_start < offset && rl->rl_end > offset + length)
+ if (rl->rl_start < end && rl->rl_end > offset)
break;
}
return (rl != NULL);
More information about the svn-src-stable-9
mailing list