mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-25 21:54:28 +08:00
mdbx: добавление MDBX_opt_writethrough_threshold
и сопутствующие доработки.
This commit is contained in:
24
src/osal.h
24
src/osal.h
@@ -312,13 +312,12 @@ typedef struct osal_ioring {
|
||||
unsigned slots_left;
|
||||
unsigned allocated;
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define IOR_DIRECT 1
|
||||
#define IOR_OVERLAPPED 2
|
||||
#define IOR_STATE_LOCKED 1
|
||||
HANDLE overlapped_fd;
|
||||
unsigned pagesize;
|
||||
unsigned last_sgvcnt;
|
||||
size_t last_bytes;
|
||||
uint8_t flags, state, pagesize_ln2;
|
||||
uint8_t direct, state, pagesize_ln2;
|
||||
unsigned event_stack;
|
||||
HANDLE *event_pool;
|
||||
volatile LONG async_waiting;
|
||||
@@ -335,7 +334,6 @@ typedef struct osal_ioring {
|
||||
#define ior_last_sgvcnt(ior, item) (1)
|
||||
#define ior_last_bytes(ior, item) (item)->single.iov_len
|
||||
#endif /* !Windows */
|
||||
mdbx_filehandle_t fd;
|
||||
ior_item_t *last;
|
||||
ior_item_t *pool;
|
||||
char *boundary;
|
||||
@@ -344,11 +342,13 @@ typedef struct osal_ioring {
|
||||
#ifndef __cplusplus
|
||||
|
||||
/* Actually this is not ioring for now, but on the way. */
|
||||
MDBX_INTERNAL_FUNC int osal_ioring_create(osal_ioring_t *,
|
||||
MDBX_INTERNAL_FUNC int osal_ioring_create(osal_ioring_t *
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
uint8_t flags,
|
||||
,
|
||||
bool enable_direct,
|
||||
mdbx_filehandle_t overlapped_fd
|
||||
#endif /* Windows */
|
||||
mdbx_filehandle_t fd);
|
||||
);
|
||||
MDBX_INTERNAL_FUNC int osal_ioring_resize(osal_ioring_t *, size_t items);
|
||||
MDBX_INTERNAL_FUNC void osal_ioring_destroy(osal_ioring_t *);
|
||||
MDBX_INTERNAL_FUNC void osal_ioring_reset(osal_ioring_t *);
|
||||
@@ -359,7 +359,7 @@ typedef struct osal_ioring_write_result {
|
||||
unsigned wops;
|
||||
} osal_ioring_write_result_t;
|
||||
MDBX_INTERNAL_FUNC osal_ioring_write_result_t
|
||||
osal_ioring_write(osal_ioring_t *ior);
|
||||
osal_ioring_write(osal_ioring_t *ior, mdbx_filehandle_t fd);
|
||||
|
||||
typedef struct iov_ctx iov_ctx_t;
|
||||
MDBX_INTERNAL_FUNC void osal_ioring_walk(
|
||||
@@ -377,11 +377,13 @@ osal_ioring_used(const osal_ioring_t *ior) {
|
||||
}
|
||||
|
||||
MDBX_MAYBE_UNUSED static inline int
|
||||
osal_ioring_reserve(osal_ioring_t *ior, size_t items, size_t bytes) {
|
||||
osal_ioring_prepare(osal_ioring_t *ior, size_t items, size_t bytes) {
|
||||
items = (items > 32) ? items : 32;
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
const size_t npages = bytes >> ior->pagesize_ln2;
|
||||
items = (items > npages) ? items : npages;
|
||||
if (ior->direct) {
|
||||
const size_t npages = bytes >> ior->pagesize_ln2;
|
||||
items = (items > npages) ? items : npages;
|
||||
}
|
||||
#else
|
||||
(void)bytes;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user