1. 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
  2. 05 6月, 2018 1 次提交
  3. 16 5月, 2018 4 次提交
  4. 10 5月, 2018 4 次提交
    • B
      xfs: don't discard on free of unwritten extents · 84ca484e
      Brian Foster 提交于
      Unwritten extents by definition have not been written to until they
      are converted to normal written extents. If unwritten extents are
      freed from a file, it is therefore guaranteed that the blocks have
      not been written to since allocation (note that zero range punches
      and reallocates blocks).
      
      To cut down on online discards generated from workloads that make
      use of preallocation, skip discards of extents if they are in the
      unwritten state when the extent is freed.
      
      Note that this optimization does not apply to log recovery, during
      which all freed extents are discarded if online discard is enabled.
      Also note that it may be possible for a filesystem crash to occur
      after write completion of an unwritten extent but before unwritten
      conversion such that the extent remains unwritten after log
      recovery. Since this pseudo-inconsistency may already be possible
      after a crash (consider writing to recently allocated blocks where
      the allocation transaction is lost after a crash), this change
      shouldn't introduce any fundamental limitations that don't already
      exist. In short, on storage stacks where discards are important,
      it's good practice to run an occasional fstrim even with online
      discard enabled in the filesystem, particularly after a crash.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      84ca484e
    • B
      xfs: add bmapi nodiscard flag · fcb762f5
      Brian Foster 提交于
      Freed extents are unconditionally discarded when online discard is
      enabled. Define XFS_BMAPI_NODISCARD to allow callers to bypass
      discards when unnecessary. For example, this will be useful for
      eofblocks trimming.
      
      This patch does not change behavior.
      Signed-off-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      fcb762f5
    • D
      xfs: get rid of the log item descriptor · e6631f85
      Dave Chinner 提交于
      It's just a connector between a transaction and a log item. There's
      a 1:1 relationship between a log item descriptor and a log item,
      and a 1:1 relationship between a log item descriptor and a
      transaction. Both relationships are created and terminated at the
      same time, so why do we even have the descriptor?
      
      Replace it with a specific list_head in the log item and a new
      log item dirtied flag to replace the XFS_LID_DIRTY flag.
      Signed-Off-By: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      [darrick: fix up deferred agfl intent finish_item use of LID_DIRTY]
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      e6631f85
    • D
      xfs: bmap debugging should never panic the system · cec57256
      Darrick J. Wong 提交于
      Don't panic() the system if the bmap records are garbage, just call
      ASSERT which gives us the same backtrace but enables developers to
      control if the system goes down or not.  This makes debugging with
      generic/388 much easier because it won't reboot the machine midway
      through a run just because btree_read_bufl returns EIO when the fs has
      already shut down.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      cec57256
  5. 18 4月, 2018 1 次提交
  6. 10 4月, 2018 1 次提交
  7. 24 3月, 2018 2 次提交
  8. 29 1月, 2018 4 次提交
    • D
      xfs: don't screw up direct writes when freesp is fragmented · 6d8a45ce
      Darrick J. Wong 提交于
      xfs_bmap_btalloc is given a range of file offset blocks that must be
      allocated to some data/attr/cow fork.  If the fork has an extent size
      hint associated with it, the request will be enlarged on both ends to
      try to satisfy the alignment hint.  If free space is fragmentated,
      sometimes we can allocate some blocks but not enough to fulfill any of
      the requested range.  Since bmapi_allocate always trims the new extent
      mapping to match the originally requested range, this results in
      bmapi_write returning zero and no mapping.
      
      The consequences of this vary -- buffered writes will simply re-call
      bmapi_write until it can satisfy at least one block from the original
      request.  Direct IO overwrites notice nmaps == 0 and return -ENOSPC
      through the dio mechanism out to userspace with the weird result that
      writes fail even when we have enough space because the ENOSPC return
      overrides any partial write status.  For direct CoW writes the situation
      was disastrous because nobody notices us returning an invalid zero-length
      wrong-offset mapping to iomap and the write goes off into space.
      
      Therefore, if free space is so fragmented that we managed to allocate
      some space but not enough to map into even a single block of the
      original allocation request range, we should break the alignment hint in
      order to guarantee at least some forward progress for the direct write.
      If we return a short allocation to iomap_apply it'll call back about the
      remaining blocks.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      6d8a45ce
    • D
      xfs: treat CoW fork operations as delalloc for quota accounting · 4b4c1326
      Darrick J. Wong 提交于
      Since the CoW fork only exists in memory, it is incorrect to update the
      on-disk quota block counts when we modify the CoW fork.  Unlike the data
      fork, even real extents in the CoW fork are only delalloc-style
      reservations (on-disk they're owned by the refcountbt) so they must not
      be tracked in the on disk quota info.  Ensure the i_delayed_blks
      accounting reflects this too.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      4b4c1326
    • D
      xfs: refactor accounting updates out of xfs_bmap_btalloc · 751f3767
      Darrick J. Wong 提交于
      Move all the inode and quota accounting updates out of xfs_bmap_btalloc
      in preparation for fixing some quota accounting problems with copy on
      write.
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      751f3767
    • S
      xfs: bmap code cleanup · 6ca30729
      Shan Hai 提交于
      Remove the extent size hint and realtime inode relevant code from
      the xfs_bmapi_reserve_delalloc since it is not called on the inode
      with extent size hint set or on a realtime inode.
      Signed-off-by: NShan Hai <shan.hai@oracle.com>
      Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      6ca30729
  9. 18 1月, 2018 1 次提交
    • D
      xfs: recheck reflink / dirty page status before freeing CoW reservations · be78ff0e
      Darrick J. Wong 提交于
      Eryu Guan reported seeing occasional hangs when running generic/269 with
      a new fsstress that supports clonerange/deduperange.  The cause of this
      hang is an infinite loop when we convert the CoW fork extents from
      unwritten to real just prior to writing the pages out; the infinite
      loop happens because there's nothing in the CoW fork to convert, and so
      it spins forever.
      
      The fundamental issue here is that when we go to perform these CoW fork
      conversions, we're supposed to have an extent waiting for us, but the
      low space CoW reaper has snuck in and blown them away!  There are four
      conditions that can dissuade the reaper from touching our file -- no
      reflink iflag; dirty page cache; writeback in progress; or directio in
      progress.  We check the four conditions prior to taking the locks, but
      we neglect to recheck them once we have the locks, which is how we end
      up whacking the writeback that's in progress.
      
      Therefore, refactor the four checks into a helper function and call it
      once again once we have the locks to make sure we really want to reap
      the inode.  While we're at it, add an ASSERT for this weird condition so
      that we'll fail noisily if we ever screw this up again.
      Reported-by: NEryu Guan <eguan@redhat.com>
      Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
      Tested-by: NEryu Guan <eguan@redhat.com>
      Reviewed-by: NBrian Foster <bfoster@redhat.com>
      be78ff0e
  10. 09 1月, 2018 1 次提交
  11. 15 12月, 2017 1 次提交
  12. 29 11月, 2017 1 次提交
  13. 07 11月, 2017 16 次提交
  14. 02 11月, 2017 1 次提交
  15. 27 10月, 2017 1 次提交