return true;
}
+ open_ino_batch_start();
+
for (auto& p : cap_imports) {
CInode *in = get_inode(p.first);
if (in) {
mds->heartbeat_reset();
}
+ open_ino_batch_submit();
+
if (cap_imports_num_opening > 0)
return true;
{
if (dir->state_test(CDir::STATE_REJOINUNDEF))
ceph_assert(dir->get_inode()->dirfragtree.is_leaf(dir->get_frag()));
- dir->fetch(dname, CEPH_NOSNAP, new C_MDC_OpenInoTraverseDir(this, ino, m, parent));
+
+ auto fin = new C_MDC_OpenInoTraverseDir(this, ino, m, parent);
+ if (open_ino_batch && !dname.empty()) {
+ auto& p = open_ino_batched_fetch[dir];
+ p.first.emplace_back(dname);
+ p.second.emplace_back(fin);
+ return;
+ }
+
+ dir->fetch(dname, CEPH_NOSNAP, fin);
if (mds->logger)
mds->logger->inc(l_mds_openino_dir_fetch);
}
}
}
+void MDCache::open_ino_batch_start()
+{
+ dout(10) << __func__ << dendl;
+ open_ino_batch = true;
+}
+
+void MDCache::open_ino_batch_submit()
+{
+ dout(10) << __func__ << dendl;
+ open_ino_batch = false;
+
+ for (auto& [dir, p] : open_ino_batched_fetch) {
+ CInode *in = dir->inode;
+ std::vector<dentry_key_t> keys;
+ for (auto& dname : p.first)
+ keys.emplace_back(CEPH_NOSNAP, dname, in->hash_dentry_name(dname));
+ dir->fetch_keys(keys,
+ new MDSInternalContextWrapper(mds,
+ new LambdaContext([this, waiters = std::move(p.second)](int r) mutable {
+ mds->queue_waiters_front(waiters);
+ })
+ )
+ );
+ if (mds->logger)
+ mds->logger->inc(l_mds_openino_dir_fetch);
+ }
+ open_ino_batched_fetch.clear();
+}
+
void MDCache::open_ino(inodeno_t ino, int64_t pool, MDSContext* fin,
bool want_replica, bool want_xlocked,
vector<inode_backpointer_t> *ancestors_hint,
void make_trace(std::vector<CDentry*>& trace, CInode *in);
- void kick_open_ino_peers(mds_rank_t who);
void open_ino(inodeno_t ino, int64_t pool, MDSContext *fin,
bool want_replica=true, bool want_xlocked=false,
std::vector<inode_backpointer_t> *ancestors_hint=nullptr,
mds_rank_t auth_hint=MDS_RANK_NONE);
+ void open_ino_batch_start();
+ void open_ino_batch_submit();
+ void kick_open_ino_peers(mds_rank_t who);
void find_ino_peers(inodeno_t ino, MDSContext *c,
mds_rank_t hint=MDS_RANK_NONE, bool path_locked=false);
MDSContext::vec waiters;
};
+ ceph_tid_t open_ino_last_tid = 0;
+ std::map<inodeno_t,open_ino_info_t> opening_inodes;
+
+ bool open_ino_batch = false;
+ std::map<CDir*, std::pair<std::vector<std::string>, MDSContext::vec> > open_ino_batched_fetch;
+
friend struct C_MDC_OpenInoTraverseDir;
friend struct C_MDC_OpenInoParentOpened;
friend struct C_MDC_RetryScanStray;
std::unique_ptr<MDSContext> rejoin_done;
std::unique_ptr<MDSContext> resolve_done;
- ceph_tid_t open_ino_last_tid = 0;
- std::map<inodeno_t,open_ino_info_t> opening_inodes;
-
StrayManager stray_manager;
private: