Skip to content
Snippets Groups Projects
Select Git revision
  • ed98b0159fa92a22a2838bd92522b8c8d964556b
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

filemap.c

Blame
    • Hugh Dickins's avatar
      ed98b015
      mm/filemap: fix mapping_seek_hole_data on THP & 32-bit · ed98b015
      Hugh Dickins authored
      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: default avatarHugh 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ed98b015
      History
      mm/filemap: fix mapping_seek_hole_data on THP & 32-bit
      Hugh Dickins authored
      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: default avatarHugh 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: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    ordered-data.c 21.75 KiB