@@ -394,14 +394,13 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
dout("readdir fetching %llx.%llx frag %x offset '%s'\n",
ceph_vinop(inode), frag, dfi->last_name);
req = ceph_mdsc_create_request(mdsc, op, USE_AUTH_MDS);
- if (IS_ERR(req)) {
- err = PTR_ERR(req);
- goto out;
- }
+ if (IS_ERR(req))
+ return PTR_ERR(req);
+
err = ceph_alloc_readdir_reply_buffer(req, inode);
if (err) {
ceph_mdsc_put_request(req);
- goto out;
+ return err;
}
/* hints to request -> mds selection code */
req->r_direct_mode = USE_AUTH_MDS;
@@ -417,14 +416,13 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
req->r_path2 = kzalloc(NAME_MAX, GFP_KERNEL);
if (!req->r_path2) {
ceph_mdsc_put_request(req);
- err = -ENOMEM;
- goto out;
+ return -ENOMEM;
}
err = ceph_encode_encrypted_dname(inode, &d_name, req->r_path2);
if (err < 0) {
ceph_mdsc_put_request(req);
- goto out;
+ return err;
}
} else if (is_hash_order(ctx->pos)) {
req->r_args.readdir.offset_hash =
@@ -445,7 +443,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
err = ceph_mdsc_do_request(mdsc, NULL, req);
if (err < 0) {
ceph_mdsc_put_request(req);
- goto out;
+ return err;
}
dout("readdir got and parsed readdir result=%d on "
"frag %x, end=%d, complete=%d, hash_order=%d\n",
@@ -500,7 +498,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
if (err) {
ceph_mdsc_put_request(dfi->last_readdir);
dfi->last_readdir = NULL;
- goto out;
+ return err;
}
} else if (req->r_reply_info.dir_end) {
dfi->next_offset = 2;
@@ -548,8 +546,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
* it will continue.
*/
dout("filldir stopping us...\n");
- err = 0;
- goto out;
+ return 0;
}
/* Reset the lengths to their original allocated vals */
@@ -607,10 +604,8 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
dfi->dir_ordered_count);
spin_unlock(&ci->i_ceph_lock);
}
- err = 0;
dout("readdir %p file %p done.\n", inode, file);
-out:
- return err;
+ return 0;
}
static void reset_readdir(struct ceph_dir_file_info *dfi)