From patchwork Tue Oct 18 06:52:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 3966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1813873wrs; Tue, 18 Oct 2022 00:06:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73Kt+oeitBhmluoqaSbQih5frEIHrnM+OwNKb2n+vgFHgCQ5XebRkRhLKS5cSBfL+GLNwf X-Received: by 2002:a17:907:d03:b0:78e:16da:e4ae with SMTP id gn3-20020a1709070d0300b0078e16dae4aemr1274008ejc.202.1666076812718; Tue, 18 Oct 2022 00:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666076812; cv=none; d=google.com; s=arc-20160816; b=Fap+GK1VN3XsSwOe2UbKJUX3OWalPiWGeVrWEDL35paW8ahAucbiVy9rD2j8NTQdw6 BbCofmoQr8F2PCLKFG4Wp2OoO81u2w+uzioEdkA2O7CZBHZfjkjP/ooM/em6TaS9NOoM 8QKUrBd5DAriTJfBkQ89T4kuj0hljPeTsTDe39EggjkKzCaybzwuIPjOBCVj5a9TlS3T csGbDwO8j8VFWfN3Lzt+SE4kEqrJwFkd9OlokEz9z/oZPnD5i5/QZHuQSlrpQGzhz+NZ 0Jww66pvfl4JoNqW0oIj2jLTCf2T27zc5pEw5dTl7uA1i++ndlWyEnRuHNMQtvkuDAbj 4lug== 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 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.06.28; Tue, 18 Oct 2022 00:06:52 -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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747008159814002473?= X-GMAIL-MSGID: =?utf-8?q?1747008159814002473?= 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;