svn commit: r295800 - head/usr.bin/cap_mkdb

Bryan Drewery bdrewery at FreeBSD.org
Sat Feb 20 00:40:38 UTC 2016


On 2/19/2016 12:42 AM, Stefan Esser wrote:
> Author: se
> Date: Fri Feb 19 08:42:13 2016
> New Revision: 295800
> URL: https://svnweb.freebsd.org/changeset/base/295800
> 
> Log:
>   Remove O_SYNC from the options passed to dbmopen().

Uh, this is a full revert of r293312's changes to cap_mkdb which were
made for good reason. So this seems simply wrong without a better fix.

>   
>   The output file 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 is not right either. Depending on the use of soft updates /
journaling the data and metadata (file name / rename) may be written at
different times. It is entirely possible to get a renamed file with no
or junk content without an fsync. That's exactly what r293312 mentions
in its commit message.

>   
>   This speeds up creation of the termcap db by a factor of 40 on my
>   ZFS based /etc filesytem (from 25 seconds to 0.6 seconds).
>   
>   I have compared multiple output files created with and without O_SYNC
>   and they came out identical each time.  Nonetheless it might be best
>   to MFC this change and the similar one for services_mkdb (r295465) at
>   the same time when the changes to hash.c in review D5186 are merged.
>   
>   MFC:	 1 week
> 
> Modified:
>   head/usr.bin/cap_mkdb/cap_mkdb.c
> 
> Modified: head/usr.bin/cap_mkdb/cap_mkdb.c
> ==============================================================================
> --- head/usr.bin/cap_mkdb/cap_mkdb.c	Fri Feb 19 08:41:47 2016	(r295799)
> +++ head/usr.bin/cap_mkdb/cap_mkdb.c	Fri Feb 19 08:42:13 2016	(r295800)
> @@ -119,7 +119,7 @@ main(int argc, char *argv[])
>  	(void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
>  	if ((capname = strdup(buf)) == NULL)
>  		errx(1, "strdup failed");
> -	if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR | O_SYNC,
> +	if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR,
>  	    DEFFILEMODE, DB_HASH, &openinfo)) == NULL)
>  		err(1, "%s", buf);
>  
> 


-- 
Regards,
Bryan Drewery

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20160219/44f1273f/attachment.sig>


More information about the svn-src-all mailing list