lvol: set default cluster size to 4MiB

Blobstore default cluster size is currently 4MiB,
but default lvol cluster size overrides it to 1GiB.

Additionally add -c flag in lvol tests to set cluster
size for tests.

1GiB was fine without thin provisioning, but we do not
want to allocate and copy 1GiB of data for newly allocated
clusters on thin provisioned logical volumes.

Note that 4MiB is same as default for Linux LVM.

lvol test case 601 had to be modified to create a malloc
LUN less than size of default cluster size.  This test is
supposed to fail - without the change here, creating the
lvolstore would work, but the script still considered it a
PASS.  Defer fixing that to a separate patch - for now just
keep the same test process.

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

Reviewed-on: https://review.gerrithub.io/397562
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>
This commit is contained in:
Maciej Szwed 2018-01-31 15:43:12 +01:00 committed by Jim Harris
parent 7d716668d6
commit cb5178ea40
4 changed files with 7 additions and 6 deletions

View File

@ -24,7 +24,7 @@ A logical volume is implemented as an SPDK blob created from an lvolstore. An lv
* Type name: struct spdk_lvol_bdev
Representation of an SPDK block device (spdk_bdev) with an lvol implementation.
A logical volume block device translates generic SPDK block device I/O (spdk_bdev_io) operations into the equivalent SPDK blob operations. Combination of lvol ID and lvolstore UUID gives lvol_bdev name in a form "uuid/lvolid". block_size of the created bdev is always 4096, due to blobstore page size. Cluster_size is configurable by parameter. By default it is 1GiB.
A logical volume block device translates generic SPDK block device I/O (spdk_bdev_io) operations into the equivalent SPDK blob operations. Combination of lvol ID and lvolstore UUID gives lvol_bdev name in a form "uuid/lvolid". block_size of the created bdev is always 4096, due to blobstore page size. Cluster_size is configurable by parameter.
Size of the new bdev will be rounded up to nearest multiple of cluster_size.
By default lvol bdevs claim part of lvol store equal to their set size. When thin provision option is enabled, no space is taken from lvol store until data is written to lvol bdev.
@ -44,7 +44,7 @@ construct_lvol_store [-h] [-c CLUSTER_SZ] base_name
Returns uuid of created lvolstore.
Optional paramters:
-h show help
-c CLUSTER_SZ Specifies the size of cluster. By default its 1GB.
-c CLUSTER_SZ Specifies the size of cluster. By default its 4MiB.
destroy_lvol_store [-h] uuid
Destroy lvolstore on specified bdev. Removes lvolstore along with lvols on
it. Note that destroying lvolstore requires using this call, while deleting

View File

@ -41,7 +41,7 @@
#include <uuid/uuid.h>
/* Default size of blobstore cluster */
#define SPDK_LVS_OPTS_CLUSTER_SZ (1024 * 1024 * 1024)
#define SPDK_LVS_OPTS_CLUSTER_SZ (4 * 1024 * 1024)
/* Length of string returned from uuid_unparse() */
#define UUID_STRING_LEN 37

View File

@ -666,7 +666,8 @@ class TestCases(object):
def test_case601(self):
header(601)
fail_count = 0
base_name = self.c.construct_malloc_bdev(self.total_size,
# Create malloc bdev smaller than default lvol cluster size
base_name = self.c.construct_malloc_bdev(1,
self.block_size)
if self.c.construct_lvol_store(base_name,
self.lvs_name, 0) == 0:

View File

@ -131,7 +131,7 @@ for (( i=0; i<$max_disks; i++ ));do
# Create base lvol store on NVMe
notice "Creating lvol store on device Nvme${i}n1"
ls_guid=$($rpc_py construct_lvol_store Nvme${i}n1 lvs_$i)
ls_guid=$($rpc_py construct_lvol_store Nvme${i}n1 lvs_$i -c 4194304)
lvol_stores+=("$ls_guid")
if $nested_lvol; then
@ -142,7 +142,7 @@ for (( i=0; i<$max_disks; i++ ));do
lb_name=$($rpc_py construct_lvol_bdev -u $ls_guid lbd_nest $size)
notice "Creating nested lvol store on lvol bdev: $lb_name"
nest_ls_guid=$($rpc_py construct_lvol_store $lb_name lvs_n_$i)
nest_ls_guid=$($rpc_py construct_lvol_store $lb_name lvs_n_$i -c 4194304)
nest_lvol_stores+=("$nest_ls_guid")
for (( j=0; j<$vm_count; j++)); do