[PATCH 2/3] mm/swapfile.c: explicitly show ssd/non-ssd is handled mutually exclusive

From: Wei Yang
Date: Sat Mar 28 2020 - 02:06:27 EST


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.

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
---
mm/swapfile.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 52afb74fc3d1..adf48d4b1b63 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -760,9 +760,7 @@ static int scan_swap_map_slots(struct swap_info_struct *si,
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;
@@ -870,10 +868,8 @@ static int scan_swap_map_slots(struct swap_info_struct *si,
goto checks;
else
goto done;
- }
-
- /* non-ssd case, still more slots in cluster? */
- if (si->cluster_nr && !si->swap_map[++offset]) {
+ } else if (si->cluster_nr && !si->swap_map[++offset]) {
+ /* non-ssd case, still more slots in cluster? */
--si->cluster_nr;
goto checks;
}
--
2.23.0