lightnvm: pblk
Subsystems (2)
PATCH v4 1/1 lightnvm: pblk
This patch introduces pblk, a new target for LightNVM implementing a full host-based FTL. Details on the commit message.
Changes since v3:
* Apply Bart's feedback [1]
* Implement dynamic L2P optimizations for > 32-bit physical media
* geometry (from Matias Bjørling)
* Fix memory leak on GC (Reported by Simon A. F. Lund)
* 8064 is a perfectly round number of lines :)
[1] https://lkml.org/lkml/2017/4/8/172
Changes since v2:
* Rebase on top of Matias' for-4.12/core
* Implement L2P scan recovery to recover L2P table in case of power failure.
* Re-design disk format to be more flexible in future versions (from Matias Bjørling)
* Implement per-instance uuid to allow correct recovery without forcing line erases (from Matias Bjørling)
* Re-design GC threading to have several GC readers and a single writer that places data on the write buffer. This allows to maximize the GC write buffer budget without having unnecessary GC writers competing for the write buffer lock.
* Simplify sysfs interface.
* Refactoring and several code improvements (together with Matias Bjørling)
Changes since v1:
* Rebase on top of Matias' for-4.12/core
* Move from per-LUN block allocation to a line model. This means that a whole lines across all LUNs is allocated at a time. Data is still stripped in a round-robin fashion at a page granurality.
* Implement new disk format scheme, where metadata is stored per line instead of per LUN. This allows for space optimizations.
* Improvements on GC workqueue management and victim selection.
* Implement sysfs interface to query pblk's operation and statistics.
* Implement a user - GC I/O rate-limiter
* Various bug fixes
Javier González (1):
lightnvm: physical block device (pblk) target
Documentation/lightnvm/pblk.txt | 21 + drivers/lightnvm/Kconfig | 9 + drivers/lightnvm/Makefile | 5 + drivers/lightnvm/pblk-cache.c | 114 +++ drivers/lightnvm/pblk-core.c | 1658 ++++++++++++++++++++++++++++++++++++++ drivers/lightnvm/pblk-gc.c | 555 +++++++++++++ drivers/lightnvm/pblk-init.c | 948 ++++++++++++++++++++++ drivers/lightnvm/pblk-map.c | 134 +++ drivers/lightnvm/pblk-rb.c | 856 ++++++++++++++++++++ drivers/lightnvm/pblk-read.c | 529 ++++++++++++ drivers/lightnvm/pblk-recovery.c | 1003 +++++++++++++++++++++++ drivers/lightnvm/pblk-rl.c | 182 +++++ drivers/lightnvm/pblk-sysfs.c | 502 ++++++++++++ drivers/lightnvm/pblk-write.c | 412 ++++++++++ drivers/lightnvm/pblk.h | 1136 ++++++++++++++++++++++++++ 15 files changed, 8064 insertions(+) create mode 100644 Documentation/lightnvm/pblk.txt create mode 100644 drivers/lightnvm/pblk-cache.c create mode 100644 drivers/lightnvm/pblk-core.c create mode 100644 drivers/lightnvm/pblk-gc.c create mode 100644 drivers/lightnvm/pblk-init.c create mode 100644 drivers/lightnvm/pblk-map.c create mode 100644 drivers/lightnvm/pblk-rb.c create mode 100644 drivers/lightnvm/pblk-read.c create mode 100644 drivers/lightnvm/pblk-recovery.c create mode 100644 drivers/lightnvm/pblk-rl.c create mode 100644 drivers/lightnvm/pblk-sysfs.c create mode 100644 drivers/lightnvm/pblk-write.c create mode 100644 drivers/lightnvm/pblk.h
Signature · 1 line
2.7.4
PATCH v4 1/1 lightnvm: physical block device (pblk) target
This patch introduces pblk, a host-side translation layer for Open-Channel SSDs to expose them like block devices. The translation layer allows data placement decisions, and I/O scheduling to be managed by the host, enabling users to optimize the SSD for their specific workloads.
An open-channel SSD has a set of LUNs (parallel units) and a collection of blocks. Each block can be read in any order, but writes must be sequential. Writes may also fail, and if a block requires it, must also be reset before new writes can be applied.
To manage the constraints, pblk maintains a logical to physical address (L2P) table, write cache, garbage collection logic, recovery scheme, and logic to rate-limit user I/Os versus garbage collection I/Os.
The L2P table is fully-associative and manages sectors at a 4KB granularity. Pblk stores the L2P table in two places, in the out-of-band area of the media and on the last page of a line. In the cause of a power failure, pblk will perform a scan to recover the L2P table.
The user data is organized into lines. A line is data striped across blocks and LUNs. The lines enable the host to reduce the amount of metadata to maintain besides the user data and makes it easier to implement RAID or erasure coding in the future.
pblk implements multi-tenant support and can be instantiated multiple times on the same drive. Each instance owns a portion of the SSD - both regarding I/O bandwidth and capacity - providing I/O isolation for each case.
Finally, pblk also exposes a sysfs interface that allows user-space to peek into the internals of pblk. The interface is available at /dev/block/*/pblk/ where * is the block device name exposed.
This work also contains contributions from:
Matias Bjørling <[email protected]>
Simon A. F. Lund <[email protected]>
Young Tack Jin <[email protected]>
Huaicheng Li <[email protected]>
--- Documentation/lightnvm/pblk.txt | 21 + drivers/lightnvm/Kconfig | 9 + drivers/lightnvm/Makefile | 5 + drivers/lightnvm/pblk-cache.c | 114 +++ drivers/lightnvm/pblk-core.c | 1658 ++++++++++++++++++++++++++++++++++++++ drivers/lightnvm/pblk-gc.c | 555 +++++++++++++ drivers/lightnvm/pblk-init.c | 948 ++++++++++++++++++++++ drivers/lightnvm/pblk-map.c | 134 +++ drivers/lightnvm/pblk-rb.c | 856 ++++++++++++++++++++ drivers/lightnvm/pblk-read.c | 529 ++++++++++++ drivers/lightnvm/pblk-recovery.c | 1003 +++++++++++++++++++++++ drivers/lightnvm/pblk-rl.c | 182 +++++ drivers/lightnvm/pblk-sysfs.c | 502 ++++++++++++ drivers/lightnvm/pblk-write.c | 412 ++++++++++ drivers/lightnvm/pblk.h | 1136 ++++++++++++++++++++++++++ 15 files changed, 8064 insertions(+) create mode 100644 Documentation/lightnvm/pblk.txt create mode 100644 drivers/lightnvm/pblk-cache.c create mode 100644 drivers/lightnvm/pblk-core.c create mode 100644 drivers/lightnvm/pblk-gc.c create mode 100644 drivers/lightnvm/pblk-init.c create mode 100644 drivers/lightnvm/pblk-map.c create mode 100644 drivers/lightnvm/pblk-rb.c create mode 100644 drivers/lightnvm/pblk-read.c create mode 100644 drivers/lightnvm/pblk-recovery.c create mode 100644 drivers/lightnvm/pblk-rl.c create mode 100644 drivers/lightnvm/pblk-sysfs.c create mode 100644 drivers/lightnvm/pblk-write.c create mode 100644 drivers/lightnvm/pblk.h
Documentation/lightnvm/pblk.txt new file +21 -0
@@ -0,0 +1,21 @@ +pblk: Physical Block Device Target +================================== + +pblk implements a fully associative, host-based FTL that exposes a traditional +block I/O interface. Its primary responsibilities are: + + - Map logical addresses onto physical addresses (4KB granularity) in a + logical-to-physical (L2P) table. + - Maintain the integrity and consistency of the L2P table as well as its + recovery from normal tear down and power outage. + - Deal with controller- and media-specific constrains. + - Handle I/O errors. + - Implement garbage collection. + - Maintain consistency across the I/O stack during synchronization points. + +For more information please refer to: + + http://lightnvm.io + +which maintains updated FAQs, manual pages, technical documentation, tools, +contacts, etc.
drivers/lightnvm/Kconfig +9 -0
@@ -33,4 +33,13 @@ config NVM_RRPC host. The target is implemented using a linear mapping table and cost-based garbage collection. It is optimized for 4K IO sizes. +config NVM_PBLK + tristate "Physical Block Device Open-Channel SSD target" + ---help--- + Allows an open-channel SSD to be exposed as a block device to the + host. The target assumes the device exposes raw flash and must be + explicitly managed by the host. + + Please note the disk format is considered EXPERIMENTAL for now. + endif # NVM
drivers/lightnvm/Makefile +5 -0
@@ -4,3 +4,8 @@ obj-$(CONFIG_NVM) := core.o obj-$(CONFIG_NVM_RRPC) += rrpc.o +obj-$(CONFIG_NVM_PBLK) += pblk.o +pblk-y := pblk-init.o pblk-core.o pblk-rb.o \ + pblk-write.o pblk-cache.o pblk-read.o \ + pblk-gc.o pblk-recovery.o pblk-map.o \ + pblk-rl.o pblk-sysfs.o
drivers/lightnvm/pblk-cache.c new file +114 -0
114 lines not on this page · raw message
drivers/lightnvm/pblk-core.c new file +1658 -0
1,658 lines not on this page · raw message
drivers/lightnvm/pblk-gc.c new file +555 -0
555 lines not on this page · raw message
drivers/lightnvm/pblk-init.c new file +948 -0
631 lines not on this page · raw message
drivers/lightnvm/pblk-map.c new file +134 -0
134 lines not on this page · raw message
drivers/lightnvm/pblk-rb.c new file +856 -0
856 lines not on this page · raw message
drivers/lightnvm/pblk-read.c new file +529 -0
529 lines not on this page · raw message
drivers/lightnvm/pblk-recovery.c new file +1003 -0
1,003 lines not on this page · raw message
drivers/lightnvm/pblk-rl.c new file +182 -0
182 lines not on this page · raw message
drivers/lightnvm/pblk-sysfs.c new file +502 -0
502 lines not on this page · raw message
drivers/lightnvm/pblk-write.c new file +412 -0
412 lines not on this page · raw message
drivers/lightnvm/pblk.h new file +1136 -0
1,136 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
Quoted 2 lines · Javier González
Changes since v3:
* Apply Bart's feedback [1]
Thanks for having addressed these comments. But please also make sure that the pblk driver builds cleanly with W=1 C=2. When running "make M=drivers/lightnvm W=1 C=2" several warnings are reported that should be reviewed. At least the endianness warnings should be addressed. An example:
CHECK drivers/lightnvm/pblk-gc.cdrivers/lightnvm/pblk-gc.c:254:18: warning: incorrect type in assignment (different base types)drivers/lightnvm/pblk-gc.c:254:18: expected unsigned long long
[usertype] *lba_listdrivers/lightnvm/pblk-gc.c:254:18: got restricted __le64 [usertype] *
Please also review the warnings reported by smatch (make M=drivers/lightnvm C=2 CHECK="smatch -p=kernel"). A few examples that most likely indicate bugs:
CHECK drivers/lightnvm/pblk-init.cdrivers/lightnvm/pblk-init.c:915: pblk_init() error: passing non negative 1 to ERR_PTRdrivers/lightnvm/pblk-rb.c:782: pblk_rb_tear_down_check() error: we previously assumed 'rb->entries' could be null (see line 778) CHECK drivers/lightnvm/pblk-read.c drivers/lightnvm/pblk-read.c:486: pblk_submit_read_gc() error: 'bio' dereferencing possible ERR_PTR()
Thanks,
Bart.
Hi Bart,
Quoted 22 lines · Bart Van Assche
Quoted 2 lines · Javier González
Changes since v3:
* Apply Bart's feedback [1]Thanks for having addressed these comments. But please also make sure that the pblk driver builds cleanly with W=1 C=2. When running "make M=drivers/lightnvm W=1 C=2" several warnings are reported that should be reviewed. At least the endianness warnings should be addressed. An example:
CHECK
drivers/lightnvm/pblk-gc.cdrivers/lightnvm/pblk-gc.c:254:18: warning: incorrect type in assignment (different base types)drivers/lightnvm/pblk-gc.c:254:18: expected unsigned long long
[usertype]*lba_listdrivers/lightnvm/pblk-gc.c:254:18: got restricted__le64[usertype] *Please also review the warnings reported by smatch (make M=drivers/lightnvm C=2 CHECK="smatch -p=kernel"). A few examples that most likely indicate bugs:
Quoted 8 lines
CHECK
drivers/lightnvm/pblk-init.cdrivers/lightnvm/pblk-init.c:915:pblk_init()error: passing non negative 1 toERR_PTRdrivers/lightnvm/pblk-rb.c:782:pblk_rb_tear_down_check()error: we previously assumed 'rb->entries' could be null (see line 778) CHECKdrivers/lightnvm/pblk-read.cdrivers/lightnvm/pblk-read.c:486:pblk_submit_read_gc()error: 'bio' dereferencing possibleERR_PTR()
I'll submit a v5 later today where these are addressed. Thanks.
Quoted 4 lines
Thanks,
Bart.
Javier