return 0;
}
-int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p,
- unsigned want, unsigned flags, bool getref)
+int Client::readdir_r_cb(dir_result_t* d,
+ add_dirent_cb_t cb,
+ void* p,
+ unsigned want,
+ unsigned flags,
+ bool getref)
+{
+ auto fill_readdir_cb = [](dir_result_t* dirp,
+ MetaRequest* req,
+ InodeRef& diri,
+ frag_t fg) {
+ filepath path;
+ diri->make_nosnap_relative_path(path);
+ req->set_filepath(path);
+ req->set_inode(diri.get());
+ req->head.args.readdir.frag = fg;
+ req->head.args.readdir.flags = CEPH_READDIR_REPLY_BITFLAGS;
+ if (dirp->last_name.length()) {
+ req->path2.set_path(dirp->last_name);
+ } else if (dirp->hash_order()) {
+ req->head.args.readdir.offset_hash = dirp->offset_high();
+ }
+ req->dirp = dirp;
+ };
+ int op = CEPH_MDS_OP_READDIR;
+ if (d->inode && d->inode->snapid == CEPH_SNAPDIR)
+ op = CEPH_MDS_OP_LSSNAP;
+ return _readdir_r_cb(op,
+ d,
+ cb,
+ fill_readdir_cb,
+ p,
+ want,
+ flags,
+ getref,
+ false);
+}
+
+//
+// NB: this is used for both readdir and readdir_snapdiff results processing
+// hence it should be request type agnostic
+//
+int Client::_readdir_r_cb(int op,
+ dir_result_t *d,
+ add_dirent_cb_t cb,
+ fill_readdir_args_cb_t fill_cb,
+ void *p,
+ unsigned want,
+ unsigned flags,
+ bool getref,
+ bool bypass_cache)
{
int caps = statx_to_mask(flags, want);
+ int rstat_on_dir = cct->_conf->client_dirsize_rbytes ? CEPH_STAT_RSTAT : 0;
RWRef_t mref_reader(mount_state, CLIENT_MOUNTING);
if (!mref_reader.is_state_satisfied())