Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5546646rwi; Tue, 18 Oct 2022 00:07:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4I6IYnuEidXjMeLOr8cn+9zr/U/T/OFe7fhmL6DhCOWfy4DYoQl6SWc2EV1diU07tJfL7P X-Received: by 2002:a05:6402:1a33:b0:458:a00a:80a with SMTP id be19-20020a0564021a3300b00458a00a080amr1338092edb.378.1666076864054; Tue, 18 Oct 2022 00:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666076864; cv=none; d=google.com; s=arc-20160816; b=AzZILEP3AVM0s/1ewkw6eCBRDuHFO2Od155TRO5YXw9bjZdROB/mzWbiq889hUpXST K6NXRnEoysRonUAMg6grEZxbvPh40kS0gLhPxRXqJI41vNOH/ckS6FtMtb/M2p8i/Joa Rep1Gg+FpS0Cu1npkMaN49cNp5J1KlDfjo/ctDLZnxPErS2bQI1VduzZ6aBSuOIjhyLr CGW7wKLiLUy9vM2Y4JI+hN4GSuLSjIrYds4bcJHssr7L/OBSAfQHJ6Ed/A8pZylJXSoD Vi0duF8j9+xOCNymgHTgZ2o7fcydgLFVHB95wBahLknVPauhqyEKrsL6kCq6wRqtB/ue QWZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Ee/1he7+E7zALrzrQ3uH8tqv4YO2F/1pB5IjM1Idqo4=; b=CY4uXcGjVctflLIEifdDS7SyIvxD2Q2aUtd4R6O5HTOf0aom/EDWd2jnG+47MknIfW xJolmRZeBh4zlOtQDogwCgRbz1ike8OgGMnBpU6BKAltfI48u9oOYm5y+4Qw39VbFOWw llwhcdmFuRnTomMAGOYI/DOV0byDkgI9uRZkFGpcsEcEupzpQKQClt0YfxvhAtx9G7y9 3sVBYoox9+fGLZg1hWEjJ6T2i4Anps0wGTzym9MOxX6ciLiGJSKLd70qU4ucqFkojIxC +EyIDMVP9H/xkp5gm3f8962K1OE1RKQIssM+CYVMIz1BUyvJOwXDEYkGuFWIuXZ07z82 M71w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs19-20020a1709072d1300b00783d5a93880si10916641ejc.503.2022.10.18.00.07.18; Tue, 18 Oct 2022 00:07:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbiJRGxA (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, 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