Commit 505f7dd2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] tmpfs blk_congestion_wait fix

From: Hugh Dickins <hugh@veritas.com>

The blk_congestion_waits in shmem_getpage are appropriate when the error is
-ENOMEM, but not when the error is -EEXIST.  So add that test in the first
instance, but omit it all in the second instance.
parent 45f59fc7
...@@ -839,7 +839,8 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, struct page **p ...@@ -839,7 +839,8 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, struct page **p
SetPageUptodate(filepage); SetPageUptodate(filepage);
set_page_dirty(filepage); set_page_dirty(filepage);
swap_free(swap); swap_free(swap);
} else if (move_from_swap_cache(swappage, idx, mapping) == 0) { } else if (!(error = move_from_swap_cache(
swappage, idx, mapping))) {
shmem_swp_set(info, entry, 0); shmem_swp_set(info, entry, 0);
shmem_swp_unmap(entry); shmem_swp_unmap(entry);
spin_unlock(&info->lock); spin_unlock(&info->lock);
...@@ -850,8 +851,10 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, struct page **p ...@@ -850,8 +851,10 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, struct page **p
spin_unlock(&info->lock); spin_unlock(&info->lock);
unlock_page(swappage); unlock_page(swappage);
page_cache_release(swappage); page_cache_release(swappage);
if (error == -ENOMEM) {
/* let kswapd refresh zone for GFP_ATOMICs */ /* let kswapd refresh zone for GFP_ATOMICs */
blk_congestion_wait(WRITE, HZ/50); blk_congestion_wait(WRITE, HZ/50);
}
goto repeat; goto repeat;
} }
} else if (sgp == SGP_READ && !filepage) { } else if (sgp == SGP_READ && !filepage) {
...@@ -905,8 +908,6 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, struct page **p ...@@ -905,8 +908,6 @@ static int shmem_getpage(struct inode *inode, unsigned long idx, struct page **p
filepage = NULL; filepage = NULL;
if (error) if (error)
goto failed; goto failed;
/* let kswapd refresh zone for GFP_ATOMICs */
blk_congestion_wait(WRITE, HZ / 50);
goto repeat; goto repeat;
} }
} }
......
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