From nobody Tue Apr 7 15:55:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D586C433FE for ; Tue, 18 Oct 2022 06:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbiJRGxA (ORCPT ); Tue, 18 Oct 2022 02:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229947AbiJRGw5 (ORCPT ); Tue, 18 Oct 2022 02:52:57 -0400 Received: from mail.nfschina.com (mail.nfschina.com [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0C252DE3 for ; Mon, 17 Oct 2022 23:52:55 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 378E51E80D76; Tue, 18 Oct 2022 14:52:13 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rymyJ6sXaElW; Tue, 18 Oct 2022 14:52:10 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 4226D1E80D17; Tue, 18 Oct 2022 14:52:10 +0800 (CST) From: Li zeming To: hubcap@omnibond.com, martin@omnibond.com Cc: devel@lists.orangefs.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] orangefs: inode: Optimized orangefs* correlation function Date: Tue, 18 Oct 2022 14:52:47 +0800 Message-Id: <20221018065247.83191-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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, s= truct iattr *iattr) struct orangefs_inode_s *orangefs_inode =3D ORANGEFS_I(inode); struct orangefs_kernel_op_s *new_op; loff_t orig_size; - int ret =3D -EINVAL; + int ret; =20 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 =3D 0; + u64 val; =20 gossip_debug(GOSSIP_FILE_DEBUG, "%s: called on %pd\n", __func__, dentry); @@ -1021,7 +1021,7 @@ static inline ino_t orangefs_handle_hash(struct orang= efs_object_kref *ref) */ static int orangefs_set_inode(struct inode *inode, void *data) { - struct orangefs_object_kref *ref =3D (struct orangefs_object_kref *) data; + struct orangefs_object_kref *ref =3D data; ORANGEFS_I(inode)->refn.fs_id =3D ref->fs_id; ORANGEFS_I(inode)->refn.khandle =3D ref->khandle; ORANGEFS_I(inode)->attr_valid =3D 0; @@ -1036,8 +1036,8 @@ static int orangefs_set_inode(struct inode *inode, vo= id *data) */ static int orangefs_test_inode(struct inode *inode, void *data) { - struct orangefs_object_kref *ref =3D (struct orangefs_object_kref *) data; - struct orangefs_inode_s *orangefs_inode =3D NULL; + struct orangefs_object_kref *ref =3D data; + struct orangefs_inode_s *orangefs_inode; =20 orangefs_inode =3D ORANGEFS_I(inode); /* test handles and fs_ids... */ @@ -1056,7 +1056,7 @@ static int orangefs_test_inode(struct inode *inode, v= oid *data) struct inode *orangefs_iget(struct super_block *sb, struct orangefs_object_kref *ref) { - struct inode *inode =3D NULL; + struct inode *inode; unsigned long hash; int error; =20 --=20 2.18.2