hammer2 - flush sequencing part 4 - stabilization and cleanup, flush sep
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 9 May 2013 00:24:23 +0000 (17:24 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 9 May 2013 00:24:23 +0000 (17:24 -0700)
commit9596b8c441af001ca471190eebadc28c684148ea
treef3cf1ca426e3de97e4b38c4bc3bfcf339500aed5
parente0836e94092043dfdc5c34d00c214369c411de76
hammer2 - flush sequencing part 4 - stabilization and cleanup, flush sep

* Fix bugs in the handling of DIRECTDATA.  The data for small
  files <= 512 bytes is stored in the inode itself using the
  area that would otherwise contain the indirect block table.

  Cleanup the flag handling for this data, ensure synchronous bwrite()s
  for this data area (the strategy code for direct-data reads and writes
  doesn't actually do any I/O), and ensure proper read-before-write
  operation.

* Adjust hammer2_inode_create() and hammer2_chain_modify_ip() to take/return
  (*chainp).

* Change the inode locking APIs to return the locked chain (unlocking APIs
  take the locked chain as an argument).  This allows the chain to be
  manipulated by the code inbetween, including replacing it with other
  chains, instead of the mess we had before where ip->chain had an implied
  lock associated with it.

  With this change, replacing ip->chain is just a matter of adjusting
  ref counts and not also having to worry about locks.

* Modify the inode chain proactively instead of indirectly.

* Set HAMMER2_INODE_MODIFIED proactively instead of indirectly.  This flag
  is now only used to filter vfs_sync scans.

* Start working on flush transitions.  hammer2_modify_chain() and friends
  will now delete/duplicate an underlying chain that is already in the
  MODIFIED state (returning the new chain) for the case where the previous
  modifications are associated with a flush-in-progress and the current
  modifications are outside of that flush.

* Add hammer2_chain_delete_duplicate(), a function which combines the
  DELETE and duplication operation in one atomic op.  Otherwise a lookup
  or find can catch such operations in the middle and improperly believe
  that the element is fully deleted when it isn't.

* Fix chain refs in a few places.
sys/vfs/hammer2/hammer2.h
sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_inode.c
sys/vfs/hammer2/hammer2_ioctl.c
sys/vfs/hammer2/hammer2_subr.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/hammer2/hammer2_vnops.c