ubik: positional io for db reads and writes 72/12272/5
authorMichael Meffie <mmeffie@sinenomine.net>
Wed, 20 Apr 2016 00:46:33 +0000 (20:46 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 21 Sep 2018 12:08:22 +0000 (08:08 -0400)
commitf62fb17b3cf1c886f8cfc2fabe9984070dd3eec4
tree0e89e51cbb17a41c5e007d8d168a36659da03576
parent8375a7f7dd0e3bcbf928a23f874d1a15a952cdef
ubik: positional io for db reads and writes

The ubik library was written before positional i/o was available and
issues an lseek system call for each database file read and write.  This
change converts the ubik database accesses to use positional i/o on
platforms where pread and pwrite are available, in order to reduce
system call load.

The new inline uphys_pread and uphys_pwrite functions are supplied on
platforms which do not supply pread and pwrite. These functions fall
back to non-positional i/o. If these symbols are present in the database
server binary then the server process will continue to call lseek before
each read and write access of the database file.

This change does not affect the whole-file database synchronization done
by ubik during database recovery (via the DISK_SendFile and DISK_GetFile
RPCs), which still uses non-positional i/o. However, that code does not
share file descriptors with the phys.c code, so there is no possibility
of mixing positional and non-positional i/o on the same FDs.

Change-Id: I28accd24f7f27b5e8a4f1dd0e3e08bab033c16e0
Reviewed-on: https://gerrit.openafs.org/12272
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/ubik/phys.c