Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2012 19:09:02 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r231701 - stable/8/sbin/hastd
Message-ID:  <201202141909.q1EJ92ob013661@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Tue Feb 14 19:09:01 2012
New Revision: 231701
URL: http://svn.freebsd.org/changeset/base/231701

Log:
  MFC r231525 (pjd):
  
  Nice range comparison.

Modified:
  stable/8/sbin/hastd/rangelock.c
Directory Properties:
  stable/8/sbin/hastd/   (props changed)

Modified: stable/8/sbin/hastd/rangelock.c
==============================================================================
--- stable/8/sbin/hastd/rangelock.c	Tue Feb 14 19:08:21 2012	(r231700)
+++ stable/8/sbin/hastd/rangelock.c	Tue Feb 14 19:09:01 2012	(r231701)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202141909.q1EJ92ob013661>