RFC: NFS client patch to reduce sychronous writes

Konstantin Belousov kostikbel at gmail.com
Thu Nov 28 07:18:27 UTC 2013


On Wed, Nov 27, 2013 at 03:20:14PM -0800, Kirk McKusick wrote:
> The ``fix'' of bzero'ing every buffer cache page was made to UFS/FFS
> for this problem and it killed write performance of the filesystem
> by nearly half. We corrected this by only doing the bzero when the
> file is mmap'ed which helped things considerably (since most files
> being written are not also bmap'ed).

I am not sure that I follow.

For UFS, leaving any part of the buffer with undefined garbage would
cause the garbage to appear on the next mmap(2), since page in is
implemented as translation of the file offsets into disk offsets and
than reading disk blocks. The read always fetch full page. UFS cannot
know if the file would be mapped sometime in future, or after the
reboot.

In fact, UFS is quite plentiful WRT zeroing buffers on write. It is easy
to see almost all places where it is done, by searching for BA_CLRBUF
flag for UFS_BALLOC(). UFS does perform the optimization of _trying_ to
not clear newly allocated buffer on write if uio covers the whole buffer
range. Still, on error it falls back to clearing, which is performed by
vfs_bio_clrbuf() call in ffs_write().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20131128/79848ab1/attachment.sig>


More information about the freebsd-fs mailing list