linux/drivers/lightnvm
Hans Holmberg 76758390f8 lightnvm: pblk: export write amplification counters to sysfs
In a SSD, write amplification, WA, is defined as the average
number of page writes per user page write. Write amplification
negatively affects write performance and decreases the lifetime
of the disk, so it's a useful metric to add to sysfs.

In plkb's case, the number of writes per user sector is the sum of:

    (1) number of user writes
    (2) number of sectors written by the garbage collector
    (3) number of sectors padded (i.e. due to syncs)

This patch adds persistent counters for 1-3 and two sysfs attributes
to export these along with WA calculated with five decimals:

    write_amp_mileage: the accumulated write amplification stats
                      for the lifetime of the pblk instance

    write_amp_trip: resetable stats to facilitate delta measurements,
                    values reset at creation and if 0 is written
                    to the attribute.

64-bit counters are used as a 32 bit counter would wrap around
already after about 17 TB worth of user data. It will take a
long long time before the 64 bit sector counters wrap around.

The counters are stored after the bad block bitmap in the first
emeta sector of each written line. There is plenty of space in the
first emeta sector, so we don't need to bump the major version of
the line data format.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-03-29 17:29:09 -06:00
..
core.c block: Add 'lock' as third argument to blk_alloc_queue_node() 2018-02-28 12:23:35 -07:00
Kconfig lightnvm: remove rrpc 2018-01-05 08:50:12 -07:00
Makefile lightnvm: remove rrpc 2018-01-05 08:50:12 -07:00
pblk-cache.c lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00
pblk-core.c lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00
pblk-gc.c lightnvm/pblk-gc: Delete an error message for a failed memory allocation in pblk_gc_line_prepare_ws() 2018-03-29 17:29:09 -06:00
pblk-init.c lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00
pblk-map.c lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00
pblk-rb.c lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00
pblk-read.c lightnvm: pblk: add iostat support 2018-01-05 08:50:12 -07:00
pblk-recovery.c lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00
pblk-rl.c lightnvm: pblk: use exact free block counter in RL 2018-01-05 08:50:12 -07:00
pblk-sysfs.c lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00
pblk-write.c lightnvm: pblk: clear flush point on completed writes 2018-01-05 08:50:12 -07:00
pblk.h lightnvm: pblk: export write amplification counters to sysfs 2018-03-29 17:29:09 -06:00