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
This commit is contained in:
Bart Van Assche
2012-11-03 13:52:27 +00:00
parent 4efdfaf368
commit 043b678ef4

View File

@@ -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
}
}