1. 20 Aug, 2013 24 commits
  2. 15 Aug, 2013 8 commits
  3. 13 Aug, 2013 8 commits
    • Dave Chinner's avatar
      xfs: split the CIL lock · 4bb928cd
      Dave Chinner authored
      The xc_cil_lock is used for two purposes - to protect the CIL
      itself, and to protect the push/commit state and lists. These are
      two logically separate structures and operations, so can have their
      own locks. This means that pushing on the CIL and the commit wait
      ordering won't contend for a lock with other transactions that are
      completing concurrently. As the CIL insertion is the hottest path
      throught eh CIL, this is a big win.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      4bb928cd
    • Dave Chinner's avatar
      xfs: Combine CIL insert and prepare passes · 991aaf65
      Dave Chinner authored
      Now that all the log item preparation and formatting is done under
      the CIL lock, we can get rid of the intermediate log vector chain
      used to track items to be inserted into the CIL.
      
      We can already find all the items to be committed from the
      transaction handle, so as long as we attach the log vectors to the
      item before we insert the items into the CIL, we don't need to
      create a log vector chain to pass around.
      
      This means we can move all the item insertion code into and optimise
      it into a pair of simple passes across all the items in the
      transaction. The first pass does the formatting and accounting, the
      second inserts them all into the CIL.
      
      We keep this two pass split so that we can separate the CIL
      insertion - which must be done under the CIL spinlock - from the
      formatting. We could insert each item into the CIL with a single
      pass, but that massively increases the number of times we have to
      grab the CIL spinlock. It is much more efficient (and hence
      scalable) to do a batch operation and insert all objects in a single
      lock grab.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      991aaf65
    • Dave Chinner's avatar
      xfs: avoid CIL allocation during insert · f5baac35
      Dave Chinner authored
      Now that we have the size of the log vector that has been allocated,
      we can determine if we need to allocate a new log vector for
      formatting and insertion. We only need to allocate a new vector if
      it won't fit into the existing buffer.
      
      However, we need to hold the CIL context lock while we do this so
      that we can't race with a push draining the currently queued log
      vectors. It is safe to do this as long as we do GFP_NOFS allocation
      to avoid avoid memory allocation recursing into the filesystem.
      Hence we can safely overwrite the existing log vector on the CIL if
      it is large enough to hold all the dirty regions of the current
      item.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      f5baac35
    • Dave Chinner's avatar
      xfs: Reduce allocations during CIL insertion · 7492c5b4
      Dave Chinner authored
      Now that we have the size of the object before the formatting pass
      is called, we can allocation the log vector and it's buffer in a
      single allocation rather than two separate allocations.
      
      Store the size of the allocated buffer in the log vector so that
      we potentially avoid allocation for future modifications of the
      object.
      
      While touching this code, remove the IOP_FORMAT definition.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      7492c5b4
    • Dave Chinner's avatar
      xfs: return log item size in IOP_SIZE · 166d1368
      Dave Chinner authored
      To begin optimising the CIL commit process, we need to have IOP_SIZE
      return both the number of vectors and the size of the data pointed
      to by the vectors. This enables us to calculate the size ofthe
      memory allocation needed before the formatting step and reduces the
      number of memory allocations per item by one.
      
      While there, kill the IOP_SIZE macro.
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      166d1368
    • Eric Sandeen's avatar
      xfs:free bp in xlog_find_tail() error path · 050a1952
      Eric Sandeen authored
      xlog_find_tail() currently leaks a bp on one error path.
      
      There is no error target, so manually free the bp before
      returning the error.
      
      Found by Coverity.
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      050a1952
    • Eric Sandeen's avatar
      xfs: free bp in xlog_find_zeroed() error path · 5d0a6549
      Eric Sandeen authored
      xlog_find_zeroed() currently leaks a bp on one error path.
      
      Using the bp_err: target resolves this.
      
      Found by Coverity.
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      5d0a6549
    • Eric Sandeen's avatar
      xfs: avoid double-free in xfs_attr_node_addname · 6dd93e9e
      Eric Sandeen authored
      xfs_attr_node_addname()'s error handling tests whether it
      should free "state" in the out: error handling label:
      
      out:
              if (state)
                      xfs_da_state_free(state);
      
      but an earlier free doesn't set state to NULL afterwards; this
      could lead to a double free.  Fix it by setting state to NULL
      after it's freed.
      
      This was found by Coverity.
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
      Signed-off-by: default avatarBen Myers <bpm@sgi.com>
      6dd93e9e