// dirstat
DirStat dst(p);
__u32 numdn;
- __u8 complete, end;
+ __u16 flags;
::decode(numdn, p);
- ::decode(end, p);
- ::decode(complete, p);
+ ::decode(flags, p);
+
+ bool end = ((unsigned)flags & CEPH_READDIR_FRAG_END);
frag_t fg = (unsigned)request->head.args.readdir.frag;
uint64_t readdir_offset = dirp->next_offset;
dirp->offset = dir_result_t::make_fpos(fg, readdir_offset);
}
- ldout(cct, 10) << __func__ << " " << numdn << " readdir items, end=" << (int)end
+ ldout(cct, 10) << __func__ << " " << numdn << " readdir items, end=" << end
<< ", offset " << readdir_offset
<< ", readdir_start " << readdir_start << dendl;
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.c_str());
}
#define CEPH_XATTR_REPLACE (1 << 1)
#define CEPH_XATTR_REMOVE (1 << 31)
+/*
+ * readdir request flags;
+ */
+#define CEPH_READDIR_REPLY_BITFLAGS (1<<0)
+
+/*
+ * readdir reply flags.
+ */
+#define CEPH_READDIR_FRAG_END (1<<0)
+#define CEPH_READDIR_FRAG_COMPLETE (1<<8)
+
union ceph_mds_request_args {
struct {
__le32 mask; /* CEPH_CAP_* */
__le32 frag; /* which dir fragment */
__le32 max_entries; /* how many dentries to grab */
__le32 max_bytes;
+ __le16 flags;
} __attribute__ ((packed)) readdir;
struct {
__le32 mode;
// which frag?
frag_t fg = (__u32)req->head.args.readdir.frag;
+ unsigned req_flags = (__u32)req->head.args.readdir.flags;
string offset_str = req->get_path2();
dout(10) << " frag " << fg << " offset '" << offset_str << "'" << dendl;
// build dir contents
bufferlist dnbl;
__u32 numfiles = 0;
- __u8 end = (dir->begin() == dir->end());
+ bool end = (dir->begin() == dir->end());
for (CDir::map_t::iterator it = dir->begin();
!end && numfiles < max;
end = (it == dir->end())) {
mdcache->lru.lru_touch(dn);
}
- __u8 complete = (end && offset_str.empty()); // FIXME: what purpose does this serve
+ bool complete = false;
+ __u16 flags = 0;
+ if (end) {
+ flags = CEPH_READDIR_FRAG_END;
+ complete = offset_str.empty(); // FIXME: what purpose does this serve
+ if (complete)
+ flags |= CEPH_READDIR_FRAG_COMPLETE;
+ }
+ // client only understand END and COMPLETE flags ?
+ if (req_flags & CEPH_READDIR_REPLY_BITFLAGS) {
+ }
// finish final blob
::encode(numfiles, dirbl);
- ::encode(end, dirbl);
- ::encode(complete, dirbl);
+ ::encode(flags, dirbl);
dirbl.claim_append(dnbl);
// yay, reply
}
::encode(num, dirbl);
- __u8 end = (p == infomap.end());
- ::encode(end, dirbl); // end
- __u8 complete = end && last_snapid == 0;
- ::encode(complete, dirbl); // complete
+ __u16 flags = 0;
+ if (p == infomap.end()) {
+ flags = CEPH_READDIR_FRAG_END;
+ if (last_snapid == 0)
+ flags |= CEPH_READDIR_FRAG_COMPLETE;
+ }
+ ::encode(flags, dirbl);
dirbl.claim_append(dnbl);
mdr->reply_extra_bl = dirbl;