|
20 | 20 | */ |
21 | 21 | #define FSYNC_FILENAME "./pg_test_fsync.out" |
22 | 22 |
|
23 | | -#if XLOG_BLCKSZ != 8 * 1024 /* 8k */ |
24 | | -#error Unknown block size for test. |
25 | | -#endif |
| 23 | +#define XLOG_BLCKSZ_K (XLOG_BLCKSZ / 1024) |
26 | 24 |
|
27 | 25 | #define LABEL_FORMAT " %-32s" |
28 | 26 | #define NA_FORMAT LABEL_FORMAT "%18s" |
@@ -61,10 +59,10 @@ main(int argc, char *argv[]) |
61 | 59 |
|
62 | 60 | test_open(); |
63 | 61 |
|
64 | | - /* Test using 1 8k write */ |
| 62 | + /* Test using 1 XLOG_BLCKSZ write */ |
65 | 63 | test_sync(1); |
66 | 64 |
|
67 | | - /* Test using 2 8k writes */ |
| 65 | + /* Test using 2 XLOG_BLCKSZ writes */ |
68 | 66 | test_sync(2); |
69 | 67 |
|
70 | 68 | test_open_syncs(); |
@@ -177,9 +175,9 @@ test_sync(int writes_per_op) |
177 | 175 | bool fs_warning = false; |
178 | 176 |
|
179 | 177 | if (writes_per_op == 1) |
180 | | - printf("\nCompare file sync methods using one 8k write:\n"); |
| 178 | + printf("\nCompare file sync methods using one %dk write:\n", XLOG_BLCKSZ_K); |
181 | 179 | else |
182 | | - printf("\nCompare file sync methods using two 8k writes:\n"); |
| 180 | + printf("\nCompare file sync methods using two %dk writes:\n", XLOG_BLCKSZ_K); |
183 | 181 | printf("(in wal_sync_method preference order, except fdatasync\n"); |
184 | 182 | printf("is Linux's default)\n"); |
185 | 183 |
|
@@ -396,11 +394,11 @@ test_open_syncs(void) |
396 | 394 | printf("(This is designed to compare the cost of writing 16k\n"); |
397 | 395 | printf("in different write open_sync sizes.)\n"); |
398 | 396 |
|
399 | | - test_open_sync(" 1 16k open_sync write", 16); |
400 | | - test_open_sync(" 2 8k open_sync writes", 8); |
401 | | - test_open_sync(" 4 4k open_sync writes", 4); |
402 | | - test_open_sync(" 8 2k open_sync writes", 2); |
403 | | - test_open_sync("16 1k open_sync writes", 1); |
| 397 | + test_open_sync("16k open_sync write", 16); |
| 398 | + test_open_sync(" 8k open_sync writes", 8); |
| 399 | + test_open_sync(" 4k open_sync writes", 4); |
| 400 | + test_open_sync(" 2k open_sync writes", 2); |
| 401 | + test_open_sync(" 1k open_sync writes", 1); |
404 | 402 | } |
405 | 403 |
|
406 | 404 | /* |
@@ -519,7 +517,7 @@ test_non_sync(void) |
519 | 517 | /* |
520 | 518 | * Test a simple write without fsync |
521 | 519 | */ |
522 | | - printf("\nNon-sync'ed 8k writes:\n"); |
| 520 | + printf("\nNon-sync'ed %dk writes:\n", XLOG_BLCKSZ_K); |
523 | 521 | printf(LABEL_FORMAT, "write"); |
524 | 522 | fflush(stdout); |
525 | 523 |
|
|
0 commit comments