ubik: Buffer log writes with stdio 70/13070/5
authorAndrew Deason <adeason@sinenomine.net>
Thu, 10 May 2018 21:22:52 +0000 (16:22 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 15 Sep 2018 01:52:33 +0000 (21:52 -0400)
commit800318b43fdf461ad95cd7f3940718f3f0a609a7
treedf7463c2da85db5d0cf8e37f45914e502532ecbb
parent93fd6d31ce441c5ab394f31355584d17ef6e455a
ubik: Buffer log writes with stdio

Currently, when we write ubik i/o operations to the db log, we tend to
issue several syscalls involving small writes and fstat()s. This is
because each "log" operation involves at least one write, and each log
operation tends to be pretty small.

Each logged operation hitting disk separately is unnecessary, since
the db log does not need to hit the disk at all until we are ready to
commit the transaction. So to reduce the number of syscalls when
writing to the db, change our log writes to be buffered in memory
(using stdio calls). This also avoids needing to fstat() the
underlying log file, since we open the underlying file in append-only
mode, since we only ever append to (and truncate) the log file.

To implement this, we introduce a new 'buffered_append' phys
operation, to explicitly separate our buffered and non-buffered
operations, to try to avoid any bugs from mixing buffered and
non-buffered i/o. This new operation is only used for the db log.

Change-Id: I5596117c6c71ab7c2d552f71b0ef038f387e358a
Reviewed-on: https://gerrit.openafs.org/13070
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/ubik/disk.c
src/ubik/phys.c
src/ubik/ubik.c
src/ubik/ubik.p.h