Triton Repository branch, master, updated. cecec3e2e49839556db09fa697380158853d07e4
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 cecec3e2e49839556db09fa697380158853d07e4 (commit) from 96f4856b89da19ec03ed14adfc9c9be6f664d9c3 (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 cecec3e2e49839556db09fa697380158853d07e4 Author: Phil Carns <[email protected]> Date: Tue Jul 27 16:54:01 2010 -0400 added function to retrieve size of fork ----------------------------------------------------------------------- Summary of changes: code/src/versioned-osd/prototype/tests/vosd1.ae | 68 +++++++++++ code/src/versioned-osd/prototype/versioned-osd.ae | 117 ++++++++++++++++++++ code/src/versioned-osd/prototype/versioned-osd.hae | 9 ++ 3 files changed, 194 insertions(+), 0 deletions(-) Diff of changes: diff --git a/code/src/versioned-osd/prototype/tests/vosd1.ae b/code/src/versioned-osd/prototype/tests/vosd1.ae index 38fb992..d35a16c 100644 --- a/code/src/versioned-osd/prototype/tests/vosd1.ae +++ b/code/src/versioned-osd/prototype/tests/vosd1.ae @@ -289,6 +289,33 @@ static __blocking int do_vosd_test(void) printf("DONE\n"); /********************************************************/ + printf("checking size of fork 0...\n"); + tret = vosd_get_size(oid, 0, obj_offsets); + if(tret != TRITON_SUCCESS) + { + printf("Error: bad error code from vosd_get_size()\n"); +#if 0 + triton_error_destroy(tret); +#endif + return(-1); + } + printf("DONE: size: %lld\n", lld(obj_offsets[0])); + + /********************************************************/ + printf("checking size of fork 1...\n"); + tret = vosd_get_size(oid, 1, obj_offsets); + if(tret != TRITON_SUCCESS) + { + printf("Error: bad error code from vosd_get_size()\n"); +#if 0 + triton_error_destroy(tret); +#endif + return(-1); + } + printf("DONE: size: %lld\n", lld(obj_offsets[0])); + + + /********************************************************/ printf("reading unaligned data with listio...\n"); buffer_offsets[0] = buffer+100; buffer_offsets[1] = buffer+1612; @@ -448,6 +475,47 @@ static __blocking int do_vosd_test(void) assert(tret == TRITON_SUCCESS); /********************************************************/ + printf("checking size of fork 0...\n"); + tret = vosd_get_size(oid, 0, obj_offsets); + if(tret != TRITON_SUCCESS) + { + printf("Error: bad error code from vosd_get_size()\n"); +#if 0 + triton_error_destroy(tret); +#endif + return(-1); + } + printf("DONE: size: %lld\n", lld(obj_offsets[0])); + + /********************************************************/ + printf("checking size of fork 1...\n"); + tret = vosd_get_size(oid, 1, obj_offsets); + if(tret != TRITON_SUCCESS) + { + printf("Error: bad error code from vosd_get_size()\n"); +#if 0 + triton_error_destroy(tret); +#endif + return(-1); + } + printf("DONE: size: %lld\n", lld(obj_offsets[0])); + + /********************************************************/ + printf("checking size of fork 2...\n"); + tret = vosd_get_size(oid, 2, obj_offsets); + if(tret != TRITON_SUCCESS) + { + printf("Error: bad error code from vosd_get_size()\n"); +#if 0 + triton_error_destroy(tret); +#endif + return(-1); + } + printf("DONE: size: %lld\n", lld(obj_offsets[0])); + + + + /********************************************************/ printf("opening txn...\n"); tret = vosd_txn_open(oid, 0, (++version)); if(tret != TRITON_SUCCESS) diff --git a/code/src/versioned-osd/prototype/versioned-osd.ae b/code/src/versioned-osd/prototype/versioned-osd.ae index f8e4318..10179cf 100644 --- a/code/src/versioned-osd/prototype/versioned-osd.ae +++ b/code/src/versioned-osd/prototype/versioned-osd.ae @@ -2096,6 +2096,123 @@ static __blocking triton_ret_t vosd_write_internal( return(tret); } +__blocking triton_ret_t vosd_get_size( + uint128_t oid, + uint64_t fork, + int64_t* size +) +{ + DB_TXN *txn; + DBT key, value; + triton_ret_t tret; + triton_ret_t tret_tmp; + DBC *dbc_p = NULL; + struct logical_map_key lmk; + struct logical_map_entry lme; + + *size = 0; + + tret = bdb_txn_begin(envp, NULL, &txn, 0); + if(tret != TRITON_SUCCESS) + { + return(tret); + } + + /* create a cursor to move through logical map db */ + tret = bdb_cursor(log_map_dbp, txn, &dbc_p, 0); + if(tret != TRITON_SUCCESS) + { + tret_tmp = bdb_txn_abort(txn); +#if 0 + triton_err_destroy(tret_tmp); +#endif + return(tret); + } + VOSD_INIT_DBT(key, lmk); + VOSD_INIT_DBT(value, lme); + + /* we want to go to the first record _after_ the fork that we are + * interested in + */ + lmk.oid = oid; + lmk.oid_fork = fork + 1; + lmk.logical_offset_end = -1; + if(lmk.oid_fork == 0) + { + lmk.oid = triton_uint128_inc(lmk.oid); + } + + tret = bdb_cursor_get(dbc_p, &key, &value, DB_SET_RANGE); + if(tret != TRITON_SUCCESS && tret != TRITON_ERR_NOENT) + { + tret_tmp = bdb_cursor_close(dbc_p); +#if 0 + triton_err_destroy(tret_tmp); +#endif + tret_tmp = bdb_txn_abort(txn); +#if 0 + triton_err_destroy(tret_tmp); +#endif + return(tret); + } + + if(tret == TRITON_SUCCESS) + { + /* we found the entry after the one we were looking for */ + /* back up one and see if we find the last entry in the fork we are + * actually interested in + */ + tret = bdb_cursor_get(dbc_p, &key, &value, DB_PREV); + } + else + { + /* we didn't find a fork/oid after this one. Try looking for the + * very last thing in the db instead + */ + tret = bdb_cursor_get(dbc_p, &key, &value, DB_LAST); + } + + if(tret != TRITON_SUCCESS && tret != TRITON_ERR_NOENT) + { + tret_tmp = bdb_cursor_close(dbc_p); + #if 0 + triton_err_destroy(tret_tmp); + #endif + tret_tmp = bdb_txn_abort(txn); + #if 0 + triton_err_destroy(tret_tmp); + #endif + return(tret); + } + + if(tret == TRITON_ERR_NOENT) + { + /* nothing in the vosd at all yet */ + *size = 0; + } + else if(triton_cmp_uint128(lmk.oid,oid) == 0 && lmk.oid_fork == fork) + { + /* this should be the last element in the fork */ + *size = lmk.logical_offset_end; + } + else + { + /* this fork doesn't have anything in it yet */ + *size = 0; + } + + tret_tmp = bdb_cursor_close(dbc_p); + if(tret_tmp != TRITON_SUCCESS) + { + return(tret_tmp); + } + + tret = bdb_txn_commit(txn, 0); + + return(tret); +} + + __blocking triton_ret_t vosd_write( uint128_t oid, uint64_t oid_fork, diff --git a/code/src/versioned-osd/prototype/versioned-osd.hae b/code/src/versioned-osd/prototype/versioned-osd.hae index 7f631b0..fb4ea04 100644 --- a/code/src/versioned-osd/prototype/versioned-osd.hae +++ b/code/src/versioned-osd/prototype/versioned-osd.hae @@ -78,6 +78,15 @@ triton_ret_t vosd_txn_open( ); /** + * Get logical size of a fork + */ +__blocking triton_ret_t vosd_get_size( + uint128_t oid, /**< object to operate on */ + uint64_t fork, /**< fork identifier */ + int64_t* size /**< logical size of fork */ +); + +/** * Writes data into an object */ __blocking triton_ret_t vosd_write( hooks/post-receive -- Triton Repository
participants (1)
-
noreply@mcs.anl.gov