summaryrefslogtreecommitdiff
path: root/lib/backend
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-10-20 15:11:20 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-10-20 15:11:20 +0300
commit2fa98b9e6ab00ee0e8200b405088130cbd626a32 (patch)
treee2dc9fefbc6973fd0c6427e5de2fc9a5e3752507 /lib/backend
parent5da136fa1d4edf23b20d6d8d91bd14c7c15e62de (diff)
downloadlibrpm-tizen-2fa98b9e6ab00ee0e8200b405088130cbd626a32.tar.gz
librpm-tizen-2fa98b9e6ab00ee0e8200b405088130cbd626a32.tar.bz2
librpm-tizen-2fa98b9e6ab00ee0e8200b405088130cbd626a32.zip
Lift fsync enable/disable configuration handling to rpmdb layer
- Add a fsync disable/enable function in the backend, call from rpmdb layer: on initial database creation (including database rebuild), it's "safe enough" to disable fsync as there's no former data to protect. Considerably speeds up initial install to eg chroots. - Always re-enable fsync when closing a read-write database - at that point there /is/ data to protect.
Diffstat (limited to 'lib/backend')
-rw-r--r--lib/backend/db3.c10
-rw-r--r--lib/backend/dbi.h5
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/backend/db3.c b/lib/backend/db3.c
index 06e407f19..ff458b5b3 100644
--- a/lib/backend/db3.c
+++ b/lib/backend/db3.c
@@ -156,11 +156,6 @@ static int db_init(rpmdb rdb, const char * dbhome)
xx = dbapi_err(rdb, "dbenv->set_cachesize", xx, _debug);
}
- if (cfg->db_no_fsync) {
- xx = db_env_set_func_fsync(fsync_disable);
- xx = dbapi_err(rdb, "db_env_set_func_fsync", xx, _debug);
- }
-
/*
* Actually open the environment. Fall back to private environment
* if we dont have permission to join/create shared environment.
@@ -202,6 +197,11 @@ errxit:
return rc;
}
+void dbSetFSync(void *dbenv, int enable)
+{
+ db_env_set_func_fsync(enable ? fdatasync : fsync_disable);
+}
+
int dbiSync(dbiIndex dbi, unsigned int flags)
{
DB * db = dbi->dbi_db;
diff --git a/lib/backend/dbi.h b/lib/backend/dbi.h
index bfa1d8773..793239743 100644
--- a/lib/backend/dbi.h
+++ b/lib/backend/dbi.h
@@ -82,6 +82,11 @@ struct _dbiIndex {
extern "C" {
#endif
+
+RPM_GNUC_INTERNAL
+/* Globally enable/disable fsync in the backend */
+void dbSetFSync(void *dbenv, int enable);
+
/** \ingroup dbi
* Return new configured index database handle instance.
* @param rdb rpm database