Skip to contentSkip to conversation

fs/ceph/export: remove unused variable 'err'

PATCH In review Qiujun Huang 2 participants 3 messages Mar 3, 2020 – Mar 5, 2020 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ceph/export: remove unused variable 'err'

fix gcc '-Wunused-but-set-variable' warning:
fs/ceph/export.c: In function ‘__get_parent’:
fs/ceph/export.c:294:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]
int err;

and needn't use the return value of ceph_mdsc_create_request.

---
 fs/ceph/export.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ceph/export.c +1 -2
index b6bfa94..b7bb41c 100644
@@ -291,7 +291,6 @@ static struct dentry *__get_parent(struct super_block *sb,
 	struct ceph_mds_request *req;
 	struct inode *inode;
 	int mask;
-	int err;
 
 	req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPPARENT,
 				       USE_ANY_MDS);
@@ -314,7 +313,7 @@ static struct dentry *__get_parent(struct super_block *sb,
 	req->r_args.getattr.mask = cpu_to_le32(mask);
 
 	req->r_num_caps = 1;
-	err = ceph_mdsc_do_request(mdsc, NULL, req);
+	ceph_mdsc_do_request(mdsc, NULL, req);
 	inode = req->r_target_inode;
 	if (inode)
 		ihold(inode);
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 25 lines · Qiujun Huang

fix gcc '-Wunused-but-set-variable' warning:
fs/ceph/export.c: In function ‘__get_parent’:
fs/ceph/export.c:294:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]
int err;

and needn't use the return value of ceph_mdsc_create_request.

---
 fs/ceph/export.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ceph/export.c +0 -1
index b6bfa94..b7bb41c 100644
@@ -291,7 +291,6 @@ static struct dentry *__get_parent(struct super_block *sb,
 	struct ceph_mds_request *req;
 	struct inode *inode;
 	int mask;
-	int err;
 
 	req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPPARENT,
 				       USE_ANY_MDS);

fs/ceph/export.c static struct dentry *__get_parent(struct super_block *sb, · line 319

Quoted 8 lines
fs/ceph/export.c +1 -1
@@ -314,7 +313,7 @@ static struct dentry *__get_parent(struct super_block *sb,
 	req->r_args.getattr.mask = cpu_to_le32(mask);
 
 	req->r_num_caps = 1;
-	err = ceph_mdsc_do_request(mdsc, NULL, req);
+	ceph_mdsc_do_request(mdsc, NULL, req);
 	inode = req->r_target_inode;
 	if (inode)
 		ihold(inode);

I think we probably ought to just return ERR_PTR(err) in that case instead of discarding it. It looks like today we'll end up returning ENOENT when that errors out which doesn't seem right when there is a different issue.

Signature · 1 line
Jeff Layton <[email protected]>
#2 lore raw
Quoted 5 lines · Jeff Layton

I think we probably ought to just return ERR_PTR(err) in that case instead of discarding it. It looks like today we'll end up returning ENOENT when that errors out which doesn't seem right when there is a different issue.

I get that, thanks.

Quoted 4 lines

--
Jeff Layton <[email protected]>