mirror of
https://github.com/ceph/ceph
synced 2025-02-15 14:58:01 +00:00
Merge pull request #13653 from rzarzynski/wip-bs-bitmap-fast-exhausted-check
os/bluestore: the exhausted check in BitMapZone can be lock-less. Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
2db2f05535
@ -421,7 +421,7 @@ BitMapZone::~BitMapZone()
|
||||
*/
|
||||
bool BitMapZone::is_exhausted()
|
||||
{
|
||||
alloc_assert(check_locked());
|
||||
/* BitMapZone::get_used_blocks operates atomically. No need for lock. */
|
||||
return get_used_blocks() == size();
|
||||
}
|
||||
|
||||
@ -1098,14 +1098,16 @@ BitMapAreaLeaf::~BitMapAreaLeaf()
|
||||
|
||||
bool BitMapAreaLeaf::child_check_n_lock(BitMapArea *child, int64_t required, bool lock)
|
||||
{
|
||||
if (lock) {
|
||||
child->lock_excl();
|
||||
} else if (!child->lock_excl_try()) {
|
||||
/* The exhausted check can be performed without acquiring the lock. This
|
||||
* is because 1) BitMapZone::is_exhausted() actually operates atomically
|
||||
* and 2) it's followed by the exclusive, required-aware re-verification. */
|
||||
if (child->is_exhausted()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (child->is_exhausted()) {
|
||||
child->unlock();
|
||||
if (lock) {
|
||||
child->lock_excl();
|
||||
} else if (!child->lock_excl_try()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user