diff --git a/scst/README b/scst/README index 41bc0576a..b2fff1aef 100644 --- a/scst/README +++ b/scst/README @@ -1952,6 +1952,20 @@ context switch is natural for such potentially long operation as EXTENDED COPY. +VMware and Ceph RBD space reclaim +--------------------------------- + +VMware with VMFS5 filesystem ignores UNMAP alignment, so if you use 4MB +Ceph RBD objects and VMFS5, only some discards will reclaim RBD space +due to 1MB discard not often hitting the tail of objects. + +Thus, to have efficient ESXi space reclamation with RBD and VMFS5, you are +recommended to use 1 MB object size in Ceph. + +See https://sourceforge.net/p/scst/mailman/message/35287598 thread for +details. + + Caching ------- diff --git a/scst/README_in-tree b/scst/README_in-tree index 78e94401d..65053019d 100644 --- a/scst/README_in-tree +++ b/scst/README_in-tree @@ -1805,6 +1805,20 @@ context switch is natural for such potentially long operation as EXTENDED COPY. +VMware and Ceph RBD space reclaim +--------------------------------- + +VMware with VMFS5 filesystem ignores UNMAP alignment, so if you use 4MB +Ceph RBD objects and VMFS5, only some discards will reclaim RBD space +due to 1MB discard not often hitting the tail of objects. + +Thus, to have efficient ESXi space reclamation with RBD and VMFS5, you are +recommended to use 1 MB object size in Ceph. + +See https://sourceforge.net/p/scst/mailman/message/35287598 thread for +details. + + Caching ------- diff --git a/scst/include/backport.h b/scst/include/backport.h index c7c923eae..eec927283 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -678,4 +678,19 @@ static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd) } #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) && \ + (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) +/** + * ktime_before - Compare if a ktime_t value is smaller than another one. + * @cmp1: comparable1 + * @cmp2: comparable2 + * + * Return: true if cmp1 happened before cmp2. + */ +static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2) +{ + return ktime_compare(cmp1, cmp2) < 0; +} +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)) */ + #endif /* _SCST_BACKPORT_H_ */ diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index b8affa4a8..81fb1a56e 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -121,7 +121,9 @@ unsigned long scst_trace_flag; unsigned long scst_flags; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) unsigned long scst_poll_ns = SCST_DEF_POLL_NS; +#endif int scst_max_tasklet_cmd = SCST_DEF_MAX_TASKLET_CMD; diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 6f89563ba..a44a5837c 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -184,8 +184,10 @@ extern unsigned int scst_setup_id; #define SCST_DEF_MAX_TASKLET_CMD 10 extern int scst_max_tasklet_cmd; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) #define SCST_DEF_POLL_NS 0 extern unsigned long scst_poll_ns; +#endif extern spinlock_t scst_init_lock; extern struct list_head scst_init_cmd_list; diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index fa6c33313..d9871a3f9 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -7059,6 +7059,8 @@ static struct kobj_attribute scst_max_tasklet_cmd_attr = __ATTR(max_tasklet_cmd, S_IRUGO | S_IWUSR, scst_max_tasklet_cmd_show, scst_max_tasklet_cmd_store); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) + static ssize_t scst_poll_us_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -7106,6 +7108,8 @@ static struct kobj_attribute scst_poll_us_attr = __ATTR(poll_us, S_IRUGO | S_IWUSR, scst_poll_us_show, scst_poll_us_store); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) */ + static ssize_t scst_suspend_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -7380,7 +7384,9 @@ static struct attribute *scst_sysfs_root_default_attrs[] = { &scst_threads_attr.attr, &scst_setup_id_attr.attr, &scst_max_tasklet_cmd_attr.attr, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) &scst_poll_us_attr.attr, +#endif &scst_suspend_attr.attr, #if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING) &scst_main_trace_level_attr.attr, diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 0f510b127..cbed2c8a8 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -5623,6 +5623,7 @@ again: thr_locked = false; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) if (scst_poll_ns > 0) { struct timespec ts; ktime_t end, kt; @@ -5655,6 +5656,7 @@ again: } go: +#endif spin_lock_irq(&p_cmd_threads->cmd_list_lock); spin_lock(&thr->thr_cmd_list_lock); }