1. 29 10月, 2020 1 次提交
  2. 07 7月, 2020 2 次提交
    • D
      xfs: redesign the reflink remap loop to fix blkres depletion crash · 00fd1d56
      Darrick J. Wong 提交于
      The existing reflink remapping loop has some structural problems that
      need addressing:
      
      The biggest problem is that we create one transaction for each extent in
      the source file without accounting for the number of mappings there are
      for the same range in the destination file.  In other words, we don't
      know the number of remap operations that will be necessary and we
      therefore cannot guess the block reservation required.  On highly
      fragmented filesystems (e.g. ones with active dedupe) we guess wrong,
      run out of block reservation, and fail.
      
      The second problem is that we don't actually use the bmap intents to
      their full potential -- instead of calling bunmapi directly and having
      to deal with its backwards operation, we could call the deferred ops
      xfs_bmap_unmap_extent and xfs_refcount_decrease_extent instead.  This
      makes the frontend loop much simpler.
      
      Solve all of these problems by refactoring the remapping loops so that
      we only perform one remapping operation per transaction, and each
      operation only tries to remap a single extent from source to dest.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      Reported-by: NEdwin Török <edwin@etorok.net>
      Tested-by: NEdwin Török <edwin@etorok.net>
      00fd1d56
    • D
      xfs: rename xfs_bmap_is_real_extent to is_written_extent · 877f58f5
      Darrick J. Wong 提交于
      The name of this predicate is a little misleading -- it decides if the
      extent mapping is allocated and written.  Change the name to be more
      direct, as we're going to add a new predicate in the next patch.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      877f58f5
  3. 14 5月, 2020 1 次提交
  4. 03 3月, 2020 1 次提交
  5. 21 10月, 2019 1 次提交
  6. 09 10月, 2019 1 次提交
  7. 03 9月, 2019 1 次提交
  8. 28 8月, 2019 1 次提交
  9. 21 2月, 2019 1 次提交
    • C
      xfs: make COW fork unwritten extent conversions more robust · 26b91c72
      Christoph Hellwig 提交于
      If we have racing buffered and direct I/O COW fork extents under
      writeback can have been moved to the data fork by the time we call
      xfs_reflink_convert_cow from xfs_submit_ioend.  This would be mostly
      harmless as the block numbers don't change by this move, except for
      the fact that xfs_bmapi_write will crash or trigger asserts when
      not finding existing extents, even despite trying to paper over this
      with the XFS_BMAPI_CONVERT_ONLY flag.
      
      Instead of special casing non-transaction conversions in the already
      way too complicated xfs_bmapi_write just add a new helper for the much
      simpler non-transactional COW fork case, which simplify ignores not
      found extents.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      26b91c72
  10. 18 2月, 2019 2 次提交
  11. 12 2月, 2019 3 次提交
    • B
      xfs: use the latest extent at writeback delalloc conversion time · c2b31643
      Brian Foster 提交于
      The writeback delalloc conversion code is racy with respect to
      changes in the currently cached file mapping outside of the current
      page. This is because the ilock is cycled between the time the
      caller originally looked up the mapping and across each real
      allocation of the provided file range. This code has collected
      various hacks over the years to help combat the symptoms of these
      races (i.e., truncate race detection, allocation into hole
      detection, etc.), but none address the fundamental problem that the
      imap may not be valid at allocation time.
      
      Rather than continue to use race detection hacks, update writeback
      delalloc conversion to a model that explicitly converts the delalloc
      extent backing the current file offset being processed. The current
      file offset is the only block we can trust to remain once the ilock
      is dropped because any operation that can remove the block
      (truncate, hole punch, etc.) must flush and discard pagecache pages
      first.
      
      Modify xfs_iomap_write_allocate() to use the xfs_bmapi_delalloc()
      mechanism to request allocation of the entire delalloc extent
      backing the current offset instead of assuming the extent passed by
      the caller is unchanged. Record the range specified by the caller
      and apply it to the resulting allocated extent so previous checks by
      the caller for COW fork overlap are not lost. Finally, overload the
      bmapi delalloc flag with the range reval flag behavior since this is
      the only use case for both.
      
      This ensures that writeback always picks up the correct
      and current extent associated with the page, regardless of races
      with other extent modifying operations. If operating on a data fork
      and the COW overlap state has changed since the ilock was cycled,
      the caller revalidates against the COW fork sequence number before
      using the imap for the next block.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      c2b31643
    • B
      xfs: create delalloc bmapi wrapper for full extent allocation · 627209fb
      Brian Foster 提交于
      The writeback delalloc conversion code is racy with respect to
      changes in the currently cached file mapping. This stems from the
      fact that the bmapi allocation code requires a file range to
      allocate and the writeback conversion code assumes the range of the
      currently cached mapping is still valid with respect to the fork. It
      may not be valid, however, because the ilock is cycled (potentially
      multiple times) between the time the cached mapping was populated
      and the delalloc conversion occurs.
      
      To facilitate a solution to this problem, create a new
      xfs_bmapi_delalloc() wrapper to xfs_bmapi_write() that takes a file
      (FSB) offset and attempts to allocate whatever delalloc extent backs
      the offset. Use a new bmapi flag to cause xfs_bmapi_write() to set
      the range based on the extent backing the bno parameter unless bno
      lands in a hole. If bno does land in a hole, fall back to the
      current behavior (which may result in an error or quietly skipping
      holes in the specified range depending on other parameters). This
      patch does not change behavior.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      627209fb
    • B
      xfs: remove superfluous writeback mapping eof trimming · 3b350898
      Brian Foster 提交于
      Now that the cached writeback mapping is explicitly invalidated on
      data fork changes, the EOF trimming band-aid is no longer necessary.
      Remove xfs_trim_extent_eof() as well since it has no other users.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      3b350898
  12. 13 12月, 2018 1 次提交
  13. 18 10月, 2018 1 次提交
  14. 03 8月, 2018 2 次提交
  15. 12 7月, 2018 10 次提交
  16. 25 6月, 2018 1 次提交
  17. 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
  18. 16 5月, 2018 3 次提交
  19. 10 5月, 2018 1 次提交
  20. 10 4月, 2018 1 次提交
  21. 24 3月, 2018 1 次提交
  22. 07 11月, 2017 2 次提交
  23. 27 10月, 2017 1 次提交