Commit 6e18087f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix layout of mapped files

If you create a shared mapping of a sparse file, dirty it
and then run msync, all the file's blocks are laid out
backwards.

This is because filemap_sync puts the lowest-index page at
mapping->dirty_pages.prev and the highest at mapping->dirty_pages.next.

I think that by walking the dirty pages list in ascending file
offset order as we instantiate their disk mappings we will generally
get better layout.
parent 71dbc87d
......@@ -550,7 +550,7 @@ int filemap_fdatasync(struct address_space * mapping)
spin_lock(&pagecache_lock);
while (!list_empty(&mapping->dirty_pages)) {
struct page *page = list_entry(mapping->dirty_pages.next, struct page, list);
struct page *page = list_entry(mapping->dirty_pages.prev, struct page, list);
list_del(&page->list);
list_add(&page->list, &mapping->locked_pages);
......
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