If blobs held in a blobstore are opened a lot, lookup
by RB_TREE will be much more efficient.
Change-Id: I7075b95c597a958e7bb10890f803191309532021
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10917
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
There is situation that num_extent_pages is zero and original pointer is
also NULL, the realloc() could return a Not NULL pointer.
Related UT has been added and updated.
1) In the default allocation (num_clusters == 0), the extent_pages is not allocated as expected.
2) In the thin provisioning allocation (num_clusters != 0), the extent_pages will be allocated if extent_table is used.
More related information as below:
The crux of the problem is that according to POSIX:
realloc: "If ptr is NULL, then the call is equivalent to malloc(size)"
malloc: "If size is 0, then malloc returns either NULL or a unique pointer value that can later be successfully passed to free"
blobstore was relying on realloc(NULL, 0) always return a unique pointer value, and not NULL. This is not portable behavior.
Change-Id: Ibc28d9696f15a3c0e2aa6bb2371dc23576c28954
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10470
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
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>
The current num_md_clusters doesn't include the the part before
md_start. So the bs_recover will get more num_free_clusters than it
should be. This patch can fix it.
Signed-off-by: Peng Yu <yupeng0921@gmail.com>
Change-Id: I911926beb69aca677da508ba71f292496c917e7f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9034
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
The assertion should verify that a clone has been found. Without the
dereference, it makes no sense, as that pointer is dereferenced earlier.
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I67fa17b33df6d507822a17ffc221a6d360985646
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8919
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Using `bs_allocate_and_copy_cluster()` instead of a zero-length write
makes it possible to inflate/decouple snapshots, as the writes would
fail with -EPERM, because the snapshots are marked as read-only.
Additionally, zero-length non-vector requests are now completed
immediately. It makes it consistent with the vector path (which already
does that) and allows us to use the zero-length reads as a context for
cluster copy.
Fixes#2028.
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ib7fdee352972ecf808833aa179820d85cfab7eed
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8918
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Fixes#1933
When decoupling parent the updated parent_id was
not persisted to the blob if it was a snapshot.
Due to having md_ro set to true, blob_set_xattr()
failed.
Later on the incorrect parent_id could cause troubles
like in the github issue, when deleting that snapshot.
This patch adds return code check for blob_set_xattr
and forces md_ro to false during blob md sync.
Since some of code paths are shared between decouple,
inflate and clone operations, the final callback for them
is doing revert of the original md_ro.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If017455f72e4d809fe533d9f986e5ae6bb8e2035
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8420
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
We find a few files to get the size of a member of a struct. How to
do it is a little complex. So add a macro to do it will be helpful
to read the current code and develop new features.
lib/dif had used member_size() internally but Linux use sizeof_member()
as the macro. Besides, SPDK have used upper case letters for similar
macros, SPDK_CONTAINEROF() and SPDK_COUNTOF(). Hence spdk_member_size()
may be good but propose SPDK_SIZEOF_MEMBER() as the macro.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2179c845a3b75fb71aa039075cc4dfd30617b898
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8738
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
In blob_load_cpl(), spdk_realloc() is called to realloc
memory of ctx->pages. If spdk_realloc() return NULL,
the ctx->pages is set to NULL without being freed,
and then a memleak problem occurs.
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: Idf21b690e89beab0245ba57a5de66a4f506d54fb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8308
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
In blob_serialize_add_page(), *pages is set to spdk_realloc(*pages).
If spdk_realloc() returns NULL, the *pages pointer will be
overridden, whose memory will leak.
Here, we introduce a new var (tmp_pages) for checking the return
value of spdk_realloc(*pages).
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Change-Id: Ib2ead3f3b5d5e44688d1f0568816f483aa9e101f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8307
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
open_blobids holds bit array of currently open blobs,
this is a way for quicker determination than iterating
over all blobs. See patch introducing it:
(30ee8137)blob: Add a bitmask for quickly checking which blobs are open
That patch added resizes of this bit array to bs init
and bs recovery path (not shut down cleanly).
But that patch skipped over bs load from a clean shutdown.
This resulted in blob open having multiple blob pointers that
target the same blob id.
Fixes#1937
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3c42a63d168d1f5b013b449f010c5b207936045b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7998
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Mellanox Build Bot
When blob persist starts, there can already be multiple
of such requests pending. It is possible to complete
a set of persists at once, if blob state after their
execution would be the same. This is the case when
persists are already pending when a particular persist
request is started.
This patch implements such mechanism by introducing
persists_to_complete queue, containing entries that
were previously queued up before starting the current
persist request. If there are any entries in this queue,
further requests are put into pending_persists.
When first request from persists_to_complete is persisted,
completions are issued for all requests on that queue at once.
If at that point there are any new entries on pending_persists,
all of them are put into persists_to_complete. Persist process is started
again with the first request from that queue.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I10063e55d6f821b1863de016d3148da6a719a422
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7643
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This helps in next patch in series where multiple
completions will be executing.
UT is adjusted since one additional poll is required.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id72377ddef91e40cdbc2bdea6f33c23309b0ca3d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7642
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
During snapshot creation the original blob becomes
a thin provisioned blob that will only the diff of data after
snapshot creation.
Despite the comment in the UT the number of polls before issuing
blob write was hitting blob BEFORE it swapped with new one.
Issuing I/O during this period shall check for io freeze
before checking cluster allocation.
Otherwise bs_io_unit_is_allocated() hits assert for thin
provisioned blob. This is because cluster map of blob is
empty, but properties have not been updated yet.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I742e1a50b14d456ae1e6de13b5111caec3e8322c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7641
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
When performing snapshot creation the I/O is frozen
during the process. The blob persists for extent page
allocation is delayed until snapshot creation is finished.
This results in multiple blob persists executing one after
the other, with only intent of writing out updated extent table
pointing to new extent pages.
Since blob->state is marked DIRTY before issuing each persist,
but a single persist completion marks state CLEAR.
Blob serialize correctly expects each persist to contain
dirtied metadata, in order to avoid unnecessary md writes.
Since all other instances of marking blob DIRTY is explicit,
assert in blob serialize is left as is.
Instead when running the queued up blob persists, the blob
state is marked DIRTY.
Side effect is that it will write out same md in some cases.
Fixes#1909
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I39f37299f3f0ebfccbdd4063781b5ecce286e993
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7640
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Before this patch blob persist wrote out all allocated extent pages.
Intended design was to write out extent pages in two cases:
1) Thin provisioned blobs to write out extent pages when necessary
during cluster allocation.
2) Thick provisioned blobs to write extent pages during blob persist
when the blob was resized
This patch implements 1) by inserting extent before issuing blob persist
in cluster allocation path.
See blob_persist_extent_page_cpl() and blob_insert_new_ep_cb().
Blob persist might have to rewrite the last extent page after blob resize.
See blob_persist_start().
Meanwhile 2) was incorrecly implemented since it always re-wrote all
extent pages starting from 0. This was addressed by limiting number
of extent pages written, only to ones that were resized.
Some considerations were needed:
a) blob resize happen on cluster granularity, it might be needed to re-write
last extent page if resize was not large enough to change number of extent pages
b) first extent page to write should be based on the num_extent_pages from
active or clean, depending on resize direction
See blob_persist_start().
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ibba9e3de3aadb64c1844a462eb0246e4ef65d37f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7202
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>
Community-CI: Mellanox Build Bot
When both clone and snapshot had already extent pages
corresponding to the same region in cluster map,
the clone extent page was replaced with one from snapshot.
This was incorrect and would result in loss of clusters
from clones extent page. It did not occur in practice
because all extent pages were rewritten anyway during
md sync. Cluster map was correct so updated extent pages
were too.
Cluster map correctness is verified in UT _blob_inflate_rw(true),
at the very end when checking data consistency of inflated blob.
This patch writes out the updated extent page explicitly.
So it would be possible to skip wirting out extent pages
during md sync later in the series.
Note 1)
At this point in series the extent page is written here,
and in blob persists. The later will be removed later in
series.
Note 2)
Errors during updating extent pages are not accounted for,
but neither does syncing them in blob persist.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7deac3c64299f33f8df49e860af1a16295c074e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7438
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>
Community-CI: Mellanox Build Bot
The blob_insert_extent() name was confusing, since the function
was actually responsible for writting out the extent page to disk.
Changed to a more fitting name.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia312b0ef152100f30d5a1bfe123e55135c8afa6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7561
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>
Community-CI: Mellanox Build Bot
This patch does not change functionality. It separates
three stages of updating clone during snapshot deletion:
- updating cluster map
- updating extent pages
- removing backing device from clone
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I44869f3be596d9d0f06db4acedfdd7e1500516ff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7437
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
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>
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>
blob_persist_clear_clusters() issues 'unmap' or 'write_zeroes'
IOs in one batch, this can consumes lots of 'bdev_io's.
we need to try best to merge the contiguous clusters
especially in the following case:
cluster 0: LBA 128 (count = 128)
cluster 1: LBA 0 (meaning thin provisioned, no cluster allocated)
cluster 2: LBA 256 (count = 128)
Besides, in the long run, we may need to do this batch by sequence.
Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I436c8b46a1ee33ec127d0f43fd85b2c443689b59
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4082
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
We have an intermittent CI failure that hits this
assert. Adding some more detail to help analyze and
root cause.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2174dda58d0ae4d98359a914e5975f8be3e45a89
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5550
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
POSIX defines PRId64/PRIu64/PRIx64 for printing 64-bit values in a
portable way. Replace a few references to %ld to remove the assumption
about the size of a long. Similarly, use %z with size_t arguments.
Where the value being printed is an unsigned 64-bit value, use PRIu64
instead of %ld.
Explicitly test for not __linux__ where that is the intent, rather
than testing for __FreeBSD__.
Cast pointer to uintptr_t before aligning it, rather than using
a specific integer size which may not be large enough to store a
pointer.
Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Icfe219e1bbb2d06b3ef05710fac5b7091d340251
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5142
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Search for md_page to be used as extent page started
from 0, which is completely valid md_page.
This page can be free when for example blob with id 0
was deleted and some other requested a new page for extent.
There are already existing blobs that have extents
pointing to 0, which means unallocated.
Unfortunetly it means 0 can never mean md page 0.
If that already occured for someone, this extent page was already
lost during blob/bs reload and nothing can be done.
With this in mind following assumptions are made for extent pages:
- 0 means unallocated extent page
- UINT32_MAX means we ran out of md pages, and should not be persisted
- [NEW] extent page can never occupy md page 0
That last one is new addition in this patch.
bs_allocate_cluster will now always try to find md page from 1 or higher.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia17ce5bbca2fab4fb4487e4e263f3a0aa120bf17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4314
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
When loading a blob and parsing its metadata,
the array of pages was not updated.
Serialization was unaffected, since the current pages
array is unused there.
Behavior was working correctly for first page,
but did not for any blob with more than one page.
Unfortunetly blob_persist_zero_pages() never zeroed out
the pages, neither blob_persist_zero_pages_cpl()
released the md pages.
Resulting in md pages being claimed even after blobs
deletion.
This patch now fills out the active pages array with
the appropriate page numbers from metadata.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6ff1f4fe95684119d283c2471fdbbea464da8151
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4504
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
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
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
uint32_t supports at most 2TB at most, we need to handle
the larger blobstores, fix this overflow problem.
Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I27950eb759e9cb9ad48fa4aa8dd1976b4e852832
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4075
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>
We still need to be able to explicitly set specific
bits in the cluster array during initialization and
loading (especially recovery), so we use a bit_array
during load, and then convert it to a bit_pool just
before calling the user's cmopletion callback.
This gives a roughly 300% improvement over baseline
on a benchmark which does continuous resize operations.
The benefit is primarily from saving the lowest free
bit rather than having to always start at bit 0. We
may be able to further improve this by saving extents
in the bit pool as well, although after this patch,
the benchmark shows other hot spots different from the
bit search.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idb1d75d8348bc50560b1f42d49dbe4d79d024619
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3975
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
The ctx allocation was duplicated after both bs_alloc
calling sites, so this reduces the code a bit. This change
also enables some future changes involving the used_clusters
bit array.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4ea98f079dbe385654e9cb9c0c58a1926a990c9e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3973
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This will allow for some additional simplifications
in future patches.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie421ad35f8c0efbb775fbe6bf85799af515264ef
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3972
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This prepares for some future patches.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If63c83f76e839b796c58200ddb0ca2137fbc4288
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3971
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Have it both find and set the lowest available cluster
bit index.
This will temporarily hurt the performance for cluster
allocation, since it will always search starting at
bit index 0. But upcoming changes in this patch set
will fix that again by using a new spdk_bit_pool object
that will do allocations much more efficiently than the
current implementation here.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iad199c9166b82cb9a31597a080f5a28823849e60
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3970
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Currently if we create a blob of 128 clusters, we
lock/unlock the used_cluster_mutex 128 times - once
for each cluster. Same when those clusters are released
when the blob is deleted. Batching these lock/unlock
operations is very easy and gives a noticeable
efficiency improvement.
My local benchmark (1GiB ramdisk, 4KB cluster size,
128 clusters/blob) creates enough blobs to fill the
blobstore and then continuously deletes and recreates
them. Performance increases 20% on that benchmark
with this patch.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic503accf1ca1ab1af7254b4067771d956f52014d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4069
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Some of the functions were only referenced directly.
There is no need to use void* or pass any bserrno,
in some cases.
Let's be explicit.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib26dda7068965838f38dad856ea1e456fd87a655
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4061
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This looks like a major omission on persist path.
Especially visible for cases where blobstore was not
reloaded between blob creations/deletion.
Added writing out zeroes to md_pages that contained
truncated extents (resized down).
After zeroes are writen out, md_pages for those extents
are released. In case of blob deletion, extents are
resized down to 0 so all extent pages are released.
Fixes#1590
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I9a2a1190e3f1f3b5d1bb806191c1fe4d27df7780
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4051
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>
We will use it earlier in this file in a future patch.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I554f2073185d466bd0b4e98bdeec721f763c1b44
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3969
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
When claiming clusters as part of blobstore initialization
or recovery, just call spdk_bit_array_set directly rather
than going through the bs_claim_cluster function. We will
be modifying how runtime cluster allocation works so need
to separate the two use cases. This code is very small so
inlining it has minimal code impact.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaaa1c817e57b4a2eea62eb4683407364bac1fcc0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3966
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
These functions were added during FTL development and
are more efficient than the roll-your-own implementations
blobstore had previously.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie09e5c305e6e171af0258e805f2aac3b88822b5e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3965
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
The md_page alignment is not really required for md_page
buffers.
Allocating 4k aligned buffers all the time, causes memory
to be heavily fragmented. Due to DPDK keeping track of the
allocation in the same DMA region as the allocation themselves.
Removing this alignment requirement will help DPDK when searching
for the right part of memory in the heap.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reported-by: Mike Cui
Change-Id: If2f4ca2be38d432d5740f6145b5e0ff46237806b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3853
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
We only create one spdk_blob object for a given blob, and just
increase the ref_count if it is opened multiple times. bs_open_blob
would do the lookup for existing opened blobs.
But if the blob is opened again, before the previous open operation
has completed, we would end up with two spdk_blob objects for the same
blob.
Solution is to do another lookup when the open operation completes.
If we find the blob, free the one we just finished opening and return
the existing one instead.
Also added unit test that failed on the existing code but passes now
with this patch.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reported-by: Mike Cui
Change-Id: I00c3a913b413deddf06f0b63f7a669efb2b5658f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3855
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
There is a fatal bug that could easily cause data corruption when using
thin-provisioned blobs. In blob_request_submit_rw_iov(), we first get
lba by calling blob_calculate_lba_and_lba_count(),
blob_calculate_lba_and_lba_count() calculates different lbas according to
the return of bs_io_unit_is_allocated(). Later, we call bs_io_unit_is_allocated()
again to judge whether the specific cluster is allocated, the problem is it may
have be allocated here while not be allocated when calling blob_calculate_lba_and_lba_count()
before. To ensure the correctness of lba, we can do lba recalculation when
bs_io_unit_is_allocated() returns true, or make
blob_calculate_lba_and_lba_count() return the result of
bs_io_unit_is_allocated(), use the second solution in this patch.
By configuring more than one cpu core, md thread will run in a separate
SPDK thread, this data corruption scenario could be easily reproduced
by running fio verify in VMs using thin-provisioned Lvols as block
devices.
Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I099865ff291ea42d5d49b693cc53f64b60881684
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3318
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This can speed up the check for whether a blob is already open
significantly.
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: If32b0b1f168fcdb58e61df6281d7b7520725a195
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2781
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>