Commit Graph

5780 Commits

Author SHA1 Message Date
Changpeng Liu
e27421b344 nvme: fix req leaks
There are many req leaks when a controller failure
occurs during submitting IO. It must free all of
the children before freeing the parent req.

If a part of the child req has been sent to the back end
and a part of the child req fails, removes the failed req
from the parent req and the parent req must be retained,
freeing the parent req after all of the submitted reqs return.

Change-Id: Ieb5423fd19c9bb0420f154b3cfc17918c2b80748
Signed-off-by: Huiming Xie <xiehuiming@huawei.com>
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-22 04:15:34 +00:00
Changpeng Liu
c4f7c1bc2a nvme: put child I/O helper functions in nvme_internal.h
Existing children split functions defined in nvme_ns_cmd.c can
also be used in nvme_qpair.c to free children requests with error
paths.

Change-Id: I640b32884424709da67ee89ff780c2de45acc54c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461372
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-22 04:15:13 +00:00
Ziye Yang
9375616ae2 nvmf/tcp: code cleanup
move the staement location of TCP request setting and remove
the duplicated code.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ia659756185547ff4f8aa26c5bc01f63defe6c113
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462589
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-22 02:40:35 +00:00
Pawel Kaminski
a15dcb0bf0 jsonrpc: always allocate response for request
We already have send buffer allocated. This will greatly improving code
as we guarantee by design that there is always JSON write context
object.

Change-Id: Id487c01448e1a65d9d4ef76d40a2a9f178b2f570
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459341
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-19 20:56:54 +00:00
Ziye Yang
6ad6a1131b nvmf/tcp: Add a feature to allow set the sock priority of the connection.
This priority is used to differentiate the sock priority on the TCP connections
between  NVMe-oF TCP target and other TCP based applications.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I6ee294e647420b56d1d91a07c2e37bf34ce24e03
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461801
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-19 06:30:19 +00:00
Tianyu Yang
96b759297f lib/bdev: fix coredump when bdev initialize failed.
If subsystem bdev module initialize failed, it will call
spdk_bdev_init_complete(-1) -> (subsystem bdev)->fini
_spdk_bdev_finish_unregister_bdevs_iter -> spdk_bdev_module_finish_iter

In abovt path, spdk_bdev_module_finish_iter will repeate to call
bdev_module->module_fini function. Some bdevs will call spdk_io_device_unregister
which never call spdk_io_device_register. It will coredump when assert false in
spdk_io_device_unregister dev is null.

To fix this, let's check whether g_bdev_mgr.module_init_complete is equals true
and then call the bdev_module->module_fini.

Change-Id: Ia9a13318720d954e40eb2d666574bcb86e5f49e3
Signed-off-by: Tianyu Yang <yangtianyu2@huawei.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462382
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-19 06:29:25 +00:00
Karol Latecki
ac8b488982 bdev/rbd: add more descriptive rpc error messages
Improve error messages where possible.
Modify spdk_bdev_rbd_create() to return instead instead
of pointer for better return code handling.

Change-Id: I5fcf90794f5fe44296422c654c5f8d404f3d5eef
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461884
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-19 02:21:53 +00:00
Mateusz Kozlowski
3500d9a98d lib/ftl: Add error log after IO failure
Adding some extra debug information for any failing IOs.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: If38de30bcb80d291778ad7325a33b7786d02390d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461588
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-18 08:49:02 +00:00
Karol Latecki
89003d5ca7 bdev/rpc: add more descriptive rpc error messages
Improve error messages where possible.

Change-Id: I6e5a50a1422f55aff0b0bad53493edc80f345ccb
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461600
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 07:52:07 +00:00
Karol Latecki
6d442665fd bdev/rpc: remove if checks for obligatory rpc arguments
These arguments are obligatory and spdk_json_decode_object will
fail even before we reach the if block.

Change-Id: I3c17faf570aefc7d96d009a595cf3a76994977e7
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462043
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-18 07:52:07 +00:00
Karol Latecki
46ebf1b1e9 bdev/virtio: add more descriptive rpc error messages
Improve error messages where possible.

Change-Id: I68b48fd448636412a2b26241c787e7b7826c9a34
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461873
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 05:34:52 +00:00
Karol Latecki
2805cad12f bdev/compress: add more descriptive rpc error messages
Improve error messages where possible.
Modify parts of the code so that it follows the same pattern
as in previousle changed bdev modules.

Change-Id: I6672a14900326029c670bfca99a6d085093861c3
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461553
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 04:25:44 +00:00
Karol Latecki
695ecf48bf bdev/delay: update rpc error messages
Consolidate rpc error handling with previous bdev rpc
changes.

Change-Id: I3f0ac3b3a0f09869e8ad7edb4bd4c8fd1e42f6b6
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461557
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 04:25:40 +00:00
Karol Latecki
b8c84b1a39 bdev/error: add more descriptive rpc error messages
Improve error messages where possible.

Change-Id: Ieaae6f2477d4a9f636cc861afbe5d80b3c74a46c
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461562
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-07-18 04:25:27 +00:00
Karol Latecki
955518d6fc bdev/iscsi: add more descriptive rpc error messages
Improve error messages where possible.

Change-Id: If08bad9f4fc88b51403b89c3f5bfc8894ef4300a
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461567
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 04:25:09 +00:00
Karol Latecki
c6f2b30918 bdev/raid: add more descriptive rpc error messages
Improve error messages where possible.
Unify returned error codes and messages with previous
changes done in other bdev modules.

Change-Id: Id35b61e8157fab9940e5811b71289978a6f23b05
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461591
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 04:24:45 +00:00
Ziye Yang
ecb4ea90ce sock: Add the socket priority setting function.
Purpose: This API can be used to set the socket
with different priority.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I9df1122bf6ae640eba731e635a1784f4e9da4104
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461738
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-18 04:09:37 +00:00
Karol Latecki
fd4d7fcb15 bdev/passthru: add more descriptive rpc error messages
Improve error messages where possible.

Change-Id: I778b4b49c1e54c0da77f6da7906df91d8aa95f9b
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461587
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-18 03:25:06 +00:00
Karol Latecki
c05355db23 bdev/lvol: add more descriptive rpc error messages
Improve error messages where possible.

Change-Id: I8f736fb6481d65b55e16e548fac0130cd152d3fa
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461575
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 03:24:26 +00:00
Karol Latecki
0965d63d3a bdev/lvol: remove optional flag for lvol_name in construct call
lvol_name is not an optional argument when creating a lvol bdev.
Also removing unnecessary if block.

Change-Id: I7d5790d648bce7f02bfed34bd714162d3ccb10ab
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461861
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 03:24:26 +00:00
Karol Latecki
75711828a9 bdev/lvol: remove if checks for obligatory rpc arguments
These arguments are obligatory and spdk_json_decode_object will
fail even before we reach the if block.

Change-Id: I295649629770ef062086308257da83a8bab44588
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461860
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 03:24:26 +00:00
paul luse
a755fb5f14 lib/reduce: use global zero buffer instead of zeroing scratch buffer
Eliminates need for memset on parts of our scratch buffer

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I00b7213d3c15562ceeda4d7a3ac2bb7cfd41bf66
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460010
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 03:21:59 +00:00
Ziye Yang
4739f62365 nvmf: enable transport based scheduler decode in RPC.
Purpose: To eanble the transport based scheduler in RPC.
Previously, we only support it with configuration file.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I02ae9b1b316d4fec8b28b550e70dcdc78ce78722
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461645
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-17 15:01:20 +00:00
Darek Stojaczyk
96ec8bff78 nvmf/rdma: switch to spdk_*malloc()
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I5bcac50baca785255eb068086e67c07d120b042f
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459432
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-17 01:28:57 +00:00
Darek Stojaczyk
36ccca2c08 nvmf/tcp: switch to spdk_*malloc()
spdk_dma_*malloc() is about to be deprecated.

Change-Id: Ic42db528bbae4b3ca2e91cb9ac46def99ecb5f28
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459431
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-17 01:28:57 +00:00
Darek Stojaczyk
e3e524306b nbd: switch to spdk_*malloc()
spdk_dma_*malloc() is about to be deprecated.

Change-Id: If0bcdf2be9756b343375f02837a414d3b86f2bca
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459430
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-17 01:28:57 +00:00
Jacek Kalwas
e95e4028c1 nvmf/rdma: exclude getaddrinfo from lock
No need to have it under lock. Additionally in case of failure
there was a lack of rdma_destroy_id(). This is addresed within this
change as well.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Idbb36d51ad4ef7ef81051463f56efc87ef00c966
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462054
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-17 01:03:36 +00:00
Jacek Kalwas
0d4a5f7e69 nvmf/rdma: free list of devices
In case of failure during pd or map allocation freeing list of devices
was missing.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: If62f7b072f3894fd1a7e856c19b4ea51646dd20e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462079
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-17 00:59:34 +00:00
Darek Stojaczyk
27b920a2a4 configure: unset CONFIG_VHOST on BSD
Remove linux #ifdefs from the vhost code and just
implicitly disable CONFIG_VHOST for BSD systems.

This serves as cleanup.

Change-Id: I8b0e0e8f80478f50ca8586cc974f7afcee2566f0
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460562
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 11:06:03 +00:00
Darek Stojaczyk
efef26e234 Revert "bdev: temporarily allow bdev descriptors to be closed from any thread"
Now that vhost closes bdev descriptors on the same thread
that opened them, we can reintroduce thread asserts into
the bdev layer.

This reverts commit 283abcb9a2.

Change-Id: I1acc455df0674b808ecf2fa58dffd183db6cf3c2
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459168
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
feaf45d31a vhost: allocate just one ctx per foreach_session chain
We used to allocate a ctx whenever new event had to
be sent, but since all events in foreach_session are
always called in a chain, we could allocate one ctx
at the start and then re-initialize it before sending
each msg.

Change-Id: Ie5477b07242f0c6eb6dc2160055a829da8ba5d11
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459167
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
3fb1a9565e vhost: finish foreach_session chain always on the init thread
foreach_session() is used to e.g. close a bdev, where
for each session we close any io_channels and then,
on the final "finish" call, close the bdev descriptor.

The vhost init thread is the one that called
spdk_vhost_init() and also the same one that calls
all management APIs. One of those is for hotplugging
LUNs to vhost scsi targets, which practically results
in opening bdev descriptors.

By always scheduling that final foreach_session()
callback to the init thread, we end up with calling
spdk_bdev_close() always on the same thread which
called spdk_bdev_open(), which is actually a bdev
layer requirement.

Change-Id: I2338e15c63f93ef37dd4412dd677dee40d272ec2
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459166
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
4b60bd1b59 vhost: don't setup session coalescing on vdev init
We used to call potentially-asynchronous foreach_session()
in vdev initialization path and that was perfectly
fine because at that time there were no sessions created
and foreach_session() was always finishing synchronously.
We're about to refactor it to be always asynchronous, and
for this coalescing case it could complicate the init
error path. Once asynchronous thread msg is sent, we would
need to wait for it to complete and we just don't want to
do that. We want error handling to be simple.

Since we know there are no sessions at the time of vdev
creation, we just add a new function for setting coalescing
params just for vdev (and not for its sessions) and we
use that function in vdev init code.

Change-Id: I44d204d03b5040525e4871693678d4b4a0204e63
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459196
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
d476d10665 vhost: reorder foreach_sesion_continue
Put it next to other functions in this call chain.

Change-Id: Ic621855b028f9bd110cdcda86b3a182369ec5e90
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459165
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
74243e36b9 vhost: reorder spdk_vhost_session_send_event
Put it next to other functions in this call chain.

Change-Id: Ieafd91c6cfefec134594aec8671eb4efdac15dfe
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459164
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
5e63804146 vhost: remove spdk_ prefix from some static function
spdk_ prefix should be only used on public API functions.

Change-Id: I663b107bd6b1c92c2c6263f2ec7c763d9812e7fe
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459163
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
4de67bbf6d vhost: inline spdk_vhost_event_async_send_foreach_continue
Despite its name, this function is defined as static
and is only used in one place, so inline it.

Change-Id: I4e217b3baae9b735761f5497f06b681a118860e9
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459162
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
98af6aba4d vhost: remove vsession->ev_ctx
It's no longer used.

Change-Id: Iffa385e18ba7a979d7a384f420f546207774dea3
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459161
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:57:46 +00:00
Darek Stojaczyk
f43a485299 env_dpdk/pci: make spdk_pci_device_detach() synchronous again
By making dpdk device detach asynchronous we have
actually broken some cases where devices are re-attached
immediately after and fail since they were not detached
yet, so now we're making device detach synchronous again.

For that we'll simply wait inside spdk_pci_device_detach()
for the background dpdk thread to perform all necessary
actions before we return. We'll also print an error msg
if DPDK failed the detach (probably because of some
internal error).

Change-Id: I7657ac1b169169eae3325de2d28c2cc311e7d901
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460286
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <jacek.kalwas@intel.com>
2019-07-16 10:56:28 +00:00
Darek Stojaczyk
79b5618168 env_dpdk/pci: don't defer device detach while on the dpdk thread
By making dpdk device detach asynchronous we have
actually broken some cases where devices are re-attached
immediately after and fail since they were not detached
yet.

We'll need to make detach synchronous again, and for that
we'll wait for the background dpdk thread to perform all
necessary actions before we return from spdk_pci_device_detach().

However, device detach could be triggered from the very
same dpdk background thread as well. Waiting there would
cause a deadlock, so now we'll schedule asynchronous
device detach to the dpdk thread only if we're not on
that thread already.

This patch itself serves also as an optimization.

Change-Id: I86b7ac1b669169eee3325de2d28c2cc313e7d901
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460285
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:56:28 +00:00
Darek Stojaczyk
cf35beccf4 env_dpdk/memory: include rte_memory.h
Latest DPDK moved some definitions around and we don't
compile with it right now. Adding the missing include
fixes it.

Change-Id: I9b0a915632996acfedbcf3d0f03feed986889a2d
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460905
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-16 10:54:01 +00:00
Darek Stojaczyk
4617707d07 reduce: switch to spdk_*malloc()
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I140e10b2fd07efb48e664cfa00e1d60f604abd21
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449797
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:51:47 +00:00
Jacek Kalwas
114a067738 nvmf/rdma: pd null check
In case of pd allocation by nvmf hooks there is a lack of null
check as oposed to pd allocation by ibv_alloc_pd.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Iead6e0332bdee3da4adb6e657af298215c4e2196
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461576
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-16 01:29:03 +00:00
Seth Howell
dc53a9de36 lib/ftl: remove local phase variable
Since the local is only used in the SPDK_DEBUGLOG call, it was causing
the build to fail when the configure options --disable-debug and
--enable-werror were supplied together. This can be seen in the most
recent nightly builds.

Change-Id: I32112cf832a705292783da4e841badaeed17dbb6
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461746
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-16 01:21:55 +00:00
Darek Stojaczyk
69642141bb blobstore: fix unused variable warning on non-debug builds
gcc complains:

blobstore.c: In function ‘_spdk_blob_load_cpl’:
blobstore.c:978:12: warning: unused variable ‘max_md_lba’ [-Wunused-variable]

Change-Id: If2875d2d83edce6d1b544d6a4f51e78fa760d752
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461750
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-16 01:20:30 +00:00
James Bergsten
5acf617c6e nvme: add functions to pretty-print commands and completions
This change attempts to address the Trello request to decode I/O errors in
NVMe hello_world example.

See https://trello.com/c/MzJJw7hM/2-decode-io-errors-in-nvme-helloworld-example

As part of this change, spdk_nvme_cpl_get_status_string was declared
in nvme.h, and spdk_nvme_qpair_print_command and
spdk_nvme_qpair_print_completion were renamed and added to nvme.h,
allowing all three to used "externally."

To test the failing paths, two compile time defines were added to force a
write or read error (bad LBA) respectively.

As the example does a read after write, if the write fails, the example fails.

Signed-off-by: James Bergsten <jamesx.bergsten@intel.com>
Change-Id: Ib94b4a02495eb40966e3f49517a5bdf64485538a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457076
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-15 07:47:03 +00:00
Richael Zhuang
d4cbbf1751 nvme: use atomic builtins for g_signal_lock
The __sync builtin based implementation generates full memory
barriers on some non-x86 platforms. Replace it with C11 atomic
builtins can make:
·arm and ppc from full barrier to half barrier
·x86 code same as before

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: Ib6624ef8e45af497b9eced6ecfa7710bcc88a733
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461590
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-15 06:01:37 +00:00
Tomasz Zawadzki
672d42b284 lib/blob: fix check against lba during blob load
md_start and md_len are values in pages rather than lba.
Those should not be compared against lba of currently
loaded md page.

This patch changes assert to verify if the lba of current
page does not exceed max lba where md is expected to be.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id445eb9871f82f7fe367bfc396f1b495591511c1
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460976
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-15 04:22:23 +00:00
Tomasz Zawadzki
6ced601526 lib/blob: only validate blobid of first page during bs_load
Blob id only is matched to the very first page of md for
that particular blob.

During loading blobstore, we shouldn't verify
further pages in chain against the blobid.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ifc7863ddcb403aedc264c14e6b4c3915bd30dc41
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460607
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-07-15 04:22:23 +00:00
Evgeniy Kochetov
9d5037275d nvmf: Add BDEV IO pending statistics
This patch adds statistics for BDEV IO pending state in NVMf subsytem
which may help to detect lack of resources and configure pool size
correctly.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I6c60c27efe3efed194b2d2c46a707af7c2808fe9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445290
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 12:46:29 +00:00
Evgeniy Kochetov
da999b69b8 nvmf: Add queue pair counts statistics
This patch adds number of admin and IO queue pairs per poll group in
NVMf statistics. It can be useful to troubleshoot load sharing issues.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I2a9c0fc99cf5d0729eb130d30540ae52b5207fc9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445288
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 12:46:29 +00:00
Evgeniy Kochetov
fca6ff8f75 rpc: Add nvmf_get_stats RPC method
This patch adds nvmf_get_stats RPC method and basic infrastructure to
report NVMf global and per poll group statistics in JSON format.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I13b83e28b75a02bc1dcb7b95cbce52ae10ff0f7b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452298
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 12:46:29 +00:00
Konrad Sztyber
d354d0a342 lib/ftl: scrub non-volatile cache after recovery
If the data from non-volatile cache was recovered, but the state of the
cache isn't clean (i.e. no range overlap, two different phases at max),
scrub it, so that subsequent recovery can be performed successfully.

Change-Id: Ic8b5cbb6e02444bc99d4700bfe3dfbb33f06ef24
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459622
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
45372c5768 lib/ftl: separate non-volatile scrub function
The cache needs to be scrubbed during the initial device creation as
well as after power loss recovery. This patch extracts the scrubbing
code into a separate function.

Change-Id: I2cb32e6993a3531470f29f466d990f0d96e45def
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459621
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
8d1bb260ea lib/ftl: separate non-volatile header write function
The header is being written from multiple places, so having a discrete
function serializing and writing it at the appropriate place in the
cache makes sense.

Change-Id: I7a1e6ebd05e8a4974d141f04202803f507b978e4
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459620
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
78154d9558 lib/ftl: allow flushing active bands
This patch adds a function that marks all active open bands to be
flushed and once all of them are closed it notifies the caller. This
needs to be done before the data from non-volatile cache can be scrubbed
to make sure its stored on bands the device can be restored from.

Change-Id: I9658554ffce90c45dabe31f294879dc17ec670b9
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459619
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
78097953f7 lib/ftl: notify init/fini callbacks on proper threads
This patch makes sure we're on the thread that requested creation /
deletion of the device when calling the notification callback.

Change-Id: Ia11a8054692874f6b57d4ebe3e3cb290c58e83b6
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459618
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
0f7080e779 lib/ftl: helper function to check for nv_cache
Added ftl_dev_has_nv_cache to check if the FTL is configured to use
non-volatile cache or not. It makes these checks a bit more readable.

Change-Id: I0140df184d89a675e40bd5056718cd64301c553e
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459617
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
17da389ecc lib/ftl: delay writing band's metadata
Wait until all user writes are completed before writing band's metadata.
Otherwise in case of power loss, user data might not get written while
the metadata does, which would result in data loss.

Change-Id: I419862960c072e38265b91d0d0498ff0c6f9f29e
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459615
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
4d7c81625c lib/ftl: non-volatile cache data recovery
Use the data placed on the non-volatile cache to perform recovery in
case the device wasn't shut down cleanly. The write phase ranges are
read and their data is copied onto the OC device.

The code added in this patch will correctly copy the data from
overlapping ranges, however it won't do anything about these overlapping
areas, so subsequent power loss happening quickly after recovery might
result in data loss.

Change-Id: Ib4c66092cee858496ec66f789fcfb1e7e32f5c20
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458105
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
81e3797452 lib/ftl: distinct non-volatile cache recovery phase
Change-Id: I6936905d4a031508a85729e61ac72a352a490e14
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458104
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
6db41a006e lib/ftl: non-volatile cache recovery scan
Scan the cache to find ranges of blocks written with the same phase.
This prepares the structures needed to perform data recovery from the
non-volatile cache.

Change-Id: I0c901d010d6ca76feabca13116d831c1d9931833
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458103
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
773b7003bc lib/ftl: add comments to ftl_restore's fields
The structures in this module had no comments, so it was a bit hard to
understand what they're used for.

Change-Id: I439c8a792f02b929006c60933e6b272751b1a675
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458102
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
0f0af48009 lib/ftl: keep reloc traffic out of non-volatile cache
Moving data from one band to the other doesn't need to be stored on the
non-volatile cache. Not only does it add unnecessary traffic to the
cache (wearing it out and reducing its throughput), but it requires us
to synchronize it with user writes to the same LBAs.

To avoid all that, this patch adds the FTL_IO_BYPASS_CACHE flag to all
writes coming from the reloc module. However, to be sure that the moved
data is stored on disk and can be restored in case of power loss, we
need to make sure that each free band have all of its data moved to a
closed band before it can be erased. It's done by keeping track of the
number of outstanding IOs moving data from particular band
(num_reloc_blocks), as well as the number of open bands that contains
data from this band (num_reloc_bands). Only when both of these are at
zero and the band has zero valid blocks it can be erased.

Change-Id: I7c106011ffc9685eb8e5ff497919237a305e4478
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458101
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
4d113ee5d3 lib/ftl: allow writes bypassing non-volatile cache
Some of the writes doesn't need to go through the non-volatile cache
(e.g. relocations, data recovery from the cache). This patch adds IO
flag to indicate that the write shouldn't be stored on the non-volatile
cache.

Change-Id: I3d485fe14cf25b3074832f26491ba0cb12ff0e58
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458100
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
9a42d7fc30 lib/ftl: initialize LBA when allocating internal IOs
Initialize children IOs with the appropriate LBA of its parent when
allocating internal IOs.

Change-Id: I191ad741b9d88d7f18cae05982e0a06a8f371f78
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458099
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
4fd4e3db5f lib/ftl: track non-volatile cache's write sequence
This patch adds tracking of the phase of the writes to the non-volatile
cache. The phase is changed each time the whole buffer is filled. Along
with every block's LBA, current phase is stored in its metadata. This
allows for replaying the sequence of writes when recovering the data
from the cache after (unclean) shutdown.

Since there are only three possible phases to be stored on the device at
a time, phase is defined as a 2-bit counter cycling through 1 -> 2 -> 3
-> 1, with 0 marking blocks that were never written.

Change-Id: Id47880367934027fd102c32f183110acc9d4c62a
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458098
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
c69529d452 lib/ftl: block nv_cache until header is written
After filling whole non-volatile cache, block all further writes until
the header with metadata is written. This means that metadata stored on
the device will always be up-to-date with the most recent write
sequence.

Change-Id: I15b724b52814289622374ce77e5c3b23173a75c6
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458097
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
2c96745563 lib/ftl: check non-volatile cache's DIF type
Check the type of DIF used by the bdev specified as the non-volatile
write cache. If it's anything other than SPDK_DIF_DISABLE, fail the
initialization, as we don't support any other type yet.

Change-Id: Ie8bc1729558e055989d7925bc55f6307ee738f0e
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458096
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
77ddc70e1c lib/ftl: restore non-volatile cache's metadata
When restoring the device, read the first block of the non-volatile
cache containing its metadata header and verify that it's indeed a
device that was used as write cache.

Change-Id: Idf113a9e8eb73160a2d9e6e882c9e026d3fafb3e
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458095
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-12 12:39:38 +00:00
Konrad Sztyber
1243c9306d lib/ftl: prepare non-volatile cache area
When creating FTL device using non-volatile cache, zero out the
non-volatile cache and store metadata (device's UUID, size of the cache)
in the first block.

Change-Id: Id8f212aef756e86e8a215582ab7c32a635e18938
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458094
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2019-07-12 12:39:38 +00:00
Vitaliy Mysak
6b654ab900 bdev: prevent early spdk_bdev_init_complete()
In case some module has `async_init = true` and
  some other module that comes after it fails to initialize,
  then callback from asynchronously initialized module
  may call `spdk_bdev_init_complete()` first, then failed module
  will call `spdk_bdev_init_complete()` later.
  This currently results in NULL dereference because
  first call to `spdk_bdev_init_complete()` sets `g_init_cb_fn = NULL`.

This change prevents first call to `spdk_bdev_init_complete()`
  by saying that failed module is not finished with initialization.

This patch fixes #847

Change-Id: Ib6b231d5ea27896ad88d7f11b8732921077b3d4d
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461230
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 04:14:58 +00:00
paul luse
0b3fb2403e lib/reduce: fix bug with adding up req->decomp_iovcnt
In the memcpy elimination patches, the same bug exists in 3
places.  When building req->decomp_iov using the host buffers,
req->decomp_iovcnt was being incremented in the loop and also
being used as part of the index messing everything up.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I485ac32502801c1e11b8392b2df7eba06b4f5a9b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461053
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-12 04:05:52 +00:00
paul luse
b9bc6254a8 lib/reduce: fix critical issue with reduce optimization
The first optimization to eliminate memcpy was too aggressive and
did so for the read-modify-write operation as well. This didn't
affect the fio tests used that the time but bdevio catches it
right away.  When over writing a chunk with data, we first need
to read the old data before applying the new. This patch uses
the scratch buffer for old data as sending it to the user buffer
results in it not being written at the end of the read-modify-write.

There is at least one more bug fix coming after this also found
with bdevio but passed with fio

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I8fe074056434bb4757c68077e2df446861edfd94
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461032
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-12 04:05:52 +00:00
Shuhei Matsumoto
b860c8dbce bdev/gpt: call get buffer function before forwarding read I/O to the base bdev
iSCSI target does not allocate data buffer on read, and delegate
allocation to the bdev.

When the bdev is a split vbdev, the split vbdev does not allocate
data buffer and delegate allocation to the backend bdev.

In this case, iSCSI target expects the buffer is allocated until
notifying completion to the split vbdev. However, the split vbdev
notifies completion to the backend bdev when calling the callback
of iSCSI target. The backend bdev frees the buffer immediately,
but iSCSI target still uses the buffer. If the buffer is reused
by another I/O, data corruption will occur.

For this issue, vbdev_gpt_submti_request() calls
spdk_bdev_io_get_buf() when the I/O is read, and its callback
vbdev_gpt_get_buf_cb calls _vbdev_gpt_submit_request() then.

This will ensure the buffer is allocated before forwarding I/O
to the backed bdev.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifb2eac500276ab5012123b7d6f7eb033d87ad17c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461350
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-12 02:25:57 +00:00
Shuhei Matsumoto
25532d08f8 bdev/split: call get buffer function before forwarding read I/O to the base bdev
iSCSI target does not allocate data buffer on read, and delegate
allocation to the bdev.

When the bdev is a split vbdev, the split vbdev does not allocate
data buffer and delegate allocation to the backend bdev.

In this case, iSCSI target expects the buffer is allocated until
notifying completion to the split vbdev. However, the split vbdev
notifies completion to the backend bdev when calling the callback
of iSCSI target. The backend bdev frees the buffer immediately,
but iSCSI target still uses the buffer. If the buffer is reused
by another I/O, data corruption will occur.

For this issue, vbdev_split_submti_request() calls
spdk_bdev_io_get_buf() when the I/O is read, and its callback
vbdev_split_get_buf_cb calls _vbdev_split_submit_request() then.

This will ensure the buffer is allocated before forwarding I/O
to the backed bdev.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Icfd0663b548479ac0bf6b5b49420f144142e3300
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461348
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-12 02:25:57 +00:00
Ben Walker
88da8a91f9 nvmf: spdk_nvmf_subsystem_remove_ns is no longer asynchronous
Now that the resume path can correctly handle the case where a namespace
was removed and a new one added with the same nsid, this no longer needs
to be asynchronous.

Change-Id: I693045e66a7d4e75255b526d8f5ca5ef8695533e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459606
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-11 11:19:53 +00:00
Shuhei Matsumoto
316d5c7c79 bdev/part: Remap DIF reference tag for read/write I/O
When using stacked virtual bdev (e.g. split virtual bdev), block
address space will be remapped during I/O processing and so
reference tag have to be remapped accordingly.

This patch adds an new helper function spdk_bdev_part_remap_dif
and call it before submitting write I/O or after completing read
I/O.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idfc6081893861d412c19a9edfb348a7faa7e8c5b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461106
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-11 11:14:22 +00:00
Shuhei Matsumoto
5a31186745 bdev/part: Consolidate getting remapped offset in spdk_bdev_part_submit_request
All IO types but reset have used the remapped offset to submit I/O
to the base bdev. Previously each IO type had got the remapped
offset by itself. Consolidating it into a place will improve
readability and will be helpful for the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I29465e92d8fb62e45cfc97c52fedaa661b2f0602
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461105
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-11 11:14:22 +00:00
Shuhei Matsumoto
7e70c3d18f dif: Add spdk_dix_remap_ref_tag to remap ref. tag for separate metadata payload
When using stacked virtual bdev (e.g. split virtual bdev), block
address space will be remapped during I/O processing and so reference
tag will have to be remapped accordingly.

This patch adds an API, spdk_dif_remap_ref_tag to satisfy the case.

UT code is added together in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I55cc45c475d4e86e736f5712baf02fcabfde3c82
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461104
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-11 11:14:22 +00:00
Shuhei Matsumoto
f4a62a3993 dif: Add spdk_dif_remap_ref_tag to remap ref. tag for extended LBA payload
When using stacked virtual bdev (e.g. split virtual bdev), block
address space will be remapped during I/O processing and so reference
tag will have to be remapped accordingly.

The use case is explained in detail as follows:

- Format a single NVMe SSD with DIF enabled.
- Create a NVMe bdev on the NVMe SSD with DIF enabled.
- Create four split vbdevs on the NVMe bdev.
- Add the split vbdevs to a NVMe-oF target.
- Application is aware of block address space of the split vbdevs.
- Application submits read/write I/O to the NVMe-oF target.

Case 1:
- Configure NVMe-oF target to DIF pass-through.

Case 2:
- Configure NVMe-oF target to DIF insert/strip

For the case 1,
- Application inserts DIF for write I/O and verifies DIF for read I/O.
- The split vbdevs remaps reference tags of DIF both for read and write
  I/O because application expects reference tags are based on the
  block address space of split vbdevs.
- The NVMe bdev processs read/write I/Os without remapping reference tags
  because reference tags are already based on the block address space
  of the NVMe bdev.

For the case 2,
- NVMe-oF target inserts DIF for write I/O, and verifies and strips
  DIF or read I/O.
- The split vbdevs remaps reference tags of DIF both for read and write
  I/O because NVMe-oF target expects reference tags are based on the
  block address space of split vbdevs.
- The NVMe bdev processs read/write I/Os without remapping reference tags
  because reference tags are already based on the block address space
  of the NVMe bdev.

This patch adds two APIs, spdk_dif_ctx_set_remapped_init_ref_tag
and spdk_dif_remap_ref_tag to satisfy the use case.

UT code is added together in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib3101129225b334d2f578eab75197790b1818770
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461103
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-11 11:14:22 +00:00
Maciej Szwed
1b4c99a2ba bdev: Introduce new bdev mutex for accessing bdevs list
In future patch in new spdk_bdev_open_ext function we will call
spdk_bdev_get_by_name function and after that call and before
calling old spdk_bdev_open routine bdev can be removed.
We need to add mutex which will prevent that. Any future code
should use this mutex when accessing the bdevs list to get
a bdev and perform some operation on it.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I785a1791346aebdd394fc51ad0e7fbfbabf317c9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458457
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 10:22:06 +00:00
Tomasz Zawadzki
69a8877e82 lib/blob: do not allow xattr to exceed maximum descriptor length
Length of xattr descriptor is equal to length of xattr struct,
xattr name and the len of stored value.

There is no limit to how much can be stored in memory for xattr.
On disk xattr size is limited to single page and within that to
max descriptors that can fit in it.
This size is known at compile time.

Before this patch it was possible to add xattr exceeding
what was possible to be written to disk. This caused issues
when serializing the metadata during spdk_blob_sync_md()
or spdk_blob_close(). Making those fail without specific info
to the user and not actually writting such descriptor.

Since maximum length of xattr descriptor is known at compile time,
this patch compares against this value when setting the xattr.
It will immediately report back to user with error, and will
not store xattr in memory (thus not serialize it).

This patch should not affect any backward compatibility for blobs.
Too large xattrs weren't written to disk before,
API for blobstore stays the same - only reporting ENOMEM
when it should.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6f4af4d079e47f084e20d7a4969d9a78ec1f8610
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460450
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 10:05:41 +00:00
Shuhei Matsumoto
7ee58b90e1 nvmf/tcp: Set DIF context to PDU when processing in-capsule, C2H, or H2C data
Set DIF context of the corresponding request to PDU when
- processing in-capsule data of the command,
- processing data of C2H PDU, or
- processing data of H2C PDU.

Change-Id: I3a668a55be21dbe2ee6ecf26476290670bd7b4a8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458929
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
e3e023cfd3 nvmf/tcp: Increase in-capsule buffer size to fill DIF fields
When NVMe/TCP initiator transfers in-capsule data, NVMe/TCP has to
process it as in-capsule data. If DIF insert/strip is enabled,
in-capsule data size will be increased by NVMe/TCP target to insert
metadata. However size of in-capsule data buffer had not been
increased, and buffer overflow occurred when NVMe/TCP initiator
transfers in-capsule data to NVMe/TCP target with DIF insert/strip
being enabled.

This patch increases size of in-capsule data buffer size to store
metadata. 16 byte metadata per 512 byte data block is the current
maximum ratio of metadata per block.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I88b127efd7a945bde167a95df19a0b9175cb8cd0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461333
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
9d4ee5f344 nvmf/tcp: Fix wrong data offset in nvmf_tcp_pdu_payload_insert_dif
We updated readv_offset before generating DIF to avoid adding
the temporary variable _rc in the previous patch, but that caused
write error when inserting DIF.

Fix the bug in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id0788280a83cbea2554c851db77751432fc00cba
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461116
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
2c9b0af271 nvmf/tcp: Get DIF context when handling capsule command header
When handling the capsule command header, call spdk_nvmf_request_get_dif_ctx
by passing the NVMf request and the reference to the DIF context, and set
the flag dif_insert_or_strip of the NVMf/TCP request to true.

spdk_nvmf_request_get_dif_ctx returns false immediately when the
corresponding NVMf controller disables DIF insert/strip.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I16f6b322f2692d5f9653d011a490e7929ec37365
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458928
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
1c7f92f075 nvmf: Hide DIF setting of the backend bdev if DIF insert/strip is enabled
When the NVMf controller's flag dif_insert_or_strip is enabled, DIF is
inserted for write I/O and stripped for read I/O, and the corresponding
NVMe-oF initiator should not be aware of the DIF setting of the
backend bdev.

Hence this patch hides the DIF setting of the backend bdev
when the flag dif_insert_or_strip is enabled.

Change-Id: I3c14880c2e94cba7f76b1bca78afb36bfe884e26
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456731
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
4ff3665ce9 nvmf: Check DIF insert/strip setting of NVMf controller when getting DIF context
The first idea was that the caller of spdk_nvmf_request_get_dif_ctx()
should check if the current transport enables DIF insert/strip before
calling spdk_nvmf_request_get_dif_ctx().

But NVMf controller knows if DIF/insert/strip is enabled now by the
previous patch. Hence spdk_nvmf_request_get_dif_ctx() checks if the NVMf
controller enables DIF insert/strip at its head.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I78253d356b694800c3a9a9608514df58e0c631a6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461314
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
91da9aaafe nvmf: Add a flag dif_insert_or_strip to struct spdk_nvmf_ctrlr
Add a flag dif_insert_or_strip to struct spdk_nvmf_ctrlr that indicates
whether DIF insert/strip is done.

Copy the DIF insert/strip setting of the corresponding transport options
to the flag at NVMf controller creation.

The purpose of this patch is to make DIF insert/strip not per-transport
option but per-controller option because we may want to be able to
control DIF insert/strip per controller at some point. Besides this patch
will clean the implementation.

Besides align indent around the change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I57f65960b430e55f4021ed514aacd85581ff9993
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461313
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Karol Latecki
a4b0a2b6fd bdev/crypto: add more descriptive rpc error messages
Improve error messages where possible

Change-Id: I2c75cea66dbd635d89e7f27aef59a38c5533b349
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460966
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-07-10 08:29:21 +00:00
Karol Latecki
d9580c759e aio/rpc: Add more descriptive error messages for aio bdevs
Improve error messages where possible

Change-Id: I104998a666789c4e724d153c2cd14ee05c71b699
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460157
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-07-10 08:29:21 +00:00
Karol Latecki
c4a1c90a4c aio/rpc: make filename an obligatory argument
Filename should not be an optional argument.
Making it obligatory removes the need for further checks as it
should then be checked in json decode.

Change-Id: Ia779c2623db8d5cdde3983507e3b2b3cfb7e971f
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460958
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-07-10 08:29:21 +00:00
Karol Latecki
37c04b7be8 lib/bdev: do not allow bdev name to be an empty string
It looks like currently we only check bdev names for NULL, but
not for "empty" string.

For example this rpc command:
sudo scripts/rpc.py construct_aio_bdev aio_disk "" 512

Will result in construction of AIO bdev with empty name:
sudo scripts/rpc.py get_bdevs
[...]
    "name": "",
    "aliases": [],
[...]

Change-Id: I41204096c8cf210a4dc40a8225d1c9dad353f533
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460150
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2019-07-10 08:29:21 +00:00
Karol Latecki
f155fedcdb null/rpc: Add more descriptive error messages for null bdevs
Improve error messages where possible.

Change-Id: I9d1e4dee106712ecd7a40cfd1eeaf74ccf6d0d1d
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460121
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-10 08:29:21 +00:00
Karol Latecki
5e28673bc5 bdev/rpc: Add descriptive error messages for malloc bdevs
Provide more error codes and/or messages then just a
generic "32602 invalid parameters" error.

Change-Id: I1777f454faef336b10af24dda50a2d5b5e73727f
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459948
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-10 08:29:21 +00:00
Vitaliy Mysak
772db556af lib/util: fix spdk_strerror() empty string return
If __USE_GNU is set, spdk_strerror()
  returns empty string instead of "Unknown error %d".
  if unknown error code provided.
The reason is that on unknown errors, `strerror_r()` will
  return provided buffer, (in our case, `buf` is returned)
  then `snprintf()` will write to `buf` having `buf` as
  input argument because `new_buffer` == `buf`, which results in
  an empty string.
This patch fixes the above issue by first checking if `buf` == `new_buffer`.

Change-Id: I838ebf47d115b58cee3145991243bc9ebaeb651d
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460825
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-07-10 08:29:21 +00:00
Evgeniy Kochetov
7535cdbd62 rpc: Add thread_get_stats RPC method
SPDK threads collect busy and idle time statistics. This commit adds
thread_get_stats RPC method to retrieve these values.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I8ed8041c6164eb0c0a9336f4e50b5f26a3f20190
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445285
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-07-10 04:28:14 +00:00
Ziye Yang
750a4213ef nvmf: add spdk_nvmf_get_optimal_poll_group
This patch is used to do the following work:

1 It is optimized for NVMe/TCP transport. If the qpair's
socket has same NAPI_ID, then the qpair will be handled
by the same polling group.

2. We add a new connection scheduling strategy, named as
ConnectionScheduler in the configuration file. It will be
used to input different scheduler according to the customers'
input.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ifc9246eece0da69bdd39fd63bfdefff18be64132
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454550
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-10 02:30:41 +00:00
Ziye Yang
960460f0d1 nvmf: add spdk_nvmf_transport_get_optimal_poll_group
Add the optimal poll group get function.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ia9e57c6924a6563d79269cf535814883e83698cd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454549
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-10 02:30:41 +00:00
Ben Walker
09ef0593d4 nvmf: Leverage bdev uuid to correctly detected remove+add ns while
paused

Change-Id: Idbf00956394f7ee7ff7e27f2627785cd7146b01f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459605
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
2019-07-10 01:59:05 +00:00
Ben Walker
85e9760161 nvmf: Capture ns_info onto stack in poll_group_update_subsystem
By capturing this pointer onto the stack, we inform the compiler
that we don't expect it to change. That allows the compiler to
generate more efficient code.

Change-Id: I0f3ff9373662198e915269c4498e4902a2cdb808
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459754
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
2019-07-10 01:59:05 +00:00
Ben Walker
ab3abc15aa nvmf: Capture channel variable to stack when updating poll groups
This signals to the compiler and analysis programs that this
won't change during iteration, so it may produce better code.

Change-Id: I478c0c9445d4ddf8a69ab1b3deaf628b82a0eaea
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459753
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
2019-07-10 01:59:05 +00:00
Ben Walker
75b4f332f4 bdev: All bdevs now have a UUID.
For devices that don't have a UUID, the UUID is generated at
registration time. That means that some devices will not have the same
UUID from run to run, but this seems no worse than having no UUID at
all.

Change-Id: Icf6b8517ffcffabafa2b73176dc03d896d0017fe
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-10 01:59:05 +00:00
Changpeng Liu
5317a9f795 rpc/nvmf: add RPC support to add the persistent configuration file for one NS
Change-Id: Ic4963d3e55cffceca35d18ba8d406658e51a189a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455913
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-10 01:40:26 +00:00
Changpeng Liu
7b74274fbf nvmf: add parameter check when loading reservation information from a JSON file
Change-Id: Id217212fd82e57a4cfb32f62f11798c72187879e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460794
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-10 01:40:26 +00:00
Shuhei Matsumoto
390cffb64e rpc: Add dif_insert_or_strip parameter to nvmf_create_transport RPC
Add an new optional parameter dif_insert_or_strip to
nvmf_create_transport RPC.

.INI config file will be deprecated and dif_insert_or_strip is not
supported in .INI config file.

Change-Id: Ibf38b599cff75eeb0056dd2125d6ec10d444f339
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458927
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-10 00:43:02 +00:00
Shuhei Matsumoto
aa322721cb nvmf: Add dif_insert_or_strip to transport options
This is a place holder and subsequent patches will use the option
dif_insert_or_strip and provide JSON RPCs to configure it.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7e3fbb1d49c47647a9a0a1a2149152801591b283
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456452
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-10 00:43:02 +00:00
Shuhei Matsumoto
ddb680ebab nvmf: Add helper function to get DIF context from NVMf request
Add a helper function to get DIF context when the passed NVMf request
is for I/O queue, NVMe read, write, or compare command, and its NSID
is valid.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I796c20607c7b64a8be85da5131c5ea95ffd9f8e4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458713
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-07-10 00:43:02 +00:00
Shuhei Matsumoto
9b04e29173 nvmf: Add helper function to get DIF context from bdev and NVMe cmd
Add a helper function to get necessary DIF information and set
them into the passed DIF context and return. This function will
be called only when the specific requirement is satisfied and
the caller will be added in the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic435886ca936a211f34278b813f547ffa43b9000
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458712
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-10 00:43:02 +00:00
Jeffry Molanus
9bba21c969 app.c: --huge-dir has not effect
`struct option` is set incorrectly for long_opt --huge-dir causing the value
to be ignored.

Change-Id: I5bb84f391e1ac551b2a91c43fe8da658ae54f115
Signed-off-by: Jeffry Molanus <jeffry.molanus@gmail.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460581
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 05:33:03 +00:00
Wojciech Malikowski
fe73e3072c lib/env: Added parent field to spdk_pci_device
VMD introduce parent/child relationship
between pci devices. Parent filed allow
to associate NVMe disk with VMD device.

Change-Id: Ie363dbe83fefbe05e3347888dc6bd361a235da4a
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459637
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-09 04:04:16 +00:00
Shuhei Matsumoto
7bfbc388d7 nvmf/tcp: Pass extended LBA based length as I/O length to NVMf controller
When DIF is inserted or stripped,
- in the TCP transport layer, we can use LBA based length throughout, but
- in the NVMf controller layer and BDEV layer, extended LBA based
  length must be used, and NVMf controller gets the length from
  tcp_req->req.length.

Hence by adding and using two variables, elba_length and orig_length
to struct spdk_nvmf_tcp_req, set the extended LBA length to
tcp_req->req.length before calling spdk_nvmf_request_exec(), and then
restore the original LBA based length to tcp_req->req.length after
calling spdk_nvmf_tcp_req_complete().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9309b8923c6386644c4fd8ef3ee83a19f5d21ce5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458926
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 03:39:25 +00:00
Shuhei Matsumoto
51b643648c nvmf/tcp: Increase buffer to insert/strip DIF in spdk_nvmf_tcp_req_parse_sgl
If tcp_req->dif_insert_or_strip, increase the length from LBA based
to extended LBA based by using its own DIF context.

Change-Id: Ie9f5cf757328dda795b43a7b6c70a72259865115
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458925
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-09 03:39:25 +00:00
Shuhei Matsumoto
536bd70eb4 nvmf/tcp: Use cached length variable in spdk_nvmf_tcp_req_parse_sgl
The next patch will extend the length from LBA based to extended
LBA based and use it as buffer length to insert or strip DIF.

So cache sgl.unkeyed.length at the top of spdk_nvmf_tcp_req_parse_sgl
and use it throughout.

Besides, one unrelated change-the-line to improve the readability
is included.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2a1dc9379bb5671ec80b5b478504c9879a4f0fff
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458924
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-09 03:39:25 +00:00
Shuhei Matsumoto
975239c29d nvmf/tcp: Insert DIF to the newly read data to create extended LBA payload
Generate and insert DIF to each data block when reading more than a single
byte.

This update is very similar with the use case of spdk_dif_generate_stream
in iSCSI target.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I063919a32153ac0daf6d6eb1836c0d5995b65d33
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459092
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 03:39:25 +00:00
yidong0635
ff0a7dfc42 nvme: Handle CQ polling failures by marking the controller as failed.
nvme_transport_qpair_process_completions calls nvme_rdma_qpair_process_completions
There are some cases return -1 due to failure of "CQ errors".

Handle CQ polling failures by marking the controller as failed.
That a completion with an error will be treated as controller failed.
Requests will be aborted after retry counter exceeded. Otherwise, code will keep on
reporting errors without recovery.

This is to fix issue #850.

Change-Id: I0b324232310e107bf7fd5722aca54d402a19b14d
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460569
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-09 01:43:02 +00:00
yidong0635
16fdf46600 bdev: Fix warning about scanbuild error on fedora30.
In file included from bdev_ut.c:43:
/root/yidong/spdk/lib/bdev/bdev.c:4373:9: warning: Access to field 'bdev'
results in a dereference of a null pointer (loaded from variable 'desc')
        return desc->bdev;
               ^~~~~~~~~~

This is related to issue #822.

Change-Id: I8cd2bafadeff9846169bc9ca67b3c4110e9c0da8
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459529
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-09 00:38:22 +00:00
Andrey Kuzmin
fa6bfa80af Nvme: check spdk_nvme_qpair_process_completions return value.
nvme_tcp_qpair_process_completions returns -1 on socket I/O
error. Unless the caller checks this return value (which
spdk_nvme_wait_for_completion_robust_lock currently doesn't),
on connection loss or any other fatal connection
error spdk_nvme_wait_for_completion will never exit the completion
check loop.

Change-Id: I92bb349beb071db312e6c31b84db2a7b51ec486c
Signed-off-by: Andrey Kuzmin <akuzmin@jetstreamsoft.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460657
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 00:27:54 +00:00
paul luse
06f6c90626 bdev/crypto: add IO queueing for out of mem condition via bdev layer
Also made on the prints a DEBUG message instead and noticed the really
name that was being registered by this component so updated it to
make it look like the rest of SPDK.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I747a846cb365e7db49be50db941e83fb1b265ea0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460244
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-08 09:24:29 +00:00
Changpeng Liu
1edc5f0040 nvmf: restore the loaded reservation information to NS
Load reservation information based on ptpl configuration file, and
restore the information to NS data structure.

Change-Id: I5f46d49a6d1e6e49aab93ca7cd654469a3a08659
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455912
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-08 08:21:03 +00:00
Shuhei Matsumoto
8448adaefa nvmf/tcp: Verify DIF before sending C2H data in spdk_nvmf_tcp_send_c2h_data
If DIF mode is local and C2H data is extended LBA payload, DIF should
be verified just before sending the payload.

Add a helper function nvmf_tcp_pdu_verify_dif and call it in
spdk_nvmf_tcp_send_c2h_data after completing nvme_tcp_pdu_set_data_buf.

When nvmf_tcp_pdu_verify_dif returns error, treat the error as fatal
transport error because the error is caused by the target itself.

Handle the fatal NVMe/TCP transport error by terminating the connection
as described in the NVMe specification.

On the other hand, data digest error is treated as a non-fatal transport
error because the error is caused outside the target. This is reasonable.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9680af2556c08f5888aeaf0a772097e4744182be
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458921
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-08 03:33:07 +00:00
Shuhei Matsumoto
457afd77b1 bdev/split: Fix orphan'ed config when removing the base bdev first
When we create a base bdev and then create a split vbdev on top of
the base bdev, if we delete the base bdev first, we have no way to
remove the configuration of the split vbdev. Hence even if we
create a base bdev again, we cannot create any split vbdev on top
of the base bdev again.

The meaning of flag, `removed` of `struct spdk_vbdev_split_config`
is not clear and there will be no issue even if the flag `removed`.

Hence remove the flag `removed` in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I053c95e647721004cecfe4fd8b0f1ff5bb9bf38a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460580
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-08 03:30:39 +00:00
Darek Stojaczyk
fcbbcf4905 bdev: cleanup child iov rewind code
When we run out of bdev_io's child iovs and we had
to round down I/O size to nearest block size boundary,
we used to decrease the existing child_iovcnt and
set a new "child_iov_run_out" flag to terminate the
uppermost splitting loop.

We can get rid of that new flag by just not decreasing
child_iovcnt when rewinding the last few iovs - it
will make the uppermost loop naturally terminate using
the existing checks.

Change-Id: Ie40c7ce135e7fb8fe284afdf7beeebd10af85cb7
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459911
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 12:11:46 +00:00
Hailiang Wang
5926236661 bdev/raid: fix a warning of freed memory
Compilation Warning on fedora30.
In file included from bdev_raid_ut.c:38:
spdk/lib/bdev/raid/bdev_raid.c:325:11: warning:
Use of memory after it is freed. raid_ch->base_channel[pd_idx],
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is related to issue #822.

Change-Id: I6432772fb38ca02bc4f0a02a36ed3fe61b8607c7
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460069
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 12:10:07 +00:00
paul luse
63d9d2e2b0 lib/reduce: eliminate RMW on writes with chunk_size length
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I6545a91e2ae4805f7bd1d92baa6dcbce0f1f8fba
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459864
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-05 11:56:03 +00:00
paul luse
d23c36a169 lib/reduce: eliminate two more memcpy operations
For callers of _reduce_vol_compress_chunk()

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I9ac1da8f9bcfd902fe58e4c5ffc20ce16e9bafcd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459863
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-05 11:56:03 +00:00
paul luse
89a9a50497 lib/reduce: eliminate memcpy in read decompression path
This is the first in a series of patches to eliminate memcpy ops
in the comp/decomp paths. Currently the lib uses 2 scratch buffers
and copies all data in and out of them to the user buffers following
a comp/decomp. This patch replaces the memcpy in one of the paths by
constructing an iovec array that points to a combination of the
scratch buffer and user buffer so that user data decompresses
directly into the user buffer and any data in the chunk that isn't
needed by the user will be sent to the scratch buffer.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ib1956875729a82d218527bc81795f750d1df2b89
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459662
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-05 11:56:03 +00:00
Shuhei Matsumoto
8b539eb553 nvme: Set appropriate value to max_xfer_size and max_sge
SPDK NVMe-oF initiator driver could not transfer IO whose size is
more than 128KiB even if NVMe-oF target allows IO whose size is
more than 128KiB both for RDMA and TCP transport.

Some use cases need to transfer IO larger than 128KiB.

For RDMA transport, max_mr_size by ibv_query_device of RDMA devices
indicates the maximum size of a single memory region and is independent
from the actual I/O size, and is very likely to be larger than 2 MiB
which is the granularity we currently register memory regions.

Actually some RDMA NICs return UINT64_MAX for max_mr_size by ibv_query_device.

Hence use UINT32_MAX and let the generic layer use the controller data
to moderate this value.

On the other hand, for TCP transport, there is no limit for maximum IO
size and hence use UINT32_MAX.

Besides, for RDMA transport, max_sges should be the minimum of
max_sge got by querying RDMA devices and NVME_RDMA_MAX_SGL_DESCRIPTORS.
Hence do this change together in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idc813afd3e525bf5f370c0fcd2623f9c146a5528
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459218
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 06:35:41 +00:00
Shuhei Matsumoto
cf3c54bc03 nvme: Ensure max_sges not to exceed what controller supports in generic layer
Previously comparing the transport supported value and the target value
was done in RDMA transport layer. However this comparison should be
done in the generic layer like the maximum IO transfer size. Hence
change the comparison to do in the generic layer in this patch.

Besides, for MSDBD, the value 0 indicates no limit but we had handled
this as maximum number of SGS entries was 0 by mistake. This patch fixes
the bug together.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I54365cf114169b10180ec2c659f9c7302672674c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459574
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 06:35:41 +00:00
Chunyang Hui
993ab4908c RocksDB: Remove static and assert for SpdkInitializeThread
RocksDB spdk-v5.13.4 and spdk-v5.18.4 still need
to call SpdkInitializeThread in its env init.
Static will trigger make error. Thus removed.

For removing assert, we already have enough check to
make sure the allocate won't happen twice. The assert
here is redundant.

Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Change-Id: I058c580349398b83fed8a8408b089e065b5d2988
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460465
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-05 04:19:11 +00:00
Ziye Yang
57efada508 nvmf/tcp: reorg the structure of struct spdk_nvmf_tcp_req
I used pahole to see whether the alignment of the structure
is reasonable. After reorgnization, we can saved 16 bytes and 1
cacheline according to the information by pahole.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I1347e7c582fe2b00707e2841690b87d53cc61e33
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460572
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 04:18:41 +00:00
Darek Stojaczyk
89021c6c6c nvme/rpc: switch to spdk_*malloc().
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I6fd1106c2278c2ef8899c822e920252f62266547
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459550
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 03:48:51 +00:00
Chunyang Hui
fbd2f3fd2e opal: add support for getting locking range info
Change-Id: I8e3e39673c260f823a9703e86006b5334dedc987
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457576
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 02:23:28 +00:00
Chunyang Hui
505dbf59ff Opal: Add locking range support
Change-Id: I4974d4134aed3b63e204b79c9292ce940e32d40c
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455175
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-05 02:23:28 +00:00
Chunyang Hui
755b4390f9 Opal: Add activate locking SP method
Change-Id: I4189bdefdb5a6651bb73bd32e61c16e899b2ae5a
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454211
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 02:23:28 +00:00
Shuhei Matsumoto
bcfb2b2b9c bdev/passthru: Pass-through metadata and DIF setting of base bdev
Allow I/O requests using metadata and DIF if base bdev supports them.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie1b4b301a3d72d3fbd6e459ee2ab7d1a85425162
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460394
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-04 09:23:07 +00:00
Shuhei Matsumoto
3ff1ff004e nvme/tcp: Minor cleanups for SGL operations
Using naming rules consistent with other related libraries is helpful
to ensure the quality as verified by this patch series.

This patch changes a few parts to use iov and iovcnt for SGL operations.
Besides, name of an array points to the head of the array and is
constant. So copying name of array to an another pointer is not
necessary and can be removed.

Change-Id: I2324f28126b3088098c1c767cf6c060f22c175c3
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455629
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-04 08:58:40 +00:00
Shuhei Matsumoto
127cfac020 nvmf/tcp: Use nvme_tcp_pdu_set_data_buf for incapsule data
Previously we had used nvme_tcp_pdu_set_data() for incapsule data.
This patch changes handling incapsule data to use
nvme_tcp_pdu_set_data_buf() as same as H2C and C2H.

This unification is necessary to support DIF insert and strip
in NVMe/TCP target later.

Change-Id: I02cae8db94e51cf79a354dd64ad45f0e491ec08e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455920
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-04 08:58:40 +00:00
Shuhei Matsumoto
3184884f9d nvmf/tcp: Properly handle multiple iovecs in processing H2C and C2H
NVMe/TCP target had assumed the size of each iovec was io_unit_size.
Using nvme_tcp_pdu_set_data_buf() instead removes the assumption
and supports any alignment transparently.

Hence this patch moves nvme_tcp_pdu_set_data_buf() to
include/spdk_internal/nvme_tcp.h and replaces the current code to use it.

Besides, this patch simplifies spdk_nvmf_tcp_calc_c2h_data_pdu_num()
because sum of iov_len of iovecs is equal to the variable length now.

We cannot separate code movement (lib/nvme/nvme_tcp.c to include/
spdk_internal/nvme_tcp.h) and code replacement (lib/nvmf/tcp.c)
because moved functions are static and compiler give warning if
they are not referenced in lib/nvmf/tcp.c.

The next patch will add UT code.

Change-Id: Iaece5639c6d9a41bd35ee4eb2b75220682dcecd1
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455625
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 08:58:40 +00:00
Ziye Yang
b09bd95ad3 sock: update spdk_sock_group_add_sock
And also add spdk_sock_group_get_ctx function

Change-Id: I2a2a58b0588ff7d99d3538ea0a633a3b8c7a234b
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454538
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2019-07-04 08:21:05 +00:00
Ziye Yang
8bb174f87d sock: add function spdk_sock_get_optimal_sock_group
Also add the mapping table and the operations between placement_id and
sock_group

Change-Id: I31868e241fdd20252c2d79792ff1239e6d23afb8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454537
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-04 08:21:05 +00:00
Changpeng Liu
bdb90726ee scsi: fix error break when checking SCSI reservation
We should return for the registrant case when the reservation holder
exists.

Change-Id: Ie3cf31554eafdad03294aef2eeb6eaef1536b8c3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460305
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-04 08:15:44 +00:00
Shuhei Matsumoto
666a0b5cb4 iscsi: Assign not pointer but instance of spdk_cpuset in struct spdk_iscsi_portal_grp
This will reduce pontential malloc failures.

Change-Id: I9b1965e0be95af4c0496dfbae80c86b25c460c94
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459718
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
Shuhei Matsumoto
752fa1ca27 thread: Assign not pointer but instance of spdk_cpuset in struct spdk_thread
This will reduce potential malloc failures.

Change-Id: Ie67554fec877e33bbd1044fc61eb4d79df306168
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459717
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
Shuhei Matsumoto
6de3d418df cpuset: Expose internal of struct spdk_cpuset in header file
This will make other structures to allocate struct spdk_cpuset
statically and will reduce potential malloc failures.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I067ec2c79824b04796a8b6f717e610727a861461
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459716
Reviewed-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-04 00:30:22 +00:00
Shuhei Matsumoto
12d6dce2aa nvmf: Use not malloc'ed but fixed size string for host NQN
Maximum size of NQN is already defined to be SPDK_NVMF_NQN_MAX_LEN,
and hence use fixed size string whose size is SPDK_NVMF_NQN_MAX_LEN
+ 1 for spdk_nvmf_vhost::nqn.

This change will reduce the potential malloc failure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2b9c7cc21200b3e88b5485ebfdcd5040bc6e3589
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459742
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
yidong0635
21740a7cac ftl_reloc: Fix scanbuild warning about moves.
/spdk/lib/ftl/ftl_reloc.c:507:8: warning: Assigned value is garbage or undefined
                move = moves[i];
                     ^ ~~~~~~~~
lib/ftl/ftl_reloc.c:508:11: warning: Access to field 'state' results in a dereference
of a null pointer (loaded from variable 'move')
                switch (move->state) {
                        ^~~~~~~~~~~

Change-Id: I9cc1c2b52a93957bb4c56b1ed463c23289b5a43d
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460120
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-04 00:25:17 +00:00
Wojciech Malikowski
e0bf5e3e4f lib/ftl: Enable ANM events handling
Added ANM events processing by relocation
module.

Change-Id: I6d20b2dd66309fd7cf0fddb44b6027848b29446b
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455253
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-03 04:28:13 +00:00
Wojciech Malikowski
fdf3c5a30f lib/ftl: Temporarily disable relocation on open bands
Handling ANMs on open band leads to many
corner cases in FTL and on the other hand
such event should be very rare.

Disable it until we will have stable test
results from current implementation with
extended dirty shutdown tests.

Change-Id: Id438c7274ed2be1712bf581d6aabfc27bcbd53dc
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459434
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-03 04:28:13 +00:00