Commit Graph

1598 Commits

Author SHA1 Message Date
Evgeniy Kochetov
2ca711694e nvme/ctrlr: Remove Get Num Queues initialization step
NVMe specification in ch.7.6 "Controller Initialization" suggests to
use only Set Features "Number of queues" command and says nothing
about Get Features. All required information is available after Set
Num Queues step.

Fixes #1270

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: Ide38ba9c7f063f1d6b13bfce4232c588cc906784
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1271
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-18 08:02:48 +00:00
Shuhei Matsumoto
2fa51eeb46 lib/nvmf: Make spdk_nvmf_poll_group_destroy() asynchronous
The next patch will create poll group threads dynamically for
NVMe-oF target, and will need to wait for completion of poll group and
I/O channel destroy. This is a preparation for the next patch.

Add callback function and its argument to spdk_nvmf_poll_group_destroy(),
and to struct spdk_nvmf_poll_group, respectively.

The callback has not only cb_arg but also status as its parameters even
if the next patch always sets the status to zero. The reason is to follow
spdk_nvmf_tgt_destroy's callback and to process any case that the status
is nonzero in future.

spdk_nvmf_poll_group_destroy() sets the passed callback to the passed
poll group.

Then spdk_nvmf_tgt_destroy_poll_group() calls the held callback in the
end.

This change will ensure all pollers are being unregistered and
all I/O channels are being released.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifb854066a5259a6029d55b88de358e3346c63f18
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/495
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-17 08:49:00 +00:00
Tomasz Zawadzki
b5ef8c45b5 ut/blob: recreate bs and blobs for each iteration of power fail UT
blob_delete_snapshot_power_failure() test always attempted
snapshot deletion until the snapshot did not open.
Which meant that on bs reload after dirty shutdown,
the snapshot was in unrecoverable state.

UT did not verify delete call beyond that point.
Next patch will stop after snapshot is unrecoverable,
AND the spdk_bs_delete_blob() returned success.

This patch makes it easier to recreate same starting
conditions after snapshot did not load.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7e14e8dadaaef4aa3287ebd376465253466b2362
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1162
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-17 08:23:25 +00:00
Ben Walker
ea65bf612d Revert "nvme/tcp: Change hdr in nvme_tcp_pdu to pointer"
This reverts commit ea5ad0b286.

This code is moving from the nvmf target to the posix sock
layer in this series.

Change-Id: I333bdf325848e726ab82a9e6916e1bbdcd34009c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/446
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-17 08:23:07 +00:00
Konrad Sztyber
02385a64b9 bdev/nvme: asynchronous module_finish
Now that a namespace can be depulated asynchronously now, the NVMe bdev
module should also be finalized asynchronously, after all namespaces and
controllers are deallocated.

Change-Id: Ic082fec8e31e9bd5ee1c698cd8dfca9f248776d3
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1198
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-13 08:53:39 +00:00
Konrad Sztyber
9d0f9b330d bdev/nvme: asynchronous namespace depopulation
This patch adds the ability for a namespace to be depopulated
asynchronously.  Currently both regular NVMe namespaces, as well as the
OCSSD ones are depopulated synchronously, but it'll be changed in the
upcoming patches.

The nvme_bdev_ctrlr.ref is now not only tracking the number of bdevs
created on that controller, but also the number of populated namespaces.

Change-Id: I7b112d9b0d41739f3dc7d427e9da340843128c54
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1197
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: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-13 08:53:39 +00:00
Shuhei Matsumoto
ea863bb0b3 lib/event: Count number of threads per reactor
Add thread_count to struct spdk_reactor to count number of threads
per reactor. This number will be used in the next patch to know
if all threads are idle or not for each reactor to support CPU
power saving.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4f7cc5a6b78d85e9f8d0b539c60058c13e282759
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1169
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-12 09:04:02 +00:00
Changpeng Liu
c61b70c3d5 nvme/opal: rename spdk_opal_init_dev() and spdk_opal_close() with construct/destruct suffix
Since the OPAL here is just for NVMe device, so we don't need to use dev_handler as common
handler, just rename it to spdk_nvme_ctrlr.  And we don't exit the initialization if
OPAL construnction had a failure.  Also move the timeout initialization to construct().

Change-Id: I11f0aea961eaa3da0c6253eb03d0227f7e7e5f11
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1101
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-03-11 11:36:08 +00:00
Tomasz Zawadzki
aba9841212 ut/blob: add setup/clean for blob creation
Added new setup/cleanup functions for a suite of
unit tests that use a particular blob through out the
tests.

This simplifies the contents of particular UTs,
and brings forward focus of each UT.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib7d69b90fcbe8e6a0ba303475fcbaeb90fa110a7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/945
Tested-by: SPDK CI Jenkins <sys_sgci@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>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
104d4c0a57 ut/blob: add blob deletion at the end of UT
Some of the unit tests were only closing a blob,
without deleting it at the end of unit tests.
This is valid behaviour, but to later simplify
the setup/cleanup - a delete blob was added.

This change was made to unit tests where,
it was not focus of particular UT.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7e338ba6fcb63af26658e8968971a6d56f70807b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1203
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>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
cc991aad61 ut/blob: simplify blob closing and deletion
Operation of closing and deleting a blob is common
throughout the tests.

This patch creates helper function ut_blob_close_and_delete(),
to do exactly that with the right asserts.
Throughout the UT this function replaces all instances where
blob is closed and deleted, when it is not the subject of
particular unit test (focus is on other functionality).

It will allow to later use it in setup/cleanup functions
for UT suite - similar to bs init.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic56594da8cd4c442b62890d62961b44771059679
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1202
Tested-by: SPDK CI Jenkins <sys_sgci@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>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
5df4f50f76 ut/blob: simplify blob creation and opening
Operation of creating a blob (with or w/o opts),
then opening it through out the tests is quite common.

This patch creates helper function ut_blob_create_and_open(),
to do exactly that with the right asserts.
Throughout the UT this function replaces all instances where
blob is created and opened, when it is not the subject of
particular unit test (focus is on other functionality).

It will allow to later use it in setup/cleanup functions
for UT suite - similar to bs init.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia541b855d154503f824bfa3909bcfeac649c5853
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1201
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
95ebed3c9e ut/blob: always use local blobid
Always call API on blobid that was received from blob
create, instead of relying on global one.

Where necessary added declaration and assignment.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3529b4d5e86c1301bb64268029a57873f9f600cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/944
Tested-by: SPDK CI Jenkins <sys_sgci@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>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
114da5a203 ut/blob: always use local blob pointer
Always call API on pointer that was received from blob
open, instead of relying on global one.

Where necessary added declaration and assignment.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I15531111201d071c471f5be79ce18ff508631677
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/943
Tested-by: SPDK CI Jenkins <sys_sgci@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>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
25a01035d2 ut/blob: put setup/clean of tests into common function
A lot of unit tests require only creation of a blobstore
then unload it at the end.
This code can be made common and invoked automatically by
CUnit with CU_add_suite_with_setup_and_teardown().
Those functions are called before and after each test in suite.

This should simplify the unit tests by removing the common
code.

Following patches will add further suites with different
setup/cleanup to reduce common code even more.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I984cde2381f4461e188e06050355024a88ebfca9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/932
Tested-by: SPDK CI Jenkins <sys_sgci@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>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
935fbcdf5c ut/blob: do not clear g_bs in helper functions
Next patch in series adds setup/cleanup functions
that use g_bs for its operation.

Particular unit tests should not leave the g_bs
unassigned, if cleanup is supposed to unload it.
It applies to helper functions to reload/dirty_load.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6e022b6c762981c2c70ebf31f4981a17f54f3591
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1182
Tested-by: SPDK CI Jenkins <sys_sgci@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>
2020-03-11 11:34:55 +00:00
Tomasz Zawadzki
a9f76ed204 ut/blob: Do not initialize default bs opts
Some of the unit tests initalized bs opts,
event if they were left unmodified.

There is no need to perform this operation,
as spdk_bs_init() can accept NULL as bs_opts parameter
to just initialize default values.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iacea1fa9d53796b8c359b611092cc63c6bce4094
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1181
Tested-by: SPDK CI Jenkins <sys_sgci@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>
2020-03-11 11:34:55 +00:00
Ziye Yang
9ba4bb22fe lib/nvme_tcp: get the max_sges from the nvme ctrlr.
Add the error print if there is still remaining_size in
order to provide more meaningful debug info.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I7b15c9c9a630ea7ecb2d3191b73c9c99f7febf31
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1189
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-03-11 02:25:12 +00:00
Ben Walker
40529e5d11 nvmf: Add a transport notification when listeners are associated with
subsystems

This is optional and most transports will not implement it.

Change-Id: I51e0f1289b0e61a8bdb9a719e0a2aae51ecb451c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/629
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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
2020-03-10 09:12:29 +00:00
Ben Walker
6fc8c8c2fc nvmf: Make spdk_nvmf_subsystem_add_listener asynchronous
In the next patch a new transport call will be added to notify
transports of subsystem->listener associations. The operations the
transports may need to perform there are likely asynchronous, so make
this top level call asynchronous here in preparation.

Change-Id: I7674f56dc3ec0d127ce1026f980d436b4269cb56
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/628
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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-03-10 09:12:29 +00:00
Ben Walker
c40f35b764 nvmf: Make spdk_nvmf_tgt_listen synchronous again
This was recently made asynchronous to support virtualized transports.
However, we're moving to add a new call to associated a listener with a
subsystem to transports and the operation that needed to be asynchronous
will actually be performed there. For simplicity, make this synchronous
again.

Change-Id: Ie98136a19c58f0f9bba0d140476de3bbb38e12d7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/881
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-06 10:29:45 +00:00
Tomasz Zawadzki
f422548ea7 ut/blob: reload bs and verify xattr in blob_persist test
This patch adds better check if the xattr was removed.
It will identify potential bugs when first md sync
takes precedence over the second md sync.

As per suggestion in
https://review.spdk.io/gerrit/c/spdk/spdk/+/774/6/test/unit/lib/blob/blob.c/blob_ut.c#7655

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I463f2455614ef11cc1512dc2fb1972ba1f024337
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1109
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-06 10:28:28 +00:00
Tomasz Zawadzki
682e7c1719 ut/blob: add common function for dirty shutdown
Operation of dirty shutdown of blobstore and reloading
it occurs often enough in UT to provide a common function
to perform it.

Added ut_bs_dirty_load() to facilitate this.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0079dfabd64eaec6495db02fe200be1d6116f0c7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1092
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: Jim Harris <james.r.harris@intel.com>
2020-03-06 10:28:28 +00:00
Tomasz Zawadzki
b8fedfa33d ut/blob: add common function to reload blobstore
Operation of unloading and loading blobstore
occurs often enough in UT to provide a common function
to perform it.

Added ut_bs_reload() to facilitate this.

Couple occurences in this patch actually fix
test cases where mistakenly opts were not passed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib46ed395cd134feaa540e00a334ae861872b3ef4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1091
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: Jim Harris <james.r.harris@intel.com>
2020-03-06 10:28:28 +00:00
Tomasz Zawadzki
9e6b5aa4c2 ut/blob: always refer to local bs pointer, rather than g_bs
Couple unit tests were still refering to g_bs pointer,
rather than the one local to particular UT.

This patch fixes this.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If343eb561a48c4547d499139d76e1db6b2d7f3bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1090
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: Jim Harris <james.r.harris@intel.com>
2020-03-06 10:28:28 +00:00
Changpeng Liu
1914de0920 blobfs: start a poller to do cache buffer reclaim regularly
Currently we will free the cache buffers in the file R/W
data path, however we can start a thread to do the cache
buffer reclaim regulary, so that we don't need to free
the cache buffer in the Rocksdb thread context.  By
doing this, we can also remove the global cache buffer
lock in following patches.

Change-Id: Icb0fbc49baecd1e9d86a5fcfe400758dfc3c53a2
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/941
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-03-06 10:27:45 +00:00
Shuhei Matsumoto
6383602952 lib/scsi: Remove workaround for astyle format check about break-after-return-type
To avoid the starnge formatting, typedef has been used. But this comment
is hard to get the meaning. So stop breaking after return type for this case.

The strange formating is

struct spdk_scsi_dev *
       spdk_scsi_dev_construct(const char *name, const char *bdev_name_list[],
                        int *lun_id_list, int num_luns, uint8_t protocol_id,
                        void (*hotremove_cb)(const struct spdk_scsi_lun *, void *),
                        void *hotremove_ctx)

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I20c30b225b3b96fa9207b4a89e3210c8a97fb1d8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1050
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-03-04 10:04:26 +00:00
Artur Paszkiewicz
73763d40ec module/raid: raid5 module
Add raid5 module and unit tests. Use './configure' with option
'--with-raid5' to enable it.

Change-Id: I9f07da8c3567fa65499444899c899adaa2e29550
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/855
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@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>
2020-03-04 10:03:45 +00:00
Ziye Yang
34bff15a19 ftl ut: Fix the compilation issue.
If we did not configure with "--enable-debug". it will
trigger the compliation failure since this function is
not defined.

Change-Id: Ia1795da736be55d4dd1418a2e74edefff7797f11
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1097
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-03-04 05:02:35 +00:00
Richael Zhuang
ceb601188b test: fix error about unittest_thread uninitialised parameters
When running unittest_thread in fedora29 with memcheck, there is
error "Conditional jump or move depends on uninitialised value(s)"
in for_each_channel_unreg test.

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I38abf4c70ff513e39232b83357d571dded8f02c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1072
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-03-03 07:55:01 +00:00
Konrad Sztyber
336505abbf lib/ftl: use per-io_channel write buffers
Replaced single global write buffer with the per-io_channel write
buffers.  This means that the "rwb" module and all of its references
were removed and replaced with the recently added interfaces.

Change-Id: Idc899d3a4d63a8a2bede1ac26549ed06e9a2e784
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/909
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2020-03-02 10:27:06 +00:00
Konrad Sztyber
925cc3b8a9 lib/ftl: pending batches queue
Added queue responsible for keeping track of full, ready to be written
batches.  A batch might be put on this queue in case it'd already been
filled, but could not be written out due to lack of resources or it was
written out, but failed and needs to be resent.

Change-Id: Iba49cd359425300d21b8100f13f17189e99d4c7c
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/908
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szczepaniak <maciej.szczepaniak@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2020-03-02 10:27:06 +00:00
Konrad Sztyber
87731e1105 lib/ftl: write buffer entry address calculation
Two functions were added:
 - ftl_get_addr_from_entry() returning an address pointing at a given
   entry
 - and it's inverse, ftl_get_entry_from_addr(), returning a write buffer
   entry for a given address

Change-Id: Iea1e2e59f240f50183fdb549280a0f0b722efbef
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/906
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-02 10:27:06 +00:00
Konrad Sztyber
35fdf2dd9e lib/ftl: write buffer batches
This patch adds the ftl_batch strucutre, which describes a single batch
of data to be written to the disk.  It's comprised of multiple write
buffer entries (the actual number depends on the write unit size of the
underyling device).

Additionally, a function responsible for filling out a batch was added.
It iterates over available IO channels and dequeues submitted write
buffer entries until a batch is completed.  The IO channel queue is
shifted, so that each time the function is called a subsequent IO
channel is used first, which guarantees that all channels are treated
fairly.

Change-Id: Ie61d8c6cb51d5c5175540c975447bc27590c5cb4
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/905
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-02 10:27:06 +00:00
Konrad Sztyber
1e8c9a4de2 lib/ftl: write buffer acquire/release
Added functions responsible for acquiring/releasing write buffer entries
from the per-io_channel caches.  They're also in charge of limiting user
writes by reducing the number of available entries to the user.

Change-Id: I23adfe36065139036f9b72a016e34fbf6eb29230
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/904
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-02 10:27:06 +00:00
Konrad Sztyber
bfafd4e472 lib/ftl: IO channel array
The IO channel pointers are now stored inside an array of the device
they belong to.  Once write buffer entries are tied to IO channels,
it'll provide a method for dereferencing an entry from its address.

Change-Id: Iaf401525eb0f5af8dc6047a1dc8bae11b56761d7
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/901
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-02 10:27:06 +00:00
Konrad Sztyber
085bfa0d13 lib/ftl: allocate separate memory for IO channels
This is the first patch of a series that replaces single global write
buffer with per-io_channel buffers.  This change is intended to improve
performance for multithreaded workloads.

This patch changes the way the ftl_io_channels are allocated by only
keeping an ftl_io_channel pointer inside spdk_io_channel's context.  It
allows for delaying IO channel destruction, which in turn allows the FTL
to iterate over all exisiting IO channels without locking.

Change-Id: I5e0cab8043a2b5f747e971dd3d65ed2546c8cf26
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/900
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-03-02 10:27:06 +00:00
Shuhei Matsumoto
a4335feb6d lib/event: Support SPDK_THREAD_OP_RESCHED operation in reactor
Add a flag resched to check if reschedule operation is requested
to struct spdk_lw_thread. Add _reactor_resquest_thread_reschedule()
to set the resched flag, and add it to the case SPDK_THREAD_OP_RESCHED
in spdk_reactor_thread_op(), and return true in the case
SPDK_THREAD_OP_RESCHED in spdk_reactor_thread_op_supported().

Then _spdk_reactor_run() checks if the resched flag is true for each
thread. If true, set the resched flag to false, and remove the
thread and call _reactor_schedule_thread(). Add continue to avoid
use-after-free issue for both reschedule and terminate cases.

This idea follows voluntary thread termination and will remove our
worries for all complicated rare cases.

Add unit test case to verify this update.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I656872d32dbb469ae70f771cd0419a77236bfe18
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/500
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-02-28 14:37:53 +00:00
Wojciech Malikowski
f93ac08d26 lib/ftl: Merge ftl_thread structure with ftl_dev
Since ftl supports only one core thread ftl_thread
structure is not needed anymore.

Change-Id: I66eda9249d74b3eff0c4473dcd0aba4a6135e296
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/548
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szczepaniak <maciej.szczepaniak@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-02-28 08:54:07 +00:00
Michal Berger
c0fb1b93d0 test/unit: [nvmf/ctrlr.c] Increase feature get|set coverage
Add tests for the following features:

  - SPDK_NVME_FEAT_TEMPERATURE_THRESHOLD (4),
  - SPDK_NVME_FEAT_ERROR_RECOVERY (5),

For Temperature Threshold feature the validity of the THSEL and TMPSEL
is covered as described in the NVMe spec (1.4):
	"Figure 279: Temperature Threshold – Command Dword 11"

For the Error Recovery feature the validity of the DULBE is covered
as decribed in the NVME spec (1.4):
	"Figure 280: Error Recovery – Command Dword 11"

Random value is selected for the lsb in the cdw11 (0x42).

Change-Id: Ia57ab4d79439ec315ddc9bbfdad8400aa926062a
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/692
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-02-27 10:15:40 +00:00
Shuhei Matsumoto
1368aec870 lib/event: Use spdk_thread_lib_init_ext() to initialize thread library
Remove the prefix "spdk" from spdk_reactor_schedule_thread(), add
spdk_reactor_thread_op() and spdk_reactor_thread_op_supported().

For SPDK_THREAD_OP_NEW, spdk_reactor_thread_op() calls
_reactor_schedule_thread() and spdk_reactor_thread_op_supported()
returns true.

Then replace spdk_thread_lib_init() by spdk_thread_lib_init_ext()
with spdk_reactor_thread_op() and spdk_reactor_thread_op_supported().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I232a3b2c6bcaf4d86b0dd3cefacd3e47eadda6d8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/968
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-02-27 10:14:23 +00:00
Shuhei Matsumoto
d82d69017f lib/thread: Add spdk_thread_lib_init_ext() and generic thread operation function
Add enum spdk_thread_op and two function typedefs spdk_thread_op_fn
and spdk_thread_op_supported_fn.

The first operation type of enum spdk_thread_op is SPDK_THREAD_OP_NEW,
and it is used as an alternative to spdk_new_thread_fn.

Add global variables, g_thread_op_fn and g_thread_op_supported_fn, and
then add spdk_thread_lib_init_ext() to initialize these.
spdk_thread_lib_init() requires both of thread_op_fn and
thread_op_supported_fn are specified or not specified.

spdk_thread_create() calls g_thread_op_fn() with SPDK_THREAD_OP_NEW
if g_new_thread_fn is NULL, g_thread_op_supported_fn is not NULL,
and g_thread_op_supported_fn(SPDK_THREAD_OP_NEW) returns true.

Update unit test to test these addition.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I56db903f62437f6ff3198248ffc5dede396c22bc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/967
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-02-27 10:14:23 +00:00
Jacek Kalwas
fb7129881a nvmf: add const to nqn getters
There is a warning triggered when holding ref to const obj and passing
to these getters.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I2c7b4ea0d325d84d66923fc524273ea44a3a311b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/997
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>
2020-02-26 09:27:11 +00:00
GangCao
c65d64a6b8 vbdev/raid: close the base bdev on its opened thread
With the JSON configure, the base device will be opened on the
same thread (RPC thread) to handle the JSON operation. Later the
virtual device upon the base device can be opened on another
thread. At the time of virtual device destruction, the base
device is also closed at the thread where opening the virtual
device, it is actually different than the original thread where
this base device is opened through the JSON configure.

Add a thread here to record the exact thread where the base
device is opened and then later route it back to handle the base
device close operation.

Change-Id: Ib95e8d190bd87158ae1ecc6698da95ccc4ba9579
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/992
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-26 09:26:49 +00:00
Changpeng Liu
4f7fa18d69 nvme: export internal security send/receive APIs as public APIs
There are synchronous security send/receive APIs defined in nvme.h,
however, we still need the asynchronous APIs so that we can make the
OPAL library can be used in asynchronous way. As the asynchronous APIs
are already defined in nvme_ctrlr_cmd.c, so just export them to public
APIs.

Change-Id: I5646f342a4bf70faad37daa956476f05a1327bcc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/675
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>
2020-02-26 09:22:15 +00:00
Richael Zhuang
5e1b30bd28 test: fix error about unittest_nvmf uninitialised parameters
When running unittest_nvmf in fedora29 with memcheck, there are
many errors about "Conditional jump or move depends on uninitialised
value(s)". The failed tests are:
in ctrlr_ut:
  test_reservation_notification_log_page
  fused_compare_and_write
in ctrlr_bdev_ut:
  spdk_nvmf_bdev_ctrlr_compare_and_write_cmd

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: Ib1e6a744e86876c15ee53206909364e853574dd1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/965
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: Jim Harris <james.r.harris@intel.com>
2020-02-21 09:39:52 +00:00
Allen Zhu
52a0feb404 bdev/nvme: handle namespace resize event
while the size of namespace is changed,
the resize event will be notified.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: Allen Zhu <allenz@mellanox.com>

Change-Id: I5d85f17df898dc21c0ae1eb9f529dcb624a457ac
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/849
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-21 09:38:42 +00:00
Tomasz Zawadzki
83e8cc3b90 ut/blob: always use local blobstore pointer
Always call API on pointer that was received from blobstore
initialization or load, instead of relying on global one.

Where necessary added declaration, assignment and asserts.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic4198ac984c13a8b77428deaa32ce9864e6750c1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/942
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-21 09:35:27 +00:00
Tomasz Zawadzki
56cec80813 ut/blob: make use of simpler CUnit test addition
CUnit provides a helper macro CU_ADD_TEST() that
simplifies using CU_add_test() function.
Test name no longer needs to be provided,
instead test is named after test function name.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I9f5d9e0d8e72ab36b2a5c04e33c336e6c0a1fa6a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/931
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-21 09:35:27 +00:00
Tomasz Zawadzki
b88f0c4f20 ut/blob: simplify error handling for UT
Failure to prepare CUnit for tests is always a fatal error,
and application exits.
Most test managment functions in CUnit set some CU_ErrorCode,
that can be retrived by return code from a function or CU_get_error().

Thus usual structure of UT in SPDK checked every output from every
test managment function.
There is a helper function CU_set_error_action() that when set to
CUEA_ABORT, will abort the application run with proper error return code.
Along with nice error message.

For example if one were to add same UT twice:
"Aborting due to error #32: Test having this name already in suite."
Application return code set to 32.

Using CU_set_error_action(CUEA_ABORT), removes the need for error checking
on test managment functions in CUnit.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ida7de5e040b714509e79957d47a006ee518a42b8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/930
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-21 09:35:27 +00:00