From: Hugh Dickins <hugh@veritas.com>

Fix a screwup in the merging of swap extents: not only do they have to be
contiguous on-disk, they have to be logically contiguous in file offset too.



---

 25-akpm/mm/swapfile.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN mm/swapfile.c~swap-extent-fix mm/swapfile.c
--- 25/mm/swapfile.c~swap-extent-fix	Fri Feb  6 14:02:48 2004
+++ 25-akpm/mm/swapfile.c	Fri Feb  6 14:02:48 2004
@@ -841,7 +841,8 @@ add_swap_extent(struct swap_info_struct 
 	lh = sis->extent_list.next;	/* The highest-addressed block */
 	while (lh != &sis->extent_list) {
 		se = list_entry(lh, struct swap_extent, list);
-		if (se->start_block + se->nr_pages == start_block) {
+		if (se->start_block + se->nr_pages == start_block &&
+		    se->start_page  + se->nr_pages == start_page) {
 			/* Merge it */
 			se->nr_pages += nr_pages;
 			return 0;

_