linux/fs/xfs
Dave Chinner 71e330b593 xfs: Introduce delayed logging core code
The delayed logging code only changes in-memory structures and as
such can be enabled and disabled with a mount option. Add the mount
option and emit a warning that this is an experimental feature that
should not be used in production yet.

We also need infrastructure to track committed items that have not
yet been written to the log. This is what the Committed Item List
(CIL) is for.

The log item also needs to be extended to track the current log
vector, the associated memory buffer and it's location in the Commit
Item List. Extend the log item and log vector structures to enable
this tracking.

To maintain the current log format for transactions with delayed
logging, we need to introduce a checkpoint transaction and a context
for tracking each checkpoint from initiation to transaction
completion.  This includes adding a log ticket for tracking space
log required/used by the context checkpoint.

To track all the changes we need an io vector array per log item,
rather than a single array for the entire transaction. Using the new
log vector structure for this requires two passes - the first to
allocate the log vector structures and chain them together, and the
second to fill them out.  This log vector chain can then be passed
to the CIL for formatting, pinning and insertion into the CIL.

Formatting of the log vector chain is relatively simple - it's just
a loop over the iovecs on each log vector, but it is made slightly
more complex because we re-write the iovec after the copy to point
back at the memory buffer we just copied into.

This code also needs to pin log items. If the log item is not
already tracked in this checkpoint context, then it needs to be
pinned. Otherwise it is already pinned and we don't need to pin it
again.

The only other complexity is calculating the amount of new log space
the formatting has consumed. This needs to be accounted to the
transaction in progress, and the accounting is made more complex
becase we need also to steal space from it for log metadata in the
checkpoint transaction. Calculate all this at insert time and update
all the tickets, counters, etc correctly.

Once we've formatted all the log items in the transaction, attach
the busy extents to the checkpoint context so the busy extents live
until checkpoint completion and can be processed at that point in
time. Transactions can then be freed at this point in time.

Now we need to issue checkpoints - we are tracking the amount of log space
used by the items in the CIL, so we can trigger background checkpoints when the
space usage gets to a certain threshold. Otherwise, checkpoints need ot be
triggered when a log synchronisation point is reached - a log force event.

Because the log write code already handles chained log vectors, writing the
transaction is trivial, too. Construct a transaction header, add it
to the head of the chain and write it into the log, then issue a
commit record write. Then we can release the checkpoint log ticket
and attach the context to the log buffer so it can be called during
Io completion to complete the checkpoint.

We also need to allow for synchronising multiple in-flight
checkpoints. This is needed for two things - the first is to ensure
that checkpoint commit records appear in the log in the correct
sequence order (so they are replayed in the correct order). The
second is so that xfs_log_force_lsn() operates correctly and only
flushes and/or waits for the specific sequence it was provided with.

To do this we need a wait variable and a list tracking the
checkpoint commits in progress. We can walk this list and wait for
the checkpoints to change state or complete easily, an this provides
the necessary synchronisation for correct operation in both cases.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
2010-05-24 10:38:03 -05:00
..
linux-2.6 xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
quota xfs: Clean up XFS_BLI_* flag namespace 2010-05-24 10:33:39 -05:00
support xfs: event tracing support 2009-12-14 23:08:16 -06:00
Kconfig xfs: use generic Posix ACL code 2009-06-10 17:07:47 +02:00
Makefile xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_acl.h xfs: convert attr to use unsigned names 2010-01-20 10:47:48 +11:00
xfs_ag.h xfs: Improve scalability of busy extent tracking 2010-05-24 10:34:00 -05:00
xfs_alloc.c xfs: Improve scalability of busy extent tracking 2010-05-24 10:34:00 -05:00
xfs_alloc.h xfs: Improve scalability of busy extent tracking 2010-05-24 10:34:00 -05:00
xfs_alloc_btree.c xfs: Improve scalability of busy extent tracking 2010-05-24 10:34:00 -05:00
xfs_alloc_btree.h
xfs_arch.h xfs: use generic Posix ACL code 2009-06-10 17:07:47 +02:00
xfs_attr.c xfs: remove duplicate buffer flags 2010-01-21 13:44:36 -06:00
xfs_attr.h xfs: convert attr to use unsigned names 2010-01-20 10:47:48 +11:00
xfs_attr_leaf.c xfs: remove duplicate buffer flags 2010-01-21 13:44:36 -06:00
xfs_attr_leaf.h
xfs_attr_sf.h xfs: convert attr to use unsigned names 2010-01-20 10:47:48 +11:00
xfs_bit.c
xfs_bit.h
xfs_bmap.c xfs: fix reservation release commit flag in xfs_bmap_add_attrfork() 2010-05-19 09:58:08 -05:00
xfs_bmap.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_bmap_btree.c xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_bmap_btree.h xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_btree.c xfs: remove duplicate buffer flags 2010-01-21 13:44:36 -06:00
xfs_btree.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_btree_trace.c
xfs_btree_trace.h xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_buf_item.c xfs: Clean up XFS_BLI_* flag namespace 2010-05-24 10:33:39 -05:00
xfs_buf_item.h xfs: Clean up XFS_BLI_* flag namespace 2010-05-24 10:33:39 -05:00
xfs_da_btree.c xfs: convert dirnameops to unsigned char names 2010-01-20 10:47:17 +11:00
xfs_da_btree.h xfs: convert dirnameops to unsigned char names 2010-01-20 10:47:17 +11:00
xfs_dfrag.c xfs: more swap extent fixes for dynamic fork offsets 2010-04-26 12:38:51 -05:00
xfs_dfrag.h xfs: clean up inconsistent variable naming in xfs_swap_extent 2010-01-15 15:31:23 -06:00
xfs_dinode.h
xfs_dir2.c xfs: clean up sign warnings in dir2 code 2010-01-20 10:48:05 +11:00
xfs_dir2.h xfs: make xfs_dir_cilookup_result use unsigned char 2010-01-20 10:47:25 +11:00
xfs_dir2_block.c xfs: clean up sign warnings in dir2 code 2010-01-20 10:48:05 +11:00
xfs_dir2_block.h
xfs_dir2_data.c
xfs_dir2_data.h
xfs_dir2_leaf.c xfs: clean up sign warnings in dir2 code 2010-01-20 10:48:05 +11:00
xfs_dir2_leaf.h
xfs_dir2_node.c xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_dir2_node.h xfs: make several more functions static 2010-01-15 15:31:38 -06:00
xfs_dir2_sf.c xfs: clean up sign warnings in dir2 code 2010-01-20 10:48:05 +11:00
xfs_dir2_sf.h
xfs_dmapi.h
xfs_dmops.c
xfs_error.c xfs: clean up log ticket overrun debug output 2010-05-24 10:33:46 -05:00
xfs_error.h xfs: add const qualifiers to xfs error function args 2010-05-19 09:58:11 -05:00
xfs_extfree_item.c xfs: remove stale parameter from ->iop_unpin method 2010-05-19 09:58:08 -05:00
xfs_extfree_item.h
xfs_filestream.c xfs: Kill filestreams cache flush 2010-01-15 15:34:22 -06:00
xfs_filestream.h xfs: Kill filestreams cache flush 2010-01-15 15:34:22 -06:00
xfs_fs.h xfs: return inode fork offset in bulkstat for fsr 2010-03-05 11:02:07 -06:00
xfs_fsops.c xfs: Replace per-ag array with a radix tree 2010-01-15 15:33:52 -06:00
xfs_fsops.h
xfs_ialloc.c xfs: remove duplicate buffer flags 2010-01-21 13:44:36 -06:00
xfs_ialloc.h xfs: rationalize xfs_inobt_lookup* 2009-09-01 12:45:39 -05:00
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_iget.c xfs: fix locking for inode cache radix tree tag updates 2010-03-01 19:14:36 -06:00
xfs_inode.c xfs: Add inode pin counts to traces 2010-05-19 09:58:08 -05:00
xfs_inode.h xfs: remove xfs_ipin/xfs_iunpin 2010-03-01 16:35:56 -06:00
xfs_inode_item.c xfs: remove stale parameter from ->iop_unpin method 2010-05-19 09:58:08 -05:00
xfs_inode_item.h xfs: Don't issue buffer IO direct from AIL push V2 2010-02-02 10:13:42 +11:00
xfs_inum.h xfs: remove XFS_INO64_OFFSET 2009-08-31 14:46:22 -05:00
xfs_iomap.c xfs: mark xfs_iomap_write_ helpers static 2010-05-19 09:58:20 -05:00
xfs_iomap.h xfs: mark xfs_iomap_write_ helpers static 2010-05-19 09:58:20 -05:00
xfs_itable.c xfs: return inode fork offset in bulkstat for fsr 2010-03-05 11:02:07 -06:00
xfs_itable.h xfs: add more statics & drop some unused functions 2009-08-31 14:46:20 -05:00
xfs_log.c xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_log.h xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_log_cil.c xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_log_priv.h xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_log_recover.c xfs: Clean up XFS_BLI_* flag namespace 2010-05-24 10:33:39 -05:00
xfs_log_recover.h xfs: Clean up XFS_BLI_* flag namespace 2010-05-24 10:33:39 -05:00
xfs_mount.c xfs: remove dead XFS_LOUD_RECOVERY code 2010-05-19 09:58:15 -05:00
xfs_mount.h xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_mru_cache.c xfs: Kill filestreams cache flush 2010-01-15 15:34:22 -06:00
xfs_mru_cache.h xfs: Kill filestreams cache flush 2010-01-15 15:34:22 -06:00
xfs_quota.h xfs: removed unused XFS_QMOPT_ flags 2010-05-19 09:58:15 -05:00
xfs_refcache.h
xfs_rename.c xfs: event tracing support 2009-12-14 23:08:16 -06:00
xfs_rtalloc.c xfs: fix missing error check in xfs_rtfree_range 2010-01-15 13:46:19 -06:00
xfs_rtalloc.h
xfs_rw.c xfs: only clear the suid bit once in xfs_write 2010-02-12 13:43:57 -06:00
xfs_rw.h xfs: only clear the suid bit once in xfs_write 2010-02-12 13:43:57 -06:00
xfs_sb.h
xfs_trans.c xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_trans.h xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_trans_ail.c xfs: Don't issue buffer IO direct from AIL push V2 2010-02-02 10:13:42 +11:00
xfs_trans_buf.c xfs: Clean up XFS_BLI_* flag namespace 2010-05-24 10:33:39 -05:00
xfs_trans_extfree.c
xfs_trans_inode.c xfs: simplify xfs_trans_iget 2009-09-01 12:46:16 -05:00
xfs_trans_item.c xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_trans_priv.h xfs: Introduce delayed logging core code 2010-05-24 10:38:03 -05:00
xfs_trans_space.h
xfs_types.h xfs: make the log ticket ID available outside the log infrastructure 2010-05-24 10:33:52 -05:00
xfs_utils.c xfs: kill xfs_qmops 2009-06-08 15:33:32 +02:00
xfs_utils.h
xfs_vnodeops.c xfs: remove wrapper for the fsync file operation 2010-03-01 16:34:38 -06:00
xfs_vnodeops.h xfs: kill xfs_lrw.h 2010-03-01 16:35:44 -06:00