Added more buffer manager flags (allow programs to bypass non_blocking).
This commit is contained in:
parent
5df9fbdc9c
commit
d7e56fc96f
3 changed files with 46 additions and 22 deletions
|
@ -46,9 +46,21 @@ int main(int argc, char ** argv) {
|
||||||
} else if(!strcmp(argv[i], "--deprecatedFH")) {
|
} else if(!strcmp(argv[i], "--deprecatedFH")) {
|
||||||
bufferManagerFileHandleType = BUFFER_MANAGER_FILE_HANDLE_DEPRECATED;
|
bufferManagerFileHandleType = BUFFER_MANAGER_FILE_HANDLE_DEPRECATED;
|
||||||
legacyFH = 1;
|
legacyFH = 1;
|
||||||
} else if(!strcmp(argv[i], "--pfile")) {
|
} else if(!strcmp(argv[i], "--nb")) {
|
||||||
bufferManagerNonBlockingSlowHandleType = IO_HANDLE_PFILE;
|
bufferManagerFileHandleType = BUFFER_MANAGER_FILE_HANDLE_NON_BLOCKING;
|
||||||
|
legacyBM = 0;
|
||||||
|
legacyFH = 0;
|
||||||
} else if(!strcmp(argv[i], "--file")) {
|
} else if(!strcmp(argv[i], "--file")) {
|
||||||
|
bufferManagerFileHandleType = BUFFER_MANAGER_FILE_HANDLE_FILE;
|
||||||
|
legacyBM = 0;
|
||||||
|
legacyFH = 0;
|
||||||
|
} else if(!strcmp(argv[i], "--pfile")) {
|
||||||
|
bufferManagerFileHandleType = BUFFER_MANAGER_FILE_HANDLE_PFILE;
|
||||||
|
legacyBM = 0;
|
||||||
|
legacyFH = 0;
|
||||||
|
} else if(!strcmp(argv[i], "--nb_pfile")) {
|
||||||
|
bufferManagerNonBlockingSlowHandleType = IO_HANDLE_PFILE;
|
||||||
|
} else if(!strcmp(argv[i], "--nb_file")) {
|
||||||
bufferManagerNonBlockingSlowHandleType = IO_HANDLE_FILE;
|
bufferManagerNonBlockingSlowHandleType = IO_HANDLE_FILE;
|
||||||
} else if(!strcmp(argv[i], "--mb")) {
|
} else if(!strcmp(argv[i], "--mb")) {
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -136,27 +136,29 @@ int Tinit() {
|
||||||
LogInit(loggerType);
|
LogInit(loggerType);
|
||||||
stasis_page_init();
|
stasis_page_init();
|
||||||
|
|
||||||
switch(bufferManagerFileHandleType) {
|
|
||||||
case BUFFER_MANAGER_FILE_HANDLE_NON_BLOCKING: {
|
|
||||||
struct sf_args * slow_arg = malloc(sizeof(sf_args));
|
|
||||||
slow_arg->filename = STORE_FILE;
|
|
||||||
|
|
||||||
#ifndef HAVE_O_DIRECT
|
#ifndef HAVE_O_DIRECT
|
||||||
if(bufferManagerO_DIRECT) {
|
if(bufferManagerO_DIRECT) {
|
||||||
printf("O_DIRECT not supported by this build; switching to conventional buffered I/O.\n");
|
printf("O_DIRECT not supported by this build; switching to conventional buffered I/O.\n");
|
||||||
bufferManagerO_DIRECT = 0;
|
bufferManagerO_DIRECT = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
int openMode;
|
||||||
if(bufferManagerO_DIRECT) {
|
if(bufferManagerO_DIRECT) {
|
||||||
#ifdef HAVE_O_DIRECT
|
#ifdef HAVE_O_DIRECT
|
||||||
slow_arg->openMode = O_CREAT | O_RDWR | O_DIRECT;
|
openMode = O_CREAT | O_RDWR | O_DIRECT;
|
||||||
#else
|
#else
|
||||||
printf("Can't happen\n");
|
printf("Can't happen\n");
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
slow_arg->openMode = O_CREAT | O_RDWR;
|
openMode = O_CREAT | O_RDWR;
|
||||||
}
|
}
|
||||||
|
switch(bufferManagerFileHandleType) {
|
||||||
|
case BUFFER_MANAGER_FILE_HANDLE_NON_BLOCKING: {
|
||||||
|
struct sf_args * slow_arg = malloc(sizeof(sf_args));
|
||||||
|
slow_arg->filename = STORE_FILE;
|
||||||
|
|
||||||
|
slow_arg->openMode = openMode;
|
||||||
|
|
||||||
slow_arg->filePerm = FILE_PERM;
|
slow_arg->filePerm = FILE_PERM;
|
||||||
// Allow 4MB of outstanding writes.
|
// Allow 4MB of outstanding writes.
|
||||||
|
@ -183,6 +185,16 @@ int Tinit() {
|
||||||
//pageFile = stasis_handle(open_debug)(pageFile);
|
//pageFile = stasis_handle(open_debug)(pageFile);
|
||||||
pageHandleOpen(pageFile);
|
pageHandleOpen(pageFile);
|
||||||
} break;
|
} break;
|
||||||
|
case BUFFER_MANAGER_FILE_HANDLE_FILE: {
|
||||||
|
stasis_handle_t * pageFile =
|
||||||
|
stasis_handle_open_file(0, STORE_FILE, openMode, FILE_PERM);
|
||||||
|
pageHandleOpen(pageFile);
|
||||||
|
} break;
|
||||||
|
case BUFFER_MANAGER_FILE_HANDLE_PFILE: {
|
||||||
|
stasis_handle_t * pageFile =
|
||||||
|
stasis_handle_open_pfile(0, STORE_FILE, openMode, FILE_PERM);
|
||||||
|
pageHandleOpen(pageFile);
|
||||||
|
} break;
|
||||||
case BUFFER_MANAGER_FILE_HANDLE_DEPRECATED: {
|
case BUFFER_MANAGER_FILE_HANDLE_DEPRECATED: {
|
||||||
printf("\nWarning: Using old I/O routines (with known bugs).\n");
|
printf("\nWarning: Using old I/O routines (with known bugs).\n");
|
||||||
openPageFile();
|
openPageFile();
|
||||||
|
@ -193,8 +205,6 @@ int Tinit() {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#else
|
|
||||||
//#endif // USE_PAGEFILE
|
|
||||||
bufInit(bufferManagerType);
|
bufInit(bufferManagerType);
|
||||||
DEBUG("Buffer manager type = %d\n", bufferManagerType);
|
DEBUG("Buffer manager type = %d\n", bufferManagerType);
|
||||||
pageOperationsInit();
|
pageOperationsInit();
|
||||||
|
|
|
@ -97,7 +97,9 @@ terms specified in this license.
|
||||||
#define BUFFER_MANAGER_DEPRECATED_HASH 3
|
#define BUFFER_MANAGER_DEPRECATED_HASH 3
|
||||||
|
|
||||||
#define BUFFER_MANAGER_FILE_HANDLE_NON_BLOCKING 0
|
#define BUFFER_MANAGER_FILE_HANDLE_NON_BLOCKING 0
|
||||||
#define BUFFER_MANAGER_FILE_HANDLE_DEPRECATED 1
|
#define BUFFER_MANAGER_FILE_HANDLE_FILE 1
|
||||||
|
#define BUFFER_MANAGER_FILE_HANDLE_PFILE 2
|
||||||
|
#define BUFFER_MANAGER_FILE_HANDLE_DEPRECATED 3
|
||||||
|
|
||||||
#define IO_HANDLE_FILE 1
|
#define IO_HANDLE_FILE 1
|
||||||
#define IO_HANDLE_PFILE 2
|
#define IO_HANDLE_PFILE 2
|
||||||
|
|
Loading…
Reference in a new issue