Skip to content

Commit

Permalink
Merge pull request #17684 from majianpeng/bluefs-release-extents
Browse files Browse the repository at this point in the history
os/bluestore/BlueFS: move release unused extents work in _flush_and_syn_log

Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Sep 28, 2017
2 parents 4e0a983 + 2fc80f9 commit bf8a109
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/os/bluestore/BlueFS.cc
Expand Up @@ -1357,6 +1357,9 @@ int BlueFS::_flush_and_sync_log(std::unique_lock<std::mutex>& l,
return 0;
}

vector<interval_set<uint64_t>> to_release(pending_release.size());
to_release.swap(pending_release);

uint64_t seq = log_t.seq = ++log_seq;
assert(want_seq == 0 || want_seq <= seq);
log_t.uuid = super.uuid;
Expand Down Expand Up @@ -1450,6 +1453,13 @@ int BlueFS::_flush_and_sync_log(std::unique_lock<std::mutex>& l,
<< " already >= out seq " << seq
<< ", we lost a race against another log flush, done" << dendl;
}

for (unsigned i = 0; i < to_release.size(); ++i) {
for (auto p = to_release[i].begin(); p != to_release[i].end(); ++p) {
alloc[i]->release(p.get_start(), p.get_len());
}
}

_update_logger_stats();

return 0;
Expand Down Expand Up @@ -1881,15 +1891,8 @@ void BlueFS::sync_metadata()
} else {
dout(10) << __func__ << dendl;
utime_t start = ceph_clock_now();
vector<interval_set<uint64_t>> to_release(pending_release.size());
to_release.swap(pending_release);
flush_bdev(); // FIXME?
_flush_and_sync_log(l);
for (unsigned i = 0; i < to_release.size(); ++i) {
for (auto p = to_release[i].begin(); p != to_release[i].end(); ++p) {
alloc[i]->release(p.get_start(), p.get_len());
}
}
dout(10) << __func__ << " done in " << (ceph_clock_now() - start) << dendl;
}

Expand Down

0 comments on commit bf8a109

Please sign in to comment.