Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1251903pxb; Wed, 27 Oct 2021 23:35:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbe0bFQbSjltuSFipTB2yv1XRB8WAltLwMgn8b3a2y4TX8ydLsw38nrqingRt/VGKGtNwC X-Received: by 2002:a17:907:1c81:: with SMTP id nb1mr3097406ejc.153.1635402918009; Wed, 27 Oct 2021 23:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635402918; cv=none; d=google.com; s=arc-20160816; b=Nz6wcQLR1FqaaDLJRl8KIoGyjJhLCCHt0r01V7JkxYjfOGx5Z2azws9sWgxqGS/Vfx XSHzZSD3hjOFNH8wfqIbJzPZ9i2Pp4jBL15eE6aHrSXG9ERfWDr/xy1PtbzkOr1tpzv5 w+NGLfTgSJIb3KylvNv+Rsz/2a46Pn/6YE8S4lDCZkUPv/tL/ixl8IgVLqtjhKpEWwE9 JhXJjkPKuBAY3YBXIzzoyJkoQVW79mw3IKR3ax3kWENo/pKZntP8yQZuwbdJNi9lyRof zk3THFdYCBp42vuELXqJrBCO9Rw55jBiszOTEyJdC7vPH5blolhqxvCLpY4tZUbD8J81 JiNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ugcr1zF2Lz6jL6mCQPhVZd8qhlgYPfi5seZLI5OCHpg=; b=L/ZIAM1ucp8UfOq37wsYfxK7whAVeYTtXboOPV7cVJqR3zAdNMFEsAwyvLkr+a94eh F+IahtAr9zUumNgHgqWFQjYAPlPpLF8lw3gPvY8LaTdiXd+MZrbZ1hB2JT0mZHmfleJY 4pwC/MO8/sd1zfMLQZmUsp7IsIqVSFP4/mGODdDy0Ze29itfJhF0Z8sK1ZzMD3ibF0WN fhHVrpnEk4VbBIrVUU0rIFTPrXyHiHzCJLm9cuGJ0MYCVb5DWbI2QyUw9p9eGjo1cxf5 NP0Rz6sdvCERTeUxnO4GpTf1PsYImkjsfsJw/UPbsGzAHLX4uFQFHVtsfj4P/2tEgbi4 BZlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz9si3530475edb.318.2021.10.27.23.34.53; Wed, 27 Oct 2021 23:35:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbhJ1Gfc (ORCPT + 99 others); Thu, 28 Oct 2021 02:35:32 -0400 Received: from mx3.molgen.mpg.de ([141.14.17.11]:60295 "EHLO mx1.molgen.mpg.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229762AbhJ1Gfb (ORCPT ); Thu, 28 Oct 2021 02:35:31 -0400 Received: from [192.168.0.2] (ip5f5aef59.dynamic.kabel-deutschland.de [95.90.239.89]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 94DC261E64846; Thu, 28 Oct 2021 08:33:02 +0200 (CEST) Message-ID: <0e1c2fd6-c792-a77c-4105-b7f6f5104357@molgen.mpg.de> Date: Thu, 28 Oct 2021 08:33:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [PATCH] raid5-ppl: use swap() to make code cleaner Content-Language: en-US To: Yang Guang Cc: Yang Guang , Zeal Robot , linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, Song Liu References: <20211028010053.7609-1-yang.guang5@zte.com.cn> From: Paul Menzel In-Reply-To: <20211028010053.7609-1-yang.guang5@zte.com.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Yang, Thank you for the patch. On 28.10.21 03:00, Yang Guang wrote: > Using swap() make it more readable. make*s* Maybe: Use the macro `swap()` defined in `include/linux/minmax.h` to avoid opencoding it. By the way, there is also the Coccinelle script `scripts/coccinelle/misc/swap.cocci`. > Reported-by: Zeal Robot > Signed-off-by: Yang Guang > --- > drivers/md/raid5-ppl.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c > index 3ddc2aa0b530..4ab417915d7f 100644 > --- a/drivers/md/raid5-ppl.c > +++ b/drivers/md/raid5-ppl.c > @@ -1081,7 +1081,7 @@ static int ppl_load_distributed(struct ppl_log *log) > struct ppl_conf *ppl_conf = log->ppl_conf; > struct md_rdev *rdev = log->rdev; > struct mddev *mddev = rdev->mddev; > - struct page *page, *page2, *tmp; > + struct page *page, *page2; > struct ppl_header *pplhdr = NULL, *prev_pplhdr = NULL; > u32 crc, crc_stored; > u32 signature; > @@ -1156,9 +1156,7 @@ static int ppl_load_distributed(struct ppl_log *log) > prev_pplhdr_offset = pplhdr_offset; > prev_pplhdr = pplhdr; > > - tmp = page; > - page = page2; > - page2 = tmp; > + swap(page, page2); > > /* calculate next potential ppl offset */ > for (i = 0; i < le32_to_cpu(pplhdr->entries_count); i++) > Kind regards, Paul