mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 19:08:58 +00:00
Nice range comparison.
MFC after: 3 days
This commit is contained in:
parent
e65d028196
commit
86b914642c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231525
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user