From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: [patch 062/128] mm/swapfile.c: explicitly show ssd/non-ssd is handled mutually exclusive Date: Tue, 02 Jun 2020 13:13:33 -0700 Message-ID: <20200602201333.3T9GkO4FW%akpm@linux-foundation.org> References: <20200602130930.8e8f10fa6f19e3766e70921f@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Return-path: Received: from mail.kernel.org ([198.145.29.99]:57444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbgFBUNg (ORCPT ); Tue, 2 Jun 2020 16:13:36 -0400 In-Reply-To: <20200602130930.8e8f10fa6f19e3766e70921f@linux-foundation.org> Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: akpm@linux-foundation.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, richard.weiyang@gmail.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org From: Wei Yang Subject: mm/swapfile.c: explicitly show ssd/non-ssd is handled mutually exclusive The code shows if this is ssd, it will jump to specific tag and skip the following code for non-ssd. Let's use "else if" to explicitly show the mutually exclusion for ssd/non-ssd to reduce ambiguity. Link: http://lkml.kernel.org/r/20200328060520.31449-3-richard.weiyang@gmail.com Signed-off-by: Wei Yang Reviewed-by: Andrew Morton Cc: Tim Chen Signed-off-by: Andrew Morton --- mm/swapfile.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/mm/swapfile.c~mm-swapfilec-explicitly-show-ssd-non-ssd-is-handled-mutually-exclusive +++ a/mm/swapfile.c @@ -763,9 +763,7 @@ static int scan_swap_map_slots(struct sw goto checks; else goto scan; - } - - if (unlikely(!si->cluster_nr--)) { + } else if (unlikely(!si->cluster_nr--)) { if (si->pages - si->inuse_pages < SWAPFILE_CLUSTER) { si->cluster_nr = SWAPFILE_CLUSTER - 1; goto checks; @@ -873,10 +871,8 @@ checks: goto checks; else goto done; - }