summaryrefslogtreecommitdiff
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2016-04-28 04:37:39 +0300
committerIlya Dryomov <idryomov@gmail.com>2016-05-26 02:15:34 +0300
commit2a5beea3f1b6544d6c72ea220e860a2eda2f9104 (patch)
treea8fb1e7aba89f8e34341cf8f8dec6083a743a166 /fs/ceph/dir.c
parenta78600e7c4fb47fb5ef34265456b731fde27a9c3 (diff)
downloadlinux-2a5beea3f1b6544d6c72ea220e860a2eda2f9104.tar.xz
ceph: define struct for dir entry in readdir reply
This avoids defining multiple arrays for entries in readdir reply Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r--fs/ceph/dir.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 31a2cdf39210..68530acea2c8 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -416,9 +416,9 @@ more:
fi->last_name = NULL;
fi->next_offset = 2;
} else {
- err = note_last_dentry(fi,
- rinfo->dir_dname[rinfo->dir_nr-1],
- rinfo->dir_dname_len[rinfo->dir_nr-1],
+ struct ceph_mds_reply_dir_entry *rde =
+ rinfo->dir_entries + (rinfo->dir_nr-1);
+ err = note_last_dentry(fi, rde->name, rde->name_len,
fi->next_offset + rinfo->dir_nr);
if (err)
return err;
@@ -431,24 +431,21 @@ more:
ctx->pos = ceph_make_fpos(frag, off);
while (off >= fi->offset && off - fi->offset < rinfo->dir_nr) {
- struct ceph_mds_reply_inode *in =
- rinfo->dir_in[off - fi->offset].in;
+ struct ceph_mds_reply_dir_entry *rde =
+ rinfo->dir_entries + (off - fi->offset);
struct ceph_vino vino;
ino_t ino;
dout("readdir off %d (%d/%d) -> %lld '%.*s' %p\n",
off, off - fi->offset, rinfo->dir_nr, ctx->pos,
- rinfo->dir_dname_len[off - fi->offset],
- rinfo->dir_dname[off - fi->offset], in);
- BUG_ON(!in);
- ftype = le32_to_cpu(in->mode) >> 12;
- vino.ino = le64_to_cpu(in->ino);
- vino.snap = le64_to_cpu(in->snapid);
+ rde->name_len, rde->name, &rde->inode.in);
+ BUG_ON(!rde->inode.in);
+ ftype = le32_to_cpu(rde->inode.in->mode) >> 12;
+ vino.ino = le64_to_cpu(rde->inode.in->ino);
+ vino.snap = le64_to_cpu(rde->inode.in->snapid);
ino = ceph_vino_to_ino(vino);
- if (!dir_emit(ctx,
- rinfo->dir_dname[off - fi->offset],
- rinfo->dir_dname_len[off - fi->offset],
- ceph_translate_ino(inode->i_sb, ino), ftype)) {
+ if (!dir_emit(ctx, rde->name, rde->name_len,
+ ceph_translate_ino(inode->i_sb, ino), ftype)) {
dout("filldir stopping us...\n");
return 0;
}