aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2013-07-02 02:32:57 -0400
committerJens Axboe <axboe@kernel.dk>2013-07-02 02:32:57 -0400
commitd0e3d0238d83b05d7846c7281524e0f814633dbd (patch)
tree9b3750123faf4975bde744bb9da9219fb697e374 /Documentation
parent5f0e5afa0de4522abb3ea7d1369039b94e740ec5 (diff)
parent8e51e414a3c6d92ef2cc41720c67342a8e2c0bf7 (diff)
Merge branch 'bcache-for-3.11' of git://evilpiepirate.org/~kent/linux-bcache into for-3.11/drivers
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/bcache.txt47
1 files changed, 29 insertions, 18 deletions
diff --git a/Documentation/bcache.txt b/Documentation/bcache.txt
index b3a7e7d384f6..32b6c3189d98 100644
--- a/Documentation/bcache.txt
+++ b/Documentation/bcache.txt
@@ -46,29 +46,33 @@ you format your backing devices and cache device at the same time, you won't
46have to manually attach: 46have to manually attach:
47 make-bcache -B /dev/sda /dev/sdb -C /dev/sdc 47 make-bcache -B /dev/sda /dev/sdb -C /dev/sdc
48 48
49To make bcache devices known to the kernel, echo them to /sys/fs/bcache/register: 49bcache-tools now ships udev rules, and bcache devices are known to the kernel
50immediately. Without udev, you can manually register devices like this:
50 51
51 echo /dev/sdb > /sys/fs/bcache/register 52 echo /dev/sdb > /sys/fs/bcache/register
52 echo /dev/sdc > /sys/fs/bcache/register 53 echo /dev/sdc > /sys/fs/bcache/register
53 54
54To register your bcache devices automatically, you could add something like 55Registering the backing device makes the bcache device show up in /dev; you can
55this to an init script: 56now format it and use it as normal. But the first time using a new bcache
57device, it'll be running in passthrough mode until you attach it to a cache.
58See the section on attaching.
56 59
57 echo /dev/sd* > /sys/fs/bcache/register_quiet 60The devices show up as:
58 61
59It'll look for bcache superblocks and ignore everything that doesn't have one. 62 /dev/bcache<N>
60 63
61Registering the backing device makes the bcache show up in /dev; you can now 64As well as (with udev):
62format it and use it as normal. But the first time using a new bcache device,
63it'll be running in passthrough mode until you attach it to a cache. See the
64section on attaching.
65 65
66The devices show up at /dev/bcacheN, and can be controlled via sysfs from 66 /dev/bcache/by-uuid/<uuid>
67/sys/block/bcacheN/bcache: 67 /dev/bcache/by-label/<label>
68
69To get started:
68 70
69 mkfs.ext4 /dev/bcache0 71 mkfs.ext4 /dev/bcache0
70 mount /dev/bcache0 /mnt 72 mount /dev/bcache0 /mnt
71 73
74You can control bcache devices through sysfs at /sys/block/bcache<N>/bcache .
75
72Cache devices are managed as sets; multiple caches per set isn't supported yet 76Cache devices are managed as sets; multiple caches per set isn't supported yet
73but will allow for mirroring of metadata and dirty data in the future. Your new 77but will allow for mirroring of metadata and dirty data in the future. Your new
74cache set shows up as /sys/fs/bcache/<UUID> 78cache set shows up as /sys/fs/bcache/<UUID>
@@ -80,11 +84,11 @@ must be attached to your cache set to enable caching. Attaching a backing
80device to a cache set is done thusly, with the UUID of the cache set in 84device to a cache set is done thusly, with the UUID of the cache set in
81/sys/fs/bcache: 85/sys/fs/bcache:
82 86
83 echo <UUID> > /sys/block/bcache0/bcache/attach 87 echo <CSET-UUID> > /sys/block/bcache0/bcache/attach
84 88
85This only has to be done once. The next time you reboot, just reregister all 89This only has to be done once. The next time you reboot, just reregister all
86your bcache devices. If a backing device has data in a cache somewhere, the 90your bcache devices. If a backing device has data in a cache somewhere, the
87/dev/bcache# device won't be created until the cache shows up - particularly 91/dev/bcache<N> device won't be created until the cache shows up - particularly
88important if you have writeback caching turned on. 92important if you have writeback caching turned on.
89 93
90If you're booting up and your cache device is gone and never coming back, you 94If you're booting up and your cache device is gone and never coming back, you
@@ -181,7 +185,7 @@ want for getting the best possible numbers when benchmarking.
181 185
182 In practice this isn't an issue because as soon as a write comes along it'll 186 In practice this isn't an issue because as soon as a write comes along it'll
183 cause the btree node to be split, and you need almost no write traffic for 187 cause the btree node to be split, and you need almost no write traffic for
184 this to not show up enough to be noticable (especially since bcache's btree 188 this to not show up enough to be noticeable (especially since bcache's btree
185 nodes are huge and index large regions of the device). But when you're 189 nodes are huge and index large regions of the device). But when you're
186 benchmarking, if you're trying to warm the cache by reading a bunch of data 190 benchmarking, if you're trying to warm the cache by reading a bunch of data
187 and there's no other traffic - that can be a problem. 191 and there's no other traffic - that can be a problem.
@@ -191,6 +195,9 @@ want for getting the best possible numbers when benchmarking.
191 195
192SYSFS - BACKING DEVICE: 196SYSFS - BACKING DEVICE:
193 197
198Available at /sys/block/<bdev>/bcache, /sys/block/bcache*/bcache and
199(if attached) /sys/fs/bcache/<cset-uuid>/bdev*
200
194attach 201attach
195 Echo the UUID of a cache set to this file to enable caching. 202 Echo the UUID of a cache set to this file to enable caching.
196 203
@@ -222,7 +229,7 @@ running
222 it's in passthrough mode or caching). 229 it's in passthrough mode or caching).
223 230
224sequential_cutoff 231sequential_cutoff
225 A sequential IO will bypass the cache once it passes this threshhold; the 232 A sequential IO will bypass the cache once it passes this threshold; the
226 most recent 128 IOs are tracked so sequential IO can be detected even when 233 most recent 128 IOs are tracked so sequential IO can be detected even when
227 it isn't all done at once. 234 it isn't all done at once.
228 235
@@ -296,10 +303,12 @@ cache_miss_collisions
296 since the synchronization for cache misses was rewritten) 303 since the synchronization for cache misses was rewritten)
297 304
298cache_readaheads 305cache_readaheads
299 Count of times readahead occured. 306 Count of times readahead occurred.
300 307
301SYSFS - CACHE SET: 308SYSFS - CACHE SET:
302 309
310Available at /sys/fs/bcache/<cset-uuid>
311
303average_key_size 312average_key_size
304 Average data per key in the btree. 313 Average data per key in the btree.
305 314
@@ -362,7 +371,7 @@ unregister
362SYSFS - CACHE SET INTERNAL: 371SYSFS - CACHE SET INTERNAL:
363 372
364This directory also exposes timings for a number of internal operations, with 373This directory also exposes timings for a number of internal operations, with
365separate files for average duration, average frequency, last occurence and max 374separate files for average duration, average frequency, last occurrence and max
366duration: garbage collection, btree read, btree node sorts and btree splits. 375duration: garbage collection, btree read, btree node sorts and btree splits.
367 376
368active_journal_entries 377active_journal_entries
@@ -390,6 +399,8 @@ trigger_gc
390 399
391SYSFS - CACHE DEVICE: 400SYSFS - CACHE DEVICE:
392 401
402Available at /sys/block/<cdev>/bcache
403
393block_size 404block_size
394 Minimum granularity of writes - should match hardware sector size. 405 Minimum granularity of writes - should match hardware sector size.
395 406
@@ -417,7 +428,7 @@ freelist_percent
417 space. 428 space.
418 429
419io_errors 430io_errors
420 Number of errors that have occured, decayed by io_error_halflife. 431 Number of errors that have occurred, decayed by io_error_halflife.
421 432
422metadata_written 433metadata_written
423 Sum of all non data writes (btree writes and all other metadata). 434 Sum of all non data writes (btree writes and all other metadata).