return 0;
}
-int PeerReplayer::cleanup_remote_dir(const std::string &dir_path) {
- dout(20) << ": dir_path=" << dir_path << dendl;
+int PeerReplayer::cleanup_remote_dir(const std::string &dir_root, const std::string &path) {
+ dout(20) << ": dir_root=" << dir_root << ", path=" << path
+ << dendl;
std::stack<SyncEntry> rm_stack;
ceph_dir_result *tdirp;
+ auto dir_path = dir_root;
+ if (!path.empty()) {
+ dir_path = entry_path(dir_root, path);
+ }
int r = ceph_opendir(m_remote_mount, dir_path.c_str(), &tdirp);
if (r < 0) {
derr << ": failed to open remote directory=" << dir_path << ": "
rm_stack.emplace(SyncEntry(dir_path, tdirp, tstx));
while (!rm_stack.empty()) {
- if (should_backoff(dir_path, &r)) {
+ if (should_backoff(dir_root, &r)) {
dout(0) << ": backing off r=" << r << dendl;
break;
}
int synchronize(const std::string &dir_path, uint64_t snap_id, const std::string &snap_name);
int do_synchronize(const std::string &path, const std::string &snap_name);
- int cleanup_remote_dir(const std::string &dir_path);
+ int cleanup_remote_dir(const std::string &dir_root, const std::string &path={});
int remote_mkdir(const std::string &local_path, const std::string &remote_path,
const struct ceph_statx &stx);
int remote_file_op(const std::string &dir_path,