]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] tmpfs blk_congestion_wait fix
authorAndrew Morton <akpm@digeo.com>
Thu, 3 Apr 2003 00:26:13 +0000 (16:26 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 3 Apr 2003 00:26:13 +0000 (16:26 -0800)
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.

mm/shmem.c

index 7347bfeda3823ae3d5ae4063f2d80871bbafd890..db89937437cf97be367de76f91513ac0b9eaed6a 100644 (file)
@@ -839,7 +839,8 @@ repeat:
                        SetPageUptodate(filepage);
                        set_page_dirty(filepage);
                        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_unmap(entry);
                        spin_unlock(&info->lock);
@@ -850,8 +851,10 @@ repeat:
                        spin_unlock(&info->lock);
                        unlock_page(swappage);
                        page_cache_release(swappage);
-                       /* let kswapd refresh zone for GFP_ATOMICs */
-                       blk_congestion_wait(WRITE, HZ/50);
+                       if (error == -ENOMEM) {
+                               /* let kswapd refresh zone for GFP_ATOMICs */
+                               blk_congestion_wait(WRITE, HZ/50);
+                       }
                        goto repeat;
                }
        } else if (sgp == SGP_READ && !filepage) {
@@ -905,8 +908,6 @@ repeat:
                                filepage = NULL;
                                if (error)
                                        goto failed;
-                               /* let kswapd refresh zone for GFP_ATOMICs */
-                               blk_congestion_wait(WRITE, HZ / 50);
                                goto repeat;
                        }
                }