[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200328060520.31449-2-richard.weiyang@gmail.com>
Date: Sat, 28 Mar 2020 06:05:18 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Wei Yang <richard.weiyang@...il.com>
Subject: [PATCH 1/3] mm/swapfile.c: offset is only used when there is more slots
When si->cluster_nr is zero, function would reach done and return. The
increased offset would not be used any more. This means we can move the
offset increment into the if clause.
This brings a further code cleanup possibility.
Signed-off-by: Wei Yang <richard.weiyang@...il.com>
---
mm/swapfile.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6b6e41967bf3..52afb74fc3d1 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -871,11 +871,9 @@ static int scan_swap_map_slots(struct swap_info_struct *si,
else
goto done;
}
- /* non-ssd case */
- ++offset;
/* non-ssd case, still more slots in cluster? */
- if (si->cluster_nr && !si->swap_map[offset]) {
+ if (si->cluster_nr && !si->swap_map[++offset]) {
--si->cluster_nr;
goto checks;
}
--
2.23.0
Powered by blists - more mailing lists