Commit Graph

144 Commits

Author SHA1 Message Date
Jim Harris
a137b9afd0 blob: queue sync requests if one already in progress
For any given blob, if an spdk_blob_sync_md() operation
is already in progress, queue additional spdk_blob_sync_md()
operations until the previous one completes.

This ensures proper ordering of writing metadata to
disk.

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

Reviewed-on: https://review.gerrithub.io/401257
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-03-12 16:24:40 -04:00
Piotr Pelplinski
7029a8868a blobstore: add internal xattrs for creating blob
This patch adds possibility to set internal xattrs on blob

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I2d0f14558e4a1af7071ee1a4f59aaf9f14bea2d9
Reviewed-on: https://review.gerrithub.io/396418
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
2018-03-08 11:34:15 -05:00
Piotr Pelplinski
c26c4e9fb4 blobstore: Add a blob_bs_dev that provides back_bs_dev for clones
Unit tests implemented in following patches.

This is rebased patch from https://review.gerrithub.io/#/c/396648
merged as commit c1174e6895
and reverted in 0847f27b54.

Change-Id: I3d152bf7847c83bf75149edd61564c1f393927d8
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Reviewed-on: https://review.gerrithub.io/402529
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-08 11:34:15 -05:00
Tomasz Kulasek
ca571b1563 blobstore: allow internaly get xattr value even in loading state
For some xattrs we need to know its value even if blob is in loading
state, e.g. BLOB_SNAPSHOT xattr value when blob is loading.

Change-Id: I1cd7805cf33be64cf59792f85a270e9b536e23bd
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/403062
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
2018-03-08 11:34:15 -05:00
Tomasz Zawadzki
b86c4b6541 blob: persist super_blob id on blobstore immediately
Before this patch super_blob id for blobstore was persisted
only during spdk_bs_unload. If power fail occurred after creating and
syncing blob, super_blob id was lost within blobstore.

Lvol store metadata would be lost, if proper shutdown
didn't occur in first SPDK instance run since creation of lvs.

This fix changes setting super blob to be instantly persisted
on disk in super block. Without affecting clean bit in super block.

Change-Id: I578f1fc8717e2d7968ad506fa4dead7507a5e0b4
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/398804
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-03-08 00:14:36 -05:00
Tomasz Kulasek
3e717065d4 blobstore: fix missing debug logs
Change-Id: I5e636c4c9d930de0d9e6eadd453f0d17eadaf45e
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/402530
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@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>
2018-03-07 11:12:56 -05:00
Daniel Verkamp
8a6ba58cb4 scripts/check_format: check for spaces before tabs
Automatically detect more whitespace errors.

All existing cases are fixed; only whitespace change (verify with
diff -w) except for one comment style fixup in include/spdk/nvme.h.

Change-Id: If750e54b9c8e3421ea6feda5f20184a31431631e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/402360
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2018-03-05 11:09:13 -05:00
Daniel Verkamp
0847f27b54 Revert "blobstore: Add a blob_bs_dev that provides back_bs_dev for clones"
This change wasn't correctly rebased and needs to be updated to compile
against the current blobstore.

This reverts commit c1174e6895.

Change-Id: I529608bee7323cb626d8c36dff15adc9ba24ad26
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/402352
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-02 15:05:45 -05:00
Piotr Pelplinski
c1174e6895 blobstore: Add a blob_bs_dev that provides back_bs_dev for clones
Unit tests implemented in following patches.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ib18c9060f527bd22bfdbed74e96871a6e0551ead
Reviewed-on: https://review.gerrithub.io/396648
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-02 14:09:09 -05:00
Piotr Pelplinski
4dc04dc679 blobstore: bugfix, pass proper spdk_io_channel to bs_dev
Currently only thin_provisioned zeroes back_bs_dev is supported.
There was no unit tests for channel in this bs_dev, because it's never used.
However, unit tests in patch https://review.gerrithub.io/c/393935/ show that channel is wrong.
This patch passed proper spdk_io_channel to callback function.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ia288ef6c35343ce533ea3f74603e73f823a18181

Reviewed-on: https://review.gerrithub.io/400955
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>
2018-03-02 14:09:09 -05:00
Jim Harris
7560f2b2a3 blob: add option to iterate all blobs during spdk_bs_load
blobfs and lvol can now use this to automatically iterate
all existing blobs during spdk_bs_load.  Changes to blobfs
and lvol will come in future patches.

This will also be used in some upcoming patches which need
to iterate through blobs during load to determine
snapshot/clone relationships.

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

Reviewed-on: https://review.gerrithub.io/400177
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 17:40:38 -05:00
Jim Harris
ee8af4e9f3 blob: fix _spdk_bs_load_ctx_fail ordering
Finish the sequence first, before calling _spdk_bs_free().
Otherwise synchronous bs_devs (like we use in the unit
tests) cause the sequence memory to get freed via
_spdk_bs_free() and then we try to finish the sequence.

This eliminates the need for g_scheduler_delay and
_bs_flush_scheduler() in the blob unit tests.  But don't
remove them - they will be useful in upcoming unit tests
for queued persist operations.

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

Reviewed-on: https://review.gerrithub.io/401267
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
758a42f692 blob: add _spdk_blob_persist_start
No functional change - this just separates out the
code that creates the persist ctx from the code that
actually performs the persist operation.

Part of series to enable queuing persist operations -
this will be useful for starting a previously queued
persist operation.

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

Reviewed-on: https://review.gerrithub.io/401255
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
d5adb95226 blob: use _spdk_blob_persist_complete for all persist error paths
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaef32731b05a53ac0707524d78086eedc89d6af6

Reviewed-on: https://review.gerrithub.io/401254
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
cb42aa1dce blob: clean up some blob->state checks
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I096fb24dd2fe2fc4dd97d80c957c328d960fb867
Reviewed-on: https://review.gerrithub.io/401073
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
4661f2aef3 blob: always use _spdk_blob_persist to check for CLEAN state
spdk_blob_close() and spdk_blob_sync_md() currently do their
own CLEAN state.  To consolidate the state checking code,
have both functions rely on the check in _spdk_blob_persist()
instead.

This will reduce code but more importantly is needed for
some upcoming changes for queuing persist operations.

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

Reviewed-on: https://review.gerrithub.io/401065
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
4f6096fa10 blob: add _spdk_blob_verify_md_op
These are common functions that can be called from
any function that reads or modifies a blob's metadata to
perform necessary asserts.

This will also fix several places where blob metadata
functions were asserting the calling thread context,
but not the current state of the blob.

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

Reviewed-on: https://review.gerrithub.io/401053
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
7d4705a257 blob: remove SPDK_BLOB_STATE_SYNCING
All metadata operations are now done on the metadata
thread, so we no longer have to worry about one thread
updating in-memory metadata structures while another
thread is transferring the in-memory structures to
on-disk structures.

This does not protect against multiple sync operations
outstanding at once - that will be coming in an
upcoming path.

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

Reviewed-on: https://review.gerrithub.io/401056
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
0928d63d20 blob: add asserts for md operations on md thread
The md (metadata) thread is always the thread that
initialize/loaded the blobstore.  Metadata operations may
only be performed from this thread.  This patch adds some
more asserts in metadata functions that were previously
missed.

While here, also update some of the blobstore documentation
related to this.

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

Reviewed-on: https://review.gerrithub.io/400885
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-27 10:58:29 -05:00
Jim Harris
66fc591ff7 blob: change spdk_bs_io_xxx_blob functions to spdk_blob_io_xxx
These new names are much more clear and are aligned with other
functions such as spdk_blob_close.

Keep the old names around for now but deprecate them.  We will
remove them in next release.

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

Reviewed-on: https://review.gerrithub.io/400884
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-23 18:37:17 -05:00
Jim Harris
e14cdc7d3a blob: change spdk_blob_set_read_only to return int
This is needed for an upcoming change which will
prevent metadata functions from being called on
threads other than the metadata thread.  Without
this change, there was no way for this function
to return an error if it was called from the wrong
thread.

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

Reviewed-on: https://review.gerrithub.io/400883
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-23 15:54:12 -05:00
Jim Harris
c8efd8a8b2 blob: revert spdk_blob_data changes
There was some thinking that we would need to allocate
I/O channels on a per-blob basis to handle dynamic
resizing during I/O.  Making spdk_blob an opaque handle,
with the existing spdk_blob structure renamed to
spdk_blob_data was a first step towards making that
happen.  But more recent work on blobstore has
simplified the resizing approach, so this spdk_blob_data
is no longer needed.  So revert it.

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

Reviewed-on: https://review.gerrithub.io/400881
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-23 15:54:12 -05:00
Jim Harris
168cfd12ca blob: add _spdk_bs_load_complete
This reduces some code duplication and ensures all
successful load operations (whether or not it included
recovery after power fail) through the same function.

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

Reviewed-on: https://review.gerrithub.io/400164
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2018-02-16 11:49:47 -05:00
Piotr Pelplinski
7ba8c006c5 blobstore: allow xattrs to be set internally only for blobstore
Patch adds internal version of xattr functions to allow
operations on internal xattrs, which are not visible to
upper layers.
When there is at least one internal xattr set, also
SPDK_BLOB_INTERNAL_XATTR flag is set in invalid_flags to prevent
loading this blob in previous spdk versions.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Iec918ec858f069f7cd9f36d5e8f0495ffa4a42d8
Reviewed-on: https://review.gerrithub.io/395122
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-12 19:12:14 -05:00
Piotr Pelplinski
5f947da76b blobstore: move free xattr's to separate function
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I8b570802b05b8e03802d3c2b68a1e7644ea548ac
Reviewed-on: https://review.gerrithub.io/396572
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-02-02 16:58:06 -05:00
Piotr Pelplinski
69c9bb0153 blobstore: move xattr serialization to separate function
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I277f7288427788e7a107b143331753fd5b23f16f
Reviewed-on: https://review.gerrithub.io/396571
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: Ben Walker <benjamin.walker@intel.com>
2018-02-02 16:58:06 -05:00
Piotr Pelplinski
c287b5b4ed blobstore: move xattrs parameters passed as options to separate structure
This change will allow reusing this structure for both internal
and external xattrs as well as in functions having optional xattr,
but missing other options (i.e. snapshot, clone implemented in next patches)

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ia6619a75efa0a100168a6f8317be274823af04ab
Reviewed-on: https://review.gerrithub.io/396417
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-02-02 16:58:06 -05:00
Piotr Pelplinski
79457c51db blobstore: separate deserializing xattrs to common function
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Icba20351c9ca76397393064b41013c527084853e
Reviewed-on: https://review.gerrithub.io/396385
Reviewed-by: Ben Walker <benjamin.walker@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>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-02 16:58:06 -05:00
Maciej Szwed
33a97f2e3f blob: print error when dma allocation fails
For thin provisioned blobs we allocate dma memory
required for copying cluster from backing device.
When cluster size is too big dma allocation may fail
silently (only IO error).

Use PRIu32 to print out the cluster size, and while
here, fix two other places that were using %d to print
cluster size instead of PRIu32.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I098b1a58aee2f0d3f4ead7aa326ecdb63a5b53d8

Reviewed-on: https://review.gerrithub.io/397563
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>
2018-01-31 15:37:26 -05:00
Maciej Szwed
9103821d3e blob: make _spdk_bs_allocate_cluster thread safe
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I3c7d2096f549a88b4a9884c0026d15d3bcd8dc67

Reviewed-on: https://review.gerrithub.io/396387
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-30 17:29:53 -05:00
Maciej Szwed
4132ac52da blob: support for thin provisioned reads and writes
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ibc9609ad36188006e9454e5c799bccd8a92d7991
Reviewed-on: https://review.gerrithub.io/391422
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>
2018-01-30 15:46:18 -05:00
Ben Walker
8970f8682a blob: Add a bs_dev that always returns 0
This will be useful for backing thin provisioned
blobs in the future.

Change-Id: I78cf8cda39e8dff42da69b79ed460797d7494af1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/397043
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>
2018-01-30 15:46:18 -05:00
Jim Harris
98d28d604d blob: allow inserting cluster from non metadata thread
This will be needed for thin provisioning, since a write
I/O may result in needing to insert a cluster into the
blob and that write I/O may not have been performed
on the metadata thread.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I84b0cb6e7af87b1f9c6cab4e2c24fa26b12e2c06
Reviewed-on: https://review.gerrithub.io/396737
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>
2018-01-29 18:54:34 -05:00
Jim Harris
85a0a63eff blob: add _spdk_blob_sync_md
This enables some code reuse for future patches.

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

Reviewed-on: https://review.gerrithub.io/396736
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>
2018-01-29 12:33:05 -05:00
Jim Harris
aec7a76e36 blob: add _spdk_blob_insert_cluster()
This will be used in the upcoming thin provisioning
patches.  A thread the wishes to insert a newly
allocated cluster into the blob will send a message
to the metadata thread to perform to call this
function, and if it succeeds, sync the blob's
metadata.

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

Reviewed-on: https://review.gerrithub.io/396711
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>
2018-01-29 12:33:05 -05:00
Jim Harris
dfb102b79a blob: add md_thread to struct spdk_blob_store
For now, use this to add some assert() calls to ensure
per-blob metadata operations are only called from the
thread that initialized/loaded the blobstore.

Upcoming patches will utilize this for metadata updates
required due to cluster allocations on thin provisioned
blobs.  In that case, the cluster allocations may not
always be done on the metadata thread - but we want
the metadata thread to actually do the metadata sync
operation to guard against races from allocations on
multiple threads in parallel.

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

Reviewed-on: https://review.gerrithub.io/396712
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>
2018-01-29 12:33:05 -05:00
Piotr Pelplinski
074f4d7627 blob: set md_ro and data_ro fields only after persisting data
Currently, there is no possibility to save read only blob to disk.
This patch modifies behaviour so that read only flags are applied after syncing blob.
This is analogy to resize, set xattr and remove xattr operations.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Iffed601c78cb83231bb20e7ef05b73847dc3c95a
Reviewed-on: https://review.gerrithub.io/394243
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-01-24 15:56:15 -05:00
Maciej Szwed
68b8237cdd blob: assign iovcnt value in spdk_bs_user_op_alloc function
iovcnt value was set to 0 instead of being assigned from
input argument.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I0f7e89871357f5db9a5a34c801176bc5c7870021

Reviewed-on: https://review.gerrithub.io/395959
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>
2018-01-23 23:41:57 -05:00
Jim Harris
b2503cb335 blob: add spdk_bs_user_op_t
This allows a channel's request_set resources to be
used for queuing I/O requests.  This is needed
for upcoming thin provisioning functionality,
where we must queue I/O requests that need to
allocate a cluster, if another cluster allocation
is in progress.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie8d3e799afc0b56bc95ba5ecab11253d8bc8608f
Reviewed-on: https://review.gerrithub.io/395037
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>
2018-01-22 16:00:09 -05:00
Jim Harris
4547f9bdf8 blob: split readv/writev as separate blob calls
Now all operations (both single buffer and iov-based
payloads) which span a cluster boundary get split into
separate blob calls for each cluster.

This will simplify upcoming patches that need to do
special operations if a cluster needs to be allocated.
This code can now be added to just the single cluster
operations and not have to worry about splits.  It
will also simplify the code that will eventually queue
requests which require a cluster allocation if an
allocation is already in progress.

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

Reviewed-on: https://review.gerrithub.io/395035
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-01-22 16:00:09 -05:00
Jim Harris
7ba04e589a blob: move batch creation into single/split non-iov functions
A future patch will queue an operation in
_spdk_blob_request_submit_op_single if the cluster is not allocated
and another allocation is already in progress.  If the queueing fails
because of no channel resources, we want to fail the callback and
need to do this before creating the batch.

This causes a bit of code duplication, but in the end should make the
code easier to read.

While here, pass spdk_blob instead of spdk_blob_data to
_spdk_blob_request_submit_op_single.  This simplifies a future patch
which will need the spdk_blob when queueing an operation.  It also
incidentally makes it consistent with _spdk_blob_request_submit_op_split.

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

Reviewed-on: https://review.gerrithub.io/395196
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
2018-01-22 16:00:09 -05:00
Jim Harris
f536eb583c blob: turn non-iov splitting into additional blob calls
For I/O that do not span a cluster boundary, just issue
a single batch command to underlying block device.

For I/O that do span a cluster boundary, issue a batch
command for each against the blob (not the block device)
for each cluster accessed by the I/O.

This is all in preparation for upcoming patches which
enable thin provisioning and hence cluster allocation
in the I/O path.  It will simplify implementation of
the cluster allocation path since now that code only
needs to be concerned with a single allocation at once.

Splitting for readv/writev will be handled in a
later patch.

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

Reviewed-on: https://review.gerrithub.io/395027
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-18 16:39:50 -05:00
Jim Harris
96d11441be blob: add _spdk_blob_request_submit_op_impl()
This breaks out the logic for building a batch for
non-iov operations to a separate function.  Future
patches will do further modifications on this
new function - separating it out into two separate
functions, one for operations that span a cluster boundary
and one for those that do not.

No functional change here - this is just moving code
around to reduce size of upcoming patches.

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

Reviewed-on: https://review.gerrithub.io/395026
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-18 16:39:50 -05:00
Jim Harris
a5ecbadb2c blob: add spdk_bs_batch_xxx_blob variants
These will be used to implement user request splitting
on cluster boundaries.

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

Reviewed-on: https://review.gerrithub.io/395021
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-18 16:39:50 -05:00
Jim Harris
c46591393b blob: add _dev prefix to sequence/batch operations
This clarifies that the read/write/etc. operation is
being performaned on the block device.  This
clarification will be important in some upcoming
patches which will batch similar operations on a
blob (as part of splitting a user request into smaller
operations if it spans a cluster boundary).

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

Reviewed-on: https://review.gerrithub.io/395017
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-18 16:39:50 -05:00
Jim Harris
a2a29abcfb blob: remove sequence/batch operations for flush
These were unused in blobstore so remove them for now.
This reduces number of code changes in some upcoming
patches.

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

Reviewed-on: https://review.gerrithub.io/395016
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-01-18 16:39:50 -05:00
Maciej Szwed
0e91725631 blob: add spdk_bs_batch/sequence_read/readv_bs_dev functions
This prepares for some future blobstore.c code that will use these
bs_dev functions directly making possible to read from different device
than the one in the current context.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I55b15544ea4b53475c4b72ee5c92ff1c0a2b8c88
Reviewed-on: https://review.gerrithub.io/393781
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
2018-01-17 07:58:57 -05:00
Maciej Szwed
bf2d02b6ef blob: add _spdk_bs_allocate_cluster function
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I35779dc547e0c084086ec6d9bf44f86850cb7f05
Reviewed-on: https://review.gerrithub.io/393780
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-01-17 07:58:57 -05:00
Maciej Szwed
bd4c63b317 blob: add missing callback in spdk_blob_sync_md function
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Iadb29a8ce8dcebfea68d4feeb5f3de1bb3124f16

Reviewed-on: https://review.gerrithub.io/392286
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-01-17 07:58:57 -05:00
Maciej Szwed
65fe29f8dd blob: cluster allocation/deallocation for thin provisioned blob
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ib3470fbac49e92308ed14e20ccde6655354f2580
Reviewed-on: https://review.gerrithub.io/389577
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>
2018-01-17 07:58:57 -05:00