diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-02 14:44:27 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-02 14:44:27 -0500 |
| commit | 37cae6ad4c484030fa972241533c32730ec79b7d (patch) | |
| tree | a01a13982af7b326af37c729a5ad83adbe99322d | |
| parent | 986248993d495aebffcdf0758ce28ab85aa4e9ff (diff) | |
| parent | 8735a8134786fa4ef36dee65d7fa779b99ba5fe3 (diff) | |
Merge tag 'dm-3.9-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm
Pull device-mapper update from Alasdair G Kergon:
"The main addition here is a long-desired target framework to allow an
SSD to be used as a cache in front of a slower device. Cache tuning
is delegated to interchangeable policy modules so these can be
developed independently of the mechanics needed to shuffle the data
around.
Other than that, kcopyd users acquire a throttling parameter, ioctl
buffer usage gets streamlined, more mempool reliance is reduced and
there are a few other bug fixes and tidy-ups."
* tag 'dm-3.9-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm: (30 commits)
dm cache: add cleaner policy
dm cache: add mq policy
dm: add cache target
dm persistent data: add bitset
dm persistent data: add transactional array
dm thin: remove cells from stack
dm bio prison: pass cell memory in
dm persistent data: add btree_walk
dm: add target num_write_bios fn
dm kcopyd: introduce configurable throttling
dm ioctl: allow message to return data
dm ioctl: optimize functions without variable params
dm ioctl: introduce ioctl_flags
dm: merge io_pool and tio_pool
dm: remove unused _rq_bio_info_cache
dm: fix limits initialization when there are no data devices
dm snapshot: add missing module aliases
dm persistent data: set some btree fn parms const
dm: refactor bio cloning
dm: rename bio cloning functions
...
48 files changed, 8791 insertions, 601 deletions
diff --git a/Documentation/device-mapper/cache-policies.txt b/Documentation/device-mapper/cache-policies.txt new file mode 100644 index 000000000000..d7c440b444cc --- /dev/null +++ b/Documentation/device-mapper/cache-policies.txt | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | Guidance for writing policies | ||
| 2 | ============================= | ||
| 3 | |||
| 4 | Try to keep transactionality out of it. The core is careful to | ||
| 5 | avoid asking about anything that is migrating. This is a pain, but | ||
| 6 | makes it easier to write the policies. | ||
| 7 | |||
| 8 | Mappings are loaded into the policy at construction time. | ||
| 9 | |||
| 10 | Every bio that is mapped by the target is referred to the policy. | ||
| 11 | The policy can return a simple HIT or MISS or issue a migration. | ||
| 12 | |||
| 13 | Currently there's no way for the policy to issue background work, | ||
| 14 | e.g. to start writing back dirty blocks that are going to be evicte | ||
| 15 | soon. | ||
| 16 | |||
| 17 | Because we map bios, rather than requests it's easy for the policy | ||
| 18 | to get fooled by many small bios. For this reason the core target | ||
| 19 | issues periodic ticks to the policy. It's suggested that the policy | ||
| 20 | doesn't update states (eg, hit counts) for a block more than once | ||
| 21 | for each tick. The core ticks by watching bios complete, and so | ||
| 22 | trying to see when the io scheduler has let the ios run. | ||
| 23 | |||
| 24 | |||
| 25 | Overview of supplied cache replacement policies | ||
| 26 | =============================================== | ||
| 27 | |||
| 28 | multiqueue | ||
| 29 | ---------- | ||
| 30 | |||
| 31 | This policy is the default. | ||
| 32 | |||
| 33 | The multiqueue policy has two sets of 16 queues: one set for entries | ||
| 34 | waiting for the cache and another one for those in the cache. | ||
| 35 | Cache entries in the queues are aged based on logical time. Entry into | ||
| 36 | the cache is based on variable thresholds and queue selection is based | ||
| 37 | on hit count on entry. The policy aims to take different cache miss | ||
| 38 | costs into account and to adjust to varying load patterns automatically. | ||
| 39 | |||
| 40 | Message and constructor argument pairs are: | ||
| 41 | 'sequential_threshold <#nr_sequential_ios>' and | ||
| 42 | 'random_threshold <#nr_random_ios>'. | ||
| 43 | |||
| 44 | The sequential threshold indicates the number of contiguous I/Os | ||
| 45 | required before a stream is treated as sequential. The random threshold | ||
| 46 | is the number of intervening non-contiguous I/Os that must be seen | ||
| 47 | before the stream is treated as random again. | ||
| 48 | |||
| 49 | The sequential and random thresholds default to 512 and 4 respectively. | ||
| 50 | |||
| 51 | Large, sequential ios are probably better left on the origin device | ||
| 52 | since spindles tend to have good bandwidth. The io_tracker counts | ||
| 53 | contiguous I/Os to try to spot when the io is in one of these sequential | ||
| 54 | modes. | ||
| 55 | |||
| 56 | cleaner | ||
| 57 | ------- | ||
| 58 | |||
| 59 | The cleaner writes back all dirty blocks in a cache to decommission it. | ||
| 60 | |||
| 61 | Examples | ||
| 62 | ======== | ||
| 63 | |||
| 64 | The syntax for a table is: | ||
| 65 | cache <metadata dev> <cache dev> <origin dev> <block size> | ||
| 66 | <#feature_args> [<feature arg>]* | ||
| 67 | <policy> <#policy_args> [<policy arg>]* | ||
| 68 | |||
| 69 | The syntax to send a message using the dmsetup command is: | ||
| 70 | dmsetup message <mapped device> 0 sequential_threshold 1024 | ||
| 71 | dmsetup message <mapped device> 0 random_threshold 8 | ||
| 72 | |||
| 73 | Using dmsetup: | ||
| 74 | dmsetup create blah --table "0 268435456 cache /dev/sdb /dev/sdc \ | ||
| 75 | /dev/sdd 512 0 mq 4 sequential_threshold 1024 random_threshold 8" | ||
| 76 | creates a 128GB large mapped device named 'blah' with the | ||
| 77 | sequential threshold set to 1024 and the random_threshold set to 8. | ||
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt new file mode 100644 index 000000000000..f50470abe241 --- /dev/null +++ b/Documentation/device-mapper/cache.txt | |||
| @@ -0,0 +1,243 @@ | |||
| 1 | Introduction | ||
| 2 | ============ | ||
| 3 | |||
| 4 | dm-cache is a device mapper target written by Joe Thornber, Heinz | ||
| 5 | Mauelshagen, and Mike Snitzer. | ||
| 6 | |||
| 7 | It aims to improve performance of a block device (eg, a spindle) by | ||
| 8 | dynamically migrating some of its data to a faster, smaller device | ||
| 9 | (eg, an SSD). | ||
| 10 | |||
| 11 | This device-mapper solution allows us to insert this caching at | ||
| 12 | different levels of the dm stack, for instance above the data device for | ||
| 13 | a thin-provisioning pool. Caching solutions that are integrated more | ||
| 14 | closely with the virtual memory system should give better performance. | ||
| 15 | |||
| 16 | The target reuses the metadata library used in the thin-provisioning | ||
| 17 | library. | ||
| 18 | |||
| 19 | The decision as to what data to migrate and when is left to a plug-in | ||
| 20 | policy module. Several of these have been written as we experiment, | ||
| 21 | and we hope other people will contribute others for specific io | ||
| 22 | scenarios (eg. a vm image server). | ||
| 23 | |||
| 24 | Glossary | ||
| 25 | ======== | ||
| 26 | |||
| 27 | Migration - Movement of the primary copy of a logical block from one | ||
