Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp280637imm; Mon, 1 Oct 2018 09:48:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV60VOhorpgZp78CYdpLyTE0nM4kPO/0D+Y/59tM/xpGEJRujmq9/1HGI9GDQwHyKTgUnJyVm X-Received: by 2002:a17:902:6909:: with SMTP id j9-v6mr12587232plk.196.1538412535131; Mon, 01 Oct 2018 09:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538412535; cv=none; d=google.com; s=arc-20160816; b=dCbQLKa63pH6qmwxYoJsM2G1GJ9jbN12UWWYXiSjjSONXGeq49bWY9KQw/YsrEH+Ua GyCG+ophvthrKL78m+FpeT7gHVyylvCot2XjC0j7JWtZDanngaLUetsy39B9fOBDwhCY Qo1SrW7YTXHam1ID6vdB1wx5lXc83kpHe+B1X4380B2eeJBaxKCFdG65RGd6FCMa7lSA EGjwiC2DeEtN1Z0ZzDahVAvtbkoq9oavz8InZ54FEXotKmcjbJn1nkFAghz85XEevfrQ /e+ThbcFfaNSFlME1XoNJa8izj4pnbo+QfRiD4VIUlLNpIVeM85aJpKQmYCDfOgaUfA9 bGIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date; bh=OjKeDeXU+s0QPjdsgEyyZyAKdG6CidinbQwjRfUqCvo=; b=hhKkGhEITJcsOjB7IbPAYE2vLf4s6grhUdC15/VLMhKg/qNbBDFCwJd4UtK/KcEXfm UWdc8et41GDSoJ8SRFHQUsHLnahycJfNApv99w+TcGc8o8JPljll3SXc25TGiklx4GKe ZmZKiRFCzF6STpztboypNGznAsFuHQKZnylvW0aQzFDrRvu8pwkqYChBrsqRBCwrxjuE AWc5k+l5FUKcOvtlns+WQpW+O7vXQqPhfROxzGFuUEHXpSd+0bIyfpx7QNshczjbSIEH ioWHQWxYZcNZ/xHb93h/XtUVhomzBPYkx1fCT3yPZixOnLQcU3xLf3gxKy22DIfcdNF0 W24Q== 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 h8-v6si6096154plk.465.2018.10.01.09.48.40; Mon, 01 Oct 2018 09:48:55 -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 S1726282AbeJAX1P (ORCPT + 99 others); Mon, 1 Oct 2018 19:27:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:60892 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725906AbeJAX1P (ORCPT ); Mon, 1 Oct 2018 19:27:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id ECB09AEE1; Mon, 1 Oct 2018 16:48:32 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id B76CBDAD55; Mon, 1 Oct 2018 18:48:31 +0200 (CEST) Date: Mon, 1 Oct 2018 18:48:31 +0200 From: David Sterba To: Omar Sandoval Cc: zhong jiang , dsterba@suse.com, jbacik@fb.com, clm@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] btrfs: list usage cleanup Message-ID: <20181001164831.GS3255@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Omar Sandoval , zhong jiang , dsterba@suse.com, jbacik@fb.com, clm@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <1537950945-5627-1-git-send-email-zhongjiang@huawei.com> <20180927184704.GA29754@vader> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180927184704.GA29754@vader> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.