Commit 38b03952 authored by Yankun Li's avatar Yankun Li Committed by Tomasz Zawadzki
Browse files

bdev/compress: check pm path for creating compress bdev



Change-Id: Iaca21fef5a8d5845e79b3ddd9b6df3dac977ddef
Signed-off-by: default avatarYankun Li <845245370@qq.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24184


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 8711e7e9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -850,6 +850,15 @@ int
create_compress_bdev(const char *bdev_name, const char *pm_path, uint32_t lb_size)
{
	struct vbdev_compress *comp_bdev = NULL;
	struct stat info;

	if (stat(pm_path, &info) != 0) {
		SPDK_ERRLOG("PM path %s does not exist.\n", pm_path);
		return -EINVAL;
	} else if (!S_ISDIR(info.st_mode)) {
		SPDK_ERRLOG("PM path %s is not a directory.\n", pm_path);
		return -EINVAL;
	}

	if ((lb_size != 0) && (lb_size != LB_SIZE_4K) && (lb_size != LB_SIZE_512B)) {
		SPDK_ERRLOG("Logical block size must be 512 or 4096\n");