]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.19/0069-swap-don-t-do-discard-if-no-discard-option-added.patch
linux-ti33x-psp 3.2: update to 3.2.21, add libertas fixes
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.19 / 0069-swap-don-t-do-discard-if-no-discard-option-added.patch
1 From c3ad2b1e42ce62ce0b8aa5283e5f1eee851dd3fb Mon Sep 17 00:00:00 2001
2 From: Shaohua Li <shli@kernel.org>
3 Date: Wed, 21 Mar 2012 16:34:17 -0700
4 Subject: [PATCH 069/117] swap: don't do discard if no discard option added
6 commit 052b1987faca3606109d88d96bce124851f7c4c2 upstream.
8 When swapon() was not passed the SWAP_FLAG_DISCARD option, sys_swapon()
9 will still perform a discard operation.  This can cause problems if
10 discard is slow or buggy.
12 Reverse the order of the check so that a discard operation is performed
13 only if the sys_swapon() caller is attempting to enable discard.
15 Signed-off-by: Shaohua Li <shli@fusionio.com>
16 Reported-by: Holger Kiehl <Holger.Kiehl@dwd.de>
17 Tested-by: Holger Kiehl <Holger.Kiehl@dwd.de>
18 Cc: Hugh Dickins <hughd@google.com>
19 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
20 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
22 ---
23  mm/swapfile.c |    2 +-
24  1 file changed, 1 insertion(+), 1 deletion(-)
26 diff --git a/mm/swapfile.c b/mm/swapfile.c
27 index 2015a1e..d3955f2 100644
28 --- a/mm/swapfile.c
29 +++ b/mm/swapfile.c
30 @@ -2102,7 +2102,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
31                         p->flags |= SWP_SOLIDSTATE;
32                         p->cluster_next = 1 + (random32() % p->highest_bit);
33                 }
34 -               if (discard_swap(p) == 0 && (swap_flags & SWAP_FLAG_DISCARD))
35 +               if ((swap_flags & SWAP_FLAG_DISCARD) && discard_swap(p) == 0)
36                         p->flags |= SWP_DISCARDABLE;
37         }
38  
39 -- 
40 1.7.9.5