Author: pjd Date: Sat Feb 11 16:41:52 2012 New Revision: 231525 URL: http://svn.freebsd.org/changeset/base/231525
Log: Nice range comparison. MFC after: 3 days Modified: head/sbin/hastd/rangelock.c Modified: head/sbin/hastd/rangelock.c ============================================================================== --- head/sbin/hastd/rangelock.c Sat Feb 11 16:34:03 2012 (r231524) +++ head/sbin/hastd/rangelock.c Sat Feb 11 16:41:52 2012 (r231525) @@ -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); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"