Commit fe252bd7 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] swap extent merging fix

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.
parent 9ae91ee6
...@@ -841,7 +841,8 @@ add_swap_extent(struct swap_info_struct *sis, unsigned long start_page, ...@@ -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 */ lh = sis->extent_list.next; /* The highest-addressed block */
while (lh != &sis->extent_list) { while (lh != &sis->extent_list) {
se = list_entry(lh, struct swap_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 */ /* Merge it */
se->nr_pages += nr_pages; se->nr_pages += nr_pages;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment