From bcd6f4831c7c54ec96ad0e1be18d53a244257829 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Fri, 11 Dec 2020 22:44:55 +0100 Subject: [PATCH] Update atomic mode support check Signed-off-by: Robert Baldyga --- modules/cas_cache/utils/utils_nvme.c | 4 ++++ modules/config.mk | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/cas_cache/utils/utils_nvme.c b/modules/cas_cache/utils/utils_nvme.c index b21c432..cc7948b 100644 --- a/modules/cas_cache/utils/utils_nvme.c +++ b/modules/cas_cache/utils/utils_nvme.c @@ -3,6 +3,8 @@ * SPDX-License-Identifier: BSD-3-Clause-Clear */ +#if defined(CAS_NVME_PARTIAL) + #include "cas_cache.h" #include "utils_nvme.h" #include "utils_blk.h" @@ -62,3 +64,5 @@ out: cas_vm_munmap(buffer, sizeof(*ns)); return ret; } + +#endif diff --git a/modules/config.mk b/modules/config.mk index 9312717..e480206 100644 --- a/modules/config.mk +++ b/modules/config.mk @@ -32,28 +32,28 @@ NVME_FULL = 0 SLES ?= $(shell cat /etc/SuSE-release 2>/dev/null) ifneq ($(SLES),) EXTRA_CFLAGS += -DCAS_UAPI_LINUX_NVME_IOCTL -EXTRA_CFLAGS += -DCAS_NVME_PARTIAL EXTRA_CFLAGS += -DCAS_SLES SLES_VERSION := $(shell cat /etc/os-release |\ sed -n 's/VERSION="\([0-9]\+\)-\(.\+\)"/\1\2/p') EXTRA_CFLAGS += -DCAS_SLES$(SLES_VERSION) INCDIR = "" +NVME_PARTIAL = 1 endif ifeq ($(call check_header,$(INCDIR)/uapi/nvme.h), 1) EXTRA_CFLAGS += -DCAS_UAPI_NVME_IOCTL EXTRA_CFLAGS += -DCAS_UAPI_NVME -EXTRA_CFLAGS += -DCAS_NVME_PARTIAL +NVME_PARTIAL = 1 endif ifeq ($(call check_header,$(INCDIR)/uapi/linux/nvme.h), 1) EXTRA_CFLAGS += -DCAS_UAPI_LINUX_NVME -EXTRA_CFLAGS += -DCAS_NVME_PARTIAL +NVME_PARTIAL = 1 endif ifeq ($(call check_header,$(INCDIR)/uapi/linux/nvme_ioctl.h), 1) EXTRA_CFLAGS += -DCAS_UAPI_LINUX_NVME_IOCTL -EXTRA_CFLAGS += -DCAS_NVME_PARTIAL +NVME_PARTIAL = 1 ifeq ($(shell cat /etc/redhat-release 2>/dev/null | grep "\(Red Hat\|CentOS\) [a-zA-Z ]* 7\.[45]" | wc -l), 1) NVME_FULL = 1 endif @@ -62,10 +62,18 @@ endif KERNEL_VERSION = $(shell echo $(KERNELRELEASE) | cut -d'.' -f1) KERNEL_MAJOR = $(shell echo $(KERNELRELEASE) | cut -d'.' -f2) -ifeq ($(shell expr $(KERNEL_VERSION) \>= 4 \& $(KERNEL_MAJOR) \> 11),1) +ifeq ($(shell expr $(KERNEL_VERSION) \> 4 \| $(KERNEL_VERSION) \== 4 \& $(KERNEL_MAJOR) \> 11),1) NVME_FULL = 0 endif +ifeq ($(shell expr $(KERNEL_VERSION) \> 5 \| $(KERNEL_VERSION) \== 5 \& $(KERNEL_MAJOR) \> 7),1) +NVME_PARTIAL = 0 +endif + +ifeq ($(NVME_PARTIAL),1) +EXTRA_CFLAGS += -DCAS_NVME_PARTIAL +endif + ifeq ($(NVME_FULL),1) EXTRA_CFLAGS += -DCAS_NVME_FULL endif