summaryrefslogtreecommitdiffstats
path: root/src/mds/SessionMap.cc
diff options
context:
space:
mode:
authorroot <tdd108128@163.com>2017-11-13 14:51:44 +0100
committerroot <tdd108128@163.com>2017-11-13 14:58:53 +0100
commitdc39faef8503cdf8209b9d004c2f971b06c226b7 (patch)
tree4ecc7b62fbdb08078e788b52e67b0971f870f671 /src/mds/SessionMap.cc
parentMerge PR #18372 into master (diff)
downloadceph-dc39faef8503cdf8209b9d004c2f971b06c226b7.tar.xz
ceph-dc39faef8503cdf8209b9d004c2f971b06c226b7.zip
mds: get rid of the "if" check which is unnecessary inside a loop
Fix: last "if" is already a perfect place to identify a new transaction Signed-off-by: dongdong tao <tdd21151186@gmail.com>
Diffstat (limited to 'src/mds/SessionMap.cc')
-rw-r--r--src/mds/SessionMap.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc
index 9d0bd4c87b6..75577e8bc1b 100644
--- a/src/mds/SessionMap.cc
+++ b/src/mds/SessionMap.cc
@@ -739,11 +739,6 @@ void SessionMap::save_if_dirty(const std::set<entity_name_t> &tgt_sessions,
const uint32_t kpo = g_conf->mds_sessionmap_keys_per_op;
map<string, bufferlist> to_set;
for (uint32_t i = 0; i < write_sessions.size(); ++i) {
- // Start a new write transaction?
- if (i % g_conf->mds_sessionmap_keys_per_op == 0) {
- to_set.clear();
- }
-
const entity_name_t &session_id = write_sessions[i];
Session *session = session_map[session_id];
session->clear_dirty_completed_requests();
@@ -764,6 +759,7 @@ void SessionMap::save_if_dirty(const std::set<entity_name_t> &tgt_sessions,
|| i % kpo == kpo - 1) {
ObjectOperation op;
op.omap_set(to_set);
+ to_set.clear(); // clear to start a new transaction
SnapContext snapc;
object_t oid = get_object_name();