Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp461267imm; Wed, 3 Oct 2018 20:26:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV61KJC7hg9gpXrGFF0rMRsXwja1jwJpk794dTFWuco2uXHwhOBwVoEaNdIcT176yQELcpdox X-Received: by 2002:a62:d110:: with SMTP id z16-v6mr4720091pfg.229.1538623574510; Wed, 03 Oct 2018 20:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538623574; cv=none; d=google.com; s=arc-20160816; b=oyKwIOnxy9LpCcspg4yR98Y/iPfZ6eesP9bq4NXk2a5DwgRMD0CAUFOcutkfJsEpaN 4vkIvbSR9jdNV8GOD6E2+RcSykDxf0MiD94sjrO19OzeFrBj6F5vOm9gKirnIQXbbrTe Pi/rBWKoCAaFzfJb8lnHbXz/LYwbovALbmnowRqjSBuqMbBnFVbW3aqQAVSMcwjkIudZ ENQufPslqUy/WcPArlyC1IizB5vl8Mn/NLiXitiMAG6KO+MFefqDPS+PY89mT2LgfNkL B3bBMklZc2i/KPFp5tBltyqMhQYtALdEDX3h5ASwoRoQrLKQ3Zz/O7LNYODSWibJOzL+ VYFg== 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:in-reply-to :references:subject:to:mime-version:user-agent:from:date:message-id; bh=i5wOv33joSRQntkS0YuPUctLmbnMn6sOHzpc9Ho/HIo=; b=VBM2374U4VntXREh8u15y6wt92eVhfLnQZosijymNVS12Ch88krdvqXMdc5w4FANV2 TOVVyf7hxQboFLplb+V/RsruXwgbIcmxadwWj4p9RZIYh09BrozkYK0IZfrrTcXNB9Zn rAYaVW8UAqcq8CGFAlrtkbcq756EWoz7mEMblzV6Kx8dcJfIn7E44xUXjIsD2jmm8f8k 4Rd8nmy0Fh5aNFlVYdy/0M+KCUwkHO2PxyuamMRcAzZ6KgYH8HlX/+XYzNLUOCpYkoHn o5BqrsJWwKqg0PRWcnxgT0BXxc7Z7YxCp/TFUx9wR+8LFI5Xm9dmkus2yaWNV8K9p0gI Q3Cw== 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 d23-v6si3711644plr.127.2018.10.03.20.25.57; Wed, 03 Oct 2018 20:26:14 -0700 (PDT) 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 S1727540AbeJDKRE (ORCPT + 99 others); Thu, 4 Oct 2018 06:17:04 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13185 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727318AbeJDKRE (ORCPT ); Thu, 4 Oct 2018 06:17:04 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id EE79F1962BF2B; Thu, 4 Oct 2018 11:25:49 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Thu, 4 Oct 2018 11:25:46 +0800 Message-ID: <5BB58838.7080202@huawei.com> Date: Thu, 4 Oct 2018 11:25:44 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: , Omar Sandoval , , , , , Subject: Re: [PATCH] btrfs: list usage cleanup References: <1537950945-5627-1-git-send-email-zhongjiang@huawei.com> <20180927184704.GA29754@vader> <20181001164831.GS3255@twin.jikos.cz> In-Reply-To: <20181001164831.GS3255@twin.jikos.cz> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/2 0:48, David Sterba wrote: > On Thu, Sep 27, 2018 at 11:47:04AM -0700, Omar Sandoval wrote: >> On Wed, Sep 26, 2018 at 04:35:45PM +0800, zhong jiang wrote: >>> Trival cleanup, list_move_tail will implement the same function that >>> list_del() + list_add_tail() will do. hence just replace them. >>> >>> Signed-off-by: zhong jiang >>> --- >>> fs/btrfs/send.c | 3 +-- >>> 1 file changed, 1 insertion(+), 2 deletions(-) >>> >>> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c >>> index 094cc144..d87f416 100644 >>> --- a/fs/btrfs/send.c >>> +++ b/fs/btrfs/send.c >>> @@ -2075,8 +2075,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx, >>> */ >>> static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce) >>> { >>> - list_del(&nce->list); >>> - list_add_tail(&nce->list, &sctx->name_cache_list); >>> + list_move_tail(&nce->list, &sctx->name_cache_list); >>> } >> At that point do we even need such a trivial helper, considering that >> this is only called in one place? > Fair point and trivial one-line helpers are on the cleanup todo list. > The exception is when the actual helper implementation is obscuring the > semantics and the helper is used in many places so it's not practical to > add a comment everywhere. But it's not the case here. > > Zhong Jiang, please update the patch and resend, thanks. Will add a comment here and resend in v2. Thanks, zhong jiang > . >