1. 19 May, 2010 8 commits
    • Alex Elder's avatar
      xfs: avoid repeated pointer dereferences · e3bb2e30
      Alex Elder authored
      
      
      In xlog_find_cycle_start() use a local variable for some repeated
      operations rather than constantly accessing the memory location
      whose address is passed in.
      
      (This version drops an assertion that a pointer is non-null.)
      
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      e3bb2e30
    • Alex Elder's avatar
      xfs: change a few labels in xfs_log_recover.c · 9db127ed
      Alex Elder authored
      
      
      Rename a label used in xlog_find_head() that I thought was poorly
      chosen.  Also combine two adjacent labels xlog_find_tail() into a
      single label, and give it a more generic name.
      
      (Now using Dave's suggested "validate_head" name for first label.)
      
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      9db127ed
    • Alex Elder's avatar
      xfs: nothing special about 1-block log sector · 36adecff
      Alex Elder authored
      
      
      There are a number of places where a log sector size of 1 uses
      special case code.  The round_up() and round_down() macros
      produce the correct result even when the log sector size is 1, and
      this eliminates the need for treating this as a special case.
      
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      36adecff
    • Alex Elder's avatar
      xfs: encapsulate bbcount validity checking · ff30a622
      Alex Elder authored
      
      
      Define a function that encapsulates checking the validity of a log
      block count.
      
      (Updated from previous version--no longer includes error reporting in the
      encapsulated validation function.)
      
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      ff30a622
    • Alex Elder's avatar
      xfs: kill XLOG_SECTOR_ROUND*() · 5c17f533
      Alex Elder authored
      
      
      XLOG_SECTOR_ROUNDUP_BBCOUNT() and XLOG_SECTOR_ROUNDDOWN_BLKNO()
      are now fairly simple macro translations.  Just get rid of them in
      favor of the round_up() and round_down() macro calls they represent.
      
      Also, in spots in xlog_get_bp() and xlog_write_log_records(),
      round_up() was being called with value 1, which just evaluates
      to the macro's second argument; so just use that instead.
      In the latter case, make use of that value, as long as it's
      already been computed.
      
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      5c17f533
    • Alex Elder's avatar
      xfs: simplify XLOG_SECTOR_ROUND*() · 8511998b
      Alex Elder authored
      
      
      XLOG_SECTOR_ROUNDUP_BBCOUNT() is defined in "fs/xfs/xfs_log_recover.c"
      in an overly-complicated way.  It is basically roundup(), but that
      is not at all clear from its definition.  (Actually, there is
      another macro round_up() that applies for power-of-two-based masks
      which I'll be using here.)
      
      The operands in XLOG_SECTOR_ROUNDUP_BBCOUNT() are basically the
      block number (bbs) and the log sector basic block mask
      (log->l_sectbb_mask).  I'll call them B and M for this discussion.
      
      The macro computes is value this way:
      	M && (B & M) ? (B + M + 1) & ~M : B
      
      Put another way, we can break it into 3 cases:
      	1)  ! M          -> B			# 0 mask, no effect
      	2)  ! (B & M)    -> B			# sector aligned
      	3)  M && (B & M) -> (B + M + 1) & ~M	# round up otherwise
      
      The round_up() macro is cleverly defined using a value, v, and a
      power-of-2, p, and the result is the nearest multiple of p greater
      than or equal to v.  Its value is computed something like this:
      	((v - 1) | (p - 1)) + 1
      Let's consider using this in the context of the 3 cases above.
      
      When p = 2^0 = 1, the result boils down to ((v - 1) | 0) + 1, so it
      just translates any value v to itself.  That handles case (1) above.
      
      When p = 2^n, n > 0, we know that (p - 1) will be a mask with all n
      bits 0..n-1 set.  The condition in this case occurs when none of
      those mask bits is set in the value v provided.  If that is the
      case, subtracting 1 from v will have 1's in all those lower bits (at
      least).  Therefore, OR-ing the mask with that decremented value has
      no effect, so adding the 1 back again will just translate the v to
      itself.  This handles case (2).
      
      Otherwise, the value v is greater than some multiple of p, and
      decrementing it will produce a result greater than or equal to that
      multiple.  OR-ing in the mask will produce a value 1 less than the
      next multiple of p, so finally adding 1 back will result in the
      desired rounded-up value.  This handles case (3).
      
      Hopefully this is convincing.
      
      While I was at it, I converted XLOG_SECTOR_ROUNDDOWN_BLKNO() to use
      the round_down() macro.
      
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      8511998b
    • Alex Elder's avatar
      xfs: fix min bufsize bugs in two places · 6881a229
      Alex Elder authored
      
      
      This fixes a bug in two places that I found by inspection.  In
      xlog_find_verify_cycle() and xlog_write_log_records(), the code
      attempts to allocate a buffer to hold as many blocks as possible.
      It gives up if the number of blocks to be allocated gets too small.
      Right now it uses log->l_sectbb_log as that lower bound, but I'm
      sure it's supposed to be the actual log sector size instead.  That
      is, the lower bound should be (1 << log->l_sectbb_log).
      
      Also define a simple macro xlog_sectbb(log) to represent the number
      of basic blocks in a sector for the given log.
      
      (No change from original submission; I have implemented Christoph's
      suggestion about storing l_sectsize rather than l_sectbb_log in
      a new, separate patch in this series.)
      
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      6881a229
    • 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
  2. 21 Jan, 2010 2 commits
  3. 15 Jan, 2010 2 commits
  4. 15 Dec, 2009 1 commit
  5. 14 Dec, 2009 1 commit
    • Christoph Hellwig's avatar
      xfs: event tracing support · 0b1b213f
      Christoph Hellwig authored
      Convert the old xfs tracing support that could only be used with the
      out of tree kdb and xfsidbg patches to use the generic event tracer.
      
      To use it make sure CONFIG_EVENT_TRACING is enabled and then enable
      all xfs trace channels by:
      
         echo 1 > /sys/kernel/debug/tracing/events/xfs/enable
      
      or alternatively enable single events by just doing the same in one
      event subdirectory, e.g.
      
         echo 1 > /sys/kernel/debug/tracing/events/xfs/xfs_ihold/enable
      
      or set more complex filters, etc. In Documentation/trace/events.txt
      all this is desctribed in more detail.  To reads the events do a
      
         cat /sys/kernel/debug/tracing/trace
      
      Compared to the last posting this patch converts the tracing mostly to
      the one tracepoint per callsite model that other users of the new
      tracing facility also employ.  This allows a very fine-grained control
      of the tracing, a cleaner output of the traces and also enables the
      perf tool to use each tracepoint as a virtual performance counter,
           allowing us to e.g. count how often certain workloads git various
           spots in XFS.  Take a look at
      
          http://lwn.net/Articles/346470/
      
      
      
      for some examples.
      
      Also the btree tracing isn't included at all yet, as it will require
      additional core tracing features not in mainline yet, I plan to
      deliver it later.
      
      And the really nice thing about this patch is that it actually removes
      many lines of code while adding this nice functionality:
      
       fs/xfs/Makefile                |    8
       fs/xfs/linux-2.6/xfs_acl.c     |    1
       fs/xfs/linux-2.6/xfs_aops.c    |   52 -
       fs/xfs/linux-2.6/xfs_aops.h    |    2
       fs/xfs/linux-2.6/xfs_buf.c     |  117 +--
       fs/xfs/linux-2.6/xfs_buf.h     |   33
       fs/xfs/linux-2.6/xfs_fs_subr.c |    3
       fs/xfs/linux-2.6/xfs_ioctl.c   |    1
       fs/xfs/linux-2.6/xfs_ioctl32.c |    1
       fs/xfs/linux-2.6/xfs_iops.c    |    1
       fs/xfs/linux-2.6/xfs_linux.h   |    1
       fs/xfs/linux-2.6/xfs_lrw.c     |   87 --
       fs/xfs/linux-2.6/xfs_lrw.h     |   45 -
       fs/xfs/linux-2.6/xfs_super.c   |  104 ---
       fs/xfs/linux-2.6/xfs_super.h   |    7
       fs/xfs/linux-2.6/xfs_sync.c    |    1
       fs/xfs/linux-2.6/xfs_trace.c   |   75 ++
       fs/xfs/linux-2.6/xfs_trace.h   | 1369 +++++++++++++++++++++++++++++++++++++++++
       fs/xfs/linux-2.6/xfs_vnode.h   |    4
       fs/xfs/quota/xfs_dquot.c       |  110 ---
       fs/xfs/quota/xfs_dquot.h       |   21
       fs/xfs/quota/xfs_qm.c          |   40 -
       fs/xfs/quota/xfs_qm_syscalls.c |    4
       fs/xfs/support/ktrace.c        |  323 ---------
       fs/xfs/support/ktrace.h        |   85 --
       fs/xfs/xfs.h                   |   16
       fs/xfs/xfs_ag.h                |   14
       fs/xfs/xfs_alloc.c             |  230 +-----
       fs/xfs/xfs_alloc.h             |   27
       fs/xfs/xfs_alloc_btree.c       |    1
       fs/xfs/xfs_attr.c              |  107 ---
       fs/xfs/xfs_attr.h              |   10
       fs/xfs/xfs_attr_leaf.c         |   14
       fs/xfs/xfs_attr_sf.h           |   40 -
       fs/xfs/xfs_bmap.c              |  507 +++------------
       fs/xfs/xfs_bmap.h              |   49 -
       fs/xfs/xfs_bmap_btree.c        |    6
       fs/xfs/xfs_btree.c             |    5
       fs/xfs/xfs_btree_trace.h       |   17
       fs/xfs/xfs_buf_item.c          |   87 --
       fs/xfs/xfs_buf_item.h          |   20
       fs/xfs/xfs_da_btree.c          |    3
       fs/xfs/xfs_da_btree.h          |    7
       fs/xfs/xfs_dfrag.c             |    2
       fs/xfs/xfs_dir2.c              |    8
       fs/xfs/xfs_dir2_block.c        |   20
       fs/xfs/xfs_dir2_leaf.c         |   21
       fs/xfs/xfs_dir2_node.c         |   27
       fs/xfs/xfs_dir2_sf.c           |   26
       fs/xfs/xfs_dir2_trace.c        |  216 ------
       fs/xfs/xfs_dir2_trace.h        |   72 --
       fs/xfs/xfs_filestream.c        |    8
       fs/xfs/xfs_fsops.c             |    2
       fs/xfs/xfs_iget.c              |  111 ---
       fs/xfs/xfs_inode.c             |   67 --
       fs/xfs/xfs_inode.h             |   76 --
       fs/xfs/xfs_inode_item.c        |    5
       fs/xfs/xfs_iomap.c             |   85 --
       fs/xfs/xfs_iomap.h             |    8
       fs/xfs/xfs_log.c               |  181 +----
       fs/xfs/xfs_log_priv.h          |   20
       fs/xfs/xfs_log_recover.c       |    1
       fs/xfs/xfs_mount.c             |    2
       fs/xfs/xfs_quota.h             |    8
       fs/xfs/xfs_rename.c            |    1
       fs/xfs/xfs_rtalloc.c           |    1
       fs/xfs/xfs_rw.c                |    3
       fs/xfs/xfs_trans.h             |   47 +
       fs/xfs/xfs_trans_buf.c         |   62 -
       fs/xfs/xfs_vnodeops.c          |    8
       70 files changed, 2151 insertions(+), 2592 deletions(-)
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      0b1b213f
  6. 11 Dec, 2009 2 commits
    • Christoph Hellwig's avatar
      xfs: simplify xfs_buf_get / xfs_buf_read interfaces · 6ad112bf
      Christoph Hellwig authored
      
      
      Currently the low-level buffer cache interfaces are highly confusing
      as we have a _flags variant of each that does actually respect the
      flags, and one without _flags which has a flags argument that gets
      ignored and overriden with a default set.  Given that very few places
      use the default arguments get rid of the duplication and convert all
      callers to pass the flags explicitly.  Also remove the now confusing
      _flags postfix.
      
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      6ad112bf
    • Andy Poling's avatar
      xfs: Wrapped journal record corruption on read at recovery · fc5bc4c8
      Andy Poling authored
      
      
      Summary of problem:
      
      If a journal record wraps at the physical end of the journal, it has to be
      read in two parts in xlog_do_recovery_pass(): a read at the physical end and a
      read at the physical beginning.  If xlog_bread() has to re-align the first
      read, the second read request does not take that re-alignment into account.
      If the first read was re-aligned, the second read over-writes the end of the
      data from the first read, effectively corrupting it.  This can happen either
      when reading the record header or reading the record data.
      
      The first sanity check in xlog_recover_process_data() is to check for a valid
      clientid, so that is the error reported.
      
      Summary of fix:
      
      If there was a first read at the physical end, XFS_BUF_PTR() returns where the
      data was requested to begin.  Conversely, because it is the result of
      xlog_align(), offset indicates where the requested data for the first read
      actually begins - whether or not xlog_bread() has re-aligned it.
      
      Using offset as the base for the calculation of where to place the second read
      data ensures that it will be correctly placed immediately following the data
      from the first read instead of sometimes over-writing the end of it.
      
      The attached patch has resolved the reported problem of occasional inability
      to recover the journal (reporting "bad clientid").
      
      Signed-off-by: default avatarAndy Poling <andy@realbig.com>
      Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
      Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
      fc5bc4c8
  7. 17 Nov, 2009 1 commit
  8. 31 Aug, 2009 1 commit
  9. 01 Jul, 2009 1 commit
  10. 08 Jun, 2009 1 commit
  11. 16 Mar, 2009 3 commits
  12. 06 Mar, 2009 1 commit
  13. 04 Mar, 2009 1 commit
  14. 09 Feb, 2009 1 commit
  15. 03 Feb, 2009 2 commits
  16. 10 Dec, 2008 1 commit
  17. 30 Nov, 2008 9 commits
  18. 10 Nov, 2008 1 commit
  19. 30 Oct, 2008 1 commit