mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-28 09:51:46 +02:00
43 lines
1.2 KiB
Diff
43 lines
1.2 KiB
Diff
# 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);
|