Skip to contentSkip to conversation

Staging: lustre: Remove unneeded variable and replace its uses

PATCH In review Vatika Harlalka 3 participants 5 messages Mar 10, 2015 – Mar 15, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: Remove unneeded variable and replace its uses

Variable dotdot is only used as a function parameter and can be replaced there directly to improve code compactness.

---
 drivers/staging/lustre/lustre/llite/llite_nfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/llite_nfs.c +3 -4
index 6a67e71..b8ced3d 100644
@@ -287,7 +287,6 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	struct ll_sb_info     *sbi;
 	struct dentry	 *result = NULL;
 	struct mdt_body       *body;
-	static const char	   dotdot[] = "..";
 	struct md_op_data     *op_data;
 	int		   rc;
 	int		      lmmsize;
@@ -303,8 +302,8 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	if (rc != 0)
 		return ERR_PTR(rc);
 
-	op_data = ll_prep_md_op_data(NULL, dir, NULL, dotdot,
-				     strlen(dotdot), lmmsize,
+	op_data = ll_prep_md_op_data(NULL, dir, NULL, "..",
+				     2, lmmsize,
 				     LUSTRE_OPC_ANY, NULL);
 	if (IS_ERR(op_data))
 		return (void *)op_data;
@@ -321,7 +320,7 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	CDEBUG(D_INFO, "parent for "DFID" is "DFID"\n",
 		PFID(ll_inode2fid(dir)), PFID(&body->fid1));
 
-	result = ll_iget_for_nfs(dir->i_sb, &body->fid1, NULL);
+	
 
 	ptlrpc_req_finished(req);
 	return result;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Vatika Harlalka

Variable dotdot is only used as a function parameter and can be replaced there directly to improve code compactness.

How did you find it? (Just curious).

julia

Quoted 48 lines
---
 drivers/staging/lustre/lustre/llite/llite_nfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/llite_nfs.c +3 -5
index 6a67e71..b8ced3d 100644
@@ -287,7 +287,6 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	struct ll_sb_info     *sbi;
 	struct dentry	 *result = NULL;
 	struct mdt_body       *body;
-	static const char	   dotdot[] = "..";
 	struct md_op_data     *op_data;
 	int		   rc;
 	int		      lmmsize;
@@ -303,8 +302,8 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	if (rc != 0)
 		return ERR_PTR(rc);
 
-	op_data = ll_prep_md_op_data(NULL, dir, NULL, dotdot,
-				     strlen(dotdot), lmmsize,
+	op_data = ll_prep_md_op_data(NULL, dir, NULL, "..",
+				     2, lmmsize,
 				     LUSTRE_OPC_ANY, NULL);
 	if (IS_ERR(op_data))
 		return (void *)op_data;
@@ -321,7 +320,7 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	CDEBUG(D_INFO, "parent for "DFID" is "DFID"\n",
 		PFID(ll_inode2fid(dir)), PFID(&body->fid1));
 
-	result = ll_iget_for_nfs(dir->i_sb, &body->fid1, NULL);
+
 
 	ptlrpc_req_finished(req);
 	return result;
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150310134242.GA9593%40akanksha.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw

I was looking into the checkpatch error related to converting static char dotdot[] to static const char dotdot[] and then saw that didn't seem to be required.

maintainer
#3 lore raw
In reply to Vatika Harlalka
Quoted 32 lines · Vatika Harlalka

Variable dotdot is only used as a function parameter and can be replaced there directly to improve code compactness.

---
 drivers/staging/lustre/lustre/llite/llite_nfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/llite/llite_nfs.c +2 -3
index 6a67e71..b8ced3d 100644
@@ -287,7 +287,6 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	struct ll_sb_info     *sbi;
 	struct dentry	 *result = NULL;
 	struct mdt_body       *body;
-	static const char	   dotdot[] = "..";
 	struct md_op_data     *op_data;
 	int		   rc;
 	int		      lmmsize;
@@ -303,8 +302,8 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	if (rc != 0)
 		return ERR_PTR(rc);
 
-	op_data = ll_prep_md_op_data(NULL, dir, NULL, dotdot,
-				     strlen(dotdot), lmmsize,
+	op_data = ll_prep_md_op_data(NULL, dir, NULL, "..",
+				     2, lmmsize,
 				     LUSTRE_OPC_ANY, NULL);
 	if (IS_ERR(op_data))
 		return (void *)op_data;

drivers/staging/lustre/lustre/llite/llite_nfs.c static struct dentry *ll_get_parent(struct dentry *dchild) · line 323

Quoted 5 lines
drivers/staging/lustre/lustre/llite/llite_nfs.c +1 -1
@@ -321,7 +320,7 @@ static struct dentry *ll_get_parent(struct dentry *dchild)
 	CDEBUG(D_INFO, "parent for "DFID" is "DFID"\n",
 		PFID(ll_inode2fid(dir)), PFID(&body->fid1));
 
-	result = ll_iget_for_nfs(dir->i_sb, &body->fid1, NULL);
+	

Why did you delete this whole function call? That does not seem to match up with what you said this patch did.

I can't take this as-is, sorry.

greg k-h

#4 lore raw

Sorry, removing the call is a mistake on my side. I'll resend a patch for this one and will ensure that I'm more careful !