ceph: preallocate buffer for readdir reply
Preallocate buffer for readdir reply. Limit number of entries in readdir reply according to the buffer size. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
这个提交包含在:
@@ -252,8 +252,6 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
|
||||
int err;
|
||||
u32 ftype;
|
||||
struct ceph_mds_reply_info_parsed *rinfo;
|
||||
const int max_entries = fsc->mount_options->max_readdir;
|
||||
const int max_bytes = fsc->mount_options->max_readdir_bytes;
|
||||
|
||||
dout("readdir %p file %p frag %u off %u\n", inode, file, frag, off);
|
||||
if (fi->flags & CEPH_F_ATEND)
|
||||
@@ -327,6 +325,11 @@ more:
|
||||
req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS);
|
||||
if (IS_ERR(req))
|
||||
return PTR_ERR(req);
|
||||
err = ceph_alloc_readdir_reply_buffer(req, inode);
|
||||
if (err) {
|
||||
ceph_mdsc_put_request(req);
|
||||
return err;
|
||||
}
|
||||
req->r_inode = inode;
|
||||
ihold(inode);
|
||||
req->r_dentry = dget(file->f_dentry);
|
||||
@@ -337,9 +340,6 @@ more:
|
||||
req->r_path2 = kstrdup(fi->last_name, GFP_NOFS);
|
||||
req->r_readdir_offset = fi->next_offset;
|
||||
req->r_args.readdir.frag = cpu_to_le32(frag);
|
||||
req->r_args.readdir.max_entries = cpu_to_le32(max_entries);
|
||||
req->r_args.readdir.max_bytes = cpu_to_le32(max_bytes);
|
||||
req->r_num_caps = max_entries + 1;
|
||||
err = ceph_mdsc_do_request(mdsc, NULL, req);
|
||||
if (err < 0) {
|
||||
ceph_mdsc_put_request(req);
|
||||
|
在新工单中引用
屏蔽一个用户