mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
swapfile: swapon use discard (trim)
When adding swap, all the old data on swap can be forgotten: sys_swapon() discard all but the header page of the swap partition (or every extent but the header of the swap file), to give a solidstate swap device the opportunity to optimize its wear-levelling. If that succeeds, note SWP_DISCARDABLE for later use, and report it with a "D" at the right end of the kernel's "Adding ... swap" message. Perhaps something should be shown in /proc/swaps (swapon -s), but we have to be more cautious before making any addition to that format. Signed-off-by: Hugh Dickins <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: Nick Piggin <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Joern Engel <[email protected]> Cc: James Bottomley <[email protected]> Cc: Donjun Shin <[email protected]> Cc: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
ebebbbe904
commit
6a6ba83175
2 changed files with 38 additions and 2 deletions
|
|
@ -120,6 +120,7 @@ struct swap_extent {
|
|||
enum {
|
||||
SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
|
||||
SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
|
||||
SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */
|
||||
/* add others here before... */
|
||||
SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue