summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohann Latocha2011-06-30 00:53:02 +0200
committerJohann Latocha2011-06-30 00:53:02 +0200
commitba4fabf2ee7506f064ee827bfc6a6c8e878fae2f (patch)
tree6427c55d132f3e628d8bdb77fb7d645f330b765e
parentDefect #350 (diff)
downloaddnbd2-ba4fabf2ee7506f064ee827bfc6a6c8e878fae2f.tar.gz
dnbd2-ba4fabf2ee7506f064ee827bfc6a6c8e878fae2f.tar.xz
dnbd2-ba4fabf2ee7506f064ee827bfc6a6c8e878fae2f.zip
Working with kernel 2.6.34
-rw-r--r--kernel/devices.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/devices.c b/kernel/devices.c
index acf87e1..857a106 100644
--- a/kernel/devices.c
+++ b/kernel/devices.c
@@ -193,11 +193,19 @@ int add_device(dnbd2_device_t *dev, int minor)
* Tell the block layer to give us only requests consisting of
* one segment of DNBD2_BLOCK_SIZE bytes.
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
+ blk_queue_max_hw_sectors(queue, DNBD2_BLOCK_SIZE/SECTOR_SIZE);
+#else
blk_queue_max_sectors(queue, DNBD2_BLOCK_SIZE/SECTOR_SIZE);
+#endif
blk_queue_max_segment_size(queue, DNBD2_BLOCK_SIZE);
blk_queue_logical_block_size(queue, DNBD2_BLOCK_SIZE);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
+ blk_queue_max_segments(queue, 1);
+#else
blk_queue_max_phys_segments(queue, 1);
blk_queue_max_hw_segments(queue, 1);
+#endif
disk->queue = queue;
add_disk(disk);