]> Pileus Git - ~andy/linux/commitdiff
mm: frontswap: make all branches of if statement in put page consistent
authorSasha Levin <levinsasha928@gmail.com>
Sun, 10 Jun 2012 10:51:04 +0000 (12:51 +0200)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 11 Jun 2012 19:31:55 +0000 (15:31 -0400)
Currently it has a complex structure where different things are compared
at each branch. Simplify that and make both branches look similar.

Reviewed-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
mm/frontswap.c

index e6353d9151eeda274ed87643ee13814f28153ac7..d8dc9867b0054521680dca9d89d8e37e7d71cc77 100644 (file)
@@ -140,16 +140,16 @@ int __frontswap_store(struct page *page)
                inc_frontswap_succ_stores();
                if (!dup)
                        atomic_inc(&sis->frontswap_pages);
-       } else if (dup) {
+       } else {
                /*
                  failed dup always results in automatic invalidate of
                  the (older) page from frontswap
                 */
-               frontswap_clear(sis, offset);
-               atomic_dec(&sis->frontswap_pages);
-               inc_frontswap_failed_stores();
-       } else {
                inc_frontswap_failed_stores();
+               if (dup) {
+                       frontswap_clear(sis, offset);
+                       atomic_dec(&sis->frontswap_pages);
+               }
        }
        if (frontswap_writethrough_enabled)
                /* report failure so swap also writes to swap device */