Merge PR #38464 into master

* refs/pull/38464/head:
	mds/OpenFileTable: make the data length as long as possible for each op

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2020-12-16 20:13:43 -08:00
commit 9b5210e497
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB

View File

@ -518,7 +518,10 @@ void OpenFileTable::commit(MDSContext *c, uint64_t log_seq, int op_prio)
first_free_idx = omap_idx;
}
auto& ctl = omap_updates.at(omap_idx);
if (ctl.write_size >= max_write_size) {
journal_func(omap_idx);
ctl.write_size = 0;
}
if (p != anchor_map.end()) {
bufferlist bl;
encode(p->second, bl);
@ -530,11 +533,6 @@ void OpenFileTable::commit(MDSContext *c, uint64_t log_seq, int op_prio)
ctl.write_size += len + sizeof(__u32);
ctl.to_remove.emplace(key);
}
if (ctl.write_size >= max_write_size) {
journal_func(omap_idx);
ctl.write_size = 0;
}
}
dirty_items.clear();
@ -550,13 +548,12 @@ void OpenFileTable::commit(MDSContext *c, uint64_t log_seq, int op_prio)
--count;
auto& ctl = omap_updates.at(omap_idx);
if (ctl.write_size >= max_write_size) {
journal_func(omap_idx);
ctl.write_size = 0;
}
ctl.write_size += len + sizeof(__u32);
ctl.to_remove.emplace(key);
if (ctl.write_size >= max_write_size) {
journal_func(omap_idx);
ctl.write_size = 0;
}
}
loaded_anchor_map.clear();
}
@ -624,24 +621,25 @@ void OpenFileTable::commit(MDSContext *c, uint64_t log_seq, int op_prio)
bool first = true;
for (auto& it : ctl.journaled_update) {
if (ctl.write_size >= max_write_size) {
create_op_func(omap_idx, first);
ctl.write_size = 0;
first = false;
}
ctl.write_size += it.first.length() + it.second.length() + 2 * sizeof(__u32);
ctl.to_update[it.first].swap(it.second);
if (ctl.write_size >= max_write_size) {
create_op_func(omap_idx, first);
ctl.write_size = 0;
first = false;
}
total_updates++;
}
for (auto& key : ctl.journaled_remove) {
if (ctl.write_size >= max_write_size) {
create_op_func(omap_idx, first);
ctl.write_size = 0;
first = false;
}
ctl.write_size += key.length() + sizeof(__u32);
ctl.to_remove.emplace(key);
if (ctl.write_size >= max_write_size) {
create_op_func(omap_idx, first);
ctl.write_size = 0;
first = false;
}
total_removes++;
}