Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4260359rwe; Tue, 30 Aug 2022 07:15:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR5cS5TW34HWXwR2pouMUrCatpfYOUrXIi+Jkz7C71zykg31EYN38umDtPc1X0FsfKqr/j7b X-Received: by 2002:a17:90b:3c48:b0:1fd:b6bd:8d2a with SMTP id pm8-20020a17090b3c4800b001fdb6bd8d2amr12747573pjb.159.1661868955768; Tue, 30 Aug 2022 07:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661868955; cv=none; d=google.com; s=arc-20160816; b=mn/1ibXHKmNDD3mEG0SdsSso9rN/igFC3AXX4wXZu5EwGaovPTUo7vNrLe10VqqPpm 478ra6mQN+3gS+qltz9UtvCmCYGb7ifVXZVoSLoh1UYdyXi+vOcvsJgp8he4euuhKNVU E0hAB0ct1b00BjApdvnqIPVeesdFEgqYZ83KYSjGejSBELZJMu2uuQFpFWAzE0+waNVl G39f3tjG8V2fcy6kbNoB6phGbT54E57umYoDglbMhCC7seM8HipXaUoIDOPJsD7VSJQV U27WGCuUy8s/PXduGZR5dHAtH3UNXki0yT6h+Vh6GO+ZUtjN74g2dGLuqWLw3HeAszj1 DAXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NR1Buglm46SD2bFMfxU1QDbzIcYARPut0ZoI0Ks5BrM=; b=PPzCZQke+xIEV1l5oMxEe4+k/EPBaWF+fjxC5aj+zN1xuBaGweyB8PBRLWyw6gnnHH +SZXPbsxp7BysueqNtNlj3EMJhIH/pscGlSthChzB4WaIKVkCLuT/PDuyyFJP5T44Ym8 yfKx0d3PIFEmAUEAER8mniZ3lyac5u/vrhjhjMPlGjam6exqJx8apYozqNZIZybS2c8f NHwZRSFmKadkI2WSPjoOek4NW71jRzw6EtLefj1lakwlh6i5XDUMubEgHarL0r8NTOmB jz4JtZhb117o1Boky5rOEtHU+eUNKPQezn6AVOzFH9Rv+dawGLCIoDWxFfNNUCY8fewM +3Ow== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i62-20020a638741000000b0042b8b0284cdsi2108578pge.97.2022.08.30.07.15.41; Tue, 30 Aug 2022 07:15:55 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbiH3NcE (ORCPT + 99 others); Tue, 30 Aug 2022 09:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230318AbiH3NcA (ORCPT ); Tue, 30 Aug 2022 09:32:00 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED8A9D5DE9; Tue, 30 Aug 2022 06:31:58 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MH7QY6dq2zYcqv; Tue, 30 Aug 2022 21:27:33 +0800 (CST) Received: from huawei.com (10.175.103.91) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 30 Aug 2022 21:31:56 +0800 From: Zeng Heng To: CC: , , Subject: [PATCH -next 2/2] xfs: simplify if-else condition in xfs_reflink_trim_around_shared Date: Tue, 30 Aug 2022 21:39:39 +0800 Message-ID: <20220830133939.2726749-3-zengheng4@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220830133939.2726749-1-zengheng4@huawei.com> References: <20220830133939.2726749-1-zengheng4@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500022.china.huawei.com (7.185.36.162) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 "else" is not generally useful after a return, so remove it for clean code. There is no logical changes. Signed-off-by: Zeng Heng --- fs/xfs/xfs_reflink.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 251f20ddd368..93bdd25680bc 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -200,7 +200,9 @@ xfs_reflink_trim_around_shared( if (fbno == NULLAGBLOCK) { /* No shared blocks at all. */ return 0; - } else if (fbno == agbno) { + } + + if (fbno == agbno) { /* * The start of this extent is shared. Truncate the * mapping at the end of the shared region so that a @@ -210,16 +212,16 @@ xfs_reflink_trim_around_shared( irec->br_blockcount = flen; *shared = true; return 0; - } else { - /* - * There's a shared extent midway through this extent. - * Truncate the mapping at the start of the shared - * extent so that a subsequent iteration starts at the - * start of the shared region. - */ - irec->br_blockcount = fbno - agbno; - return 0; } + + /* + * There's a shared extent midway through this extent. + * Truncate the mapping at the start of the shared + * extent so that a subsequent iteration starts at the + * start of the shared region. + */ + irec->br_blockcount = fbno - agbno; + return 0; } int -- 2.25.1