Commit 956d39d6 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: define 'end/complete' in readdir reply as bit flags

Set a flag in readdir request, which indicates that client interprets
'end/complete' as bit flags. So that mds can reply additional flags in
readdir reply.
Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
parent 2a5beea3
...@@ -365,6 +365,8 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) ...@@ -365,6 +365,8 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
req->r_readdir_cache_idx = fi->readdir_cache_idx; req->r_readdir_cache_idx = fi->readdir_cache_idx;
req->r_readdir_offset = fi->next_offset; req->r_readdir_offset = fi->next_offset;
req->r_args.readdir.frag = cpu_to_le32(frag); req->r_args.readdir.frag = cpu_to_le32(frag);
req->r_args.readdir.flags =
cpu_to_le16(CEPH_READDIR_REPLY_BITFLAGS);
req->r_inode = inode; req->r_inode = inode;
ihold(inode); ihold(inode);
......
...@@ -181,8 +181,11 @@ static int parse_reply_info_dir(void **p, void *end, ...@@ -181,8 +181,11 @@ static int parse_reply_info_dir(void **p, void *end,
ceph_decode_need(p, end, sizeof(num) + 2, bad); ceph_decode_need(p, end, sizeof(num) + 2, bad);
num = ceph_decode_32(p); num = ceph_decode_32(p);
info->dir_end = ceph_decode_8(p); {
info->dir_complete = ceph_decode_8(p); u16 flags = ceph_decode_16(p);
info->dir_end = !!(flags & CEPH_READDIR_FRAG_END);
info->dir_complete = !!(flags & CEPH_READDIR_FRAG_COMPLETE);
}
if (num == 0) if (num == 0)
goto done; goto done;
......
...@@ -80,7 +80,7 @@ struct ceph_mds_reply_info_parsed { ...@@ -80,7 +80,7 @@ struct ceph_mds_reply_info_parsed {
struct ceph_mds_reply_dirfrag *dir_dir; struct ceph_mds_reply_dirfrag *dir_dir;
size_t dir_buf_size; size_t dir_buf_size;
int dir_nr; int dir_nr;
u8 dir_complete, dir_end; bool dir_complete, dir_end;
struct ceph_mds_reply_dir_entry *dir_entries; struct ceph_mds_reply_dir_entry *dir_entries;
}; };
......
...@@ -347,6 +347,17 @@ extern const char *ceph_mds_op_name(int op); ...@@ -347,6 +347,17 @@ extern const char *ceph_mds_op_name(int op);
#define CEPH_XATTR_REPLACE (1 << 1) #define CEPH_XATTR_REPLACE (1 << 1)
#define CEPH_XATTR_REMOVE (1 << 31) #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 { union ceph_mds_request_args {
struct { struct {
__le32 mask; /* CEPH_CAP_* */ __le32 mask; /* CEPH_CAP_* */
...@@ -364,6 +375,7 @@ union ceph_mds_request_args { ...@@ -364,6 +375,7 @@ union ceph_mds_request_args {
__le32 frag; /* which dir fragment */ __le32 frag; /* which dir fragment */
__le32 max_entries; /* how many dentries to grab */ __le32 max_entries; /* how many dentries to grab */
__le32 max_bytes; __le32 max_bytes;
__le16 flags;
} __attribute__ ((packed)) readdir; } __attribute__ ((packed)) readdir;
struct { struct {
__le32 mode; __le32 mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment