Remove O_SYNC from the options passed to dbmopen().

The services db is created as a temporary file that is moved over the
existing file after completion. Thus there is no need to immediately
flush all created db records to the temporary file.

This speeds up creation of the services db by a factor of 500 on my
ZFS based /var/db filesytem (from 110 seconds to 0.235 seconds).

MFC after:	1 week
This commit is contained in:
Stefan Eßer 2016-02-10 09:40:45 +00:00
parent 907fe11655
commit fde0af719b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295465

View File

@ -141,7 +141,7 @@ main(int argc, char *argv[])
err(1, "Cannot install exit handler");
(void)snprintf(tname, sizeof(tname), "%s.tmp", dbname);
db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL | O_SYNC,
db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL,
(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH), DB_HASH, &hinfo);
if (!db)
err(1, "Error opening temporary database `%s'", tname);