mm: zswap: remove unnecessary check in zswap_find_zpool()
authorYosry Ahmed <yosryahmed@google.com>
Mon, 11 Mar 2024 23:52:10 +0000 (23:52 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Apr 2024 03:55:48 +0000 (20:55 -0700)
zswap_find_zpool() checks if ZSWAP_NR_ZPOOLS > 1, which is always true.
This is a remnant from a patch version that had ZSWAP_NR_ZPOOLS as a
config option and never made it upstream.  Remove the unnecessary check.

Link: https://lkml.kernel.org/r/20240311235210.2937484-1-yosryahmed@google.com
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/zswap.c

index 8721980a22740a698878d0ecea9a2b3febe4e4fd..e435dc7c043b7ea64b0034ba24b0751af44c2c2b 100644 (file)
@@ -871,12 +871,7 @@ static void zswap_entry_cache_free(struct zswap_entry *entry)
 
 static struct zpool *zswap_find_zpool(struct zswap_entry *entry)
 {
-       int i = 0;
-
-       if (ZSWAP_NR_ZPOOLS > 1)
-               i = hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS));
-
-       return entry->pool->zpools[i];
+       return entry->pool->zpools[hash_ptr(entry, ilog2(ZSWAP_NR_ZPOOLS))];
 }
 
 /*