Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/bluestore/BlueFS: log dirty files at sync time #11108

Merged
merged 1 commit into from
Sep 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/os/bluestore/BlueFS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1279,14 +1279,26 @@ int BlueFS::_flush_and_sync_log(std::unique_lock<std::mutex>& l,
<< log_seq_stable << ", done" << dendl;
return 0;
}
if (log_t.empty()) {
if (log_t.empty() && dirty_files.empty()) {
dout(10) << __func__ << " want_seq " << want_seq
<< " " << log_t << " not dirty, no-op" << dendl;
<< " " << log_t << " not dirty, dirty_files empty, no-op" << dendl;
return 0;
}

uint64_t seq = log_t.seq = ++log_seq;
assert(want_seq == 0 || want_seq <= seq);
log_t.uuid = super.uuid;

// log dirty files
auto lsi = dirty_files.find(seq);
if (lsi != dirty_files.end()) {
dout(20) << __func__ << " " << lsi->second.size() << " dirty_files" << dendl;
for (auto &f : lsi->second) {
dout(20) << __func__ << " op_file_update " << f.fnode << dendl;
log_t.op_file_update(f.fnode);
}
}

dout(10) << __func__ << " " << log_t << dendl;
assert(!log_t.empty());

Expand Down Expand Up @@ -1432,7 +1444,6 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length)
if (must_dirty) {
h->file->fnode.mtime = ceph_clock_now(NULL);
assert(h->file->fnode.ino >= 1);
log_t.op_file_update(h->file->fnode);
if (h->file->dirty_seq == 0) {
h->file->dirty_seq = log_seq + 1;
dirty_files[h->file->dirty_seq].push_back(*h->file);
Expand Down