HAMMER 53A/Many: Read and write performance enhancements, etc.
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 7 Jun 2008 07:41:51 +0000 (07:41 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 7 Jun 2008 07:41:51 +0000 (07:41 +0000)
commit47637bffad7ba04e4e0d59cde1529523d59ec099
treef3f6a4355f615b9320d1f4cf4c983166ae84f5db
parent09ff60812353c2c68a9976743903b06ff406b8bb
HAMMER 53A/Many: Read and write performance enhancements, etc.

* Add hammer_io_direct_read().  For full-block reads this code allows
  a high-level frontend buffer cache buffer associated with the
  regular file vnode to directly access the underlying storage,
  instead of loading that storage via a hammer_buffer and bcopy()ing it.

* Add a write bypass, allowing the frontend to bypass the flusher and
  write full-blocks directly to the underlying storage, greatly improving
  frontend write performance.  Caveat: See note at bottom.

  The write bypass is implemented by adding a feature whereby the frontend
  can soft-reserve unused disk space on the physical media without having
  to interact (much) with on-disk meta-data structures.  This allows the
  frontend to flush high-level buffer cache buffers directly to disk
  and release the buffer for reuse by the system, resulting in very high
  write performance.

  To properly associate the reserved space with the filesystem so it can be
  accessed in later reads, an in-memory hammer_record is created referencing
  it.  This record is queued to the backend flusher for final disposition.
  The backend disposes of the record by inserting the appropriate B-Tree
  element and marking the storage as allocated.  At that point the storage
  becomes official.

* Clean up numerous procedures to support the above new features.  In
  particular, do a major cleanup of the cached truncation offset code
  (this is the code which allows HAMMER to implement wholely asynchronous
  truncate()/ftruncate() support.

  Also clean up the flusher triggering code, removing numerous hacks that
  had been in place to deal with the lack of a direct-write mechanism.

* Start working on statistics gathering to track record and B-Tree
  operations.

* CAVEAT: The backend flusher creates a significant cpu burden when flushing
  a large number of in-memory data records.  Even though the data itself
  has already been written to disk, there is currently a great deal of
  overhead involved in manipulating the B-Tree to insert the new records.
  Overall write performance will only be modestly improved until these
  code paths are optimized.
15 files changed:
sys/vfs/hammer/hammer.h
sys/vfs/hammer/hammer_blockmap.c
sys/vfs/hammer/hammer_btree.c
sys/vfs/hammer/hammer_cursor.h
sys/vfs/hammer/hammer_disk.h
sys/vfs/hammer/hammer_flusher.c
sys/vfs/hammer/hammer_freemap.c
sys/vfs/hammer/hammer_inode.c
sys/vfs/hammer/hammer_io.c
sys/vfs/hammer/hammer_object.c
sys/vfs/hammer/hammer_ondisk.c
sys/vfs/hammer/hammer_recover.c
sys/vfs/hammer/hammer_subs.c
sys/vfs/hammer/hammer_vfsops.c
sys/vfs/hammer/hammer_vnops.c