1. 19 May, 2010 16 commits
    • Dave Chinner's avatar
      xfs: add log item recovery tracing · 9abbc539
      Dave Chinner authored
      Currently there is no tracing in log recovery, so it is difficult to
      determine what is going on when something goes wrong.
      
      Add tracing for log item recovery to provide visibility into the log
      recovery process. The tracing added shows regions being extracted
      from the log transactions and added to the transaction hash forming
      recovery items, followed by the reordering, cancelling and finally
      recovery of the items.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      9abbc539
    • Christoph Hellwig's avatar
      xfs: clean up xlog_write_adv_cnt · e6b1f273
      Christoph Hellwig authored
      Replace the awkward xlog_write_adv_cnt with an inline helper that makes
      it more obvious that it's modifying it's paramters, and replace the use
      of an integer type for "ptr" with a real void pointer.  Also move
      xlog_write_adv_cnt to xfs_log_priv.h as it will be used outside of
      xfs_log.c in the delayed logging series.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      e6b1f273
    • Dave Chinner's avatar
      xfs: introduce new internal log vector structure · 55b66332
      Dave Chinner authored
      The current log IO vector structure is a flat array and not
      extensible. To make it possible to keep separate log IO vectors for
      individual log items, we need a method of chaining log IO vectors
      together.
      
      Introduce a new log vector type that can be used to wrap the
      existing log IO vectors on use that internally to the log. This
      means that the existing external interface (xfs_log_write) does not
      change and hence no changes to the transaction commit code are
      required.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      55b66332
    • Christoph Hellwig's avatar
      xfs: reindent xlog_write · 99428ad0
      Christoph Hellwig authored
      Reindent xlog_write to normal one tab indents and move all variable
      declarations into the closest enclosing block.
      
      Split from a bigger patch by Dave Chinner.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      99428ad0
    • Dave Chinner's avatar
      xfs: factor xlog_write · b5203cd0
      Dave Chinner authored
      xlog_write is a mess that takes a lot of effort to understand. It is
      a mass of nested loops with 4 space indents to get it to fit in 80 columns
      and lots of funky variables that aren't obvious what they mean or do.
      
      Break it down into understandable chunks.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      b5203cd0
    • Dave Chinner's avatar
      xfs: log ticket reservation underestimates the number of iclogs · 9b9fc2b7
      Dave Chinner authored
      When allocation a ticket for a transaction, the ticket is initialised with the
      worst case log space usage based on the number of bytes the transaction may
      consume. Part of this calculation is the number of log headers required for the
      iclog space used up by the transaction.
      
      This calculation makes an undocumented assumption that if the transaction uses
      the log header space reservation on an iclog, then it consumes either the
      entire iclog or it completes. That is - the transaction that is first in an
      iclog is the transaction that the log header reservation is accounted to. If
      the transaction is larger than the iclog, then it will use the entire iclog
      itself. Document this assumption.
      
      Further, the current calculation uses the rule that we can fit iclog_size bytes
      of transaction data into an iclog. This is in correct - the amount of space
      available in an iclog for transaction data is the size of the iclog minus the
      space used for log record headers. This means that the calculation is out by
      512 bytes per 32k of log space the transaction can consume. This is rarely an
      issue because maximally sized transactions are extremely uncommon, and for 4k
      block size filesystems maximal transaction reservations are about 400kb. Hence
      the error in this case is less than the size of an iclog, so that makes it even
      harder to hit.
      
      However, anyone using larger directory blocks (16k directory blocks push the
      maximum transaction size to approx. 900k on a 4k block size filesystem) or
      larger block size (e.g. 64k blocks push transactions to the 3-4MB size) could
      see the error grow to more than an iclog and at this point the transaction is
      guaranteed to get a reservation underrun and shutdown the filesystem.
      
      Fix this by adjusting the calculation to calculate the correct number of iclogs
      required and account for them all up front.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      9b9fc2b7
    • Dave Chinner's avatar
      xfs: Clean up xfs_trans_committed code after factoring · b1c1b5b6
      Dave Chinner authored
      Now that the code has been factored, clean up all the remaining
      style cruft, simplify the code and re-order functions so that it
      doesn't need forward declarations.
      
      Also move the remaining functions that require forward declarations
      (xfs_trans_uncommit, xfs_trans_free) so that all the forward
      declarations can be removed from the file.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      b1c1b5b6
    • Dave Chinner's avatar
      xfs: update and factor xfs_trans_committed() · 8e646a55
      Dave Chinner authored
      The function header to xfs-trans_committed has long had this
      comment:
      
       * THIS SHOULD BE REWRITTEN TO USE xfs_trans_next_item()
      
      To prepare for different methods of committing items, convert the
      code to use xfs_trans_next_item() and factor the code into smaller,
      more digestible chunks.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      8e646a55
    • Christoph Hellwig's avatar
      xfs: clean up xfs_trans_commit logic even more · a3ccd2ca
      Christoph Hellwig authored
      > +shut_us_down:
      > +	shutdown = XFS_FORCED_SHUTDOWN(mp) ? EIO : 0;
      > +	if (!(tp->t_flags & XFS_TRANS_DIRTY) || shutdown) {
      > +		xfs_trans_unreserve_and_mod_sb(tp);
      > +		/*
      
      This whole area in _xfs_trans_commit is still a complete mess.
      
      So while touching this code, unravel this mess as well to make the
      whole flow of the function simpler and clearer.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
      a3ccd2ca
    • Dave Chinner's avatar
      xfs: split out iclog writing from xfs_trans_commit() · 0924378a
      Dave Chinner authored
      Split the the part of xfs_trans_commit() that deals with writing the
      transaction into the iclog into a separate function. This isolates the
      physical commit process from the logical commit operation and makes
      it easier to insert different transaction commit paths without affecting
      the existing algorithm adversely.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      0924378a
    • Dave Chinner's avatar
      xfs: fix reservation release commit flag in xfs_bmap_add_attrfork() · 713bf88b
      Dave Chinner authored
      xfs_bmap_add_attrfork() passes XFS_TRANS_PERM_LOG_RES to xfs_trans_commit()
      to indicate that the commit should release the permanent log reservation
      as part of the commit. This is wrong - the correct flag is
      XFS_TRANS_RELEASE_LOG_RES - and it is only by the chance that both these
      flags have the value of 0x4 that the code is doing the right thing.
      
      Fix it by changing to use the correct flag.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      713bf88b
    • Dave Chinner's avatar
      xfs: remove stale parameter from ->iop_unpin method · 8e123850
      Dave Chinner authored
      The staleness of a object being unpinned can be directly derived
      from the object itself - there is no need to extract it from the
      object then pass it as a parameter into IOP_UNPIN().
      
      This means we can kill the XFS_LID_BUF_STALE flag - it is set,
      checked and cleared in the same places XFS_BLI_STALE flag in the
      xfs_buf_log_item so it is now redundant and hence safe to remove.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      8e123850
    • Dave Chinner's avatar
      xfs: Add inode pin counts to traces · 4aaf15d1
      Dave Chinner authored
      We don't record pin counts in inode events right now, and this makes
      it difficult to track down problems related to pinning inodes. Add
      the pin count to the inode trace class and add trace events for
      pinning and unpinning inodes.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      4aaf15d1
    • Dave Chinner's avatar
      xfs: factor log item initialisation · 43f5efc5
      Dave Chinner authored
      Each log item type does manual initialisation of the log item.
      Delayed logging introduces new fields that need initialisation, so
      factor all the open coded initialisation into a common function
      first.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      43f5efc5
    • Jan Engelhardt's avatar
      xfs: add blockdev name to kthreads · e2a07812
      Jan Engelhardt authored
      This allows to see in `ps` and similar tools which kthreads are
      allotted to which block device/filesystem, similar to what jbd2
      does. As the process name is a fixed 16-char array, no extra
      space is needed in tasks.
      
        PID TTY      STAT   TIME COMMAND
          2 ?        S      0:00 [kthreadd]
        197 ?        S      0:00  \_ [jbd2/sda2-8]
        198 ?        S      0:00  \_ [ext4-dio-unwrit]
        204 ?        S      0:00  \_ [flush-8:0]
       2647 ?        S      0:00  \_ [xfs_mru_cache]
       2648 ?        S      0:00  \_ [xfslogd/0]
       2649 ?        S      0:00  \_ [xfsdatad/0]
       2650 ?        S      0:00  \_ [xfsconvertd/0]
       2651 ?        S      0:00  \_ [xfsbufd/ram0]
       2652 ?        S      0:00  \_ [xfsaild/ram0]
       2653 ?        S      0:00  \_ [xfssyncd/ram0]
      Signed-off-by: default avatarJan Engelhardt <jengelh@medozas.de>
      Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
      e2a07812
    • Zhitong Wang's avatar
      xfs: Fix integer overflow in fs/xfs/linux-2.6/xfs_ioctl*.c · fda168c2
      Zhitong Wang authored
      The am_hreq.opcount field in the xfs_attrmulti_by_handle() interface
      is not bounded correctly. The opcount is used to determine the size
      of the buffer required. The size is bounded, but can overflow and so
      the size checks may not be sufficient to catch invalid opcounts.
      Fix it by catching opcount values that would cause overflows before
      calculating the size.
      Signed-off-by: default avatarZhitong Wang <zhitong.wangzt@alibaba-inc.com>
      Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
      fda168c2
  2. 16 May, 2010 6 commits
  3. 15 May, 2010 17 commits
  4. 14 May, 2010 1 commit