Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp361240lqb; Tue, 28 May 2024 19:13:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUkDaS5ksB1Iyv1pYI2U0kRTnRxlfpDwczsz1/Mu7KbfBwFelhT6XKHeNcvKV+WkcOCmGfzXFCbS41wHM1BkJwwC5ONn9QeA+EjL8JZYA== X-Google-Smtp-Source: AGHT+IEQVi41w3ZdV0jd5f0r/Mp2GhtbtsvyObC7J0LmmVi/ASxbETIMWnTWvXHJfmr/X4VVqZqb X-Received: by 2002:a17:90a:bd8f:b0:2bd:db8b:ca73 with SMTP id 98e67ed59e1d1-2bf5ee1ed8dmr14251229a91.26.1716948799804; Tue, 28 May 2024 19:13:19 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5fccebb9si8633353a91.53.2024.05.28.19.13.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 19:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193349-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linux.alibaba.com header.s=default header.b=HRSdr8mM; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-193349-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9841A284D1F for ; Wed, 29 May 2024 02:12:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9362715A854; Wed, 29 May 2024 02:12:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="HRSdr8mM" Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99D4226AF3 for ; Wed, 29 May 2024 02:12:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716948762; cv=none; b=RFTcCk39zRARsHawq7Zhs1m0iAHFJ8Pht1kqz7zi13nnudTf6DWgA6YLC7c3YfUYKvQ95Afats0ILBBFJC03mXJ7S+AdeVslViKV8AgDMXaNTm1pWFMAuDMhLz8MQo4fHO3gm4gFMhgRPZzrWFCFkHu2k9bzTkOfGlB3tJZ8z+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716948762; c=relaxed/simple; bh=QfND/PD5GrGnKbwK+0FJycGdhW/D1Jmpc9axx2H3JGg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Pl4bKONjhLoWDfU/F/QmNKWKSZbTFdRIleeJ2vELDKGZn02TBMDdiKPFzMb6ubuhGGc+KanAoeNAvRpX8FWSA177BmTmtOxshaGwyCrUi5Bu+Qy3xRkJjAw6ofc6jpqcMDQnO6nZ0Z5ag/hsOyc6B2Xs9Kq/f+a+2Yl70RKoHgs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=HRSdr8mM; arc=none smtp.client-ip=115.124.30.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1716948758; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=diY8Yj7pHCeARPPadn/ZK5HGSeSyGpgtjlSUI3jYyZ0=; b=HRSdr8mMfWr05qLRrX6BLm+pP+7kF9OE4rSYN8i5m2jXnjGNEpNxfLwuBAkPWv1Z7k43UbydWcSeolENWNBZHXvPDJpvFAOYZdErGGB4PGc1HlQbxSRaagVMCli+y5f8j5vYWfe4lVCEAeGHnqN4RudTCFD001S7STNZ1GouTp4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033032014031;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0W7RADWX_1716948752; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0W7RADWX_1716948752) by smtp.aliyun-inc.com; Wed, 29 May 2024 10:12:37 +0800 From: Jiapeng Chong To: msakai@redhat.com Cc: dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH v2] dm vdo indexer: Use swap() in swap_open_chapter() Date: Wed, 29 May 2024 10:12:31 +0800 Message-Id: <20240529021231.21043-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use existing swap() function rather than duplicating its implementation. /drivers/md/dm-vdo/indexer/index.c:207:43-44: WARNING opportunity for swap(). Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9173 Signed-off-by: Jiapeng Chong --- Changes in v2: -Amend commit message to make it more clear. drivers/md/dm-vdo/indexer/index.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/md/dm-vdo/indexer/index.c b/drivers/md/dm-vdo/indexer/index.c index 1ba767144426..df4934846244 100644 --- a/drivers/md/dm-vdo/indexer/index.c +++ b/drivers/md/dm-vdo/indexer/index.c @@ -197,15 +197,12 @@ static int finish_previous_chapter(struct uds_index *index, u64 current_chapter_ static int swap_open_chapter(struct index_zone *zone) { int result; - struct open_chapter_zone *temporary_chapter; result = finish_previous_chapter(zone->index, zone->newest_virtual_chapter); if (result != UDS_SUCCESS) return result; - temporary_chapter = zone->open_chapter; - zone->open_chapter = zone->writing_chapter; - zone->writing_chapter = temporary_chapter; + swap(zone->open_chapter, zone->writing_chapter); return UDS_SUCCESS; } -- 2.20.1.7.g153144c