1. 13 4月, 2022 1 次提交
    • C
      xfs: Directory's data fork extent counter can never overflow · 83a21c18
      Chandan Babu R 提交于
      The maximum file size that can be represented by the data fork extent counter
      in the worst case occurs when all extents are 1 block in length and each block
      is 1KB in size.
      
      With XFS_MAX_EXTCNT_DATA_FORK_SMALL representing maximum extent count and with
      1KB sized blocks, a file can reach upto,
      (2^31) * 1KB = 2TB
      
      This is much larger than the theoretical maximum size of a directory
      i.e. XFS_DIR2_SPACE_SIZE * 3 = ~96GB.
      
      Since a directory's inode can never overflow its data fork extent counter,
      this commit removes all the overflow checks associated with
      it. xfs_dinode_verify() now performs a rough check to verify if a diretory's
      data fork is larger than 96GB.
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NChandan Babu R <chandan.babu@oracle.com>
      83a21c18
  2. 11 4月, 2022 7 次提交
  3. 15 10月, 2021 3 次提交
  4. 20 8月, 2021 7 次提交
    • D
      xfs: kill xfs_sb_version_has_v3inode() · cf28e17c
      Dave Chinner 提交于
      All callers to xfs_dinode_good_version() and XFS_DINODE_SIZE() in
      both the kernel and userspace have a xfs_mount structure available
      which means they can use mount features checks instead looking
      directly are the superblock.
      
      Convert these functions to take a mount and use a xfs_has_v3inodes()
      check and move it out of the libxfs/xfs_format.h file as it really
      doesn't have anything to do with the definition of the on-disk
      format.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      cf28e17c
    • D
      xfs: introduce xfs_sb_is_v5 helper · d6837c1a
      Dave Chinner 提交于
      Rather than open coding XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5
      checks everywhere, add a simple wrapper to encapsulate this and make
      the code easier to read.
      
      This allows us to remove the xfs_sb_version_has_v3inode() wrapper
      which is only used in xfs_format.h now and is just a version number
      check.
      
      There are a couple of places where we should be checking the mount
      feature bits rather than the superblock version (e.g. remount), so
      those are converted to use xfs_has_crc(mp) instead.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      d6837c1a
    • D
      xfs: remove unused xfs_sb_version_has wrappers · 2beb7b50
      Dave Chinner 提交于
      The vast majority of these wrappers are now unused. Remove them
      leaving just the small subset of wrappers that are used to either
      add feature bits or make the mount features field setup code
      simpler.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      2beb7b50
    • D
      xfs: open code sb verifier feature checks · fe08cc50
      Dave Chinner 提交于
      The superblock verifiers are one of the last places that use the sb
      version functions to do feature checks. This are all quite simple
      uses, and there aren't many of them so open code them all.
      
      Also, move the good version number check into xfs_sb.c instead of it
      being an inline function in xfs_format.h
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      fe08cc50
    • D
      xfs: replace xfs_sb_version checks with feature flag checks · 38c26bfd
      Dave Chinner 提交于
      Convert the xfs_sb_version_hasfoo() to checks against
      mp->m_features. Checks of the superblock itself during disk
      operations (e.g. in the read/write verifiers and the to/from disk
      formatters) are not converted - they operate purely on the
      superblock state. Everything else should use the mount features.
      
      Large parts of this conversion were done with sed with commands like
      this:
      
      for f in `git grep -l xfs_sb_version_has fs/xfs/*.c`; do
      	sed -i -e 's/xfs_sb_version_has\(.*\)(&\(.*\)->m_sb)/xfs_has_\1(\2)/' $f
      done
      
      With manual cleanups for things like "xfs_has_extflgbit" and other
      little inconsistencies in naming.
      
      The result is ia lot less typing to check features and an XFS binary
      size reduced by a bit over 3kB:
      
      $ size -t fs/xfs/built-in.a
      	text	   data	    bss	    dec	    hex	filenam
      before	1130866  311352     484 1442702  16038e (TOTALS)
      after	1127727  311352     484 1439563  15f74b (TOTALS)
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      38c26bfd
    • D
      xfs: reflect sb features in xfs_mount · a1d86e8d
      Dave Chinner 提交于
      Currently on-disk feature checks require decoding the superblock
      fileds and so can be non-trivial. We have almost 400 hundred
      individual feature checks in the XFS code, so this is a significant
      amount of code. To reduce runtime check overhead, pre-process all
      the version flags into a features field in the xfs_mount at mount
      time so we can convert all the feature checks to a simple flag
      check.
      
      There is also a need to convert the dynamic feature flags to update
      the m_features field. This is required for attr, attr2 and quota
      features. New xfs_mount based wrappers are added for this.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      a1d86e8d
    • D
      xfs: rework attr2 feature and mount options · e23b55d5
      Dave Chinner 提交于
      The attr2 feature is somewhat unique in that it has both a superblock
      feature bit to enable it and mount options to enable and disable it.
      
      Back when it was first introduced in 2005, attr2 was disabled unless
      either the attr2 superblock feature bit was set, or the attr2 mount
      option was set. If the superblock feature bit was not set but the
      mount option was set, then when the first attr2 format inode fork
      was created, it would set the superblock feature bit. This is as it
      should be - the superblock feature bit indicated the presence of the
      attr2 on disk format.
      
      The noattr2 mount option, however, did not affect the superblock
      feature bit. If noattr2 was specified, the on-disk superblock
      feature bit was ignored and the code always just created attr1
      format inode forks.  If neither of the attr2 or noattr2 mounts
      option were specified, then the behaviour was determined by the
      superblock feature bit.
      
      This was all pretty sane.
      
      Fast foward 3 years, and we are dealing with fallout from the
      botched sb_features2 addition and having to deal with feature
      mismatches between the sb_features2 and sb_bad_features2 fields. The
      attr2 feature bit was one of these flags. The reconciliation was
      done well after mount option parsing and, unfortunately, the feature
      reconciliation had a bug where it ignored the noattr2 mount option.
      
      For reasons lost to the mists of time, it was decided that resolving
      this issue in commit 7c12f296 ("[XFS] Fix up noattr2 so that it
      will properly update the versionnum and features2 fields.") required
      noattr2 to clear the superblock attr2 feature bit.  This greatly
      complicated the attr2 behaviour and broke rules about feature bits
      needing to be set when those specific features are present in the
      filesystem.
      
      By complicated, I mean that it introduced problems due to feature
      bit interactions with log recovery. All of the superblock feature
      bit checks are done prior to log recovery, but if we crash after
      removing a feature bit, then on the next mount we see the feature
      bit in the unrecovered superblock, only to have it go away after the
      log has been replayed.  This means our mount time feature processing
      could be all wrong.
      
      Hence you can mount with noattr2, crash shortly afterwards, and
      mount again without attr2 or noattr2 and still have attr2 enabled
      because the second mount sees attr2 still enabled in the superblock
      before recovery runs and removes the feature bit. It's just a mess.
      
      Further, this is all legacy code as the v5 format requires attr2 to
      be enabled at all times and it cannot be disabled.  i.e. the noattr2
      mount option returns an error when used on v5 format filesystems.
      
      To straighten this all out, this patch reverts the attr2/noattr2
      mount option behaviour back to the original behaviour. There is no
      reason for disabling attr2 these days, so we will only do this when
      the noattr2 mount option is set. This will not remove the superblock
      feature bit. The superblock bit will provide the default behaviour
      and only track whether attr2 is present on disk or not. The attr2
      mount option will enable the creation of attr2 format inode forks,
      and if the superblock feature bit is not set it will be added when
      the first attr2 inode fork is created.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
      e23b55d5
  5. 10 8月, 2021 2 次提交
  6. 08 4月, 2021 1 次提交
  7. 10 12月, 2020 3 次提交
  8. 16 9月, 2020 9 次提交
  9. 29 7月, 2020 6 次提交
  10. 20 5月, 2020 1 次提交