1. 18 12月, 2019 1 次提交
  2. 14 11月, 2019 2 次提交
  3. 29 6月, 2019 1 次提交
  4. 12 6月, 2019 2 次提交
  5. 23 4月, 2019 1 次提交
    • B
      xfs: make tr_growdata a permanent transaction · 945c941f
      Brian Foster 提交于
      The growdata transaction is used by growfs operations to increase
      the data size of the filesystem. Part of this sequence involves
      extending the size of the last preexisting AG in the fs, if
      necessary. This is implemented by freeing the newly available
      physical range to the AG.
      
      tr_growdata is not a permanent transaction, however, and block
      allocation transactions must be permanent to handle deferred frees
      of AGFL blocks. If the grow operation extends an existing AG that
      requires AGFL fixing, assert failures occur due to a populated dfops
      list on a non-permanent transaction and the AGFL free does not
      occur. This is reproduced (rarely) by xfs/104.
      
      Change tr_growdata to a permanent transaction with a default log
      count. This increases initial transaction reservation size, but
      growfs is an infrequent and non-performance critical operation and
      so should have minimal impact.
      Reported-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      [darrick: add a comment to the assert]
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      945c941f
  6. 09 6月, 2018 1 次提交
  7. 07 6月, 2018 1 次提交
    • D
      xfs: convert to SPDX license tags · 0b61f8a4
      Dave Chinner 提交于
      Remove the verbose license text from XFS files and replace them
      with SPDX tags. This does not change the license of any of the code,
      merely refers to the common, up-to-date license files in LICENSES/
      
      This change was mostly scripted. fs/xfs/Makefile and
      fs/xfs/libxfs/xfs_fs.h were modified by hand, the rest were detected
      and modified by the following command:
      
      for f in `git grep -l "GNU General" fs/xfs/` ; do
      	echo $f
      	cat $f | awk -f hdr.awk > $f.new
      	mv -f $f.new $f
      done
      
      And the hdr.awk script that did the modification (including
      detecting the difference between GPL-2.0 and GPL-2.0+ licenses)
      is as follows:
      
      $ cat hdr.awk
      BEGIN {
      	hdr = 1.0
      	tag = "GPL-2.0"
      	str = ""
      }
      
      /^ \* This program is free software/ {
      	hdr = 2.0;
      	next
      }
      
      /any later version./ {
      	tag = "GPL-2.0+"
      	next
      }
      
      /^ \*\// {
      	if (hdr > 0.0) {
      		print "// SPDX-License-Identifier: " tag
      		print str
      		print $0
      		str=""
      		hdr = 0.0
      		next
      	}
      	print $0
      	next
      }
      
      /^ \* / {
      	if (hdr > 1.0)
      		next
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      		next
      	}
      	print $0
      	next
      }
      
      /^ \*/ {
      	if (hdr > 0.0)
      		next
      	print $0
      	next
      }
      
      // {
      	if (hdr > 0.0) {
      		if (str != "")
      			str = str "\n"
      		str = str $0
      		next
      	}
      	print $0
      }
      
      END { }
      $
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      0b61f8a4
  8. 10 4月, 2018 1 次提交
  9. 09 1月, 2018 6 次提交
    • B
      xfs: eliminate duplicate icreate tx reservation functions · c017cb5d
      Brian Foster 提交于
      The create transaction reservation calculation has two different
      branches of code depending on whether the filesystem is a v5 format
      fs or older. Each branch considers the max reservation between the
      allocation case (new chunk allocation + record insert) and the
      modify case (chunk exists, record modification) of inode allocation.
      
      The modify case is the same for both superblock versions with the
      exception of the finobt. The finobt helper checks the feature bit,
      however, and so the modify case already shares the same code.
      
      Now that inode chunk allocation has been refactored into a helper
      that checks the superblock version to calculate the appropriate
      reservation for the create transaction, the only remaining
      difference between the create and icreate branches is the call to
      the finobt helper. As noted above, the finobt helper is a no-op when
      the feature is not enabled. Therefore, these branches are
      effectively duplicate and can be condensed.
      
      Remove the xfs_calc_create_*() branch of functions and update the
      various callers to use the xfs_calc_icreate_*() variant. The latter
      creates the same reservation size for v4 create transactions as the
      removed branch. As such, this patch does not result in transaction
      reservation changes.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      c017cb5d
    • B
      xfs: refactor inode chunk alloc/free tx reservation · 57af33e4
      Brian Foster 提交于
      The reservation for the various forms of inode allocation is
      scattered across several different functions. This includes two
      variants of chunk allocation (v5 icreate transactions vs. older
      create transactions) and the inode free transaction.
      
      To clean up some of this code and clarify the purpose of specific
      allocfree reservations, continue the pattern of defining helper
      functions for smaller operational units of broader transactions.
      Refactor the reservation into an inode chunk alloc/free helper that
      considers the various conditions based on filesystem format.
      
      An inode chunk free involves an extent free and buffer
      invalidations. The latter requires reservation for log headers only.
      An inode chunk allocation modifies the free space btrees and logs
      the chunk on v4 supers. v5 supers initialize the inode chunk using
      ordered buffers and so do not log the chunk.
      
      As a side effect of this refactoring, add one more allocfree res to
      the ifree transaction. Technically this does not serve a specific
      purpose because inode chunks are freed via deferred operations and
      thus occur after a transaction roll. tr_ifree has a bit of a history
      of tx overruns caused by too many agfl fixups during sustained file
      deletion workloads, so add this extra reservation as a form of
      padding nonetheless.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      57af33e4
    • B
      xfs: include an allocfree res for inobt modifications · f03c78f3
      Brian Foster 提交于
      Analysis of recent reports of log reservation overruns and code
      inspection has uncovered that the reservations associated with inode
      operations may not cover the worst case scenarios. In particular,
      many cases only include one allocfree res. for a particular
      operation even though said operations may also entail AGFL fixups
      and inode btree block allocations in addition to the actual inode
      chunk allocation. This can easily turn into two or three block
      allocations (or frees) per operation.
      
      In theory, the only way to define the worst case reservation is to
      include an allocfree res for each individual allocation in a
      transaction. Since that is impractical (we can perform multiple agfl
      fixups per tx and not every allocation results in a full tree
      operation), we need to find a reasonable compromise that addresses
      the deficiency in practice without blowing out the size of the
      transactions.
      
      Since the inode btrees are not filled by the AGFL, record insertion
      and removal can directly result in block allocations and frees
      depending on the shape of the tree. These allocations and frees
      occur in the same transaction context as the inobt update itself,
      but are separate from the allocation/free that might be required for
      an inode chunk. Therefore, it makes sense to assume that an [f]inobt
      insert/remove can directly result in one or more block allocations
      on behalf of the tree.
      
      Refactor the inode transaction reservations to include one allocfree
      res. per inode btree modification to cover allocations required by
      the tree itself. This separates the reservation required to allocate
      the inode chunk from the reservation required for inobt record
      insertion/removal. Apply the same logic to the finobt. This results
      in killing off the finobt modify condition because we no longer
      assume that the broader transaction reservation will cover finobt
      block allocations and finobt shape changes can occur in either of
      the inobt allocation or modify situations.
      Suggested-by: NDave Chinner <david@fromorbit.com>
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      f03c78f3
    • B
      xfs: truncate transaction does not modify the inobt · a606ebdb
      Brian Foster 提交于
      The truncate transaction does not ever modify the inode btree, but
      includes an associated log reservation. Update
      xfs_calc_itruncate_reservation() to remove the reservation
      associated with inobt updates.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      a606ebdb
    • B
      xfs: fix up agi unlinked list reservations · e8341d9f
      Brian Foster 提交于
      The current AGI unlinked list addition and removal reservations do
      not reflect the worst case log usage. An unlinked list removal can
      log up to two on-disk inode clusters but only includes reservation
      for one. An unlinked list addition logs the on-disk cluster but
      includes reservation for an in-core inode.
      
      Update the AGI unlinked list reservation helpers to calculate the
      correct worst case reservation for the associated operations.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      e8341d9f
    • B
      xfs: include inobt buffers in ifree tx log reservation · a6f48590
      Brian Foster 提交于
      The tr_ifree transaction handles inode unlinks and inode chunk
      frees. The current transaction calculation does not accurately
      reflect worst case changes to the inode btree, however. The inobt
      portion of the current transaction reservation only covers
      modification of a single inobt buffer (for the particular inode
      record). This is a historical artifact from the days before XFS
      supported full inode chunk removal.
      
      When support for inode chunk removal was added in commit
      254f6311ed1b ("Implement deletion of inode clusters in XFS."), the
      additional log reservation required for chunk removal was not added
      correctly. The new reservation only considered the header overhead
      of associated buffers rather than the full contents of the btrees
      and AGF and AGFL buffers affected by the transaction. The
      reservation for the free space btrees was subsequently fixed up in
      commit 5fe6abb82f76 ("Add space for inode and allocation btrees to
      ITRUNCATE log reservation"), but the res. for full inobt joins has
      never been added.
      
      Further review of the ifree reservation uncovered a couple more
      problems:
      
      - The undocumented +2 blocks are intended for the AGF and AGFL, but
        are also not sized correctly and should be logged as full sectors
        (not FSBs).
      - The additional single block header is undocumented and serves no
        apparent purpose.
      
      Update xfs_calc_ifree_reservation() to include a full inobt join in
      the reservation calculation. Refactor the undocumented blocks
      appropriately and fix up the comments to reflect the current
      calculation.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      a6f48590
  10. 07 7月, 2017 1 次提交
    • D
      xfs: rename MAXPATHLEN to XFS_SYMLINK_MAXLEN · 6eb0b8df
      Darrick J. Wong 提交于
      XFS has a maximum symlink target length of 1024 bytes; this is a
      holdover from the Irix days.  Unfortunately, the constant establishing
      this is 'MAXPATHLEN' and is /not/ the same as the Linux MAXPATHLEN,
      which is 4096.
      
      The kernel enforces its 1024 byte MAXPATHLEN on symlink targets, but
      xfsprogs picks up the (Linux) system 4096 byte MAXPATHLEN, which means
      that xfs_repair doesn't complain about oversized symlinks.
      
      Since this is an on-disk format constraint, put the define in the XFS
      namespace and move everything over to use the new name.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      6eb0b8df
  11. 06 10月, 2016 1 次提交
  12. 04 10月, 2016 2 次提交
  13. 03 8月, 2016 2 次提交
  14. 22 1月, 2015 1 次提交
    • D
      xfs: consolidate superblock logging functions · 61e63ecb
      Dave Chinner 提交于
      We now have several superblock loggin functions that are identical
      except for the transaction reservation and whether it shoul dbe a
      synchronous transaction or not. Consolidate these all into a single
      function, a single reserveration and a sync flag and call it
      xfs_sync_sb().
      
      Also, xfs_mod_sb() is not really a modification function - it's the
      operation of logging the superblock buffer. hence change the name of
      it to reflect this.
      
      Note that we have to change the mp->m_update_flags that are passed
      around at mount time to a boolean simply to indicate a superblock
      update is needed.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      61e63ecb
  15. 28 11月, 2014 2 次提交
  16. 25 6月, 2014 1 次提交
  17. 06 6月, 2014 2 次提交
  18. 24 4月, 2014 1 次提交
  19. 07 3月, 2014 1 次提交
    • D
      xfs: inode log reservations are still too small · fe4c224a
      Dave Chinner 提交于
      Back in commit 23956703 ("xfs: inode log reservations are too
      small"), the reservation size was increased to take into account the
      difference in size between the in-memory BMBT block headers and the
      on-disk BMDR headers. This solved a transaction overrun when logging
      the inode size.
      
      Recently, however, we've seen a number of these same overruns on
      kernels with the above fix in it. All of them have been by 4 bytes,
      so we must still not be accounting for something correctly.
      
      Through inspection it turns out the above commit didn't take into
      account everything it should have. That is, it only accounts for a
      single log op_hdr structure, when it can actually require up to four
      op_hdrs - one for each region (log iovec) that is formatted. These
      regions are the inode log format header, the inode core, and the two
      forks that can be held in the literal area of the inode.
      
      This means we are not accounting for 36 bytes of log space that the
      transaction can use, and hence when we get inodes in certain formats
      with particular fragmentation patterns we can overrun the
      transaction. Fix this by adding the correct accounting for log
      op_headers in the transaction.
      Tested-by: NBrian Foster <bfoster@redhat.com>
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      fe4c224a
  20. 07 2月, 2014 2 次提交
    • B
      xfs: use tr_qm_dqalloc log reservation for dquot alloc · 410b11a6
      Brian Foster 提交于
      The dquot allocation path in xfs_qm_dqread() currently uses the
      attribute set log reservation, which appears to be incorrect. We
      have reports of transaction reservation overruns with the current
      code. E.g., a repeated run of xfstests test generic/270 on a 512b
      block size fs occassionally produces the following in dmesg:
      
      	XFS (sdN): xlog_write: reservation summary:
      	  trans type  = QM_DQALLOC (30)
      	  unit res    = 7080 bytes
      	  current res = -632 bytes
      	  total reg   = 0 bytes (o/flow = 0 bytes)
      	  ophdrs      = 0 (ophdr space = 0 bytes)
      	  ophdr + reg = 0 bytes
      	  num regions = 0
      
      	XFS (sdN): xlog_write: reservation ran out. Need to up reservation
      
      The dquot allocation case should consist of a write reservation
      (i.e., we are allocating a range of the internal quota file) plus
      the size of the actual dquots. We already have a log reservation
      definition for this operation (tr_qm_dqalloc). Use it in
      xfs_qm_dqread() and update the log reservation calculation function
      to use the write res. calculation function rather than reading the
      assumed to be pre-calculated value directly.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NJie Liu <jeff.liu@oracle.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      
      410b11a6
    • E
      xfs: remove unused tr_swrite · c19ec235
      Eric Sandeen 提交于
      tr_swrite is never used, remove it.
      
      From a very quick look, I think the usage of it (and its ancestor
      XFS_SWRITE_LOG_RES) went away in commit 13e6d5cd "xfs: merge fsync
      and O_SYNC handling" back in 2009.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Reviewed-by: NJie Liu <jeff.liu@oracle.com>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      c19ec235
  21. 07 1月, 2014 2 次提交
    • Z
      xfs: allow linkat() on O_TMPFILE files · ab297431
      Zhi Yong Wu 提交于
      The VFS allows an anonymous temporary file to be named at a later
      time via a linkat() syscall. The inodes for O_TMPFILE files are
      are marked with a special flag I_LINKABLE and have a zero link count.
      
      To support this in XFS, xfs_link() detects if this flag I_LINKABLE
      is set and behaves appropriately when detected. So in this case,
      its transaciton reservation takes into account the additional
      overhead of removing the inode from the unlinked list. Then the
      inode is removed from the unlinked list and the directory entry
      is added. Finally its link count is bumped accordingly.
      Signed-off-by: NZhi Yong Wu <wuzhy@linux.vnet.ibm.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: Christoph Hellwig <hch@lst.de> 
      Signed-off-by: NBen Myers <bpm@sgi.com>
      ab297431
    • Z
      xfs: add O_TMPFILE support · 99b6436b
      Zhi Yong Wu 提交于
      Add two functions xfs_create_tmpfile() and xfs_vn_tmpfile()
      to support O_TMPFILE file creation.
      
      In contrast to xfs_create(), xfs_create_tmpfile() has a different
      log reservation to the regular file creation because there is no
      directory modification, and doesn't check if an entry can be added
      to the directory, but the reservation quotas is required appropriately,
      and finally its inode is added to the unlinked list.
      
      xfs_vn_tmpfile() add one O_TMPFILE method to VFS interface and directly
      invoke xfs_create_tmpfile().
      Signed-off-by: NZhi Yong Wu <wuzhy@linux.vnet.ibm.com>
      Reviewed-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      99b6436b
  22. 13 12月, 2013 2 次提交
  23. 18 11月, 2013 1 次提交
    • D
      xfs: increase inode cluster size for v5 filesystems · 8f80587b
      Dave Chinner 提交于
      v5 filesystems use 512 byte inodes as a minimum, so read inodes in
      clusters that are effectively half the size of a v4 filesystem with
      256 byte inodes. For v5 fielsystems, scale the inode cluster size
      with the size of the inode so that we keep a constant 32 inodes per
      cluster ratio for all inode IO.
      
      This only works if mkfs.xfs sets the inode alignment appropriately
      for larger inode clusters, so this functionality is made conditional
      on mkfs doing the right thing. xfs_repair needs to know about
      the inode alignment changes, too.
      
      Wall time:
      	create	bulkstat	find+stat	ls -R	unlink
      v4	237s	161s		173s		201s	299s
      v5	235s	163s		205s		 31s	356s
      patched	234s	160s		182s		 29s	317s
      
      System time:
      	create	bulkstat	find+stat	ls -R	unlink
      v4	2601s	2490s		1653s		1656s	2960s
      v5	2637s	2497s		1681s		  20s	3216s
      patched	2613s	2451s		1658s		  20s	3007s
      
      So, wall time same or down across the board, system time same or
      down across the board, and cache hit rates all improve except for
      the ls -R case which is a pure cold cache directory read workload
      on v5 filesystems...
      
      So, this patch removes most of the performance and CPU usage
      differential between v4 and v5 filesystems on traversal related
      workloads.
      
      Note: while this patch is currently for v5 filesystems only, there
      is no reason it can't be ported back to v4 filesystems.  This hasn't
      been done here because bringing the code back to v4 requires
      forwards and backwards kernel compatibility testing.  i.e. to
      deterine if older kernels(*) do the right thing with larger inode
      alignments but still only using 8k inode cluster sizes. None of this
      testing and validation on v4 filesystems has been done, so for the
      moment larger inode clusters is limited to v5 superblocks.
      
      (*) a current default config v4 filesystem should mount just fine on
      2.6.23 (when lazy-count support was introduced), and so if we change
      the alignment emitted by mkfs without a feature bit then we have to
      make sure it works properly on all kernels since 2.6.23. And if we
      allow it to be changed when the lazy-count bit is not set, then it's
      all kernels since v2 logs were introduced that need to be tested for
      compatibility...
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NEric Sandeen <sandeen@redhat.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      8f80587b
  24. 24 10月, 2013 3 次提交
    • D
      xfs: decouple inode and bmap btree header files · a4fbe6ab
      Dave Chinner 提交于
      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: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      a4fbe6ab
    • D
      xfs: decouple log and transaction headers · 239880ef
      Dave Chinner 提交于
      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: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      239880ef
    • D
      xfs: unify directory/attribute format definitions · 57062787
      Dave Chinner 提交于
      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: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBen Myers <bpm@sgi.com>
      Signed-off-by: NBen Myers <bpm@sgi.com>
      57062787