Commit 164a4d66 authored by Yoni Fogel's avatar Yoni Fogel

Standardized 'static inline' to be the default

(We had both inline static and static inline

git-svn-id: file:///svn/tokudb@2629 c7de825b-a66e-492c-adef-691d508d4ae1
parent d4efc426
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
(return EINVAL if necessary) before making lock tree calls. */ (return EINVAL if necessary) before making lock tree calls. */
inline static int toku__lt_panic(toku_lock_tree *tree, int r) { static inline int toku__lt_panic(toku_lock_tree *tree, int r) {
return tree->panic(tree->db, r); return tree->panic(tree->db, r);
} }
inline static int toku__lt_callback(toku_lock_tree *tree, DB_TXN* txn) { static inline int toku__lt_callback(toku_lock_tree *tree, DB_TXN* txn) {
return tree->lock_callback ? tree->lock_callback(txn, tree) : 0; return tree->lock_callback ? tree->lock_callback(txn, tree) : 0;
} }
...@@ -52,7 +52,7 @@ char* toku_lt_strerror(TOKU_LT_ERROR r) { ...@@ -52,7 +52,7 @@ char* toku_lt_strerror(TOKU_LT_ERROR r) {
return "Unknown error in locking data structures.\n"; return "Unknown error in locking data structures.\n";
} }
/* Compare two payloads assuming that at least one of them is infinite */ /* Compare two payloads assuming that at least one of them is infinite */
inline static int toku__infinite_compare(const DBT* a, const DBT* b) { static inline int toku__infinite_compare(const DBT* a, const DBT* b) {
if (a == b) return 0; if (a == b) return 0;
if (a == toku_lt_infinity) return 1; if (a == toku_lt_infinity) return 1;
if (b == toku_lt_infinity) return -1; if (b == toku_lt_infinity) return -1;
...@@ -60,7 +60,7 @@ inline static int toku__infinite_compare(const DBT* a, const DBT* b) { ...@@ -60,7 +60,7 @@ inline static int toku__infinite_compare(const DBT* a, const DBT* b) {
assert(b == toku_lt_neg_infinity); return 1; assert(b == toku_lt_neg_infinity); return 1;
} }
inline static BOOL toku__lt_is_infinite(const DBT* p) { static inline BOOL toku__lt_is_infinite(const DBT* p) {
if (p == toku_lt_infinity || p == toku_lt_neg_infinity) { if (p == toku_lt_infinity || p == toku_lt_neg_infinity) {
DBT* dbt = (DBT*)p; DBT* dbt = (DBT*)p;
assert(!dbt->data && !dbt->size); assert(!dbt->data && !dbt->size);
...@@ -71,19 +71,19 @@ inline static BOOL toku__lt_is_infinite(const DBT* p) { ...@@ -71,19 +71,19 @@ inline static BOOL toku__lt_is_infinite(const DBT* p) {
/* Verifies that NULL data and size are consistent. /* Verifies that NULL data and size are consistent.
i.e. The size is 0 if and only if the data is NULL. */ i.e. The size is 0 if and only if the data is NULL. */
inline static int toku__lt_verify_null_key(const DBT* key) { static inline int toku__lt_verify_null_key(const DBT* key) {
if (key && key->size && !key->data) return EINVAL; if (key && key->size && !key->data) return EINVAL;
return 0; return 0;
} }
inline static DBT* toku__recreate_DBT(DBT* dbt, void* payload, u_int32_t length) { static inline DBT* toku__recreate_DBT(DBT* dbt, void* payload, u_int32_t length) {
memset(dbt, 0, sizeof(DBT)); memset(dbt, 0, sizeof(DBT));
dbt->data = payload; dbt->data = payload;
dbt->size = length; dbt->size = length;
return dbt; return dbt;
} }
inline static int toku__lt_txn_cmp(DB_TXN* a, DB_TXN* b) { static inline int toku__lt_txn_cmp(DB_TXN* a, DB_TXN* b) {
return a < b ? -1 : (a != b); return a < b ? -1 : (a != b);
} }
...@@ -124,27 +124,27 @@ int toku__lt_point_cmp(toku_point* x, toku_point* y) { ...@@ -124,27 +124,27 @@ int toku__lt_point_cmp(toku_point* x, toku_point* y) {
/* Functions to update the range count and compare it with the /* Functions to update the range count and compare it with the
maximum number of ranges */ maximum number of ranges */
inline static BOOL toku__lt_range_test_incr(toku_lock_tree* tree, u_int32_t replace) { static inline BOOL toku__lt_range_test_incr(toku_lock_tree* tree, u_int32_t replace) {
assert(tree); assert(tree);
assert(tree->num_ranges); assert(tree->num_ranges);
assert(replace <= *tree->num_ranges); assert(replace <= *tree->num_ranges);
return *tree->num_ranges - replace < tree->max_ranges; return *tree->num_ranges - replace < tree->max_ranges;
} }
inline static void toku__lt_range_incr(toku_lock_tree* tree, u_int32_t replace) { static inline void toku__lt_range_incr(toku_lock_tree* tree, u_int32_t replace) {
assert(toku__lt_range_test_incr(tree, replace)); assert(toku__lt_range_test_incr(tree, replace));
*tree->num_ranges -= replace; *tree->num_ranges -= replace;
*tree->num_ranges += 1; *tree->num_ranges += 1;
} }
inline static void toku__lt_range_decr(toku_lock_tree* tree, u_int32_t ranges) { static inline void toku__lt_range_decr(toku_lock_tree* tree, u_int32_t ranges) {
assert(tree); assert(tree);
assert(tree->num_ranges); assert(tree->num_ranges);
assert(*tree->num_ranges >= ranges); assert(*tree->num_ranges >= ranges);
*tree->num_ranges -= ranges; *tree->num_ranges -= ranges;
} }
inline static void toku__p_free(toku_lock_tree* tree, toku_point* point) { static inline void toku__p_free(toku_lock_tree* tree, toku_point* point) {
assert(point); assert(point);
if (!toku__lt_is_infinite(point->key_payload)) { if (!toku__lt_is_infinite(point->key_payload)) {
tree->free(point->key_payload); tree->free(point->key_payload);
...@@ -158,7 +158,7 @@ inline static void toku__p_free(toku_lock_tree* tree, toku_point* point) { ...@@ -158,7 +158,7 @@ inline static void toku__p_free(toku_lock_tree* tree, toku_point* point) {
/* /*
Allocate and copy the payload. Allocate and copy the payload.
*/ */
inline static int toku__payload_copy(toku_lock_tree* tree, static inline int toku__payload_copy(toku_lock_tree* tree,
void** payload_out, u_int32_t* len_out, void** payload_out, u_int32_t* len_out,
void* payload_in, u_int32_t len_in) { void* payload_in, u_int32_t len_in) {
assert(payload_out && len_out); assert(payload_out && len_out);
...@@ -177,7 +177,7 @@ inline static int toku__payload_copy(toku_lock_tree* tree, ...@@ -177,7 +177,7 @@ inline static int toku__payload_copy(toku_lock_tree* tree,
return 0; return 0;
} }
inline static int toku__p_makecopy(toku_lock_tree* tree, toku_point** ppoint) { static inline int toku__p_makecopy(toku_lock_tree* tree, toku_point** ppoint) {
assert(ppoint); assert(ppoint);
toku_point* point = *ppoint; toku_point* point = *ppoint;
toku_point* temp_point = NULL; toku_point* temp_point = NULL;
...@@ -225,7 +225,7 @@ toku_range_tree* toku__lt_ifexist_selfwrite(toku_lock_tree* tree, ...@@ -225,7 +225,7 @@ toku_range_tree* toku__lt_ifexist_selfwrite(toku_lock_tree* tree,
/* Provides access to a selfread tree for a particular transaction. /* Provides access to a selfread tree for a particular transaction.
Creates it if it does not exist. */ Creates it if it does not exist. */
inline static int toku__lt_selfread(toku_lock_tree* tree, DB_TXN* txn, static inline int toku__lt_selfread(toku_lock_tree* tree, DB_TXN* txn,
toku_range_tree** pselfread) { toku_range_tree** pselfread) {
int r; int r;
assert(tree && txn && pselfread); assert(tree && txn && pselfread);
...@@ -252,7 +252,7 @@ inline static int toku__lt_selfread(toku_lock_tree* tree, DB_TXN* txn, ...@@ -252,7 +252,7 @@ inline static int toku__lt_selfread(toku_lock_tree* tree, DB_TXN* txn,
/* Provides access to a selfwrite tree for a particular transaction. /* Provides access to a selfwrite tree for a particular transaction.
Creates it if it does not exist. */ Creates it if it does not exist. */
inline static int toku__lt_selfwrite(toku_lock_tree* tree, DB_TXN* txn, static inline int toku__lt_selfwrite(toku_lock_tree* tree, DB_TXN* txn,
toku_range_tree** pselfwrite) { toku_range_tree** pselfwrite) {
int r; int r;
assert(tree && txn && pselfwrite); assert(tree && txn && pselfwrite);
...@@ -282,7 +282,7 @@ inline static int toku__lt_selfwrite(toku_lock_tree* tree, DB_TXN* txn, ...@@ -282,7 +282,7 @@ inline static int toku__lt_selfwrite(toku_lock_tree* tree, DB_TXN* txn,
Uses the standard definition of dominated from the design document. Uses the standard definition of dominated from the design document.
Determines whether 'query' is dominated by 'rt'. Determines whether 'query' is dominated by 'rt'.
*/ */
inline static int toku__lt_rt_dominates(toku_lock_tree* tree, toku_range* query, static inline int toku__lt_rt_dominates(toku_lock_tree* tree, toku_range* query,
toku_range_tree* rt, BOOL* dominated) { toku_range_tree* rt, BOOL* dominated) {
assert(tree && query && dominated); assert(tree && query && dominated);
if (!rt) { if (!rt) {
...@@ -327,7 +327,7 @@ typedef enum ...@@ -327,7 +327,7 @@ typedef enum
If exactly one range overlaps and its data != self, there might be a If exactly one range overlaps and its data != self, there might be a
conflict. We need to check the 'peer'write table to verify. conflict. We need to check the 'peer'write table to verify.
*/ */
inline static int toku__lt_borderwrite_conflict(toku_lock_tree* tree, DB_TXN* self, static inline int toku__lt_borderwrite_conflict(toku_lock_tree* tree, DB_TXN* self,
toku_range* query, toku_range* query,
toku_conflict* conflict, DB_TXN** peer) { toku_conflict* conflict, DB_TXN** peer) {
assert(tree && self && query && conflict && peer); assert(tree && self && query && conflict && peer);
...@@ -361,7 +361,7 @@ inline static int toku__lt_borderwrite_conflict(toku_lock_tree* tree, DB_TXN* se ...@@ -361,7 +361,7 @@ inline static int toku__lt_borderwrite_conflict(toku_lock_tree* tree, DB_TXN* se
Uses the standard definition of 'query' meets 'tree' at 'data' from the Uses the standard definition of 'query' meets 'tree' at 'data' from the
design document. design document.
*/ */
inline static int toku__lt_meets(toku_lock_tree* tree, toku_range* query, static inline int toku__lt_meets(toku_lock_tree* tree, toku_range* query,
toku_range_tree* rt, BOOL* met) { toku_range_tree* rt, BOOL* met) {
assert(tree && query && rt && met); assert(tree && query && rt && met);
const u_int32_t query_size = 1; const u_int32_t query_size = 1;
...@@ -390,7 +390,7 @@ inline static int toku__lt_meets(toku_lock_tree* tree, toku_range* query, ...@@ -390,7 +390,7 @@ inline static int toku__lt_meets(toku_lock_tree* tree, toku_range* query,
Uses the standard definition of 'query' meets 'tree' at 'data' from the Uses the standard definition of 'query' meets 'tree' at 'data' from the
design document. design document.
*/ */
inline static int toku__lt_meets_peer(toku_lock_tree* tree, toku_range* query, static inline int toku__lt_meets_peer(toku_lock_tree* tree, toku_range* query,
toku_range_tree* rt, BOOL is_homogenous, toku_range_tree* rt, BOOL is_homogenous,
DB_TXN* self, BOOL* met) { DB_TXN* self, BOOL* met) {
assert(tree && query && rt && self && met); assert(tree && query && rt && self && met);
...@@ -414,7 +414,7 @@ inline static int toku__lt_meets_peer(toku_lock_tree* tree, toku_range* query, ...@@ -414,7 +414,7 @@ inline static int toku__lt_meets_peer(toku_lock_tree* tree, toku_range* query,
Utility function to implement: (from design document) Utility function to implement: (from design document)
if K meets E at v'!=t and K meets W_v' then return failure. if K meets E at v'!=t and K meets W_v' then return failure.
*/ */
inline static int toku__lt_check_borderwrite_conflict(toku_lock_tree* tree, static inline int toku__lt_check_borderwrite_conflict(toku_lock_tree* tree,
DB_TXN* txn, toku_range* query) { DB_TXN* txn, toku_range* query) {
assert(tree && txn && query); assert(tree && txn && query);
toku_conflict conflict; toku_conflict conflict;
...@@ -439,7 +439,7 @@ inline static int toku__lt_check_borderwrite_conflict(toku_lock_tree* tree, ...@@ -439,7 +439,7 @@ inline static int toku__lt_check_borderwrite_conflict(toku_lock_tree* tree,
return 0; return 0;
} }
inline static void toku__payload_from_dbt(void** payload, u_int32_t* len, static inline void toku__payload_from_dbt(void** payload, u_int32_t* len,
const DBT* dbt) { const DBT* dbt) {
assert(payload && len && dbt); assert(payload && len && dbt);
if (toku__lt_is_infinite(dbt)) *payload = (void*)dbt; if (toku__lt_is_infinite(dbt)) *payload = (void*)dbt;
...@@ -453,7 +453,7 @@ inline static void toku__payload_from_dbt(void** payload, u_int32_t* len, ...@@ -453,7 +453,7 @@ inline static void toku__payload_from_dbt(void** payload, u_int32_t* len,
} }
} }
inline static void toku__init_point(toku_point* point, toku_lock_tree* tree, static inline void toku__init_point(toku_point* point, toku_lock_tree* tree,
const DBT* key, const DBT* data) { const DBT* key, const DBT* data) {
assert(point && tree && key); assert(point && tree && key);
assert(!tree->duplicates == !data); assert(!tree->duplicates == !data);
...@@ -472,7 +472,7 @@ inline static void toku__init_point(toku_point* point, toku_lock_tree* tree, ...@@ -472,7 +472,7 @@ inline static void toku__init_point(toku_point* point, toku_lock_tree* tree,
} }
} }
inline static void toku__init_query(toku_range* query, static inline void toku__init_query(toku_range* query,
toku_point* left, toku_point* right) { toku_point* left, toku_point* right) {
query->left = left; query->left = left;
query->right = right; query->right = right;
...@@ -492,7 +492,7 @@ inline static void toku__init_query(toku_range* query, ...@@ -492,7 +492,7 @@ inline static void toku__init_query(toku_range* query,
we made copies from the DB at consolidation time we made copies from the DB at consolidation time
*/ */
inline static void toku__init_insert(toku_range* to_insert, static inline void toku__init_insert(toku_range* to_insert,
toku_point* left, toku_point* right, toku_point* left, toku_point* right,
DB_TXN* txn) { DB_TXN* txn) {
to_insert->left = left; to_insert->left = left;
...@@ -502,12 +502,12 @@ inline static void toku__init_insert(toku_range* to_insert, ...@@ -502,12 +502,12 @@ inline static void toku__init_insert(toku_range* to_insert,
/* Returns whether the point already exists /* Returns whether the point already exists
as an endpoint of the given range. */ as an endpoint of the given range. */
inline static BOOL toku__lt_p_independent(toku_point* point, toku_range* range) { static inline BOOL toku__lt_p_independent(toku_point* point, toku_range* range) {
assert(point && range); assert(point && range);
return point != range->left && point != range->right; return point != range->left && point != range->right;
} }
inline static int toku__lt_extend_extreme(toku_lock_tree* tree,toku_range* to_insert, static inline int toku__lt_extend_extreme(toku_lock_tree* tree,toku_range* to_insert,
BOOL* alloc_left, BOOL* alloc_right, BOOL* alloc_left, BOOL* alloc_right,
u_int32_t numfound) { u_int32_t numfound) {
assert(to_insert && tree && alloc_left && alloc_right); assert(to_insert && tree && alloc_left && alloc_right);
...@@ -539,7 +539,7 @@ inline static int toku__lt_extend_extreme(toku_lock_tree* tree,toku_range* to_in ...@@ -539,7 +539,7 @@ inline static int toku__lt_extend_extreme(toku_lock_tree* tree,toku_range* to_in
return 0; return 0;
} }
inline static int toku__lt_alloc_extreme(toku_lock_tree* tree, toku_range* to_insert, static inline int toku__lt_alloc_extreme(toku_lock_tree* tree, toku_range* to_insert,
BOOL alloc_left, BOOL* alloc_right) { BOOL alloc_left, BOOL* alloc_right) {
assert(to_insert && alloc_right); assert(to_insert && alloc_right);
BOOL copy_left = FALSE; BOOL copy_left = FALSE;
...@@ -569,7 +569,7 @@ inline static int toku__lt_alloc_extreme(toku_lock_tree* tree, toku_range* to_in ...@@ -569,7 +569,7 @@ inline static int toku__lt_alloc_extreme(toku_lock_tree* tree, toku_range* to_in
return 0; return 0;
} }
inline static int toku__lt_delete_overlapping_ranges(toku_lock_tree* tree, static inline int toku__lt_delete_overlapping_ranges(toku_lock_tree* tree,
toku_range_tree* rt, toku_range_tree* rt,
u_int32_t numfound) { u_int32_t numfound) {
assert(tree && rt); assert(tree && rt);
...@@ -583,7 +583,7 @@ inline static int toku__lt_delete_overlapping_ranges(toku_lock_tree* tree, ...@@ -583,7 +583,7 @@ inline static int toku__lt_delete_overlapping_ranges(toku_lock_tree* tree,
return 0; return 0;
} }
inline static int toku__lt_free_points(toku_lock_tree* tree, toku_range* to_insert, static inline int toku__lt_free_points(toku_lock_tree* tree, toku_range* to_insert,
u_int32_t numfound, toku_range_tree *rt) { u_int32_t numfound, toku_range_tree *rt) {
assert(tree && to_insert); assert(tree && to_insert);
assert(numfound <= tree->buflen); assert(numfound <= tree->buflen);
...@@ -613,7 +613,7 @@ inline static int toku__lt_free_points(toku_lock_tree* tree, toku_range* to_inse ...@@ -613,7 +613,7 @@ inline static int toku__lt_free_points(toku_lock_tree* tree, toku_range* to_inse
} }
/* Consolidate the new range and all the overlapping ranges */ /* Consolidate the new range and all the overlapping ranges */
inline static int toku__consolidate(toku_lock_tree* tree, static inline int toku__consolidate(toku_lock_tree* tree,
toku_range* query, toku_range* to_insert, toku_range* query, toku_range* to_insert,
DB_TXN* txn) { DB_TXN* txn) {
int r; int r;
...@@ -686,7 +686,7 @@ inline static int toku__consolidate(toku_lock_tree* tree, ...@@ -686,7 +686,7 @@ inline static int toku__consolidate(toku_lock_tree* tree,
return 0; return 0;
} }
inline static void toku__lt_init_full_query(toku_lock_tree* tree, toku_range* query, static inline void toku__lt_init_full_query(toku_lock_tree* tree, toku_range* query,
toku_point* left, toku_point* right) { toku_point* left, toku_point* right) {
toku__init_point(left, tree, (DBT*)toku_lt_neg_infinity, toku__init_point(left, tree, (DBT*)toku_lt_neg_infinity,
tree->duplicates ? (DBT*)toku_lt_neg_infinity : NULL); tree->duplicates ? (DBT*)toku_lt_neg_infinity : NULL);
...@@ -695,7 +695,7 @@ inline static void toku__lt_init_full_query(toku_lock_tree* tree, toku_range* qu ...@@ -695,7 +695,7 @@ inline static void toku__lt_init_full_query(toku_lock_tree* tree, toku_range* qu
toku__init_query(query, left, right); toku__init_query(query, left, right);
} }
inline static int toku__lt_free_contents_slow(toku_lock_tree* tree, static inline int toku__lt_free_contents_slow(toku_lock_tree* tree,
toku_range_tree* rt, toku_range_tree* rt,
toku_range_tree* rtdel) { toku_range_tree* rtdel) {
int r; int r;
...@@ -723,7 +723,7 @@ inline static int toku__lt_free_contents_slow(toku_lock_tree* tree, ...@@ -723,7 +723,7 @@ inline static int toku__lt_free_contents_slow(toku_lock_tree* tree,
return r; return r;
} }
inline static int toku__lt_free_contents(toku_lock_tree* tree, toku_range_tree* rt, static inline int toku__lt_free_contents(toku_lock_tree* tree, toku_range_tree* rt,
toku_range_tree *rtdel) { toku_range_tree *rtdel) {
assert(tree); assert(tree);
if (!rt) return 0; if (!rt) return 0;
...@@ -746,7 +746,7 @@ inline static int toku__lt_free_contents(toku_lock_tree* tree, toku_range_tree* ...@@ -746,7 +746,7 @@ inline static int toku__lt_free_contents(toku_lock_tree* tree, toku_range_tree*
return r; return r;
} }
inline static BOOL toku__r_backwards(toku_range* range) { static inline BOOL toku__r_backwards(toku_range* range) {
assert(range && range->left && range->right); assert(range && range->left && range->right);
toku_point* left = (toku_point*)range->left; toku_point* left = (toku_point*)range->left;
toku_point* right = (toku_point*)range->right; toku_point* right = (toku_point*)range->right;
...@@ -758,7 +758,7 @@ inline static BOOL toku__r_backwards(toku_range* range) { ...@@ -758,7 +758,7 @@ inline static BOOL toku__r_backwards(toku_range* range) {
} }
inline static int toku__lt_preprocess(toku_lock_tree* tree, DB_TXN* txn, static inline int toku__lt_preprocess(toku_lock_tree* tree, DB_TXN* txn,
const DBT* key_left, const DBT** pdata_left, const DBT* key_left, const DBT** pdata_left,
const DBT* key_right, const DBT** pdata_right, const DBT* key_right, const DBT** pdata_right,
toku_point* left, toku_point* right, toku_point* left, toku_point* right,
...@@ -794,7 +794,7 @@ inline static int toku__lt_preprocess(toku_lock_tree* tree, DB_TXN* txn, ...@@ -794,7 +794,7 @@ inline static int toku__lt_preprocess(toku_lock_tree* tree, DB_TXN* txn,
return 0; return 0;
} }
inline static int toku__lt_get_border(toku_lock_tree* tree, BOOL in_borderwrite, static inline int toku__lt_get_border(toku_lock_tree* tree, BOOL in_borderwrite,
toku_range* pred, toku_range* succ, toku_range* pred, toku_range* succ,
BOOL* found_p, BOOL* found_s, BOOL* found_p, BOOL* found_s,
toku_range* to_insert) { toku_range* to_insert) {
...@@ -811,7 +811,7 @@ inline static int toku__lt_get_border(toku_lock_tree* tree, BOOL in_borderwrite, ...@@ -811,7 +811,7 @@ inline static int toku__lt_get_border(toku_lock_tree* tree, BOOL in_borderwrite,
return 0; return 0;
} }
inline static int toku__lt_expand_border(toku_lock_tree* tree, toku_range* to_insert, static inline int toku__lt_expand_border(toku_lock_tree* tree, toku_range* to_insert,
toku_range* pred, toku_range* succ, toku_range* pred, toku_range* succ,
BOOL found_p, BOOL found_s) { BOOL found_p, BOOL found_s) {
assert(tree && to_insert && pred && succ); assert(tree && to_insert && pred && succ);
...@@ -829,7 +829,7 @@ inline static int toku__lt_expand_border(toku_lock_tree* tree, toku_range* to_in ...@@ -829,7 +829,7 @@ inline static int toku__lt_expand_border(toku_lock_tree* tree, toku_range* to_in
return 0; return 0;
} }
inline static int toku__lt_split_border(toku_lock_tree* tree, toku_range* to_insert, static inline int toku__lt_split_border(toku_lock_tree* tree, toku_range* to_insert,
toku_range* pred, toku_range* succ, toku_range* pred, toku_range* succ,
BOOL found_p, BOOL found_s) { BOOL found_p, BOOL found_s) {
assert(tree && to_insert && pred && succ); assert(tree && to_insert && pred && succ);
...@@ -881,7 +881,7 @@ inline static int toku__lt_split_border(toku_lock_tree* tree, toku_range* to_ins ...@@ -881,7 +881,7 @@ inline static int toku__lt_split_border(toku_lock_tree* tree, toku_range* to_ins
done with borderwrite. done with borderwrite.
insert point,point into selfwrite. insert point,point into selfwrite.
*/ */
inline static int toku__lt_borderwrite_insert(toku_lock_tree* tree, static inline int toku__lt_borderwrite_insert(toku_lock_tree* tree,
toku_range* query, toku_range* query,
toku_range* to_insert) { toku_range* to_insert) {
assert(tree && query && to_insert); assert(tree && query && to_insert);
...@@ -1161,7 +1161,7 @@ int toku_lt_acquire_range_write_lock(toku_lock_tree* tree, DB_TXN* txn, ...@@ -1161,7 +1161,7 @@ int toku_lt_acquire_range_write_lock(toku_lock_tree* tree, DB_TXN* txn,
} }
inline static int toku__sweep_border(toku_lock_tree* tree, toku_range* range) { static inline int toku__sweep_border(toku_lock_tree* tree, toku_range* range) {
assert(tree && range); assert(tree && range);
toku_range_tree* borderwrite = tree->borderwrite; toku_range_tree* borderwrite = tree->borderwrite;
assert(borderwrite); assert(borderwrite);
...@@ -1229,7 +1229,7 @@ inline static int toku__sweep_border(toku_lock_tree* tree, toku_range* range) { ...@@ -1229,7 +1229,7 @@ inline static int toku__sweep_border(toku_lock_tree* tree, toku_range* range) {
If both found and pred.data=succ.data, merge pred and succ (expand?) If both found and pred.data=succ.data, merge pred and succ (expand?)
free_points free_points
*/ */
inline static int toku__lt_border_delete(toku_lock_tree* tree, toku_range_tree* rt) { static inline int toku__lt_border_delete(toku_lock_tree* tree, toku_range_tree* rt) {
int r; int r;
assert(tree); assert(tree);
if (!rt) return 0; if (!rt) return 0;
......
...@@ -174,8 +174,8 @@ static void dbg_name_delete (char *name) { ...@@ -174,8 +174,8 @@ static void dbg_name_delete (char *name) {
assert(0); assert(0);
} }
#else #else
inline static void dbg_name_insert(unsigned char*name __attribute__((__unused__))) {} static inline void dbg_name_insert(unsigned char*name __attribute__((__unused__))) {}
inline static void dbg_name_delete(char*name __attribute__((__unused__))) {} static inline void dbg_name_delete(char*name __attribute__((__unused__))) {}
#endif #endif
......
...@@ -958,7 +958,7 @@ static int get_main_cursor_flag(u_int32_t flag) { ...@@ -958,7 +958,7 @@ static int get_main_cursor_flag(u_int32_t flag) {
return flag; return flag;
} }
inline static BOOL toku_c_uninitialized(DBC* c) { static inline BOOL toku_c_uninitialized(DBC* c) {
return toku_brt_cursor_uninitialized(c->i->c); return toku_brt_cursor_uninitialized(c->i->c);
} }
...@@ -995,7 +995,7 @@ static inline int toku_uninitialized_swap(DBC* c, DBT* key, DBT* data, ...@@ -995,7 +995,7 @@ static inline int toku_uninitialized_swap(DBC* c, DBT* key, DBT* data,
This may hold extra locks, and will not work as expected when This may hold extra locks, and will not work as expected when
a node has two non-completed txns at any time. a node has two non-completed txns at any time.
*/ */
inline static DB_TXN* toku_txn_ancestor(DB_TXN* txn) { static inline DB_TXN* toku_txn_ancestor(DB_TXN* txn) {
while (txn && txn->i->parent) txn = txn->i->parent; while (txn && txn->i->parent) txn = txn->i->parent;
return txn; return txn;
} }
...@@ -2214,7 +2214,7 @@ static int toku_db_fd(DB *db, int *fdp) { ...@@ -2214,7 +2214,7 @@ static int toku_db_fd(DB *db, int *fdp) {
//TODO: DB_AUTO_COMMIT. //TODO: DB_AUTO_COMMIT.
//TODO: Nowait only conditionally? //TODO: Nowait only conditionally?
//TODO: NOSYNC change to SYNC if DB_ENV has something in set_flags //TODO: NOSYNC change to SYNC if DB_ENV has something in set_flags
inline static int toku_db_construct_autotxn(DB* db, DB_TXN **txn, BOOL* changed, static inline int toku_db_construct_autotxn(DB* db, DB_TXN **txn, BOOL* changed,
BOOL force_auto_commit) { BOOL force_auto_commit) {
assert(db && txn && changed); assert(db && txn && changed);
DB_ENV* env = db->dbenv; DB_ENV* env = db->dbenv;
...@@ -2230,14 +2230,14 @@ inline static int toku_db_construct_autotxn(DB* db, DB_TXN **txn, BOOL* changed, ...@@ -2230,14 +2230,14 @@ inline static int toku_db_construct_autotxn(DB* db, DB_TXN **txn, BOOL* changed,
return 0; return 0;
} }
inline static int toku_db_destruct_autotxn(DB_TXN *txn, int r, BOOL changed) { static inline int toku_db_destruct_autotxn(DB_TXN *txn, int r, BOOL changed) {
if (!changed) return r; if (!changed) return r;
if (r==0) return toku_txn_commit(txn, 0); if (r==0) return toku_txn_commit(txn, 0);
toku_txn_abort(txn); toku_txn_abort(txn);
return r; return r;
} }
inline static int autotxn_db_associate(DB *primary, DB_TXN *txn, DB *secondary, static inline int autotxn_db_associate(DB *primary, DB_TXN *txn, DB *secondary,
int (*callback)(DB *secondary, const DBT *key, const DBT *data, DBT *result), u_int32_t flags) { int (*callback)(DB *secondary, const DBT *key, const DBT *data, DBT *result), u_int32_t flags) {
BOOL changed; int r; BOOL changed; int r;
r = toku_db_construct_autotxn(primary, &txn, &changed, FALSE); r = toku_db_construct_autotxn(primary, &txn, &changed, FALSE);
...@@ -2255,7 +2255,7 @@ static int locked_db_close(DB * db, u_int32_t flags) { ...@@ -2255,7 +2255,7 @@ static int locked_db_close(DB * db, u_int32_t flags) {
toku_ydb_lock(); int r = toku_db_close(db, flags); toku_ydb_unlock(); return r; toku_ydb_lock(); int r = toku_db_close(db, flags); toku_ydb_unlock(); return r;
} }
inline static int autotxn_db_cursor(DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) { static inline int autotxn_db_cursor(DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) {
if (!txn && (db->dbenv->i->open_flags & DB_INIT_TXN)) { if (!txn && (db->dbenv->i->open_flags & DB_INIT_TXN)) {
return toku_ydb_do_error(db->dbenv, EINVAL, return toku_ydb_do_error(db->dbenv, EINVAL,
"Cursors in a transaction environment must have transactions.\n"); "Cursors in a transaction environment must have transactions.\n");
...@@ -2267,7 +2267,7 @@ static int locked_db_cursor(DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) { ...@@ -2267,7 +2267,7 @@ static int locked_db_cursor(DB *db, DB_TXN *txn, DBC **c, u_int32_t flags) {
toku_ydb_lock(); int r = autotxn_db_cursor(db, txn, c, flags); toku_ydb_unlock(); return r; toku_ydb_lock(); int r = autotxn_db_cursor(db, txn, c, flags); toku_ydb_unlock(); return r;
} }
inline static int autotxn_db_del(DB* db, DB_TXN* txn, DBT* key, static inline int autotxn_db_del(DB* db, DB_TXN* txn, DBT* key,
u_int32_t flags) { u_int32_t flags) {
BOOL changed; int r; BOOL changed; int r;
r = toku_db_construct_autotxn(db, &txn, &changed, FALSE); r = toku_db_construct_autotxn(db, &txn, &changed, FALSE);
...@@ -2280,7 +2280,7 @@ static int locked_db_del(DB * db, DB_TXN * txn, DBT * key, u_int32_t flags) { ...@@ -2280,7 +2280,7 @@ static int locked_db_del(DB * db, DB_TXN * txn, DBT * key, u_int32_t flags) {
toku_ydb_lock(); int r = autotxn_db_del(db, txn, key, flags); toku_ydb_unlock(); return r; toku_ydb_lock(); int r = autotxn_db_del(db, txn, key, flags); toku_ydb_unlock(); return r;
} }
inline static int autotxn_db_get(DB* db, DB_TXN* txn, DBT* key, DBT* data, static inline int autotxn_db_get(DB* db, DB_TXN* txn, DBT* key, DBT* data,
u_int32_t flags) { u_int32_t flags) {
BOOL changed; int r; BOOL changed; int r;
r = toku_db_construct_autotxn(db, &txn, &changed, FALSE); r = toku_db_construct_autotxn(db, &txn, &changed, FALSE);
...@@ -2293,7 +2293,7 @@ static int locked_db_get (DB * db, DB_TXN * txn, DBT * key, DBT * data, u_int32_ ...@@ -2293,7 +2293,7 @@ static int locked_db_get (DB * db, DB_TXN * txn, DBT * key, DBT * data, u_int32_
toku_ydb_lock(); int r = autotxn_db_get(db, txn, key, data, flags); toku_ydb_unlock(); return r; toku_ydb_lock(); int r = autotxn_db_get(db, txn, key, data, flags); toku_ydb_unlock(); return r;
} }
inline static int autotxn_db_pget(DB* db, DB_TXN* txn, DBT* key, DBT* pkey, static inline int autotxn_db_pget(DB* db, DB_TXN* txn, DBT* key, DBT* pkey,
DBT* data, u_int32_t flags) { DBT* data, u_int32_t flags) {
BOOL changed; int r; BOOL changed; int r;
r = toku_db_construct_autotxn(db, &txn, &changed, FALSE); r = toku_db_construct_autotxn(db, &txn, &changed, FALSE);
...@@ -2306,7 +2306,7 @@ static int locked_db_pget (DB *db, DB_TXN *txn, DBT *key, DBT *pkey, DBT *data, ...@@ -2306,7 +2306,7 @@ static int locked_db_pget (DB *db, DB_TXN *txn, DBT *key, DBT *pkey, DBT *data,
toku_ydb_lock(); int r = autotxn_db_pget(db, txn, key, pkey, data, flags); toku_ydb_unlock(); return r; toku_ydb_lock(); int r = autotxn_db_pget(db, txn, key, pkey, data, flags); toku_ydb_unlock(); return r;
} }
inline static int autotxn_db_open(DB* db, DB_TXN* txn, const char *fname, const char *dbname, DBTYPE dbtype, u_int32_t flags, int mode) { static inline int autotxn_db_open(DB* db, DB_TXN* txn, const char *fname, const char *dbname, DBTYPE dbtype, u_int32_t flags, int mode) {
BOOL changed; int r; BOOL changed; int r;
r = toku_db_construct_autotxn(db, &txn, &changed, flags & DB_AUTO_COMMIT); r = toku_db_construct_autotxn(db, &txn, &changed, flags & DB_AUTO_COMMIT);
if (r!=0) return r; if (r!=0) return r;
...@@ -2318,7 +2318,7 @@ static int locked_db_open(DB *db, DB_TXN *txn, const char *fname, const char *db ...@@ -2318,7 +2318,7 @@ static int locked_db_open(DB *db, DB_TXN *txn, const char *fname, const char *db
toku_ydb_lock(); int r = autotxn_db_open(db, txn, fname, dbname, dbtype, flags, mode); toku_ydb_unlock(); return r; toku_ydb_lock(); int r = autotxn_db_open(db, txn, fname, dbname, dbtype, flags, mode); toku_ydb_unlock(); return r;
} }
inline static int autotxn_db_put(DB* db, DB_TXN* txn, DBT* key, DBT* data, static inline int autotxn_db_put(DB* db, DB_TXN* txn, DBT* key, DBT* data,
u_int32_t flags) { u_int32_t flags) {
BOOL changed; int r; BOOL changed; int r;
r = toku_db_construct_autotxn(db, &txn, &changed, FALSE); r = toku_db_construct_autotxn(db, &txn, &changed, FALSE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment