Commit Graph

133 Commits

Author SHA1 Message Date
Tomasz Zawadzki
5f6306ea24 bdev/gpt: free base bdev_part in gpt after examining
Currently GPT keeps the bdev it is examining open, even after determining there is no GPT on it.
It is due to spdk_gpt_base_free() not notifying bdev layer to free base bdev_part.

Additionally release of bdev module for that bdev was moved to bdev_part_free,
as the module is not claimed until bdev_part on base bdev are created.

Functional tests added to verify the changes.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id75f88259267847e8ec476d19750dc1e2690f11a
Reviewed-on: https://review.gerrithub.io/378621
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-14 13:39:29 -04:00
Jim Harris
9197acd42d bdev: free memory associated with part and part_base
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reported-by: Cunyin Chang <cunyin.chang@intel.com>
Change-Id: I94ec3a5f43839f1fa4379d2f275c4e19f81e1a52

Reviewed-on: https://review.gerrithub.io/378003
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-09-14 13:28:01 -04:00
Jim Harris
d8cdbb8931 bdev: queue resets per channel instead of per bdev
This moves towards the ability to queue ios while
a reset is in progress.

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

Reviewed-on: https://review.gerrithub.io/377827
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-12 11:16:50 -04:00
Jim Harris
70a0bc3096 bdev: add bdev_io optimizations
First, improve packing of spdk_bdev_io.  Move any
fields which must be zeroed into the first cacheline.
Also change type and status from enums (needing 4 bytes)
to int16_t which is still a far bigger range than
needed.

Next, modify spdk_bdev_get_io to only zero the
first cacheline (actually a bit less).

SPDK_BDEV_IO_TYPE_INVALID is also added, making it
explicit that 0 is an invalid value for the IO type.
Previously this was somewhat inferred.

There are still additional improvements that can
be made to this area - primarily combining
spdk_bdev_get_io() and spdk_bdev_io_init() into
a single function.

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

Reviewed-on: https://review.gerrithub.io/377799
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-12 11:16:50 -04:00
Jim Harris
c3bcdb8f8b bdev: remove return value from spdk_bdev_io_submit()
spdk_bdev_io_submit() always returns 0, so the return
value is unnecessary.  This eliminates a slew of checks
on that return value.

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

Reviewed-on: https://review.gerrithub.io/377627
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-12 11:16:50 -04:00
Jim Harris
ff9cadadb3 bdev: remove spdk_bdev_resubmit_io
We no longer support resubmitting an existing I/O to
a lower bdev.  This enables accurate tracking of I/O
at each bdev layer for purposes of reset handling and
QoS.

__submit_request() in bdev.c is now only called
from spdk_bdev_io_submit(), so just collapse these
two functions together while we are here.

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

Reviewed-on: https://review.gerrithub.io/377626
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-12 11:16:50 -04:00
Jim Harris
85cc223946 bdev: add common partition helper functions
split, gpt and error all have a lot of similar code, and
are based on the presumption of one or more "partition" bdevs
on a "base" bdev.  This results in quite a bit of duplicated
code between these three bdev modules.  The error bdev
module does follow this same model - it just always has only
a one-to-one mapping between the error bdev and its base bdev.

As all of the modules move to allocating their own bdev_io
rather than allowing for adjusting an existing bdev_io and
resubmitting it, there will be even more duplicated code
between these modules.

So this patch adds a set of helper functions in the common
bdev library to eliminate all of this duplicated code.

This patch also moves the split module to use it - future
patches will also convert gpt and error.

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

Reviewed-on: https://review.gerrithub.io/376423
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-12 11:16:50 -04:00
Daniel Verkamp
e83f976743 bdev: introduce APIs with block units
Add new versions of all of the I/O calls that take parameters in blocks
instead of bytes.  These are intended to replace the old APIs, but
we'll keep them for now to preserve compatibility.

Change-Id: I85ab665c653e8c697016c628837d49aa0c3bfcd0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376255
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-09-06 13:01:13 -04:00
Daniel Verkamp
7394f69054 bdev: convert bdev module APIs to use blocks
The bdev modules now take all read, write, unmap, and flush requests in
terms of blocks rather than bytes.

The public bdev APIs still accept offset and length in bytes for now.

Change-Id: I57f0955d52272f57755f0ff4dbc56721fdc2ef51
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376037
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-09-06 13:01:13 -04:00
Dariusz Stojaczyk
c5ff3d7d26 bdev: make module init asynchronous again
bdev_virtio requires us to do SCSI inquiry for
each device and wait for a response. It currently
polls inline for this response, taking up entire
reactor exclusively. Making it async would allow
other pollers to run while bdev_virtio still has
to wait.

Change-Id: Iefc88e0a2efb5b791ffe23b2e623b7c50d759084
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375573
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-01 18:16:46 -04:00
Dariusz Stojaczyk
5557843311 bdev: cleaned up module init
Removed duplicated code.

Change-Id: Id50466f97932db580f29c1ca5cc6f5a20c134707
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375727
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-01 18:16:46 -04:00
Dariusz Stojaczyk
e237ce317e bdev: don't continue on module init error
spdk_bdev_init_complete could have been called twice.

While here, also simplify bdev_initialize error path.
On allocation failure, bdev subsystem will now finish
with bdev_mgr->module_init_complete set to false.

Fixes: 7fefd60fab ("bdev: make module init synchronous again")

Change-Id: Ia4b5d571d26beb34f0e6c0f4c7b3176215eec69f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375572
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-01 12:36:59 -04:00
Daniel Verkamp
932a186b4c log: remove uses of SPDK_TRACE_DEBUG
Replace SPDK_TRACE_DEBUG with component-specific flags.

Change-Id: Iee7eafab5e6ac8713f247323a18552b5afb0e86a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375834
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-08-29 15:07:13 -04:00
Daniel Verkamp
d92f0f75ca log: rename SPDK_TRACELOG to SPDK_DEBUGLOG
This matches the name to the behavior and prepares for addition of a new
log macro for "info" log level.

Change-Id: I94ccd49face4309d3368e399528776ab140748c4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375833
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-08-29 13:25:58 -04:00
Jim Harris
2a75143441 bdev: change bdev_io flush "length" to "len"
This makes it consistent it with other parts of this structure.

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

Reviewed-on: https://review.gerrithub.io/375494
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-28 13:06:37 -04:00
Jim Harris
f054577df1 bdev: remove gencnt
gencnt is no longer really used since there is no more
differentiation between "soft" and "hard" reset.  The
original idea was that a hard reset would complete I/O
known to the bdev layer even if the underlying bdev
module had not actually completed it yet.  We do not
actually support that concept, and it was a bit flawed
anyways.

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

Reviewed-on: https://review.gerrithub.io/375484
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-08-25 13:12:04 -04:00
Dariusz Stojaczyk
2705f6f10d Fixed all SPDK_LOG() calls without newline char
Change-Id: Ib9a6b3e7584c5edd8f8c0f8cd20349d86651a5a2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/374780
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: Ben Walker <benjamin.walker@intel.com>
2017-08-18 18:56:51 -04:00
Daniel Verkamp
45d4b1973a bdev: add API to get optimal I/O boundary
Allow passing the NVMe namespace optimal I/O boundary through the bdev
layer.

Change-Id: I27a2d5498df56775d3330e40c31bd7c23bbc77a5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/374532
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-08-17 17:56:18 -04:00
GangCao
264a611c49 bdev: add the PID to the mempool allocation
Change-Id: I6c8c50639e31f79e2ec5fd560db20011c975484b
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/374610
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-08-17 13:41:28 -04:00
Seth Howell
670dc20f63 bdev: add write_zeroes function
Add functionality to the bdev layer to handle the nvme write_zeroes
function.

Change-Id: I0dadad273b28c16db5a2275f7d8d57e98253a8d3
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/372171
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-08-15 15:27:09 -04:00
Daniel Verkamp
3754eedc9b bdev: validate I/O offset block alignment
Change-Id: I33506d6b9ff09c45c057326f7339d742eebc45b4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/372861
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-08-07 17:48:22 -04:00
Daniel Verkamp
8f823b93cf bdev: make spdk_bdev_io_valid() return bool
Swap the meaning of the return value to match the name of the function.

Change-Id: I89dc09e3b309a06586adf2ab750092f06077ffd9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/372859
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-08-07 17:48:22 -04:00
Ben Walker
60c38d4022 bdev: Change unmap to use offset/len instead of descriptors
This is far simpler, although it does limit the bdev
layer to unmapped just one range per command. In practice,
all of our code reports limits of just one range per command
anyway.

Change-Id: I99247ab349fe85b9925769e965833b06708d0d70
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/370382
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-08-04 20:03:37 -04:00
Dariusz Stojaczyk
f84616102b bdev: allow closing descriptor from it's remove_cb
bdev could be unregistered multiple times when all it's descriptors have
been instantly closed via it's remove_cb without any deferred
event/poller

Change-Id: I128716077b0512c6334bdd113220684f8cfcbecb
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/370949
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-25 15:55:58 -04:00
Dariusz Stojaczyk
73358c99e1 util/nvme: added io_device unregister callback
Patch afe860ae deferred freeing the io_device. However, for nvme, the
io_device context (spdk_nvme_ctrlr) is still being destructed before
io_channels are destroyed, causing segfaults on hotremove.

This patch defers io_device context destruction and fixes nvme
hotremove.

Fixes: afe860aeb1 ("channel: Correctly defer unregisters if channels exist")
Fixes: 5533c3d208 ("util: defer put_io_channel")

Change-Id: I7af699174cac0c6c6a6faa2cc65418c47347eb9a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/370459
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-20 16:07:02 -04:00
Roman
5b53b568e4 add VTune support: spin-wait stat
Change-Id: Ie25a87c4b3f781299fa744fdcff6c9a63d473935
Signed-off-by: Roman <roman.sudarikov@intel.com>
Reviewed-on: https://review.gerrithub.io/365723
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-07-18 15:33:56 -04:00
Dariusz Stojaczyk
25499c4dba bdev: mark bdev as opened for write when claiming it
Otherwise we'd fail sanity checks when closing the claiming descriptor.
Current approach works because we never close the claiming descriptor.

Fixes: 4fc7e66614 ("bdev: add vbdev claim/release semantics")

Change-Id: I1c1f0c11450e749419726df460334ab97b43b584
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/370179
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-07-18 15:33:22 -04:00
Dariusz Stojaczyk
32f86a5f34 bdev: don't call recursively desc->remove_cb on bdev removal
When device has more than one open descriptor, remove_cbs of particular
descriptors could be called more than once.

Consider the following scenario:
bdev X with 2 open descriptors A and B.
X is removed (hotremoved for instance)
bdev_unregister(X) is called
  * bdev->status = REMOVING
  * A->remove_cb is called
    * some poller is started
  * B->remove_cb is called
    * another poller started

* poller from A->remove_cb finishes it's work and closes the desc:
  * bdev_close(A)
    * A is removed from bdev->open_descs list
    * bdev->status is REMOVING, so bdev_unregister(X) is called again!
      * B->remove cb is called again!
        * another poller starts? segfault?

Fixes: 57d174ff67 ("bdev: add spdk_bdev_open/close")

Change-Id: I0a898ec0aee521d0b2a1168fe7d469cc41a8ef4f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/369727
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-17 19:06:42 -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
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
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
Jim Harris
908cab3f1c bdev: populate module_name
Add a name parameter to the MODULE_REGISTER macros, and then
modify each bdev module to pass a string for its name.

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

Reviewed-on: https://review.gerrithub.io/368596
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-10 19:17:08 -04:00
Jim Harris
57d174ff67 bdev: add spdk_bdev_open/close
Retire the old claim/unclaim semantics in favor of
open/close.  Clients must now open a bdev to get
an spdk_bdev_desc, then pass this desc to get an
I/O channel.

This allows multiple clients to open a bdev,
although only one may open a bdev with write
access.

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

Reviewed-on: https://review.gerrithub.io/367611
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-05 18:04:28 -04:00
Jim Harris
7f6c737a25 bdev: add virtual to base bdev relationships
Each virtual bdev now has a pointer to its base
bdev, and a base bdev has a pointers to any virtual
bdevs built on top of it.

Also add a new set of leaf iterators, to get only
bdevs that have no virtual bdevs built on top of
them.  These iterators are now used by the bdevio and
bdevperf utilities, in advance of the claim/unclaim
semantics getting removed in a future patch.

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

Reviewed-on: https://review.gerrithub.io/367610
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-05 15:09:46 -04:00
Ben Walker
c224997be5 bdev: Remove direct calls to start/stop pollers
Abstract these through the bdev API to break this
dependency on the event framework.

Change-Id: I108505bf27e94b2985f53d0a4dc0b847ae264d25
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/366340
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-22 10:47:31 -04:00
Ben Walker
90779f58c7 bdev: Move event subsystem initialization to event_bdev
This breaks the dependency on the event subsystem logic.

Change-Id: Ic47a219bc1e272c3421b265f74bba959e1aa5f62
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365730
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-06-20 16:58:35 -04:00
Ben Walker
4c0eaac47a bdev: Create a separate bdev subsystem library
Much like bdev modules inside the bdev directory,
add a subsystems directory inside of event. The subsystem
specific code for the bdev library is placed in to
a separate library in that directory, breaking the
strict dependency of the bdev library on the event subsystem
code.

Change-Id: I255941b823a9ec3e2d62f22a586414949d8ff5ad
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365055
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-16 13:10:26 -04:00
Jim Harris
3e4ac61d92 bdev: only allow one reset per io_device at a time
This also requires vbdev modules to call spdk_bdev_reset
explicitly on the base bdev, rather than just resubmitting
the original reset bdev_io.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie33d506f68506096306c9f0a9ff5e11141578b15
Reviewed-on: https://review.gerrithub.io/365712
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-06-15 19:51:27 -04:00
Jim Harris
dfa0618d29 bdev: simplify completion callback deferring
We can do all of the completion work first, and then
make the decision at the very end on whether to
defer the callback or not.

This also removes the bdev_io defer_callback member -
we no longer need it since we now only defer the
callback itself, instead of deferring the full
execution of the spdk_bdev_io_complete() routine.

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

Reviewed-on: https://review.gerrithub.io/365711
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-15 19:51:27 -04:00
Jim Harris
03e0a3027f bdev: remove parent/child I/O related code
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia45876fb6f0eefd987cdb36521ecb591ef1f9499

Reviewed-on: https://review.gerrithub.io/365669
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-06-15 13:37:50 -04:00
Jim Harris
80161622b8 bdev: defer completion on resets
This ensures a reset is completed after any I/O completions
that may have been deferred.

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

Reviewed-on: https://review.gerrithub.io/365663
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-06-15 13:37:50 -04:00
Daniel Verkamp
22a11feeb1 bdev: use spdk_thread_send_msg() to defer completion
Switch from the SPDK event library event to the spdk/io_channel.h thread
message abstraction.  This partially decouples the bdev layer from the
SPDK event library.

Change-Id: I2300b8d84c357d6d8cab0d370d7681e948fe97d0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365077
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-06-13 11:37:13 -04:00
Ben Walker
89ad3f3d6b nvme: Abort outstanding commands when qpair is deleted
These commands should be treated as aborted by spec,
so correctly deliver abort notifications when a
qpair is deleted.

Change-Id: I8af47a3f42f5695ef8e1a70813662e69102720b2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364681
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-09 13:49:13 -04:00