From: Akinobu Mita Date: Wed, 22 Mar 2006 08:09:09 +0000 (-0800) Subject: [PATCH] fix swap cluster offset X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9b65ef59d42a56fa1358958ede77aaa5bac385a8;p=openwrt%2Fstaging%2Fblogic.git [PATCH] fix swap cluster offset When we've allocated SWAPFILE_CLUSTER pages, ->cluster_next should be the first index of swap cluster. But current code probably sets it wrong offset. Signed-off-by: Akinobu Mita Acked-by: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/swapfile.c b/mm/swapfile.c index 1f9cf0d073b8..365ed6ff182d 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -116,7 +116,7 @@ static inline unsigned long scan_swap_map(struct swap_info_struct *si) last_in_cluster = offset + SWAPFILE_CLUSTER; else if (offset == last_in_cluster) { spin_lock(&swap_lock); - si->cluster_next = offset-SWAPFILE_CLUSTER-1; + si->cluster_next = offset-SWAPFILE_CLUSTER+1; goto cluster; } if (unlikely(--latency_ration < 0)) {