Commit Graph

2658 Commits

Author SHA1 Message Date
Daniel Verkamp
37962990e4 nvme/fio_plugin: fix ->queue() error reporting
FIO backends are supposed to return a negative value on error.

Add special handling for -ENOMEM (out of requests) case to return
FIO_Q_BUSY, indicating that FIO should resubmit the request later.

This is part of the fix for issue #169, which is related to high queue
depths with large I/Os causing the NVMe library to run out of request
objects.

Change-Id: I4fa4001b078b07c42fcd4d1357434575b2c84023
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369664
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-14 18:15:07 -04:00
Paul Luse
b9244352b0 unittests.sh: use valgrind if installed and not using ASAN
Automatically uses valgrind with the same options as CI does
provided that it is available ASAN is not enabled.

NOTE: if you don't want to use valgrind then enable ASAN

Change-Id: I44f8322680eb2608464eb128d49d20dc1d311f0c
Signed-off-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/369064
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-14 18:14:09 -04:00
Ziye Yang
36a0d1e5d1 test, blockdev: simplify the if statement
Change-Id: I88b4e91181ef87264a71bcbddb56d7a71cc0b084
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/369542
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-14 16:02:44 -04:00
Paweł Niedźwiecki
6bd54f1bf1 vhost: Make JSON-RPC parameter names as consistent as possible
-changed "cpu_mask" to "cpumask"
 -changed "name" to "lun_name"
 -changed "bdev" to "dev_name"

Change-Id: I52b77fa01384df8e6e725f236f23cb568b35f189
Signed-off-by: Paweł Niedźwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/368774
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-14 15:54:28 -04:00
Jim Harris
be9a3b9f69 bdev: pass descriptors for I/O operations
This enables checking permissions - for example,
spdk_bdev_write will fail if the descriptor was not
created with write permissions.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I68b65a560f471f2e0f71a7f42cfa6689b911110f

Reviewed-on: https://review.gerrithub.io/369493
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-14 13:31:30 -04:00
Jim Harris
f71447e80d bdev: remove differentiation between bdev and vbdev modules
We still will sort the bdev_module list so that modules
with an examine() callback are initialized first.  This ensures
they have a chance to initialize before later modules start
registering physical block devices.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I792cfb41b0abe030fe2486a2c872cbf329735932

Reviewed-on: https://review.gerrithub.io/369486
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-14 13:31:30 -04:00
Jim Harris
7fefd60fab bdev: make module init synchronous again
Module initializaiton was made asynchronous recently
to support bdev modules like gpt which need to do
asynchronous I/O.  But all modules now do any
asynchronous I/O in their examine() routines, and
init functions only do very basic operations to be
ready to handle examine() callbacks.

So simplify the bdev code and modules to go back to
a synchronous init procedure.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idb16156796ad7511d00f465d7a2db9acda6315b6

Reviewed-on: https://review.gerrithub.io/369485
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-14 13:31:30 -04:00
Jim Harris
dd06e98d4a bdev: rename blockdev instances to bdev
This includes file names, functions, #defines, etc.
There are still a few uses of "blockdev" outside of
include/ and lib/ - these can be handled later.

This preps for a future patch to consolidate vbdev
modules and bdev modules into just bdev modules.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I70e575709ae1b0a116b08515fd38ae793de05377

Reviewed-on: https://review.gerrithub.io/369325
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-14 13:31:30 -04:00
Jim Harris
4fc7e66614 bdev: add vbdev claim/release semantics
vbdev modules still open/close bdevs as normal, but
should open bdevs read only when tasting (i.e. reading
the GPT to see if there are SPDK partitions).  When
a vbdev module is ready to claim the bdev for purposes
of creating virtual bdevs on top of it, it calls
spdk_vbdev_module_claim_bdev().  It can pass its
open descriptor as well to have it promoted to
write access (required for future vbdev modules like
logical volumes).

Note: error vbdev was changed to copy the base bdev
parameters one-by-one instead of a blind memcpy - we
do not want to copy the base bdev's vbdev_claim_module
into the new bdev!

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If2ee67dc78daf96050343c473671aa3402991bb1

Reviewed-on: https://review.gerrithub.io/368628
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-14 13:31:30 -04:00
Jim Harris
86af2ae59f test/bdev: do not hardcode sgdisk directory
At least on Ubuntu, sgdisk gets installed to /sbin, not /usr/sbin.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I59c806d2c93c6a1773aea11d6fc669e3df0e3c08

Reviewed-on: https://review.gerrithub.io/369304
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-14 13:31:30 -04:00
Daniel Verkamp
15337ade6b changelog: add vhost-blk, GPT
Change-Id: Iedae857cba4d69278013c31395515062bfa2f829
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/367741
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-14 13:07:03 -04:00
Daniel Verkamp
92a9961f83 doc/bdev: add configuration info for GPT
Change-Id: I326963cd0646a9ed9f05e6001de966ecde179464
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369085
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-14 13:07:03 -04:00
Daniel Verkamp
e283c385e7 iscsi: fix AHS handling
Previously, we had a pdu->ahs pointer that was always NULL (never set
anywhere), and we would try to read data into this NULL pointer if the
initiator ever sent a PDU with a non-zero TotalAHSLength.

Rename the existing ahs_data array in the PDU to just "ahs" to minimize
the necessary changes.  We never actually dereference the ahs structure,
so its type is not important. (We can cast it later if we add support
for anything that requires an AHS.)

Change-Id: I10d19a6e0d99f326794cbe6469eacedadc634c67
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369315
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-14 11:14:21 -04:00
Jim Harris
a6014eb2ad blobfs: process one set_xattr at a time
During RocksDB testing with MySQL, we found cases
where blobfs would try to update and sync the length
xattr on the underlying blob while an existing update
was already in progress.  This was primarily driven
by RocksDB performing appends and syncs on the log
file from multiple writer threads.

The simplest way to fix this is to just process one
sync_request at a time.  There could be a tiny bit
of inefficiency here if multiple threads are appending
and syncing a file in parallel - we can look at some
additional optimizations if we find a case where that
is noticeable.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reported-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: Changpeng Liu <changpeng.liu@intel.com>
Change-Id: I7ab7814494d365bae8716efd0b828337286cc7b7

Reviewed-on: https://review.gerrithub.io/369490
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-07-13 19:53:25 -04:00
Karol Latecki
86538ffa24 test/vhost: remove tee pipe from vhost start command
Also restoring vhost block tests in autotest.

Change-Id: Idc6a3068650ce28636f4709df5a51029bfddbcdd
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/369470
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-13 19:18:18 -04:00
Daniel Verkamp
d72ff7f825 configure: fix up inconsistent indentation
Whitespace modifications only, no functional change.

Change-Id: I984bd4299a7a49d116bee6f723f71e094ecd2209
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369483
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-13 17:28:00 -04:00
Daniel Verkamp
4560c2bf89 autotest: explicitly remove /usr from coverage
The lcov --no-external option seems to still generate coverage data for
e.g. /usr/include/c++/4.8.2/tuple on some test pool machines, contrary to
the description of the option.  Add an explicit removal of all /usr file
coverage at the end of the test run to work around it.

Change-Id: I8579813b1b76b4bfdef86748e88352bf232df954
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369305
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-13 15:48:07 -04:00
Daniel Verkamp
2bcabb2004 jsonrpc: remove incorrect handling for send() == 0
recv() returns 0 when the remote end of the connection is shut down, but
there is no such rule for send().  Remove the incorrect treatment of
send() returning 0 as an error.  The remaining code will treat a send()
return value of 0 as a non-error condition and will continue to work
correctly.

Change-Id: Ia753b802d95428104a62d1acb13c5fa437add6b4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369299
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-13 15:47:56 -04:00
Daniel Verkamp
684dd86f34 vhost_iommu: handle realloc() failure
Change-Id: I50203e0e02d2201fea5112789c1fd84b9a61417a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369283
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-13 15:47:33 -04:00
Changpeng Liu
4c408e7924 rocksdb: set errno to support Myrocks engine
Myrocks engine uses errno(ENOENT) as one of the condition
to create new database, this is okay for POSIX environment,
to support MySQL, spdk environment layer set errno to right
value as well.

Change-Id: Ib633f915ffafde0eacc0a8a0c451e510396d9176
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/369320
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-13 15:43:55 -04:00
Jim Harris
4ce7dd66cd test/vhost: disable vhost-blk tests
The vhost blk tests are causing a lot of intermittent
failures in the test pool.  Disable for now while this
is debugged further.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia49db7b48b5850e92f60983348c13f724c8895c0

Reviewed-on: https://review.gerrithub.io/369323
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-07-13 01:23:35 -04:00
Daniel Verkamp
2c28fa5426 test/json_util_ut: assert that string is valid
Make sure the output.my_name pointer is not NULL before calling memcmp()
on it.  Fixes static analysis warning about a potential NULL pointer
dereference.

Change-Id: I85faf57c63b0760c4f90d9ee99f6d7e3df121211
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369264
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 18:13:23 -04:00
Daniel Verkamp
cb29ce869f bdev/gpt: dump partition name
Change-Id: I1899a47fa9d9821c16ea648bbe3290f6306d0e3d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368626
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 18:12:52 -04:00
Daniel Verkamp
429672d31b json: add function to write UTF-16LE strings
spdk_json_write_string_utf16le() writes a UTF-16LE string to a
JSON write context.

Change-Id: I413ffb8a3dee6e1b44ec96ce2415fd1b9c36320f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368625
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 18:12:52 -04:00
Daniel Verkamp
229f64942d test/bdev_ut: fix build with --with-vtune
Change-Id: Iaed5e670bef4ef5e588c9df4858f4d1ff240df58
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369273
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <roman.sudarikov@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 18:11:50 -04:00
Daniel Verkamp
cc7407947b jsonrpc: avoid calling poll() with a closed fd
If a connection is closed by the remote end, the JSON-RPC server could
potentially call poll() on the pollfd containing the invalid file
descriptor.  Rework the logic so that the pollfd's fd field is set to a
negative value so that poll() will ignore it until the connection is
fully cleaned up by spdk_jsonrpc_server_conn_remove().

Also add handling for the potential error conditions returned by poll()
so that if something does go wrong, the server doesn't get stuck polling
a broken pollfd forever.

Change-Id: Id02e3a230740c8ffd513888cb0564891b3aca069
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369285
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 17:43:22 -04:00
Daniel Verkamp
122e284652 jsonrpc: move closed conn handling before poll()
Make sure that we check any closed connections even if poll() indicates
that no sockets are ready, since closed sockets won't ever trigger
poll().

Change-Id: Ie543cc2848d07f3d8e22662cb22c3d0f5cf3d174
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369292
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 17:43:22 -04:00
Pawel Wodkowski
7f6b78611a vhost_blk: don't abort on bdev hotremove
Virtio block doesn't know how to handle hot-remove so no way of
informing guest when that happen but at least we don't crash.

Change-Id: I54576bc0693c2e706ef3c45b0de313e9beb2a2c7
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/368789
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 13:21:50 -04:00
Dariusz Stojaczyk
fa15dc611a scsi: removed dev->maxlun field
This variable was misleading and unnecessary. Replaced all it's
occurences with SPDK_SCSI_DEV_MAX_LUN.

Change-Id: Iaaf9ed5efb60f9a89585121d2fbec7b43c3723e9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/368115
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 13:16:55 -04:00
Daniel Verkamp
f25f84b796 scsi: fix off-by-one error in spdk_scsi_dev_get_lun()
lun_id could potentially overflow the dev->lun array bounds if it was
equal to dev->maxlun, which is actually the maximum lun array index plus
one, not the maximum valid LUN index.

Change-Id: I5662c6f6fa634a7dd755c9bfc1a24d3c4cabe7ea
Reported-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369074
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 13:16:55 -04:00
Dariusz Stojaczyk
e2f42584b0 vhost: renamed MAX_VRINGS define to MAX_VQUEUES
Renamed it to avoid misconceptions.
Struct rte_vhost_vring describes a virtqueue, not a vring.

Change-Id: I89b94c8d78052b1a4796a9b74653237e5f8b6f52
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/368720
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 13:14:26 -04:00
Jim Harris
8bf4c089f6 bdev: initialize vbdev modules first
This allows vbdev modules to be ready for examine
calls for (physical) bdev modules when the latter
initialize.

This requires the following modifications to existing
bdev modules:
1) error and split now search their config sections
   at examine time (instead of init) to see if the
   bdev should be consumed by the vbdev module
2) gpt is simplified considerably - it no longer
   needs to save bdevs to examine when
   gpt initializes later
3) nvme must register its io device before registering
   the bdev, since vbdevs may immediately start trying
   to send I/O to the new nvme bdev

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8fe5686092ffb15fc8bdbc068b09add229d9da6c

Reviewed-on: https://review.gerrithub.io/368598
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:42:56 -04:00
Jim Harris
2c83a481e1 bdev: defer spdk_bdev_init_complete for async registration
Add additional fields to the g_bdev_mgr to enable
deferring spdk_bdev_init_complete when modules have
finished initialization, but vbdevs are still processing
examination callbacks due to asynchronous I/O.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I12dc7cb08e44e022b5bad75ba9a946571eb65957

Reviewed-on: https://review.gerrithub.io/368832
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:42:56 -04:00
Jim Harris
e075a3dc7a bdev: track number of outstanding examinations
Add a new spdk_vbdev_module_examine_done() API which
vbdev modules can use to notify the generic bdev layer
once a base bdev examination is complete.

This is especially required for asynchronous vbdevs
like GPT which must issue I/O to the base bdev.

As part of this patch, add examine callbacks
for both split and error, which for now only call
this new functions.  Later patches will move code from
the init callback to the examine callback for these
modules.  examine callbacks are now required for all
vbdev modules.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I49f2d012d1675b878bcd23afff427c740c6502c7

Reviewed-on: https://review.gerrithub.io/368831
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:42:56 -04:00
Jim Harris
7abb7cb83e bdev: change bdev_registered to examine
This eliminates overloading of the term "register"
in the context of bdevs, as well as opens up the
idea of examining bdevs not just when they are
registered, but also after they are closed with
write access.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9e15f9dc0fa4e02214f188f987f9da2dbc8db1f7

Reviewed-on: https://review.gerrithub.io/369042
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:42:56 -04:00
Jim Harris
5533c3d208 util: defer put_io_channel
With vbdevs, there are many more cases where the last
(or only) channel for a given I/O device may be destroyed
in the context of the poller for that I/O device.  To
avoid returning to the poller and having it check
for data on a resource that was just released, instead
defer the actual put_io_channel work via
spdk_thread_send_msg().

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic99776bddbe9a305f221f8c094ea97dce2d6df0b

Reviewed-on: https://review.gerrithub.io/368619
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:42:56 -04:00
Jim Harris
be2cb0c535 test/bdevio: add delay before starting unit tests
This is a bit of a workaround for some upcoming changes
where bdev subsystem initialization will not wait for
all vbdevs to finish tasting all bdevs that are registered.

We need to allow those vbdevs to clean up after themselves
after doing their initial tasting, before we start the
unit tests, since the unit tests are blocking and won't
return to the reactor loop to allow asynchronous tasting
I/O to get returned to the vbdev modules.

Eventually we should consider modifying bdevio run
asynchronously, maybe including removing its use of CUnit
for test reporting.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6c425dd2711ce06fb6df1678f08294d6228c9ae4

Reviewed-on: https://review.gerrithub.io/368616
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:42:56 -04:00
Jim Harris
4794c791de bdev: add pointer to module structure
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic3051b63942770e45be22af0ae03a78a7c543f81

Reviewed-on: https://review.gerrithub.io/368597
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:42:56 -04:00
Daniel Verkamp
0bb3618a99 vhost_scsi: check for task allocation failure
Change-Id: I03e63985907d7330373b1883652cd27a0cf466db
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369081
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:20:56 -04:00
Daniel Verkamp
4e003b6714 jsonrpc: allow asynchronous request completion
Move the per-connection send buffer into each request, and allow a
connection to have a queue of responses ready to be sent.

Change-Id: If6b2151691c4cd76f3cf7cde0cdd8f20cac77ceb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368470
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-12 12:10:31 -04:00
Daniel Verkamp
977fd23033 jsonrpc: dynamically allocate request object
This will be necessary when the lifetime of a request can exceed the
lifetime of the values stored in spdk_jsonrpc_server_conn.

Change-Id: Icd9772eb142e3f6ae69303aff1e12bc213f435a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368455
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 12:10:31 -04:00
Daniel Verkamp
35d46267b8 jsonrpc: remove support for batch requests
This will greatly simplify the implementation of asynchronous requests,
and asynchronous requests also allow clients to submit multiple
overlapped requests, making batches unnecessary for executing multiple
RPCs at once.  Additionally, our RPC client (scripts/rpc.py) does not
use batch requests.

Change-Id: I2529793c54b43acbacd934d82926aa32e286210c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368449
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-12 12:10:31 -04:00
Pawel Wodkowski
1eaba102ed vhost_blk: fix error code in IO path and simplify process_blk_request
Failures in IO path should return VIRTIO_BLK_S_IOERR instead
VIRTIO_BLK_S_UNSUPP.

Change-Id: Ic0a36ae95b16e15c1e0c67e9e5c848b14ad0ba75
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/368788
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-11 18:34:17 -04:00
Daniel Verkamp
ac4398a31d log: set print level when enabling tracelogs
The default print level used by the apps is SPDK_LOG_NOTICE, which will
prevent the tracelogs from being shown.

Change-Id: I5f136e8aa0be0aa7634c7dd72231f2c23b129e51
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368803
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-11 18:02:47 -04:00
Daniel Verkamp
a3fd882901 vhost_scsi: fix build error after last merge
struct spdk_vhost_task was renamed to spdk_vhost_scsi_task in commit
68f0c87e64, but this was rebased without
adjusting the spdk_vhost_task introduced by commit
05fd28399a.

Change-Id: I7046d04d3ce56d62fdfb1166f8b4c5676bc7397b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369080
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-07-11 17:53:44 -04:00
Paweł Niedźwiecki
68f0c87e64 vhost_scsi: renamed "vhost_task" to "vhost_scsi_task"
Change-Id: I76f3468aab3213594db6c3242166e00926c95575
Signed-off-by: Paweł Niedźwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/368781
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-11 17:28:25 -04:00
Karol Latecki
5dd160bde6 test/vhost: Modify wait time for vhost start in fiotest
Look for open RPC port instead of issuing "sleep" for a
number of seconds.

Change-Id: Id75476ae3d6c39de7f7da2c0878d251384c2bb65
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/364974
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-11 17:27:30 -04:00
Pawel Wodkowski
05fd28399a vhost_scsi: fix bug with tasks enqueue/dequeue
We need MP MC ring for tasks. So instead implementing this add per
controller ring to avoid this issue.

Change-Id: I5926ad7866ab28251aeebd163917de2df2b44a22
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/368547
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-11 17:23:25 -04:00
Jim Harris
5586209634 bdev/gpt: change get_ref function to void
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I96cf4e40e8218c6ba150fe9ffead58340c7bdf6a

Reviewed-on: https://review.gerrithub.io/368627
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-07-10 20:53:51 -04:00
Fam Zheng
ee263a80fc vhost: Fix spdk_iommu_mem_unregister
The function body uses VFIO_IOMMU_MAP_DMA which appears to be a
copy&paste mistake, make it VFIO_IOMMU_UNMAP_DMA because we are doing
the opposite of spdk_iommu_mem_register.

Change-Id: If9f3b188178e71ff71221c77c1680b679fec1df0
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-on: https://review.gerrithub.io/368551
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-10 20:27:28 -04:00