mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li zeming <zeming@nfschina.com>
To: hubcap@omnibond.com, martin@omnibond.com
Cc: devel@lists.orangefs.org, linux-kernel@vger.kernel.org,
	Li zeming <zeming@nfschina.com>
Subject: [PATCH] orangefs: inode: Optimized orangefs* correlation function
Date: Tue, 18 Oct 2022 14:52:47 +0800	[thread overview]
Message-ID: <20221018065247.83191-1-zeming@nfschina.com> (raw)

The orangefs* function has been optimized as follows.
1. Remove the initialization assignment of variables, which are assigned
first.
2. Remove void* associated variable cast.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 fs/orangefs/inode.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 7a8c0c6e698d..54d47b9ad0db 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -719,7 +719,7 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr)
 	struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
 	struct orangefs_kernel_op_s *new_op;
 	loff_t orig_size;
-	int ret = -EINVAL;
+	int ret;
 
 	gossip_debug(GOSSIP_INODE_DEBUG,
 		     "%s: %pU: Handle is %pU | fs_id %d | size is %llu\n",
@@ -941,7 +941,7 @@ static int orangefs_fileattr_get(struct dentry *dentry, struct fileattr *fa)
 static int orangefs_fileattr_set(struct user_namespace *mnt_userns,
 				 struct dentry *dentry, struct fileattr *fa)
 {
-	u64 val = 0;
+	u64 val;
 
 	gossip_debug(GOSSIP_FILE_DEBUG, "%s: called on %pd\n", __func__,
 		     dentry);
@@ -1021,7 +1021,7 @@ static inline ino_t orangefs_handle_hash(struct orangefs_object_kref *ref)
  */
 static int orangefs_set_inode(struct inode *inode, void *data)
 {
-	struct orangefs_object_kref *ref = (struct orangefs_object_kref *) data;
+	struct orangefs_object_kref *ref = data;
 	ORANGEFS_I(inode)->refn.fs_id = ref->fs_id;
 	ORANGEFS_I(inode)->refn.khandle = ref->khandle;
 	ORANGEFS_I(inode)->attr_valid = 0;
@@ -1036,8 +1036,8 @@ static int orangefs_set_inode(struct inode *inode, void *data)
  */
 static int orangefs_test_inode(struct inode *inode, void *data)
 {
-	struct orangefs_object_kref *ref = (struct orangefs_object_kref *) data;
-	struct orangefs_inode_s *orangefs_inode = NULL;
+	struct orangefs_object_kref *ref = data;
+	struct orangefs_inode_s *orangefs_inode;
 
 	orangefs_inode = ORANGEFS_I(inode);
 	/* test handles and fs_ids... */
@@ -1056,7 +1056,7 @@ static int orangefs_test_inode(struct inode *inode, void *data)
 struct inode *orangefs_iget(struct super_block *sb,
 		struct orangefs_object_kref *ref)
 {
-	struct inode *inode = NULL;
+	struct inode *inode;
 	unsigned long hash;
 	int error;
 
-- 
2.18.2


                 reply	other threads:[~2022-10-18  6:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221018065247.83191-1-zeming@nfschina.com \
    --to=zeming@nfschina.com \
    --cc=devel@lists.orangefs.org \
    --cc=hubcap@omnibond.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@omnibond.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®