Skip to content

Commit 3ae24c0

Browse files
committed
Merge PR ceph#57813 into main
* refs/pull/57813/head: mds: avoid use of swap to initialize Reviewed-by: Leonid Usov <[email protected]>
2 parents 234407e + 8e76f77 commit 3ae24c0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/mds/CDir.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,18 +2327,18 @@ class C_IO_Dir_Committed : public CDirIOContext {
23272327

23282328
class C_IO_Dir_Commit_Ops : public Context {
23292329
public:
2330-
C_IO_Dir_Commit_Ops(CDir *d, int pr,
2331-
vector<CDir::dentry_commit_item> &&s, bufferlist &&bl,
2332-
vector<string> &&r,
2333-
mempool::mds_co::compact_set<mempool::mds_co::string> &&stales) :
2334-
dir(d), op_prio(pr) {
2330+
C_IO_Dir_Commit_Ops(CDir* d, int pr, auto&& s, auto&& bl, auto&& r, auto&& stales)
2331+
:
2332+
dir(d),
2333+
op_prio(pr),
2334+
to_set(std::forward<decltype(s)>(s)),
2335+
dfts(std::forward<decltype(bl)>(bl)),
2336+
to_remove(std::forward<decltype(r)>(r)),
2337+
stale_items(std::forward<decltype(stales)>(stales))
2338+
{
23352339
metapool = dir->mdcache->mds->get_metadata_pool();
23362340
version = dir->get_version();
23372341
is_new = dir->is_new();
2338-
to_set.swap(s);
2339-
dfts.swap(bl);
2340-
to_remove.swap(r);
2341-
stale_items.swap(stales);
23422342
}
23432343

23442344
void finish(int r) override {
@@ -2488,9 +2488,9 @@ void CDir::_omap_commit_ops(int r, int op_prio, int64_t metapool, version_t vers
24882488
mdcache->mds->heartbeat_reset();
24892489
}
24902490

2491-
bufferlist bl;
24922491
using ceph::encode;
24932492
for (auto &item : to_set) {
2493+
bufferlist bl;
24942494
encode(item.first, bl);
24952495
if (item.is_remote) {
24962496
// remote link
@@ -2510,7 +2510,7 @@ void CDir::_omap_commit_ops(int r, int op_prio, int64_t metapool, version_t vers
25102510
commit_one();
25112511

25122512
write_size += size;
2513-
_set[std::move(item.key)].swap(bl);
2513+
_set[std::move(item.key)] = std::move(bl);
25142514

25152515
if (!(++count % mdcache->mds->heartbeat_reset_grace()))
25162516
mdcache->mds->heartbeat_reset();
@@ -2621,7 +2621,7 @@ void CDir::_omap_commit(int op_prio)
26212621

26222622
auto c = new C_IO_Dir_Commit_Ops(this, op_prio, std::move(to_set), std::move(dfts),
26232623
std::move(to_remove), std::move(stale_items));
2624-
stale_items.clear();
2624+
stale_items.clear(); /* in CDir */
26252625
mdcache->mds->finisher->queue(c);
26262626
}
26272627

0 commit comments

Comments
 (0)