1. 07 7月, 2022 3 次提交
  2. 21 4月, 2022 1 次提交
  3. 11 4月, 2022 1 次提交
  4. 22 3月, 2022 1 次提交
  5. 23 10月, 2021 4 次提交
  6. 20 10月, 2021 3 次提交
    • D
      xfs: compute absolute maximum nlevels for each btree type · 0ed5f735
      Darrick J. Wong 提交于
      Add code for all five btree types so that we can compute the absolute
      maximum possible btree height for each btree type.  This is a setup for
      the next patch, which makes every btree type have its own cursor cache.
      
      The functions are exported so that we can have xfs_db report the
      absolute maximum btree heights for each btree type, rather than making
      everyone run their own ad-hoc computations.
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      0ed5f735
    • D
      xfs: rename m_ag_maxlevels to m_allocbt_maxlevels · 7cb3efb4
      Darrick J. Wong 提交于
      Years ago when XFS was thought to be much more simple, we introduced
      m_ag_maxlevels to specify the maximum btree height of per-AG btrees for
      a given filesystem mount.  Then we observed that inode btrees don't
      actually have the same height and split that off; and now we have rmap
      and refcount btrees with much different geometries and separate
      maxlevels variables.
      
      The 'ag' part of the name doesn't make much sense anymore, so rename
      this to m_alloc_maxlevels to reinforce that this is the maximum height
      of the *free space* btrees.  This sets us up for the next patch, which
      will add a variable to track the maximum height of all AG btrees.
      
      (Also take the opportunity to improve adjacent comments and fix minor
      style problems.)
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      7cb3efb4
    • D
      xfs: prepare xfs_btree_cur for dynamic cursor heights · 6ca444cf
      Darrick J. Wong 提交于
      Split out the btree level information into a separate struct and put it
      at the end of the cursor structure as a VLA.  Files with huge data forks
      (and in the future, the realtime rmap btree) will require the ability to
      support many more levels than a per-AG btree cursor, which means that
      we're going to create per-btree type cursor caches to conserve memory
      for the more common case.
      
      Note that a subsequent patch actually introduces dynamic cursor heights.
      This one merely rearranges the structure to prepare for that.
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: NChandan Babu R <chandan.babu@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      6ca444cf
  7. 15 10月, 2021 1 次提交
  8. 20 8月, 2021 4 次提交
  9. 19 8月, 2021 2 次提交
  10. 03 6月, 2021 1 次提交
  11. 02 6月, 2021 7 次提交
  12. 27 5月, 2021 1 次提交
    • G
      xfs: Fix fall-through warnings for Clang · 53004ee7
      Gustavo A. R. Silva 提交于
      In preparation to enable -Wimplicit-fallthrough for Clang, fix
      the following warnings by replacing /* fall through */ comments,
      and its variants, with the new pseudo-keyword macro fallthrough:
      
      fs/xfs/libxfs/xfs_alloc.c:3167:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/libxfs/xfs_da_btree.c:286:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/libxfs/xfs_ag_resv.c:346:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/libxfs/xfs_ag_resv.c:388:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_bmap_util.c:246:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_export.c:88:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_export.c:96:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_file.c:867:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_ioctl.c:562:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_ioctl.c:1548:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_iomap.c:1040:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_inode.c:852:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_log.c:2627:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/xfs_trans_buf.c:298:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/bmap.c:275:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/btree.c:48:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/common.c:85:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/common.c:138:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/common.c:698:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/dabtree.c:51:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/repair.c:951:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      fs/xfs/scrub/agheader.c:89:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      
      Notice that Clang doesn't recognize /* fall through */ comments as
      implicit fall-through markings, so in order to globally enable
      -Wimplicit-fallthrough for Clang, these comments need to be
      replaced with fallthrough; in the whole codebase.
      
      Link: https://github.com/KSPP/linux/issues/115Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      53004ee7
  13. 29 4月, 2021 2 次提交
    • B
      xfs: introduce in-core global counter of allocbt blocks · 16eaab83
      Brian Foster 提交于
      Introduce an in-core counter to track the sum of all allocbt blocks
      used by the filesystem. This value is currently tracked per-ag via
      the ->agf_btreeblks field in the AGF, which also happens to include
      rmapbt blocks. A global, in-core count of allocbt blocks is required
      to identify the subset of global ->m_fdblocks that consists of
      unavailable blocks currently used for allocation btrees. To support
      this calculation at block reservation time, construct a similar
      global counter for allocbt blocks, populate it on first read of each
      AGF and update it as allocbt blocks are used and released.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChandan Babu R <chandanrlinux@gmail.com>
      Reviewed-by: NAllison Henderson <allison.henderson@oracle.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      16eaab83
    • D
      xfs: remove obsolete AGF counter debugging · 1aec7c3d
      Darrick J. Wong 提交于
      In commit f8f2835a we changed the behavior of XFS to use EFIs to
      remove blocks from an overfilled AGFL because there were complaints
      about transaction overruns that stemmed from trying to free multiple
      blocks in a single transaction.
      
      Unfortunately, that commit missed a subtlety in the debug-mode
      transaction accounting when a realtime volume is attached.  If a
      realtime file undergoes a data fork mapping change such that realtime
      extents are allocated (or freed) in the same transaction that a data
      device block is also allocated (or freed), we can trip a debugging
      assertion.  This can happen (for example) if a realtime extent is
      allocated and it is necessary to reshape the bmbt to hold the new
      mapping.
      
      When we go to allocate a bmbt block from an AG, the first thing the data
      device block allocator does is ensure that the freelist is the proper
      length.  If the freelist is too long, it will trim the freelist to the
      proper length.
      
      In debug mode, trimming the freelist calls xfs_trans_agflist_delta() to
      record the decrement in the AG free list count.  Prior to f8f28 we would
      put the free block back in the free space btrees in the same
      transaction, which calls xfs_trans_agblocks_delta() to record the
      increment in the AG free block count.  Since AGFL blocks are included in
      the global free block count (fdblocks), there is no corresponding
      fdblocks update, so the AGFL free satisfies the following condition in
      xfs_trans_apply_sb_deltas:
      
      	/*
      	 * Check that superblock mods match the mods made to AGF counters.
      	 */
      	ASSERT((tp->t_fdblocks_delta + tp->t_res_fdblocks_delta) ==
      	       (tp->t_ag_freeblks_delta + tp->t_ag_flist_delta +
      		tp->t_ag_btree_delta));
      
      The comparison here used to be: (X + 0) == ((X+1) + -1 + 0), where X is
      the number blocks that were allocated.
      
      After commit f8f28 we defer the block freeing to the next chained
      transaction, which means that the calls to xfs_trans_agflist_delta and
      xfs_trans_agblocks_delta occur in separate transactions.  The (first)
      transaction that shortens the free list trips on the comparison, which
      has now become:
      
      (X + 0) == ((X) + -1 + 0)
      
      because we haven't freed the AGFL block yet; we've only logged an
      intention to free it.  When the second transaction (the deferred free)
      commits, it will evaluate the expression as:
      
      (0 + 0) == (1 + 0 + 0)
      
      and trip over that in turn.
      
      At this point, the astute reader may note that the two commits tagged by
      this patch have been in the kernel for a long time but haven't generated
      any bug reports.  How is it that the author became aware of this bug?
      
      This originally surfaced as an intermittent failure when I was testing
      realtime rmap, but a different bug report by Zorro Lang reveals the same
      assertion occuring on !lazysbcount filesystems.
      
      The common factor to both reports (and why this problem wasn't
      previously reported) becomes apparent if we consider when
      xfs_trans_apply_sb_deltas is called by __xfs_trans_commit():
      
      	if (tp->t_flags & XFS_TRANS_SB_DIRTY)
      		xfs_trans_apply_sb_deltas(tp);
      
      With a modern lazysbcount filesystem, transactions update only the
      percpu counters, so they don't need to set XFS_TRANS_SB_DIRTY, hence
      xfs_trans_apply_sb_deltas is rarely called.
      
      However, updates to the count of free realtime extents are not part of
      lazysbcount, so XFS_TRANS_SB_DIRTY will be set on transactions adding or
      removing data fork mappings to realtime files; similarly,
      XFS_TRANS_SB_DIRTY is always set on !lazysbcount filesystems.
      
      Dave mentioned in response to an earlier version of this patch:
      
      "IIUC, what you are saying is that this debug code is simply not
      exercised in normal testing and hasn't been for the past decade?  And it
      still won't be exercised on anything other than realtime device testing?
      
      "...it was debugging code from 1994 that was largely turned into dead
      code when lazysbcounters were introduced in 2007. Hence I'm not sure it
      holds any value anymore."
      
      This debugging code isn't especially helpful - you can modify the
      flcount on one AG and the freeblks of another AG, and it won't trigger.
      Add the fact that nobody noticed for a decade, and let's just get rid of
      it (and start testing realtime :P).
      
      This bug was found by running generic/051 on either a V4 filesystem
      lacking lazysbcount; or a V5 filesystem with a realtime volume.
      
      Cc: bfoster@redhat.com, zlang@redhat.com
      Fixes: f8f2835a ("xfs: defer agfl block frees when dfops is available")
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      1aec7c3d
  14. 26 3月, 2021 1 次提交
  15. 23 1月, 2021 1 次提交
    • C
      xfs: Introduce error injection to allocate only minlen size extents for files · 30151967
      Chandan Babu R 提交于
      This commit adds XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag which
      helps userspace test programs to get xfs_bmap_btalloc() to always
      allocate minlen sized extents.
      
      This is required for test programs which need a guarantee that minlen
      extents allocated for a file do not get merged with their existing
      neighbours in the inode's BMBT. "Inode fork extent overflow check" for
      Directories, Xattrs and extension of realtime inodes need this since the
      file offset at which the extents are being allocated cannot be
      explicitly controlled from userspace.
      
      One way to use this error tag is to,
      1. Consume all of the free space by sequentially writing to a file.
      2. Punch alternate blocks of the file. This causes CNTBT to contain
         sufficient number of one block sized extent records.
      3. Inject XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag.
      After step 3, xfs_bmap_btalloc() will issue space allocation
      requests for minlen sized extents only.
      
      ENOSPC error code is returned to userspace when there aren't any "one
      block sized" extents left in any of the AGs.
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NChandan Babu R <chandanrlinux@gmail.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      30151967
  16. 17 12月, 2020 1 次提交
  17. 29 10月, 2020 1 次提交
  18. 29 7月, 2020 1 次提交
  19. 14 7月, 2020 1 次提交
    • G
      xfs: get rid of unnecessary xfs_perag_{get,put} pairs · 92a00544
      Gao Xiang 提交于
      In the course of some operations, we look up the perag from
      the mount multiple times to get or change perag information.
      These are often very short pieces of code, so while the
      lookup cost is generally low, the cost of the lookup is far
      higher than the cost of the operation we are doing on the
      perag.
      
      Since we changed buffers to hold references to the perag
      they are cached in, many modification contexts already hold
      active references to the perag that are held across these
      operations. This is especially true for any operation that
      is serialised by an allocation group header buffer.
      
      In these cases, we can just use the buffer's reference to
      the perag to avoid needing to do lookups to access the
      perag. This means that many operations don't need to do
      perag lookups at all to access the perag because they've
      already looked up objects that own persistent references
      and hence can use that reference instead.
      
      Cc: Dave Chinner <dchinner@redhat.com>
      Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
      Signed-off-by: NGao Xiang <hsiangkao@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      92a00544
  20. 17 3月, 2020 1 次提交
  21. 14 3月, 2020 2 次提交