From 043b678ef49c2a1e2c7f03b1dc6b8a16d2c5066c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 3 Nov 2012 13:52:27 +0000 Subject: [PATCH] scst_vdisk: Build fix for kernel 3.5.0 and later. Unfortunately this means (for now) no thin provisioning support on the 2.2.x branch with kernel 3.5.0 or later. Such support is available on the SCST trunk though. git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4573 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 817e7c68a..5a05eab0b 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -639,6 +639,7 @@ static void vdisk_check_tp_support(struct scst_vdisk_dev *virt_dev) supported = false; #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) } else { /* * truncate_range() was chosen rather as a sample. In future, @@ -646,12 +647,18 @@ static void vdisk_check_tp_support(struct scst_vdisk_dev *virt_dev) * will just switch to the new call. */ supported = (inode->i_op->truncate_range != NULL); +#endif } if (!supported) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) PRINT_WARNING("Device %s doesn't support thin " "provisioning, disabling it.", virt_dev->filename); +#else + PRINT_WARNING("Thin provisioning support for kernel 3.5.0 and " + "later has not yet been implemented on the 2.2.x branch"); +#endif virt_dev->thin_provisioned = 0; } @@ -1380,6 +1387,7 @@ static void vdisk_exec_unmap(struct scst_cmd *cmd, struct scst_vdisk_thr *thr) SCST_LOAD_SENSE(scst_sense_invalid_opcode)); goto out_put; #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0) } else { const int block_shift = virt_dev->block_shift; const loff_t a0 = start << block_shift; @@ -1402,6 +1410,7 @@ static void vdisk_exec_unmap(struct scst_cmd *cmd, struct scst_vdisk_thr *thr) a0 == a1)); if (a0 < a1) inode->i_op->truncate_range(inode, a0, a1 - 1); +#endif } }