Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1055502ybl; Tue, 3 Dec 2019 00:34:38 -0800 (PST) X-Google-Smtp-Source: APXvYqx7FrM9d7FCMZ3IaUpW/K4HKWl4bymLVyhf54Bf/FDZa0MobVhoxlT+ZSYjMNCAKEquXaoi X-Received: by 2002:a9d:22e3:: with SMTP id y90mr2365553ota.218.1575362078370; Tue, 03 Dec 2019 00:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575362078; cv=none; d=google.com; s=arc-20160816; b=S6Q1+irVTfSS9wdbvs95Z3owqVfhl5eETZFxA/6lDkJi6gwrmA85lib0Uz0TMP+82/ CQfibEnCuevQcZMnwxurhG2N82sohhvPiTYmGYnnmx0e12ldIpmeEfcY+btUaQd8Ihi2 mqwz3AnkOE6Ok1AOc3VBI2FumJ0gOTb71xA9wEclBFVYaCdoYsi3Qx+wClwIeI0MmBsJ dY8GNBZwc7xgb8UD9r/EPohG3LoDEbK0oaE8fzyViKlgGEPDQF03slXlao5DhtfcGtRi /nh8c//lZ7GehqcJrd234GdnAPm2FE07YtK66Vc3VWf5vY4MOJyv44I0xU7mYkaRZ212 rzig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=WFSYKvEgzSQokmrHgBSwlHxZMcZPVuej2MCUe+5B8fI=; b=obuQ4Pon5pB7nVUd0YSm4eXxM4RaXgipRUUHuOcquZdb7+WVDiGP1vYSEuvtNE2fDP 8s6s+he3qWzJI6WtTKK9bwR0dwPBwDBXScJTOeAjS00sEWpVHHLmj+RA1NrIaPYugFvN y32Lfv25dj+mZ44Vm234ZdpQGpxgomYbtiDAQhP6zV0dhvneUhZfwQb+f2Y8p9R6ghX4 +QxVUp+yildkQhlamtTBowNSK89WbvXOZGO+X15YrxZQIkC3nUytXA0fS9Dp7v5GGLaS gE0wxmuUK4iE1mgtoymqgdVv3N8OvNevB3s7GAJJq3ImDrL5zOMGvc56zEhpWXv1rJLK qt/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h184si966320oia.19.2019.12.03.00.34.25; Tue, 03 Dec 2019 00:34:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726066AbfLCIdx (ORCPT + 99 others); Tue, 3 Dec 2019 03:33:53 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6740 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725773AbfLCIdx (ORCPT ); Tue, 3 Dec 2019 03:33:53 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B2160C238957AF1B488A; Tue, 3 Dec 2019 16:33:51 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Tue, 3 Dec 2019 16:33:44 +0800 Subject: Re: [PATCH] btrfs: remove unused condition check in btrfs_page_mkwrite() To: Omar Sandoval CC: , , , , , "hushiyuan@huawei.com" , "linfeilong@huawei.com" References: <20191203082426.GC829117@vader> From: Yunfeng Ye Message-ID: <4796f90f-ca5d-7b7c-5645-034af21d7c8b@huawei.com> Date: Tue, 3 Dec 2019 16:33:33 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20191203082426.GC829117@vader> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/3 16:24, Omar Sandoval wrote: > On Tue, Dec 03, 2019 at 04:16:43PM +0800, Yunfeng Ye wrote: >> The condition '!ret2' is always true. so remove the unused condition >> check. >> >> Signed-off-by: Yunfeng Ye > > For this sort of change, one should mention how the code got in this > state. In this case, commit 717beb96d969 ("Btrfs: fix regression in > btrfs_page_mkwrite() from vm_fault_t conversion") left behind the check > after moving this code out of the goto. > ok, I will update the comment, thanks. > Ohter than that, > > Reviewed-by: Omar Sandoval > >> --- >> fs/btrfs/inode.c | 11 ++++------- >> 1 file changed, 4 insertions(+), 7 deletions(-) >> >> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c >> index 56032c518b26..eef2432597e2 100644 >> --- a/fs/btrfs/inode.c >> +++ b/fs/btrfs/inode.c >> @@ -9073,7 +9073,6 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) >> ret = VM_FAULT_SIGBUS; >> goto out_unlock; >> } >> - ret2 = 0; >> >> /* page is wholly or partially inside EOF */ >> if (page_start + PAGE_SIZE > size) >> @@ -9097,12 +9096,10 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) >> >> unlock_extent_cached(io_tree, page_start, page_end, &cached_state); >> >> - if (!ret2) { >> - btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); >> - sb_end_pagefault(inode->i_sb); >> - extent_changeset_free(data_reserved); >> - return VM_FAULT_LOCKED; >> - } >> + btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); >> + sb_end_pagefault(inode->i_sb); >> + extent_changeset_free(data_reserved); >> + return VM_FAULT_LOCKED; >> >> out_unlock: >> unlock_page(page); >> -- >> 2.7.4 >> > > . >