mbox series

[0/9] nvmet: add genblk ZBD backend

Message ID 20201126024043.3392-1-chaitanya.kulkarni@wdc.com (mailing list archive)
Headers show
Series nvmet: add genblk ZBD backend | expand

Message

Chaitanya Kulkarni Nov. 26, 2020, 2:40 a.m. UTC
Hi,

NVMeOF Host is capable of handling the NVMe Protocol based Zoned Block
Devices (ZBD) in the ZNS mode with the passthru backend. There is no
support for a generic block device backend to handle the ZBD devices
which are not NVMe devices.

This adds support to export the ZBD drives (which are not NVMe drives)
to host from the target with NVMeOF using the host side ZNS interface.

The patch series is generated in bottom-top manner where, it first adds
prep patch and ZNS command-specific handlers on the top of genblk and 
updates the data structures, then one by one it wires up the admin cmds
in the order host calls them in namespace initializing sequence. Once
everything is ready, it wires-up the I/O command handlers. See below for 
patch-series overview.

I've tested the ZoneFS testcases with the null_blk memory backed NVMeOF
namespace with nvme-loop transport. The same testcases are passing on the
NVMeOF zbd-ns and are passing for null_blk without NVMeOF .

Regards,
Chaitanya

Chaitanya Kulkarni (9):
  block: export __bio_iov_append_get_pages()
	Prep patch needed for implementing Zone Append.
  nvmet: add ZNS support for bdev-ns
	Core Command handlers and various helpers for ZBD backend which
	 will be called by target-core/target-admin etc.
  nvmet: trim down id-desclist to use req->ns
	Cleanup needed to avoid the code repetation for passing extra
	function parameters for ZBD backend handlers.
  nvmet: add NVME_CSI_ZNS in ns-desc for zbdev
	Allows host to identify zoned namesapce.
  nvmet: add cns-cs-ctrl in id-ctrl for ZNS bdev
	Allows host to identify controller with the ZBD-ZNS.
  nvmet: add cns-cs-ns in id-ctrl for ZNS bdev
	Allows host to identify namespace with the ZBD-ZNS.
  nvmet: add zns cmd effects to support zbdev
	Allows host to support the ZNS commands when zoned-blkdev is
	 selected.
  nvmet: add zns bdev config support
	Allows user to override any target namespace attributes for
	 ZBD.
  nvmet: add ZNS based I/O cmds handlers
	Handlers for Zone-Mgmt-Send/Zone-Mgmt-Recv/Zone-Append.

 block/bio.c                       |   3 +-
 drivers/nvme/target/Makefile      |   3 +-
 drivers/nvme/target/admin-cmd.c   |  38 ++-
 drivers/nvme/target/io-cmd-bdev.c |  12 +
 drivers/nvme/target/io-cmd-file.c |   2 +-
 drivers/nvme/target/nvmet.h       |  18 ++
 drivers/nvme/target/zns.c         | 390 ++++++++++++++++++++++++++++++
 include/linux/bio.h               |   1 +
 8 files changed, 451 insertions(+), 16 deletions(-)
 create mode 100644 drivers/nvme/target/zns.c

Test Report :-

# cat /sys/kernel/config/nvmet/subsystems/testnqn/namespaces/1/device_path 
/dev/nullb1
# nvme list | tr -s ' ' ' ' 
Node SN Model Namespace Usage Format FW Rev 
/dev/nvme1n1 212d336db96a4282 Linux 1 1.07 GB / 1.07 GB 4 KiB + 0 B 5.10.0-r
# ./zonefs-tests.sh /dev/nullb1 
Gathering information on /dev/nullb1...
zonefs-tests on /dev/nullb1:
  4 zones (0 conventional zones, 4 sequential zones)
  524288 512B sectors zone size (256 MiB)
  0 max open zones
Running tests
  Test 0010:  mkzonefs (options)                                   ... PASS
  Test 0011:  mkzonefs (force format)                              ... PASS
  Test 0012:  mkzonefs (invalid device)                            ... FAIL
  Test 0013:  mkzonefs (super block zone state)                    ... FAIL
  Test 0020:  mount (default)                                      ... PASS
  Test 0021:  mount (invalid device)                               ... PASS
  Test 0022:  mount (check mount directory sub-directories)        ... PASS
  Test 0023:  mount (options)                                      ... PASS
  Test 0030:  Number of files (default)                            ... PASS
  Test 0031:  Number of files (aggr_cnv)                           ... skip
  Test 0032:  Number of files using stat (default)                 ... PASS
  Test 0033:  Number of files using stat (aggr_cnv)                ... PASS
  Test 0034:  Number of blocks using stat (default)                ... PASS
  Test 0035:  Number of blocks using stat (aggr_cnv)               ... PASS
  Test 0040:  Files permissions (default)                          ... PASS
  Test 0041:  Files permissions (aggr_cnv)                         ... skip
  Test 0042:  Files permissions (set value)                        ... PASS
  Test 0043:  Files permissions (set value + aggr_cnv)             ... skip
  Test 0050:  Files owner (default)                                ... PASS
  Test 0051:  Files owner (aggr_cnv)                               ... skip
  Test 0052:  Files owner (set value)                              ... PASS
  Test 0053:  Files owner (set value + aggr_cnv)                   ... skip
  Test 0060:  Files size (default)                                 ... PASS
  Test 0061:  Files size (aggr_cnv)                                ... skip
  Test 0070:  Conventional file truncate                           ... skip
  Test 0071:  Conventional file truncate (aggr_cnv)                ... skip
  Test 0072:  Conventional file unlink                             ... skip
  Test 0073:  Conventional file unlink (aggr_cnv)                  ... skip
  Test 0074:  Conventional file random write                       ... skip
  Test 0075:  Conventional file random write (direct)              ... skip
  Test 0076:  Conventional file random write (aggr_cnv)            ... skip
  Test 0077:  Conventional file random write (aggr_cnv, direct)    ... skip
  Test 0078:  Conventional file mmap read/write                    ... skip
  Test 0079:  Conventional file mmap read/write (aggr_cnv)         ... skip
  Test 0080:  Sequential file truncate                             ... PASS
  Test 0081:  Sequential file unlink                               ... PASS
  Test 0082:  Sequential file buffered write IO                    ... PASS
  Test 0083:  Sequential file overwrite                            ... PASS
  Test 0084:  Sequential file unaligned write (sync IO)            ... PASS
  Test 0085:  Sequential file unaligned write (async IO)           ... PASS
  Test 0086:  Sequential file append (sync)                        ... PASS
  Test 0087:  Sequential file append (async)                       ... PASS
  Test 0088:  Sequential file random read                          ... PASS
  Test 0089:  Sequential file mmap read/write                      ... PASS
  Test 0090:  sequential file 4K synchronous write                 ... PASS
  Test 0091:  Sequential file large synchronous write              ... PASS

44 / 46 tests passed
#
#
# ./zonefs-tests.sh /dev/nvme1n1
Gathering information on /dev/nvme1n1...
zonefs-tests on /dev/nvme1n1:
  4 zones (0 conventional zones, 4 sequential zones)
  524288 512B sectors zone size (256 MiB)
  1 max open zones
Running tests
  Test 0010:  mkzonefs (options)                                   ... PASS
  Test 0011:  mkzonefs (force format)                              ... PASS
  Test 0012:  mkzonefs (invalid device)                            ... FAIL
  Test 0013:  mkzonefs (super block zone state)                    ... FAIL
  Test 0020:  mount (default)                                      ... PASS
  Test 0021:  mount (invalid device)                               ... PASS
  Test 0022:  mount (check mount directory sub-directories)        ... PASS
  Test 0023:  mount (options)                                      ... PASS
  Test 0030:  Number of files (default)                            ... PASS
  Test 0031:  Number of files (aggr_cnv)                           ... skip
  Test 0032:  Number of files using stat (default)                 ... PASS
  Test 0033:  Number of files using stat (aggr_cnv)                ... PASS
  Test 0034:  Number of blocks using stat (default)                ... PASS
  Test 0035:  Number of blocks using stat (aggr_cnv)               ... PASS
  Test 0040:  Files permissions (default)                          ... PASS
  Test 0041:  Files permissions (aggr_cnv)                         ... skip
  Test 0042:  Files permissions (set value)                        ... PASS
  Test 0043:  Files permissions (set value + aggr_cnv)             ... skip
  Test 0050:  Files owner (default)                                ... PASS
  Test 0051:  Files owner (aggr_cnv)                               ... skip
  Test 0052:  Files owner (set value)                              ... PASS
  Test 0053:  Files owner (set value + aggr_cnv)                   ... skip
  Test 0060:  Files size (default)                                 ... PASS
  Test 0061:  Files size (aggr_cnv)                                ... skip
  Test 0070:  Conventional file truncate                           ... skip
  Test 0071:  Conventional file truncate (aggr_cnv)                ... skip
  Test 0072:  Conventional file unlink                             ... skip
  Test 0073:  Conventional file unlink (aggr_cnv)                  ... skip
  Test 0074:  Conventional file random write                       ... skip
  Test 0075:  Conventional file random write (direct)              ... skip
  Test 0076:  Conventional file random write (aggr_cnv)            ... skip
  Test 0077:  Conventional file random write (aggr_cnv, direct)    ... skip
  Test 0078:  Conventional file mmap read/write                    ... skip
  Test 0079:  Conventional file mmap read/write (aggr_cnv)         ... skip
  Test 0080:  Sequential file truncate                             ... PASS
  Test 0081:  Sequential file unlink                               ... PASS
  Test 0082:  Sequential file buffered write IO                    ... PASS
  Test 0083:  Sequential file overwrite                            ... PASS
  Test 0084:  Sequential file unaligned write (sync IO)            ... PASS
  Test 0085:  Sequential file unaligned write (async IO)           ... PASS
  Test 0086:  Sequential file append (sync)                        ... PASS
  Test 0087:  Sequential file append (async)                       ... PASS
  Test 0088:  Sequential file random read                          ... PASS
  Test 0089:  Sequential file mmap read/write                      ... PASS
  Test 0090:  sequential file 4K synchronous write                 ... PASS
  Test 0091:  Sequential file large synchronous write              ... PASS

44 / 46 tests passed

Comments

Damien Le Moal Nov. 26, 2020, 8:07 a.m. UTC | #1
On 2020/11/26 11:42, Chaitanya Kulkarni wrote:
> Hi,
> 
> NVMeOF Host is capable of handling the NVMe Protocol based Zoned Block
> Devices (ZBD) in the ZNS mode with the passthru backend. There is no
> support for a generic block device backend to handle the ZBD devices
> which are not NVMe devices.
> 
> This adds support to export the ZBD drives (which are not NVMe drives)
> to host from the target with NVMeOF using the host side ZNS interface.
> 
> The patch series is generated in bottom-top manner where, it first adds
> prep patch and ZNS command-specific handlers on the top of genblk and 
> updates the data structures, then one by one it wires up the admin cmds
> in the order host calls them in namespace initializing sequence. Once
> everything is ready, it wires-up the I/O command handlers. See below for 
> patch-series overview.
> 
> I've tested the ZoneFS testcases with the null_blk memory backed NVMeOF
> namespace with nvme-loop transport. The same testcases are passing on the
> NVMeOF zbd-ns and are passing for null_blk without NVMeOF .
> 
> Regards,
> Chaitanya
> 
> Chaitanya Kulkarni (9):
>   block: export __bio_iov_append_get_pages()
> 	Prep patch needed for implementing Zone Append.
>   nvmet: add ZNS support for bdev-ns
> 	Core Command handlers and various helpers for ZBD backend which
> 	 will be called by target-core/target-admin etc.
>   nvmet: trim down id-desclist to use req->ns
> 	Cleanup needed to avoid the code repetation for passing extra
> 	function parameters for ZBD backend handlers.
>   nvmet: add NVME_CSI_ZNS in ns-desc for zbdev
> 	Allows host to identify zoned namesapce.
>   nvmet: add cns-cs-ctrl in id-ctrl for ZNS bdev
> 	Allows host to identify controller with the ZBD-ZNS.
>   nvmet: add cns-cs-ns in id-ctrl for ZNS bdev
> 	Allows host to identify namespace with the ZBD-ZNS.
>   nvmet: add zns cmd effects to support zbdev
> 	Allows host to support the ZNS commands when zoned-blkdev is
> 	 selected.
>   nvmet: add zns bdev config support
> 	Allows user to override any target namespace attributes for
> 	 ZBD.
>   nvmet: add ZNS based I/O cmds handlers
> 	Handlers for Zone-Mgmt-Send/Zone-Mgmt-Recv/Zone-Append.
> 
>  block/bio.c                       |   3 +-
>  drivers/nvme/target/Makefile      |   3 +-
>  drivers/nvme/target/admin-cmd.c   |  38 ++-
>  drivers/nvme/target/io-cmd-bdev.c |  12 +
>  drivers/nvme/target/io-cmd-file.c |   2 +-
>  drivers/nvme/target/nvmet.h       |  18 ++
>  drivers/nvme/target/zns.c         | 390 ++++++++++++++++++++++++++++++
>  include/linux/bio.h               |   1 +
>  8 files changed, 451 insertions(+), 16 deletions(-)
>  create mode 100644 drivers/nvme/target/zns.c
> 
> Test Report :-
> 
> # cat /sys/kernel/config/nvmet/subsystems/testnqn/namespaces/1/device_path 
> /dev/nullb1
> # nvme list | tr -s ' ' ' ' 
> Node SN Model Namespace Usage Format FW Rev 
> /dev/nvme1n1 212d336db96a4282 Linux 1 1.07 GB / 1.07 GB 4 KiB + 0 B 5.10.0-r
> # ./zonefs-tests.sh /dev/nullb1 
> Gathering information on /dev/nullb1...
> zonefs-tests on /dev/nullb1:
>   4 zones (0 conventional zones, 4 sequential zones)
>   524288 512B sectors zone size (256 MiB)
>   0 max open zones
> Running tests
>   Test 0010:  mkzonefs (options)                                   ... PASS
>   Test 0011:  mkzonefs (force format)                              ... PASS
>   Test 0012:  mkzonefs (invalid device)                            ... FAIL
>   Test 0013:  mkzonefs (super block zone state)                    ... FAIL

See below.

>   Test 0020:  mount (default)                                      ... PASS
>   Test 0021:  mount (invalid device)                               ... PASS
>   Test 0022:  mount (check mount directory sub-directories)        ... PASS
>   Test 0023:  mount (options)                                      ... PASS
>   Test 0030:  Number of files (default)                            ... PASS
>   Test 0031:  Number of files (aggr_cnv)                           ... skip
>   Test 0032:  Number of files using stat (default)                 ... PASS
>   Test 0033:  Number of files using stat (aggr_cnv)                ... PASS
>   Test 0034:  Number of blocks using stat (default)                ... PASS
>   Test 0035:  Number of blocks using stat (aggr_cnv)               ... PASS
>   Test 0040:  Files permissions (default)                          ... PASS
>   Test 0041:  Files permissions (aggr_cnv)                         ... skip
>   Test 0042:  Files permissions (set value)                        ... PASS
>   Test 0043:  Files permissions (set value + aggr_cnv)             ... skip
>   Test 0050:  Files owner (default)                                ... PASS
>   Test 0051:  Files owner (aggr_cnv)                               ... skip
>   Test 0052:  Files owner (set value)                              ... PASS
>   Test 0053:  Files owner (set value + aggr_cnv)                   ... skip
>   Test 0060:  Files size (default)                                 ... PASS
>   Test 0061:  Files size (aggr_cnv)                                ... skip
>   Test 0070:  Conventional file truncate                           ... skip
>   Test 0071:  Conventional file truncate (aggr_cnv)                ... skip
>   Test 0072:  Conventional file unlink                             ... skip
>   Test 0073:  Conventional file unlink (aggr_cnv)                  ... skip
>   Test 0074:  Conventional file random write                       ... skip
>   Test 0075:  Conventional file random write (direct)              ... skip
>   Test 0076:  Conventional file random write (aggr_cnv)            ... skip
>   Test 0077:  Conventional file random write (aggr_cnv, direct)    ... skip
>   Test 0078:  Conventional file mmap read/write                    ... skip
>   Test 0079:  Conventional file mmap read/write (aggr_cnv)         ... skip
>   Test 0080:  Sequential file truncate                             ... PASS
>   Test 0081:  Sequential file unlink                               ... PASS
>   Test 0082:  Sequential file buffered write IO                    ... PASS
>   Test 0083:  Sequential file overwrite                            ... PASS
>   Test 0084:  Sequential file unaligned write (sync IO)            ... PASS
>   Test 0085:  Sequential file unaligned write (async IO)           ... PASS
>   Test 0086:  Sequential file append (sync)                        ... PASS
>   Test 0087:  Sequential file append (async)                       ... PASS
>   Test 0088:  Sequential file random read                          ... PASS
>   Test 0089:  Sequential file mmap read/write                      ... PASS
>   Test 0090:  sequential file 4K synchronous write                 ... PASS
>   Test 0091:  Sequential file large synchronous write              ... PASS
> 
> 44 / 46 tests passed
> #
> #
> # ./zonefs-tests.sh /dev/nvme1n1
> Gathering information on /dev/nvme1n1...
> zonefs-tests on /dev/nvme1n1:
>   4 zones (0 conventional zones, 4 sequential zones)
>   524288 512B sectors zone size (256 MiB)
>   1 max open zones
> Running tests
>   Test 0010:  mkzonefs (options)                                   ... PASS
>   Test 0011:  mkzonefs (force format)                              ... PASS
>   Test 0012:  mkzonefs (invalid device)                            ... FAIL

Weird, this should not fail. zonefs-tests.sh creates a regular nullb device to
test that mkzonefs rejects regular disks. What was the failure here ?

>   Test 0013:  mkzonefs (super block zone state)                    ... FAIL

Same, this should not fail: this checks that if the super block is in a
sequential zone, that zone must be in the full condition. And seeing that all
conventional tests are skipped, it looks like your nullb drive does not have any
conventional zones. What was the error here ?

>   Test 0020:  mount (default)                                      ... PASS
>   Test 0021:  mount (invalid device)                               ... PASS
>   Test 0022:  mount (check mount directory sub-directories)        ... PASS
>   Test 0023:  mount (options)                                      ... PASS
>   Test 0030:  Number of files (default)                            ... PASS
>   Test 0031:  Number of files (aggr_cnv)                           ... skip
>   Test 0032:  Number of files using stat (default)                 ... PASS
>   Test 0033:  Number of files using stat (aggr_cnv)                ... PASS
>   Test 0034:  Number of blocks using stat (default)                ... PASS
>   Test 0035:  Number of blocks using stat (aggr_cnv)               ... PASS
>   Test 0040:  Files permissions (default)                          ... PASS
>   Test 0041:  Files permissions (aggr_cnv)                         ... skip
>   Test 0042:  Files permissions (set value)                        ... PASS
>   Test 0043:  Files permissions (set value + aggr_cnv)             ... skip
>   Test 0050:  Files owner (default)                                ... PASS
>   Test 0051:  Files owner (aggr_cnv)                               ... skip
>   Test 0052:  Files owner (set value)                              ... PASS
>   Test 0053:  Files owner (set value + aggr_cnv)                   ... skip
>   Test 0060:  Files size (default)                                 ... PASS
>   Test 0061:  Files size (aggr_cnv)                                ... skip
>   Test 0070:  Conventional file truncate                           ... skip
>   Test 0071:  Conventional file truncate (aggr_cnv)                ... skip
>   Test 0072:  Conventional file unlink                             ... skip
>   Test 0073:  Conventional file unlink (aggr_cnv)                  ... skip
>   Test 0074:  Conventional file random write                       ... skip
>   Test 0075:  Conventional file random write (direct)              ... skip
>   Test 0076:  Conventional file random write (aggr_cnv)            ... skip
>   Test 0077:  Conventional file random write (aggr_cnv, direct)    ... skip
>   Test 0078:  Conventional file mmap read/write                    ... skip
>   Test 0079:  Conventional file mmap read/write (aggr_cnv)         ... skip
>   Test 0080:  Sequential file truncate                             ... PASS
>   Test 0081:  Sequential file unlink                               ... PASS
>   Test 0082:  Sequential file buffered write IO                    ... PASS
>   Test 0083:  Sequential file overwrite                            ... PASS
>   Test 0084:  Sequential file unaligned write (sync IO)            ... PASS
>   Test 0085:  Sequential file unaligned write (async IO)           ... PASS
>   Test 0086:  Sequential file append (sync)                        ... PASS
>   Test 0087:  Sequential file append (async)                       ... PASS
>   Test 0088:  Sequential file random read                          ... PASS
>   Test 0089:  Sequential file mmap read/write                      ... PASS
>   Test 0090:  sequential file 4K synchronous write                 ... PASS
>   Test 0091:  Sequential file large synchronous write              ... PASS
> 
> 44 / 46 tests passed
>