diff options
| author | eunhhu <[email protected]> | 2026-09-24 17:33:55 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-24 17:33:55 +0100 |
| commit | 4525124c01cc4c4ee335b0a430354a235a6539e0 (patch) | |
| tree | 094372b8d78e05dca5d462aace4affd93450ff21 /prototypes/connections/store-paged.c | |
| parent | b1ce1927022d374198441afafeb27199fc8a052a (diff) | |
| download | pure-4525124c01cc4c4ee335b0a430354a235a6539e0.tar.gz pure-4525124c01cc4c4ee335b0a430354a235a6539e0.zip | |
Admit aligned OS pages in selected paged store
Diffstat (limited to 'prototypes/connections/store-paged.c')
| -rw-r--r-- | prototypes/connections/store-paged.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/prototypes/connections/store-paged.c b/prototypes/connections/store-paged.c index 89c0148..137301a 100644 --- a/prototypes/connections/store-paged.c +++ b/prototypes/connections/store-paged.c @@ -11,7 +11,7 @@ #include <sys/stat.h> #include <unistd.h> -/* Selected Linux/16 KiB-page storage experiment. Small values retain the +/* Selected Linux storage experiment with 16 KiB logical pages. Small values retain the * existing PUREB001 inline file. Large roots name an append-only page * generation. Both forms expose one immutable, contiguous mapped read. */ enum { PAGE = 16384, INLINE_BYTES = 24, ROOT_BYTES = 48, @@ -167,7 +167,11 @@ static PureResult open_locked(const char *path, bool writer, int *directory, int } PureResult pure_store_init(const char *path) { - if (!path || !*path || sysconf(_SC_PAGESIZE) != PAGE) return PURE_STORE_ERROR; + long host_page = sysconf(_SC_PAGESIZE); + /* Every file offset and MAP_FIXED address uses a PAGE-sized step, so a + * smaller OS page works when its size divides the logical page. */ + if (!path || !*path || host_page <= 0 || PAGE % host_page) + return PURE_STORE_ERROR; bool created = mkdir(path, 0700) == 0; if (!created && errno != EEXIST) return PURE_STORE_ERROR; int directory = open(path, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC); |
