diff options
Diffstat (limited to 'xlators/storage/bdb/src/bctx.c')
-rw-r--r-- | xlators/storage/bdb/src/bctx.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/xlators/storage/bdb/src/bctx.c b/xlators/storage/bdb/src/bctx.c index 7fc47cd7b..fce78e95f 100644 --- a/xlators/storage/bdb/src/bctx.c +++ b/xlators/storage/bdb/src/bctx.c @@ -324,76 +324,3 @@ out: free (pathname); return bctx; } - -inline int32_t -bdb_db_rename (bctx_table_t *table, - const char *oldpath, - const char *newpath) -{ - DB_ENV *dbenv = NULL; - int32_t ret = -1; - - GF_VALIDATE_OR_GOTO ("bctx", table, out); - GF_VALIDATE_OR_GOTO ("bctx", oldpath, out); - GF_VALIDATE_OR_GOTO ("bctx", newpath, out); - - dbenv = table->dbenv; - GF_VALIDATE_OR_GOTO ("bctx", dbenv, out); - - LOCK (&table->lock); - { - ret = dbenv->dbrename (dbenv, NULL, oldpath, NULL, newpath, 0); - - if (ret != 0) { - gf_log ("bctx", GF_LOG_ERROR, - "failed to rename %s to %s: %s", - oldpath, newpath, db_strerror (ret)); - } else { - gf_log ("bctx", GF_LOG_DEBUG, - "successfully renamed %s to %s: %s", - oldpath, newpath, db_strerror (ret)); - } - } - UNLOCK (&table->lock); - -out: - return ret; -} - -bctx_t * -bctx_rename (bctx_t *bctx, - const char *db_newpath) -{ - bctx_table_t *table = NULL; - int32_t ret = -1; - - table = bctx->table; - - LOCK (&table->lock); - { - __unhash_bctx (bctx); - list_del_init (&bctx->list); - if (bctx->dbp) { - ret = bctx->dbp->close (bctx->dbp, 0); - if (ret != 0) { - gf_log ("bdb-ll", GF_LOG_ERROR, - "failed to close db for " - "directory %s (%s)", - bctx->directory, db_strerror (ret)); - } - bctx->dbp = NULL; - } - } - UNLOCK (&table->lock); - - ret = bdb_db_rename (table, bctx->db_path, db_newpath); - - if (ret != 0) { - gf_log ("bctx", GF_LOG_ERROR, - "bdb_db_rename failed for directory %s", - bctx->directory); - bctx = NULL; - } - - return bctx; -} |