]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] swap extent merging fix
authorAndrew Morton <akpm@osdl.org>
Fri, 13 Feb 2004 07:47:03 +0000 (23:47 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 13 Feb 2004 07:47:03 +0000 (23:47 -0800)
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.

mm/swapfile.c

index 112117a5d66c845606f7ea9a7da3efc2f812ff1d..ddf9b9d3fd00b27444859637202a4953ed4d721a 100644 (file)
@@ -841,7 +841,8 @@ add_swap_extent(struct swap_info_struct *sis, unsigned long start_page,
        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;