git: HAMMER VFS - Version 4 part 1/many - UNDO FIFO layout work.

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Nov 1 16:54:23 PST 2009


commit 02428fb6131e2f23a94e640dca6b54c0428be2e1
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Nov 1 16:35:41 2009 -0800

    HAMMER VFS - Version 4 part 1/many - UNDO FIFO layout work.
    
    These changes only apply to HAMMER version 4+ filesystems.  HAMMER
    versions less then 4 only implement some of these changes and do not
    use the new features during crash recovery.
    
    * Add a sequence number of the UNDO FIFO media record format.  The field
      already existed for just this purpose so no media structures changed
      size.
    
    * Change the alignment boundary for HAMMER UNDO records from 16K to 512
      bytes.  This coupled with the sequence number virtually guarantees that
      the recovery code can detect uninterrupted sequences of UNDO records
      without having to relay on the FIFO last_offset field in the volume
      header.
    
      This isn't as bad as it sounds.  It just means that large UNDO blocks
      are broken up into smaller on-media structures in order to ensure a
      record header occurs on every 512 byte boundary.
    
    * Add HAMMER_HEAD_TYPE_DUMMY and HAMMER_HEAD_TYPE_REDO (Redo is not yet
      used).  The DUMMY type is a dummy record used solely to identify a
      sequence number.  PAD records cannot have sequence numbers so we need
      a DUMMY record for it.
    
      Remove unused UNDO FIFO record types.
    
    * Adjust the version upgrade code to completely reinitialize the UNDO FIFO
      space when moving from version < 4 to version >= 4.  This puts all blocks
      in the UNDO FIFO in a deterministic state with deterministic sequence
      numbers on 512 byte boundaries.
    
    * Refactor the flush code.  In versions less then 4 the flush code had to
      flush dirty UNDO buffers, synchronize disk, then flush the volume header
      and synchronize disk again, then flush the meta data.  For HAMMER
      versions >= 4 the flush code removes the second disk synchronization
      operation.
    
    * Refactor the crash recovery code.  For versions < 4 the crash recovery
      code relied on the UNDO FIFO first_offset and next_offset indexes in
      the volume header to calculate the UNDO space that needed to be run.
      For versions >= 4 the crash recovery code uses first_offset for the
      beginning of the UNDO space and proactively scans the UNDO FIFO to
      find the end of the space.  This takes longer but allows HAMMER to
      remove one of the two disk sync operations in the flush code.
    
    * Split the crash recovery code into stage 1 and stage 2.  Stage 2 will
      be used to run REDO operations (REDO is not yet implemented).

Summary of changes:
 sys/vfs/hammer/hammer.h         |    7 +-
 sys/vfs/hammer/hammer_disk.h    |   67 +++-
 sys/vfs/hammer/hammer_flusher.c |   36 ++-
 sys/vfs/hammer/hammer_io.c      |    4 +-
 sys/vfs/hammer/hammer_ioctl.c   |   43 ++-
 sys/vfs/hammer/hammer_mount.h   |    2 +
 sys/vfs/hammer/hammer_recover.c |  723 ++++++++++++++++++++++++++++++---------
 sys/vfs/hammer/hammer_undo.c    |  372 ++++++++++++++++----
 sys/vfs/hammer/hammer_vfsops.c  |   13 +-
 9 files changed, 1004 insertions(+), 263 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/02428fb6131e2f23a94e640dca6b54c0428be2e1


-- 
DragonFly BSD source repository





More information about the Commits mailing list