1. 18 10月, 2021 1 次提交
    • A
      gup: Turn fault_in_pages_{readable,writeable} into fault_in_{readable,writeable} · bb523b40
      Andreas Gruenbacher 提交于
      Turn fault_in_pages_{readable,writeable} into versions that return the
      number of bytes not faulted in, similar to copy_to_user, instead of
      returning a non-zero value when any of the requested pages couldn't be
      faulted in.  This supports the existing users that require all pages to
      be faulted in as well as new users that are happy if any pages can be
      faulted in.
      
      Rename the functions to fault_in_{readable,writeable} to make sure
      this change doesn't silently break things.
      
      Neither of these functions is entirely trivial and it doesn't seem
      useful to inline them, so move them to mm/gup.c.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      bb523b40
  2. 04 9月, 2021 1 次提交
  3. 23 8月, 2021 1 次提交
    • J
      fs: add a filemap_fdatawrite_wbc helper · 5a798493
      Josef Bacik 提交于
      Btrfs sometimes needs to flush dirty pages on a bunch of dirty inodes in
      order to reclaim metadata reservations.  Unfortunately most helpers in
      this area are too smart for us:
      
      1) The normal filemap_fdata* helpers only take range and sync modes, and
         don't give any indication of how much was written, so we can only
         flush full inodes, which isn't what we want in most cases.
      2) The normal writeback path requires us to have the s_umount sem held,
         but we can't unconditionally take it in this path because we could
         deadlock.
      3) The normal writeback path also skips inodes with I_SYNC set if we
         write with WB_SYNC_NONE.  This isn't the behavior we want under heavy
         ENOSPC pressure, we want to actually make sure the pages are under
         writeback before returning, and if another thread is in the middle of
         writing the file we may return before they're under writeback and
         miss our ordered extents and not properly wait for completion.
      4) sync_inode() uses the normal writeback path and has the same problem
         as #3.
      
      What we really want is to call do_writepages() with our wbc.  This way
      we can make sure that writeback is actually started on the pages, and we
      can control how many pages are written as a whole as we write many
      inodes using the same wbc.  Accomplish this with a new helper that does
      just that so we can use it for our ENOSPC flushing infrastructure.
      Reviewed-by: NNikolay Borisov <nborisov@suse.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      5a798493
  4. 13 7月, 2021 3 次提交
  5. 30 6月, 2021 1 次提交
  6. 10 6月, 2021 1 次提交
  7. 03 6月, 2021 1 次提交
  8. 07 5月, 2021 1 次提交
  9. 06 5月, 2021 3 次提交
  10. 01 5月, 2021 5 次提交
  11. 24 4月, 2021 2 次提交
    • H
      mm/filemap: fix mapping_seek_hole_data on THP & 32-bit · ed98b015
      Hugh Dickins 提交于
      No problem on 64-bit, or without huge pages, but xfstests generic/285
      and other SEEK_HOLE/SEEK_DATA tests have regressed on huge tmpfs, and on
      32-bit architectures, with the new mapping_seek_hole_data().  Several
      different bugs turned out to need fixing.
      
      u64 cast to stop losing bits when converting unsigned long to loff_t
      (and let's use shifts throughout, rather than mixed with * and /).
      
      Use round_up() when advancing pos, to stop assuming that pos was already
      THP-aligned when advancing it by THP-size.  (This use of round_up()
      assumes that any THP has THP-aligned index: true at present and true
      going forward, but could be recoded to avoid the assumption.)
      
      Use xas_set() when iterating away from a THP, so that xa_index stays in
      synch with start, instead of drifting away to return bogus offset.
      
      Check start against end to avoid wrapping 32-bit xa_index to 0 (and to
      handle these additional cases, seek_data or not, it's easier to break
      the loop than goto: so rearrange exit from the function).
      
      [hughd@google.com: remove unneeded u64 casts, per Matthew]
        Link: https://lkml.kernel.org/r/alpine.LSU.2.11.2104221347240.1170@eggly.anvils
      
      Link: https://lkml.kernel.org/r/alpine.LSU.2.11.2104211737410.3299@eggly.anvils
      Fixes: 41139aa4 ("mm/filemap: add mapping_seek_hole_data")
      Signed-off-by: NHugh Dickins <hughd@google.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dave Chinner <dchinner@redhat.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: William Kucharski <william.kucharski@oracle.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ed98b015
    • H
      mm/filemap: fix find_lock_entries hang on 32-bit THP · 2d11e738
      Hugh Dickins 提交于
      No problem on 64-bit, or without huge pages, but xfstests generic/308
      hung uninterruptibly on 32-bit huge tmpfs.
      
      Since commit 0cc3b0ec ("Clarify (and fix) in 4.13 MAX_LFS_FILESIZE
      macros"), MAX_LFS_FILESIZE is only a PAGE_SIZE away from wrapping 32-bit
      xa_index to 0, so the new find_lock_entries() has to be extra careful
      when handling a THP.
      
      Link: https://lkml.kernel.org/r/alpine.LSU.2.11.2104211735430.3299@eggly.anvils
      Fixes: 5c211ba2 ("mm: add and use find_lock_entries")
      Signed-off-by: NHugh Dickins <hughd@google.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: William Kucharski <william.kucharski@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Dave Chinner <dchinner@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2d11e738
  12. 23 4月, 2021 2 次提交
  13. 27 2月, 2021 9 次提交
  14. 25 2月, 2021 9 次提交