Commit Graph

103 Commits

Author SHA1 Message Date
Jim Harris
f01146ae48 blob: use uint64_t for unmap and write_zeroes lba count
Previous patches (5363eb3c) tried to work around the
32-bit unmap and write_zeroes LBA counts by breaking
up larger operations into smaller chunks of max size
UINT32_MAX lba chunks.

But some SSDs may just ignore unmap operations that
are not aligned to full physical block boundaries -
and a UINT32_MAX lba unmap on a 512B logical /
4KiB physical SSD would not be aligned.  If the SSD
decided to ignore the unmap/deallocate (which it is
allowed to do according to NVMe spec), we could end
up with not unmapping *any* blocks.  Probably SSDs
should always be trying hard to unmap as many
blocks as possible, but let's not try to depend on
that in blobstore.

So one option would be to break them into chunks
close to UINT32_MAX which are still aligned to
4KiB boundaries.  But the better fix is to just
change the unmap and write_zeroes APIs to take
64-bit arguments, and then we can avoid the
chunking altogether.

Fixes issue #2190.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I23998e493a764d466927c3520c7a8c7f943000a6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9737
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-10-14 08:17:16 +00:00
Tomasz Zawadzki
e4070ee0e0 so_ver: increase all major versions
To allow SO_MINOR updates on LTS for the whole year it is supported,
the major version for all components needs to be increased.
This is to prevent scenario where two versions exists with matching
versions, but conflicting ABI.
Ex. Next SPDK release adds an API call increasing the minor version,
then LTS needs just a subset of those additions.

Increasing major so version after LTS, allows the quarterly releases
to update versions as needed. Yet allowing LTS to increase minor
version separately.

Disabled test for increasing SO version without ABI change, as
that is goal of this patch. This check shall be removed with SPDK 21.04
release.

This patch:
- increases SO_VER by 1 for all components
- resets SO_MINOR to 0 for all components
- removes suppressions for ABI tests

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I44d01154430a074103bd21c7084f44932e81fe72
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6167
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-05 14:43:47 +00:00
Ziye Yang
9472eecbdb blob: Make the ABI compatibility of spdk_blob_open_opts structure.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I8627347f44f0a9cb4b50f41ac5effae18b427c6d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5701
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-12-29 07:55:22 +00:00
Ziye Yang
b47f0f20b7 blob: Make the ABI compatibility of spdk_blob_opts structure.
Change-Id: I1b1806864783e944d8f55c9393228a1954051236
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5687
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-12-29 07:55:22 +00:00
Ziye Yang
3de9887d6d blob: Make the ABI compatibility for spdk_bs_opts
The purpose of this patch is to make spdk_bs_opts
for compatiblity issue.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I26d2a6bc644feede64d48890c7903f224b1fc306
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5681
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-12-29 07:55:22 +00:00
Jacek Kalwas
296a6d9838 bdev: extend interface with get module ctx
Currently only nvme bdev module implements this interface. Bdev module
context (in this case spdk_nvme_ctrlr opaque handle) allows for nvme
interface usage for additional management.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I6302c9229d5f7f294a3c1472d9e8dc1519637ffb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4924
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-01 10:20:56 +00:00
Tomasz Zawadzki
4e8e97c886 log: remove internal log.h header
There is nothing left here, so remove it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib947d42bc577dbebb4650b1be885e05a80f8f8cf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4541
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI
2020-10-15 08:23:39 +00:00
Tomasz Zawadzki
2172c432cf log: simplify SPDK_LOG_REGISTER_COMPONENT
This patch removes the string from register component.
Removed are all instances in libs or hardcoded in apps.

Starting with this patch literal passed to register,
serves as name for the flag.

All instances of SPDK_LOG_* were replaced with just *
in lowercase.
No actual name change for flags occur in this patch.

Affected are SPDK_LOG_REGISTER_COMPONENT() and
SPDK_*LOG() macros.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I002b232fde57ecf9c6777726b181fc0341f1bb17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4495
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Mellanox Build Bot
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI
2020-10-14 08:00:35 +00:00
Maciej Szwed
a2606d4b5d all: Fix warnings found by gcc 9.3.0 and 9.3.1
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ie7c5b7b1c2d59a1f927eb5602f4ea5a003eff287
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2433
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-06-02 09:51:57 +00:00
Seth Howell
f7ebaeaa59 lib/lvol: remove spdk_ prefix from functions.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Ic8446a9e577e7f55f09b365f2f1e41b44f81e4bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2441
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-05-27 07:35:02 +00:00
Sochin Jiang
aaca23fb4b lvol: let thin_provision flag be consistent with Blob
I found this flag weird while debugging a lvol with
thin provisioned Blob, so make it consistent with it's Blob.

Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: Iae555020d5781dfcf4d4f072a47e9573d35b8705
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2435
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-05-22 10:42:28 +00:00
Seth Howell
0be5557cad lib: json-nbd remove spdk prefix from static functions.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Idbf8d37fbac4e3a9eff253095efb2525c9094d94
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2364
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-05-21 09:19:00 +00:00
Seth Howell
d18e63206a mk/lib: add a check that major and minor version is set for libs.
Also, while we are here, consolidate setting SO_SUFFIX to one spot.

Previously, it was possible for a library to slip through
without an SO version.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I4db5fa5839502d266c6259892e5719b05134518c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2361
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-05-21 09:19:00 +00:00
Seth Howell
bbb6368e42 lib/lvol: add a map file.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Iec2a50ca4af8fe24f011d4cc6e04606115ba45a0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2237
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-05-11 12:29:07 +00:00
Tomasz Zawadzki
eb341e7d32 lvol: do not refer to blob when create returned error
Recent improvements to blobstore code, allow proper
reporting whenever error occured.

Callback for blob_create, should not refer to the blob
pointer when the operation failed.
Defer checking spdk_blob_get_id(blob), til after checking
error code.

This has been encountered in "vhost_boot" test:
  15:20:54	# /var/jenkins/workspace/vhost-autotest/spdk/scripts/rpc.py -s /home/sys_sgci/vhost_test/vhost/0/rpc.sock bdev_lvol_create -u d605539d-2186-486f-bc3e-745e33d37072 lvb0 20000
vhost: blobstore.c:5101: spdk_blob_get_id: Assertion `blob != NULL' failed.

https://ci.spdk.io/results/autotest-per-patch/builds/8135/archive/vhost-autotest/build.log

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id926576e10a72e0d50fb65105be07c8ae8e40096
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-04-02 07:03:35 +00:00
Seth Howell
193927830d make: rev SO versions individually for libraries.
This will allow us to keep track of compatibility issues on a
per-library basis.

Change-Id: Ib0c796adb1efe1570212a503ed660bef6f142b6e
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1067
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-03-18 08:02:30 +00:00
paul luse
ea69d6d6cc lib/blob: store clear_method in per blob metadata
Accept a clear method option on blob create by adding clear_method
to the opts structure passed in to _spdk_bs_create_blob(). Store
these 2 bits in md_ro_flags so that earlier versions without an
understanding of these bits can not alter metadata.

The new metadata values will be used later in the series.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I5440645ca20b426778d13b2e544b65dc2b3b83c7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472204
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-20 09:57:16 +00:00
paul luse
27fbf685bb lib/lvol: no longer store clear_method as an xattr
Part of a longer series to make clear_method a lot easier to use and
understand. We're going to store this parm now in the blob metadata
instead of lvol xattr. That way it will be usable without having
to remove the option from lvol_create or adding to lvol_delete
(which was what the last version of this patch did for those keeping
score at home)

Note: the current use of this xattr is broken anyway, its missing
plumbing to use it on a subsequent delete so this doesn't break
anything new.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ie77a25ecdc52fd4aef6c090756c6cafe79486bc8
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470410
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2019-11-28 12:37:46 +00:00
Maciej Szwed
039b462d5a lvol: Remove blobstore on super blob creation/open error
Fixes github issue #929

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467327
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-09-09 21:56:47 +00:00
Maciej Szwed
e87e8263df lvol: Fix for lvol failed deletion flow
lvol should not only be freed but also removed
from lvols list when deletion fails.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I3a047e1cc611e71b1544ca77c256a879dd2efdae
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446619
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-02 19:23:22 +00:00
Tomasz Zawadzki
ca87060dcc lvol: add option to change clear method for lvol store creation
Default 'unmap' option stays as it was.

'Write_zeroes' comes useful when one wants to make sure
that data presented from lvol bdevs on initial creation presents 0's.

'None' will be used for performance tests,
when whole device is preconditioned before creating lvol store.
Instead of performing preconditioning on each lvol bdev after its creation.

Change-Id: Ic5a5985e42a84f038a882bbe6f881624ae96242c
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442881
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-02-28 20:50:27 +00:00
Maciej Szwed
adb39585ef lvol: add option to change default data erase method
Some users require to do write zeroes operation when
erasing data on lvol. Currently the default method is
unmap. This patch adds flag to spdk_rpc_construct_lvol_bdev
call that changes default erase method. This is also a base
implementation for possible future function for erasing
data on lvol bdev.

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

Reviewed-on: https://review.gerrithub.io/c/441527
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2019-01-23 22:25:37 +00:00
Pawel Wodkowski
1da6e2f5c5 lvol: make unique_id an array
We know how big this should be so no need to dynamically allocate it.

Change-Id: I00ae6cb7c7f525d946d213e0f58cc5fe05bcf932
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/441128
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-01-22 19:45:15 +00:00
Jie Wang
e24da0913c lvol: fix Null-checking after dereferenced
fix Null-checking after dereferenced

Change-Id: I5c9dad9c894e8d7cc9e9847c7c03d204fdbacfcb
Signed-off-by: Jie Wang <wangjie88@huawei.com>
Reviewed-on: https://review.gerrithub.io/c/439094
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-01-22 08:50:14 +00:00
Tomasz Zawadzki
3bb815ae9f lvol: exposed marking lvol bdev as read only
Added set_read_only_lvol_bdev() RPC that marks
lvol bdev as read only.
This enables to create clones off of a base lvol,
without having to create additional lvol bdev with snapshot.

Change-Id: Ic20bbcd8fbebcef157acce44bfa1da035b0da459
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440534
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-01-18 19:02:36 +00:00
Konrad Sztyber
62db4ac2cf util: added spdk_divide_round_up()
Replaced divide_round_up() from blobstore.c, lvol.c and reduce.c with
new spdk_divide_round_up() from util.h.

Change-Id: I013383ac286ca52b5c15c7fab4fb40ad97b92656
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/437649
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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-12-18 17:26:49 +00:00
wuzhouhui
fdaea1fa5a lvol: lock g_lvol_stores_mutex when access g_lvol_stores
Since we lock g_lvol_stores_mutex when add lvs to g_lvol_stores, so
logically speaking, we shoud lock g_lvol_stores_mutex whenever access
g_lvol_stores_mutex. Although I can't figure out specific scenario that
will cause contention if we don't lock it.

Change-Id: If3bdba91407f5c9d09fc16c5ec7dcb919ff9647d
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/426147
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-12-13 08:10:51 +00:00
Tomasz Zawadzki
6bba6fe9b5 lvol: check spdk_lvol for NULL before dereferencing it
Change-Id: I0f01e2ccde06fa0a5a4ff31f106381bbf3ae6020
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/433858
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-20 15:01:57 +00:00
wuzhouhui
8220121f44 lvol: _spdk_add_lvs_to_list: break loop immediately if find
Change-Id: Ic599a862dfdfbb86ebab14a9142099fc4c456b5b
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/425330
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-09-14 03:56:35 +00:00
Seth Howell
49911660c7 lvol: move null check from verify_lvol_name
This makes the implementation of that function better fit the name.
Control of checking whether the lvs is null is passed to the functions
that call verify_lvol_name

Change-Id: Iedaf3e332797af00161b91e526805151778ae679
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/424579
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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-09-05 15:59:45 +00:00
Seth Howell
84009795c5 test/unit: fix Scan-build errors in lvol tests.
Fixes two null pointer dereference errors.

Change-Id: I7d685fa54af60e6efd70f3686d4dc4dba338f555
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/424108
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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-08-31 19:09:07 +00:00
Tomasz Zawadzki
b36face57d lvol: remove destruct_req from lvol store
Since destroy_lvol_bdev was implemented, it is now more convinient
to call destroy/unload for lvol store explicitly.
Rather than using lvs struct to pass a request checked on each
lvol close/destroy.

Change-Id: I56ee626e96f8752909d1584a20fe3345c5607fdc
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/420285
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-07-26 21:55:36 +00:00
Tomasz Zawadzki
4219407a93 lvol: destroy_lvol_bdev implementation
This patch fixes lvol delete behaviour.
First, we look if there are any dependencies that disallow lvol deletion.
If there are any (i.e. dependent clones) we fail.
Otherwise we delete lvol and unregister associated bdev.

destroy_bdev no longer deletes lvol.

Fixes #345

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I99e6abded2ed3ae2742103f81fc7eb937ad1cab4
Reviewed-on: https://review.gerrithub.io/407402
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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-07-25 17:06:45 +00:00
Tomasz Kulasek
635a1aa8a9 blobstore: add decouple parent function
This patch adds an API to decouple blobs parent removing dependency
on it. Blob stays thin after this operation.

Also unit tests for blobstore inflate are improved and reused with
decouple parent functionality.

Change-Id: I96dfee467c78cf4f4d929ec7bc05263f7a23a8aa
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/410829
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-06-21 22:50:03 +00:00
Ben Walker
a83f91c29a thread: Replace #include of io_channel.h with thread.h
Change-Id: I6babd4cf990bf19b510db88bdfb0ca81e29d9252
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/414700
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Madhu Pai <mpai@netapp.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-06-12 15:24:07 +00:00
Maciej Szwed
6ce7a73912 lvol: add lvol inflate function
Change-Id: Ib999d3f082f5d632cb1aaf089504d0cd48e77539
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/408696
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-05-23 18:12:52 +00:00
Maciej Szwed
208748b423 lvol: Creating 2 lvols simultaneously with same name
This patch fixes issue where user creates 2 lvols
with the same name simultaneously. New solution
builds list of names of lvols that are currently
being created and when new request comes it compares
name against existing lvols and lvols that are in the
process of creation.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I31b59ee13b5b9bae531866925dd409b143f08ad4
Reviewed-on: https://review.gerrithub.io/407408
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-04-17 14:03:22 -04:00
Tomasz Kulasek
2da6293e85 lvol: add UUID to lvols snapshots and clones
See commit 8887697f8c ("bdev/lvol: add UUID to lvols")

Change-Id: I8b0c2678678588fc9ab85bfcf19fefffc0e26b0c
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/407300
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-04-12 19:29:00 -04:00
Ben Walker
9611db82a3 lvol: Remove all uses of strncpy
strncpy is going to be added to the list of banned functions because
it does not guarantee strings are null terminated.

Change-Id: Iabd65cc703f56e8bc561344893aaeb6dc5f25fb8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/407022
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-04-12 13:45:04 -04:00
Daniel Verkamp
3b62b84f41 lvol: use uint64_t to represent lvol sizes
Replace the few existing uses of size_t as lvol size with uint64_t for
consistency.  size_t is meant to represent the size of an object in
memory, and it may be smaller than uint64_t (e.g. on 32-bit platforms).

Change-Id: Ifed8959625e18be67e98070f7fea1f2a09e4e791
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/407008
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@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-04-12 11:42:06 -04:00
Daniel Verkamp
72b7f73c26 lvol: remove free cluster check on resize
spdk_blob_resize() already checks for free clusters as needed (as well
as handling the thin provisioning case).

Change-Id: I445cc0f4ce15b67253bdfa15c2d703ff0fcb49b3
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/407010
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@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-04-10 19:24:04 -04:00
Daniel Verkamp
5a79fdc6ef lvol: convert size to clusters in spdk_lvol_resize
This fixes the units when calling spdk_blob_resize(), which wants
clusters, from spdk_lvol_resize(), which takes sz in bytes.

Change-Id: Ie6863b7569a43cfe181645e2776ea17b28ad5677
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/407007
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@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-04-10 19:24:04 -04:00
Tomasz Zawadzki
97934c5291 lvol: add snapshots and clones
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Change-Id: Ibc43e3ee65d85a83d78d6e15457ae57992a1188a
Reviewed-on: https://review.gerrithub.io/395059
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-04-10 13:46:09 -04:00
Daniel Verkamp
bf41a94216 lvol: use per-lvol uuid as unique_id if available
For old lvols that were generated before the per-lvol uuid was added,
the original lvolstore uuid + blob ID unique_id will still be used.

Change-Id: Id0f23836ff6fc8886d313f9e3d03e8b7204de2a2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/404033
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-04-06 18:31:31 -04:00
Tomasz Kulasek
f0aacaf6ae lvol: verify lvol name rework
This commit moves the name verification function out of the
spdk_lvol_create.

Also changes return value from -EINVAL to -EEXIST when name
already exists in lvol store, as more informative. It implies
that spdk_lvol_create also returns -EEXIST error code for
this case.

Change-Id: Ie0f642b316ba8c5cc42657334d35e539be56e830
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/406745
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-04-06 16:30:24 -04:00
Jim Harris
463925ff0f blob: make spdk_blob_resize an async operation
To support resize operations during I/O, we will need
to send messages to each thread to quiesce I/O while
the resize operation is in progress to guard against
the cluster map memory changing while another thread
is accessing the cluster map.

Therefore, spdk_blob_resize needs to be asynchronous.

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

Reviewed-on: https://review.gerrithub.io/404616
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-04-05 18:43:11 -04:00
Daniel Verkamp
af5683b705 lvol: read uuid xattr before name
This just moves some code around in preparation for an upcoming patch -
no functional change.

Change-Id: Ib1584fcf65d1be2063766588a79c434ad5fef716
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/404032
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2018-03-23 04:18:23 -04:00
Jim Harris
3fe80a337c lvol: remove num_clusters member from spdk_lvol
This is not needed - we can easily get the number
of clusters from the underlying blob.

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

Reviewed-on: https://review.gerrithub.io/404615
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>
2018-03-23 04:02:13 -04:00
Jim Harris
1cc6601a77 lvol: remove length xattr
This is always just the number of clusters in the
underlying blob.  The length xattr was set but never
retrieved later so it's obviously not needed.

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

Reviewed-on: https://review.gerrithub.io/404614
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>
2018-03-23 04:02:13 -04:00
Sebastian Basierski
f5e590c8f2 bdev: Added functions allowing logical volume store rename.
Change-Id: Ief1f809308fbde2e696c60d3ce79c0720cb3e2ff
Signed-off-by: Sebastian Basierski <sebastianx.basierski@intel.com>
Reviewed-on: https://review.gerrithub.io/398934
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2018-03-08 11:26:16 -05:00