aboutsummaryrefslogtreecommitdiffstats
path: root/testing/xnbd/fix-cblocksize.patch
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2015-11-06 11:43:32 +0100
committerCarlo Landmeter <clandmeter@gmail.com>2015-11-06 11:43:51 +0100
commit52c5ab1f7a48e06de55edbb43a6564257499425c (patch)
tree4e8ba0b01a9d3e90f38edc4efbbe9da6f1ad1a72 /testing/xnbd/fix-cblocksize.patch
parent1a09689271c4e4aaef6837e8aebc9aab39b5ab21 (diff)
downloadaports-52c5ab1f7a48e06de55edbb43a6564257499425c.tar.bz2
aports-52c5ab1f7a48e06de55edbb43a6564257499425c.tar.xz
testing/xnbd: new aport
Diffstat (limited to 'testing/xnbd/fix-cblocksize.patch')
-rw-r--r--testing/xnbd/fix-cblocksize.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/xnbd/fix-cblocksize.patch b/testing/xnbd/fix-cblocksize.patch
new file mode 100644
index 0000000000..c678204a1b
--- /dev/null
+++ b/testing/xnbd/fix-cblocksize.patch
@@ -0,0 +1,42 @@
+# HG changeset patch
+# User hirofuchi
+# Date 1393586078 -32400
+# Node ID 34a08647f2e40d22960d8cb1de718a4391c15f3b
+# Parent 93c3b58d3df2ea3f361779dad61240e9381f0bf4
+make the requirement of CBLOCKSIZE clear
+
+CBLOCKSIZE must be a power of 2. 1024 or 8192 should be possible, which is not equal to PAGESIZE.
+
+diff --git a/xnbd_common.c b/trunk/xnbd_common.c
+--- a/xnbd_common.c
++++ b/xnbd_common.c
+@@ -25,6 +25,13 @@
+ #include "xnbd_common.h"
+
+
++/*
++ * CBLOCKSIZE must be a power of 2, because bit operations are used in
++ * mmap_block_region functions. There is an assertion to check this in main()
++ * of xnbd-server.
++ *
++ * 1024 or 8192, which is different from the page size, is also possible, but not well tested.
++ **/
+ const unsigned int CBLOCKSIZE = 4096;
+ unsigned int PAGESIZE = 4096;
+
+diff --git a/xnbd_server.c b/trunk/xnbd_server.c
+--- a/xnbd_server.c
++++ b/xnbd_server.c
+@@ -1060,10 +1060,9 @@
+ xnbd_initialize(&xnbd);
+
+
++ /* must be a power of 2 */
++ g_assert((CBLOCKSIZE & (CBLOCKSIZE - 1)) == 0);
+
+- PAGESIZE = (unsigned int) getpagesize();
+- if (CBLOCKSIZE % PAGESIZE != 0)
+- warn("CBLOCKSIZE %u PAGESIZE %u", CBLOCKSIZE, PAGESIZE);
+
+ if (xnbd.cmd == xnbd_cmd_proxy)
+ cachestat_initialize(DEFAULT_CACHESTAT_PATH, xnbd.nblocks);