aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorHugh Dickins <[email protected]>2009-01-06 14:39:54 -0800
committerLinus Torvalds <[email protected]>2009-01-06 15:59:05 -0800
commit20137a490f397d9c01fc9fadd83a8d198bda4477 (patch)
tree38e2d904e06f576a825cca3e1eaad7da6fd55947 /include/linux
parent7992fde72ce06c73280a1939b7a1e903bc95ef85 (diff)
swapfile: swapon randomize if nonrot
Swap allocation has always started from the beginning of the swap area; but if we're dealing with a solidstate swap device which can only remap blocks within limited zones, that would sooner wear out the first zone. Therefore sys_swapon() test whether blk_queue is non-rotational, and if so randomize the cluster_next starting position for allocation. If blk_queue is nonrot, note SWP_SOLIDSTATE for later use, and report it with an "SS" at the right end of the kernel's "Adding ... swap" message (so that if it's both nonrot and discardable, "SSD" will be shown there). 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]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/swap.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index fe79f44c858e..cbf7fbed3dfd 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -122,6 +122,7 @@ enum {
SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */
SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
+ SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
/* add others here before... */
SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
};