1. 01 Sep, 2017 1 commit
  2. 03 May, 2017 1 commit
  3. 06 Apr, 2017 1 commit
  4. 03 Apr, 2017 1 commit
  5. 19 Sep, 2016 1 commit
    • Darrick J. Wong's avatar
      xfs: set up per-AG free space reservations · 3fd129b6
      Darrick J. Wong authored
      One unfortunate quirk of the reference count and reverse mapping
      btrees -- they can expand in size when blocks are written to *other*
      allocation groups if, say, one large extent becomes a lot of tiny
      extents.  Since we don't want to start throwing errors in the middle
      of CoWing, we need to reserve some blocks to handle future expansion.
      The transaction block reservation counters aren't sufficient here
      because we have to have a reserve of blocks in every AG, not just
      somewhere in the filesystem.
      
      Therefore, create two per-AG block reservation pools.  One feeds the
      AGFL so that rmapbt expansion always succeeds, and the other feeds all
      other metadata so that refcountbt expansion never fails.
      
      Use the count of how many reserved blocks we need to have on hand to
      create a virtual reservation in the AG.  Through selective clamping of
      the maximum length of allocation requests and of the length of the
      longest free extent, we can make it look like there's less free space
      in the AG unless the reservation owner is asking for blocks.
      
      In other words, play some accounting tricks in-core to make sure that
      we always have blocks available.  On the plus side, there's nothing to
      clean up if we crash, which is contrast to the strategy that the rough
      draft used (actually removing extents from the freespace btrees).
      Signed-off-by: 's avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: 's avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      3fd129b6
  6. 13 Sep, 2016 1 commit
  7. 05 Apr, 2016 2 commits
  8. 15 Mar, 2016 1 commit
  9. 12 Oct, 2015 1 commit
    • Bill O'Donnell's avatar
      xfs: per-filesystem stats counter implementation · ff6d6af2
      Bill O'Donnell authored
      This patch modifies the stats counting macros and the callers
      to those macros to properly increment, decrement, and add-to
      the xfs stats counts. The counts for global and per-fs stats
      are correctly advanced, and cleared by writing a "1" to the
      corresponding clear file.
      
      global counts: /sys/fs/xfs/stats/stats
      per-fs counts: /sys/fs/xfs/sda*/stats/stats
      
      global clear:  /sys/fs/xfs/stats/stats_clear
      per-fs clear:  /sys/fs/xfs/sda*/stats/stats_clear
      
      [dchinner: cleaned up macro variables, removed CONFIG_FS_PROC around
       stats structures and macros. ]
      Signed-off-by: 's avatarBill O'Donnell <billodo@redhat.com>
      Reviewed-by: 's avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      ff6d6af2
  10. 18 Aug, 2015 1 commit
  11. 04 Jun, 2015 5 commits
  12. 23 Feb, 2015 5 commits
    • Dave Chinner's avatar
      xfs: replace xfs_mod_incore_sb_batched · 0bd5dded
      Dave Chinner authored
      Introduce helper functions for modifying fields in the superblock
      into xfs_trans.c, the only caller of xfs_mod_incore_sb_batch().  We
      can then use these directly in xfs_trans_unreserve_and_mod_sb() and
      so remove another user of the xfs_mode_incore_sb() API without
      losing any functionality or scalability of the transaction commit
      code..
      
      Based on a patch from Christoph Hellwig.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      0bd5dded
    • Dave Chinner's avatar
      xfs: introduce xfs_mod_frextents · bab98bbe
      Dave Chinner authored
      Add a new helper to modify the incore counter of free realtime
      extents. This matches the helpers used for inode and data block
      counters, and removes a significant users of the xfs_mod_incore_sb()
      interface.
      
      Based on a patch originally from Christoph Hellwig.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      bab98bbe
    • Dave Chinner's avatar
      xfs: use generic percpu counters for free block counter · 0d485ada
      Dave Chinner authored
      XFS has hand-rolled per-cpu counters for the superblock since before
      there was any generic implementation. The free block counter is
      special in that it is used for ENOSPC detection outside transaction
      contexts for for delayed allocation. This means that the counter
      needs to be accurate at zero. The current per-cpu counter code jumps
      through lots of hoops to ensure we never run past zero, but we don't
      need to make all those jumps with the generic counter
      implementation.
      
      The generic counter implementation allows us to pass a "batch"
      threshold at which the addition/subtraction to the counter value
      will be folded back into global value under lock. We can use this
      feature to reduce the batch size as we approach 0 in a very similar
      manner to the existing counters and their rebalance algorithm. If we
      use a batch size of 1 as we approach 0, then every addition and
      subtraction will be done against the global value and hence allow
      accurate detection of zero threshold crossing.
      
      Hence we can replace the handrolled, accurate-at-zero counters with
      generic percpu counters.
      
      Note: this removes just enough of the icsb infrastructure to compile
      without warnings. The rest will go in subsequent commits.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      0d485ada
    • Dave Chinner's avatar
      xfs: use generic percpu counters for free inode counter · e88b64ea
      Dave Chinner authored
      XFS has hand-rolled per-cpu counters for the superblock since before
      there was any generic implementation. The free inode counter is not
      used for any limit enforcement - the per-AG free inode counters are
      used during allocation to determine if there are inode available for
      allocation.
      
      Hence we don't need any of the complexity of the hand-rolled
      counters and we can simply replace them with generic per-cpu
      counters similar to the inode counter.
      
      This version introduces a xfs_mod_ifree() helper function from
      Christoph Hellwig.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      e88b64ea
    • Dave Chinner's avatar
      xfs: use generic percpu counters for inode counter · 501ab323
      Dave Chinner authored
      XFS has hand-rolled per-cpu counters for the superblock since before
      there was any generic implementation. There are some warts around
      the  use of them for the inode counter as the hand rolled counter is
      designed to be accurate at zero, but has no specific accurracy at
      any other value. This design causes problems for the maximum inode
      count threshold enforcement, as there is no trigger that balances
      the counters as they get close tothe maximum threshold.
      
      Instead of designing new triggers for balancing, just replace the
      handrolled per-cpu counter with a generic counter.  This enables us
      to update the counter through the normal superblock modification
      funtions, but rather than do that we add a xfs_mod_icount() helper
      function (from Christoph Hellwig) and keep the percpu counter
      outside the superblock in the struct xfs_mount.
      
      This means we still need to initialise the per-cpu counter
      specifically when we read the superblock, and vice versa when we
      log/write it, but it does mean that we don't need to change any
      other code.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      501ab323
  13. 21 Jan, 2015 1 commit
    • Dave Chinner's avatar
      xfs: set superblock buffer type correctly · 3443a3bc
      Dave Chinner authored
      When the superblock is modified in a transaction, the commonly
      modified fields are not actually copied to the superblock buffer to
      avoid the buffer lock becoming a serialisation point. However, there
      are some other operations that modify the superblock fields within
      the transaction that don't directly log to the superblock but rely
      on the changes to be applied during the transaction commit (to
      minimise the buffer lock hold time).
      
      When we do this, we fail to mark the buffer log item as being a
      superblock buffer and that can lead to the buffer not being marked
      with the corect type in the log and hence causing recovery issues.
      Fix it by setting the type correctly, similar to xfs_mod_sb()...
      
      cc: <stable@vger.kernel.org> # 3.10 to current
      Tested-by: 's avatarJan Kara <jack@suse.cz>
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      3443a3bc
  14. 28 Nov, 2014 2 commits
  15. 25 Jun, 2014 1 commit
    • Dave Chinner's avatar
      xfs: global error sign conversion · 2451337d
      Dave Chinner authored
      Convert all the errors the core XFs code to negative error signs
      like the rest of the kernel and remove all the sign conversion we
      do in the interface layers.
      
      Errors for conversion (and comparison) found via searches like:
      
      $ git grep " E" fs/xfs
      $ git grep "return E" fs/xfs
      $ git grep " E[A-Z].*;$" fs/xfs
      
      Negation points found via searches like:
      
      $ git grep "= -[a-z,A-Z]" fs/xfs
      $ git grep "return -[a-z,A-D,F-Z]" fs/xfs
      $ git grep " -[a-z].*;" fs/xfs
      
      [ with some bits I missed from Brian Foster ]
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: 's avatarDave Chinner <david@fromorbit.com>
      2451337d
  16. 22 Jun, 2014 2 commits
  17. 14 Apr, 2014 1 commit
  18. 07 Feb, 2014 1 commit
  19. 23 Oct, 2013 4 commits
    • Dave Chinner's avatar
      xfs: decouple inode and bmap btree header files · a4fbe6ab
      Dave Chinner authored
      Currently the xfs_inode.h header has a dependency on the definition
      of the BMAP btree records as the inode fork includes an array of
      xfs_bmbt_rec_host_t objects in it's definition.
      
      Move all the btree format definitions from xfs_btree.h,
      xfs_bmap_btree.h, xfs_alloc_btree.h and xfs_ialloc_btree.h to
      xfs_format.h to continue the process of centralising the on-disk
      format definitions. With this done, the xfs inode definitions are no
      longer dependent on btree header files.
      
      The enables a massive culling of unnecessary includes, with close to
      200 #include directives removed from the XFS kernel code base.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBen Myers <bpm@sgi.com>
      Signed-off-by: 's avatarBen Myers <bpm@sgi.com>
      a4fbe6ab
    • Dave Chinner's avatar
      xfs: decouple log and transaction headers · 239880ef
      Dave Chinner authored
      xfs_trans.h has a dependency on xfs_log.h for a couple of
      structures. Most code that does transactions doesn't need to know
      anything about the log, but this dependency means that they have to
      include xfs_log.h. Decouple the xfs_trans.h and xfs_log.h header
      files and clean up the includes to be in dependency order.
      
      In doing this, remove the direct include of xfs_trans_reserve.h from
      xfs_trans.h so that we remove the dependency between xfs_trans.h and
      xfs_mount.h. Hence the xfs_trans.h include can be moved to the
      indicate the actual dependencies other header files have on it.
      
      Note that these are kernel only header files, so this does not
      translate to any userspace changes at all.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBen Myers <bpm@sgi.com>
      Signed-off-by: 's avatarBen Myers <bpm@sgi.com>
      239880ef
    • Dave Chinner's avatar
      xfs: unify directory/attribute format definitions · 57062787
      Dave Chinner authored
      The on-disk format definitions for the directory and attribute
      structures are spread across 3 header files right now, only one of
      which is dedicated to defining on-disk structures and their
      manipulation (xfs_dir2_format.h). Pull all the format definitions
      into a single header file - xfs_da_format.h - and switch all the
      code over to point at that.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarBen Myers <bpm@sgi.com>
      Signed-off-by: 's avatarBen Myers <bpm@sgi.com>
      57062787
    • Dave Chinner's avatar
      xfs: create a shared header file for format-related information · 70a9883c
      Dave Chinner authored
      All of the buffer operations structures are needed to be exported
      for xfs_db, so move them all to a common location rather than
      spreading them all over the place. They are verifying the on-disk
      format, so while xfs_format.h might be a good place, it is not part
      of the on disk format.
      
      Hence we need to create a new header file that we centralise these
      related definitions. Start by moving the bffer operations
      structures, and then also move all the other definitions that have
      crept into xfs_log_format.h and xfs_format.h as there was no other
      shared header file to put them in.
      Signed-off-by: 's avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: 's avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: 's avatarBen Myers <bpm@sgi.com>
      70a9883c
  20. 30 Aug, 2013 1 commit
  21. 12 Aug, 2013 5 commits
  22. 27 Jun, 2013 1 commit