diff --git a/kvdo.spec b/kvdo.spec index 6e396423..a096f7f8 100644 --- a/kvdo.spec +++ b/kvdo.spec @@ -1,6 +1,6 @@ %define spec_release 1 %define kmod_name kvdo -%define kmod_driver_version 6.2.0.187 +%define kmod_driver_version 6.2.0.197 %define kmod_rpm_release %{spec_release} %define kmod_kernel_version 3.10.0-693.el7 @@ -85,5 +85,5 @@ rm -rf $RPM_BUILD_ROOT %{_usr}/src/%{kmod_name}-%{version}-%{kmod_driver_version}/* %changelog -* Fri Jul 27 2018 - J. corwin Coburn - 6.2.0.187-1 -HASH(0x229f768) \ No newline at end of file +* Mon Aug 06 2018 - J. corwin Coburn - 6.2.0.197-1 +HASH(0x26d07a0) \ No newline at end of file diff --git a/vdo/Makefile b/vdo/Makefile index eb409f32..b3370d11 100644 --- a/vdo/Makefile +++ b/vdo/Makefile @@ -1,4 +1,4 @@ -VDO_VERSION = 6.2.0.187 +VDO_VERSION = 6.2.0.197 VDO_VERSION_MAJOR = $(word 1,$(subst ., ,$(VDO_VERSION))) VDO_VERSION_MINOR = $(word 2,$(subst ., ,$(VDO_VERSION))) diff --git a/vdo/kernel/dmvdo.c b/vdo/kernel/dmvdo.c index ddf3da3a..05434a47 100644 --- a/vdo/kernel/dmvdo.c +++ b/vdo/kernel/dmvdo.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * $Id: //eng/vdo-releases/aluminum/src/c++/vdo/kernel/dmvdo.c#6 $ + * $Id: //eng/vdo-releases/aluminum/src/c++/vdo/kernel/dmvdo.c#7 $ */ #include "dmvdo.h" @@ -57,20 +57,10 @@ struct kvdoDevice kvdoDevice; // global driver state (poorly named) * /var/log/kern.log. In order to avoid these warnings, we choose to use the * smallest reasonable value. See VDO-3062 and VDO-3087. * - * Pre kernel version 4.3, we use the functionality in blkdev_issue_discard - * and the value in max_discard_sectors to split large discards into smaller - * ones. 4.3 and beyond kernels have removed the code in blkdev_issue_discard - * and so after that point, we use the code in device mapper itself to - * split the discards. Unfortunately, it uses the same value to split large - * discards as it does to split large data bios. As such, we should never - * change the value of max_discard_sectors in kernel versions beyond that. - * We continue to set the value for max_discard_sectors as it is used in other - * code, like sysfs display of queue limits and since we are actually splitting - * discards it makes sense to show the correct value there. - * - * DO NOT CHANGE VALUE for kernel versions 4.3 and beyond to anything other - * than what is set to the max_io_len field below. We mimic to_sector here - * as a non const, otherwise compile would fail. + * We allow setting of the value for max_discard_sectors even in situations + * where we only split on 4k (see comments for HAS_NO_BLKDEV_SPLIT) as the + * value is still used in other code, like sysfs display of queue limits and + * most especially in dm-thin to determine whether to pass down discards. */ unsigned int maxDiscardSectors = VDO_SECTORS_PER_BLOCK; @@ -94,6 +84,23 @@ unsigned int maxDiscardSectors = VDO_SECTORS_PER_BLOCK; #endif #endif +/* + * Pre kernel version 4.3, we use the functionality in blkdev_issue_discard + * and the value in max_discard_sectors to split large discards into smaller + * ones. 4.3 to 4.18 kernels have removed the code in blkdev_issue_discard + * and so in place of that, we use the code in device mapper itself to + * split the discards. Unfortunately, it uses the same value to split large + * discards as it does to split large data bios. + * + * In kernel version 4.18, support for splitting discards was added + * back into blkdev_issue_discard. Since this mode of splitting + * (based on max_discard_sectors) is preferable to splitting always + * on 4k, we are turning off the device mapper splitting from 4.18 + * on. + */ +#define HAS_NO_BLKDEV_SPLIT LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) \ + && LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0) + /* * We want to support flush requests in async mode, but early device mapper * versions got in the way if the underlying device did not also support @@ -534,15 +541,9 @@ static void configureTargetCapabilities(struct dm_target *ti, #endif /* - * As of linux kernel version 4.3, support for splitting discards - * was removed from blkdev_issue_discard. Luckily, device mapper - * added its own support for splitting discards in kernel version - * 3.6 and beyond. We will begin using this support from 4.3 on. - * Please keep in mind the device mapper support uses the same value - * for splitting discards as it does for splitting regular data i/os. - * See the max_io_len setting above. + * Please see comments above where the macro is defined. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) +#if HAS_NO_BLKDEV_SPLIT ti->split_discard_bios = 1; #endif } diff --git a/vdo/kernel/sysfs.c b/vdo/kernel/sysfs.c index 3366e5fe..490a9f12 100644 --- a/vdo/kernel/sysfs.c +++ b/vdo/kernel/sysfs.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. * - * $Id: //eng/vdo-releases/aluminum/src/c++/vdo/kernel/sysfs.c#2 $ + * $Id: //eng/vdo-releases/aluminum/src/c++/vdo/kernel/sysfs.c#3 $ */ #include "sysfs.h" @@ -28,12 +28,7 @@ #include "dmvdo.h" #include "logger.h" -#define HAS_MAX_DISCARD_SECTORS (LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)) - -#if HAS_MAX_DISCARD_SECTORS extern unsigned int maxDiscardSectors; -#endif /* HAS_MAX_DISCARD_SECTORS */ - extern int defaultMaxRequestsActive; typedef struct vdoAttribute { @@ -194,7 +189,6 @@ static ssize_t vdoMaxReqActiveStore(struct kvdoDevice *device, return scanInt(buf, n, &defaultMaxRequestsActive, 1, MAXIMUM_USER_VIOS); } -#if HAS_MAX_DISCARD_SECTORS /**********************************************************************/ static ssize_t vdoMaxDiscardSectors(struct kvdoDevice *device, const char *buf, @@ -202,7 +196,6 @@ static ssize_t vdoMaxDiscardSectors(struct kvdoDevice *device, { return scanUInt(buf, n, &maxDiscardSectors, 8, UINT_MAX); } -#endif /* HAS_MAX_DISCARD_SECTORS */ /**********************************************************************/ static ssize_t vdoAlbireoTimeoutIntervalStore(struct kvdoDevice *device, @@ -285,14 +278,12 @@ static VDOAttribute vdoMaxReqActiveAttr = { .valuePtr = &defaultMaxRequestsActive, }; -#if HAS_MAX_DISCARD_SECTORS static VDOAttribute vdoMaxDiscardSectorsAttr = { .attr = {.name = "max_discard_sectors", .mode = 0644, }, .show = showUInt, .store = vdoMaxDiscardSectors, .valuePtr = &maxDiscardSectors, }; -#endif /* HAS_MAX_DISCARD_SECTORS */ static VDOAttribute vdoAlbireoTimeoutInterval = { .attr = {.name = "deduplication_timeout_interval", .mode = 0644, }, @@ -324,9 +315,7 @@ static struct attribute *defaultAttrs[] = { &vdoStatusAttr.attr, &vdoLogLevelAttr.attr, &vdoMaxReqActiveAttr.attr, -#if HAS_MAX_DISCARD_SECTORS &vdoMaxDiscardSectorsAttr.attr, -#endif /* HAS_MAX_DISCARD_SECTORS */ &vdoAlbireoTimeoutInterval.attr, &vdoMinAlbireoTimerInterval.attr, &vdoTraceRecording.attr,