mirror of
https://review.haiku-os.org/haiku
synced 2025-01-18 04:28:52 +01:00
ramfs: Avoid acquiring locks for suspend/resume of EntryIterator in more cases.
If we don't have an Entry to attach/detach from, then we don't need to acquire any locks at all. Now that we return multiple dirents from read_dir, it's much more likely that we wind up with EntryIterators in such a state, so this avoids some lock contention.
This commit is contained in:
parent
3f73e6e934
commit
89dd4ee819
@ -64,13 +64,13 @@ EntryIterator::Suspend()
|
||||
if (fDirectory == NULL || fSuspended)
|
||||
return B_ERROR;
|
||||
|
||||
if (!fDirectory->GetVolume()->IteratorLock())
|
||||
return B_ERROR;
|
||||
|
||||
if (fEntry != NULL)
|
||||
if (fEntry != NULL) {
|
||||
if (!fDirectory->GetVolume()->IteratorLock())
|
||||
return B_ERROR;
|
||||
fEntry->AttachEntryIterator(this);
|
||||
fDirectory->GetVolume()->IteratorUnlock();
|
||||
}
|
||||
|
||||
fDirectory->GetVolume()->IteratorUnlock();
|
||||
fSuspended = true;
|
||||
return B_OK;
|
||||
}
|
||||
@ -82,14 +82,14 @@ EntryIterator::Resume()
|
||||
if (fDirectory == NULL)
|
||||
return B_ERROR;
|
||||
|
||||
if (!fDirectory->GetVolume()->IteratorLock())
|
||||
return B_ERROR;
|
||||
|
||||
if (fSuspended && fEntry != NULL)
|
||||
if (fSuspended && fEntry != NULL) {
|
||||
if (!fDirectory->GetVolume()->IteratorLock())
|
||||
return B_ERROR;
|
||||
fEntry->DetachEntryIterator(this);
|
||||
fDirectory->GetVolume()->IteratorUnlock();
|
||||
}
|
||||
|
||||
fSuspended = false;
|
||||
fDirectory->GetVolume()->IteratorUnlock();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user