Triton Repository branch, master, updated. 25b73eda97a9bf57bd552b6c13a87be7787f2183
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Triton Repository". The branch, master has been updated via 25b73eda97a9bf57bd552b6c13a87be7787f2183 (commit) from 30db3c52fb3ff91070e640ec675fa8146b340ed7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 25b73eda97a9bf57bd552b6c13a87be7787f2183 Author: Phil Carns <[email protected]> Date: Thu Feb 10 14:37:04 2011 -0500 tweaks to file resource progress mode ----------------------------------------------------------------------- Summary of changes: .../prototype/bdb-resource/bdb-resource.c | 3 - .../prototype/file-resource/file-resource.c | 123 ++++++++++---------- .../prototype/file-resource/file-resource.hae | 1 + code/src/versioned-osd/prototype/versioned-osd.ae | 21 +--- 4 files changed, 64 insertions(+), 84 deletions(-) Diff of changes: diff --git a/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c b/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c index 6d8f5b0..a4f4e45 100644 --- a/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c +++ b/code/src/versioned-osd/prototype/bdb-resource/bdb-resource.c @@ -1076,9 +1076,6 @@ triton_ret_t triton_ret_from_bdb(int error) static triton_ret_t progress_mode_updater(const char *key, const char *value) { - int s; - int tmp_value; - if(!strcmp(key, txn_progress_mode_confkey)) { if(!strcmp(value, "THREAD_PER_OP")) diff --git a/code/src/versioned-osd/prototype/file-resource/file-resource.c b/code/src/versioned-osd/prototype/file-resource/file-resource.c index 19f672a..101d888 100644 --- a/code/src/versioned-osd/prototype/file-resource/file-resource.c +++ b/code/src/versioned-osd/prototype/file-resource/file-resource.c @@ -30,15 +30,18 @@ #define FILE_DEFAULT_OPCACHE_SIZE 1024 static ae_opcache_t file_opcache; -static ae_ops_t file_oplist; +static ae_ops_t file_poll_oplist; +static ae_ops_t file_thread_oplist; static triton_mutex_t file_mutex = TRITON_MUTEX_INITIALIZER; static int triton_file_resource_id; -static enum file_progress_mode triton_file_progress_mode = TRITON_FILE_PROG_NONE; +static enum file_progress_mode meta_progress_mode = TRITON_FILE_PROG_NONE; +static enum file_progress_mode io_progress_mode = TRITON_FILE_PROG_NONE; static triton_debug_mask_t file_r_mask; #define FILE_CONFKEY_PREFIX "triton.file" -static const char *progress_mode_confkey = FILE_CONFKEY_PREFIX ".progress_mode"; +static const char *meta_progress_mode_confkey = FILE_CONFKEY_PREFIX ".meta_progress_mode"; +static const char *io_progress_mode_confkey = FILE_CONFKEY_PREFIX ".io_progress_mode"; struct file_op { @@ -139,19 +142,29 @@ static triton_ret_t file_launch_op(struct ae_op *op, enum file_progress_mode mod int ret; pthread_t tid; pthread_attr_t attr; + struct file_op* f_op = ae_op_entry(op, struct file_op, op); switch(mode) { + case TRITON_FILE_PROG_IN_PLACE: + /* spin on op worker */ + while(f_op->work_fn(op) != 1); + /* call cleanup function if present */ + if(f_op->cleanup_fn) + f_op->cleanup_fn(op); + /* trigger completion of the operation */ + ae_opcache_complete_op(file_opcache, op, triton_ret_t, f_op->return_code); + break; case TRITON_FILE_PROG_POLL: triton_mutex_lock(&file_mutex); - ae_ops_enqueue(op, &file_oplist); + ae_ops_enqueue(op, &file_poll_oplist); ae_resource_request_poll(NULL, triton_file_resource_id); triton_mutex_unlock(&file_mutex); break; case TRITON_FILE_PROG_THREAD_PER_OP: /* put on the queue */ triton_mutex_lock(&file_mutex); - ae_ops_enqueue(op, &file_oplist); + ae_ops_enqueue(op, &file_thread_oplist); triton_mutex_unlock(&file_mutex); /* launch a thread to do the work */ @@ -186,15 +199,6 @@ static triton_ret_t file_launch_op(struct ae_op *op, enum file_progress_mode mod return(0); } -/* file_poll_thread_per_op() - * - * poll function in the thread-per-op mode that doesn't do anything. - */ -static triton_ret_t file_poll_thread_per_op(ae_context_t context) -{ - return(TRITON_SUCCESS); -} - static triton_ret_t file_poll(ae_context_t context) { struct ae_op *a_op; @@ -204,7 +208,7 @@ static triton_ret_t file_poll(ae_context_t context) /* NOTE: poll doesn't need locking, because it is not used in the * threaded modes */ - a_op = ae_ops_dequeue(&file_oplist); + a_op = ae_ops_dequeue(&file_poll_oplist); if(!a_op) { /* nothing to work on */ @@ -222,7 +226,7 @@ static triton_ret_t file_poll(ae_context_t context) /* trigger completion of the operation */ ae_opcache_complete_op(file_opcache, a_op, triton_ret_t, f_op->return_code); - if(!ae_ops_empty(&file_oplist)) + if(!ae_ops_empty(&file_poll_oplist)) { /* need to poll more */ ae_resource_request_poll(NULL, triton_file_resource_id); @@ -275,15 +279,24 @@ triton_ret_t file_init(void) return(ret); } - ret = triton_zeroconf_register(progress_mode_confkey, - "2", progress_mode_updater, - "Specify the progress mode for the File resource (1 for polling, 2 for threaded)"); + ret = triton_zeroconf_register(meta_progress_mode_confkey, + "IN_PLACE", progress_mode_updater, + "Specify the progress mode for metadata ops in the file resource (IN_PLACE, THREAD_PER_OP, or POLL)"); if(ret != TRITON_SUCCESS && ret != TRITON_ERR_EXIST) { return(ret); } - ae_ops_init(&file_oplist); + ret = triton_zeroconf_register(io_progress_mode_confkey, + "THREAD_PER_OP", progress_mode_updater, + "Specify the progress mode for the I/O ops in the file resource (IN_PLACE, THREAD_PER_OP, or POLL)"); + if(ret != TRITON_SUCCESS && ret != TRITON_ERR_EXIST) + { + return(ret); + } + + ae_ops_init(&file_poll_oplist); + ae_ops_init(&file_thread_oplist); ret = AE_OPCACHE_INIT(struct file_op, op, FILE_DEFAULT_OPCACHE_SIZE, &file_opcache); @@ -292,19 +305,6 @@ triton_ret_t file_init(void) return(ret); } - /* modify poll function depending on requested mode */ - switch(triton_file_progress_mode) - { - case TRITON_FILE_PROG_POLL: - triton_file_resource.poll_context = file_poll; - break; - case TRITON_FILE_PROG_THREAD_PER_OP: - triton_file_resource.poll_context = file_poll_thread_per_op; - break; - default: - return(TRITON_ERR_INVAL); - } - ret = ae_resource_register(&triton_file_resource, &triton_file_resource_id); if(ret != TRITON_SUCCESS) { @@ -312,8 +312,6 @@ triton_ret_t file_init(void) return(ret); } - triton_debug(file_r_mask, - "file resource initialized with progress mode %d.\n", triton_file_progress_mode); return TRITON_SUCCESS; } @@ -356,7 +354,7 @@ ae_define_post(triton_ret_t, file_open, f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, meta_progress_mode); return(TRITON_SUCCESS); } @@ -400,7 +398,7 @@ ae_define_post(triton_ret_t, file_fsync, int fd) f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, io_progress_mode); return(TRITON_SUCCESS); } @@ -422,7 +420,7 @@ ae_define_post(triton_ret_t, file_fdatasync, int fd) f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, io_progress_mode); return(TRITON_SUCCESS); } @@ -444,7 +442,7 @@ ae_define_post(triton_ret_t, file_close, int fd) f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, meta_progress_mode); return(TRITON_SUCCESS); } @@ -532,7 +530,7 @@ ae_define_post(triton_ret_t, file_fstat, f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, meta_progress_mode); return(TRITON_SUCCESS); } @@ -577,7 +575,7 @@ ae_define_post(triton_ret_t, file_ftruncate, f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, io_progress_mode); return(TRITON_SUCCESS); } @@ -626,7 +624,7 @@ ae_define_post(triton_ret_t, file_pwrite, f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, io_progress_mode); return(TRITON_SUCCESS); } @@ -684,7 +682,7 @@ ae_define_post(triton_ret_t, file_pread, f_op->cleanup_fn = NULL; *__ae_op_id = f_op->op_id; - file_launch_op(op, triton_file_progress_mode); + file_launch_op(op, io_progress_mode); return(TRITON_SUCCESS); } @@ -719,31 +717,34 @@ static int pread_work_fn(struct ae_op* op) } static triton_ret_t progress_mode_updater(const char *key, const char *value) -{ - int s; - int tmp_value; - assert(!strcmp(key, progress_mode_confkey)); +{ + enum file_progress_mode *mode; - /* TODO: change this to be run-time configurable once we switch to the - * pipe/poll model - */ - if(triton_init_check("triton.vosd.file") == TRITON_SUCCESS) + if(!strcmp(key, io_progress_mode_confkey)) { - triton_err(triton_log_default, "Error: %s parameter cannot be modified after file resource has been initialized.\n", progress_mode_confkey); - return TRITON_ERR_INVAL; + mode = &io_progress_mode; } - - s = sscanf(value, "%d", &tmp_value); - if(s < 1 || - tmp_value <= TRITON_FILE_PROG_NONE || - tmp_value >= TRITON_FILE_PROG_MAX ) + else if(!strcmp(key, meta_progress_mode_confkey)) + { + mode = &meta_progress_mode; + } + else { - return TRITON_ERR_INVAL; + return(TRITON_ERR_INVAL); } - triton_file_progress_mode = tmp_value; + if(!strcmp(value, "IN_PLACE")) + *mode = TRITON_FILE_PROG_IN_PLACE; + else if(!strcmp(value, "POLL")) + *mode = TRITON_FILE_PROG_POLL; + else if(!strcmp(value, "THREAD_PER_OP")) + *mode = TRITON_FILE_PROG_THREAD_PER_OP; + else + return(TRITON_ERR_INVAL); + triton_debug(file_r_mask, - "file progress mode set to: %d\n", tmp_value); + "%s set to: %s\n", key, value); + return TRITON_SUCCESS; } diff --git a/code/src/versioned-osd/prototype/file-resource/file-resource.hae b/code/src/versioned-osd/prototype/file-resource/file-resource.hae index 90b14a7..ee36f05 100644 --- a/code/src/versioned-osd/prototype/file-resource/file-resource.hae +++ b/code/src/versioned-osd/prototype/file-resource/file-resource.hae @@ -26,6 +26,7 @@ enum file_progress_mode TRITON_FILE_PROG_NONE = 0, /**< invalid mode */ TRITON_FILE_PROG_POLL, /**< requires active polling by client */ TRITON_FILE_PROG_THREAD_PER_OP, /**< spawns new thread for each op */ + TRITON_FILE_PROG_IN_PLACE, /**< immediate execution */ TRITON_FILE_PROG_MAX, /**< invalid mode */ }; diff --git a/code/src/versioned-osd/prototype/versioned-osd.ae b/code/src/versioned-osd/prototype/versioned-osd.ae index d81d453..c103a53 100644 --- a/code/src/versioned-osd/prototype/versioned-osd.ae +++ b/code/src/versioned-osd/prototype/versioned-osd.ae @@ -3384,14 +3384,6 @@ __blocking triton_ret_t vosd_check_niid(uint128_t oid, uint64_t niid, int op_typ __blocking triton_ret_t vosd_autotune(void) { /* TODO: - * - go ahead and switch some of the more obvious operations to either - * execute immediately or else run in non threaded mode - * - examples: open, close, and fstat in file resource should probably - * run in non threaded mode - * - examples: bdb txn open, etc. should just execute immediately - */ - - /* TODO: * - need a way to toggle O_DIRECT mode on the fly rather than forcing * it at init time: * - restrictions: all file descriptors must be idle (so that we can @@ -3413,27 +3405,16 @@ __blocking triton_ret_t vosd_autotune(void) * - with and without o_direct * - with and without threads * - sweep coalescing values again? - * - vosd_read small (4k read) - * - with and without o_direct - * - with and without threads * - vosd_write large (4M read) * - with and without o_direct * - with and without threads * - sweep coalescing values again? - * - vosd_read large (4M read) - * - with and without o_direct - * - with and without threads - * - * - if run as root, then try to drop buffer caches before each read - * test * * - run everything in parallel; we don't really care so much about * sequential performance * - maybe do test duration based on elapsed time rather than number of ops? + * - hold alignment fixed at 4096 for now * - * - other things we could do (probably just hold these at default level - * for the moment?): - * - vary the alignment (for non-odirect use) */ return(TRITON_ERR_NOSYS); hooks/post-receive -- Triton Repository
participants (1)
-
noreply@mcs.anl.gov