]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge tag 'vfs-6.19-rc1.folio' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Dec 2025 18:26:38 +0000 (10:26 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Dec 2025 18:26:38 +0000 (10:26 -0800)
Pull folio updates from Christian Brauner:
 "Add a new folio_next_pos() helper function that returns the file
  position of the first byte after the current folio. This is a common
  operation in filesystems when needing to know the end of the current
  folio.

  The helper is lifted from btrfs which already had its own version, and
  is now used across multiple filesystems and subsystems:
   - btrfs
   - buffer
   - ext4
   - f2fs
   - gfs2
   - iomap
   - netfs
   - xfs
   - mm

  This fixes a long-standing bug in ocfs2 on 32-bit systems with files
  larger than 2GiB. Presumably this is not a common configuration, but
  the fix is backported anyway. The other filesystems did not have bugs,
  they were just mildly inefficient.

  This also introduce uoff_t as the unsigned version of loff_t. A recent
  commit inadvertently changed a comparison from being unsigned (on
  64-bit systems) to being signed (which it had always been on 32-bit
  systems), leading to sporadic fstests failures.

  Generally file sizes are restricted to being a signed integer, but in
  places where -1 is passed to indicate "up to the end of the file", it
  is convenient to have an unsigned type to ensure comparisons are
  always unsigned regardless of architecture"

* tag 'vfs-6.19-rc1.folio' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  fs: Add uoff_t
  mm: Use folio_next_pos()
  xfs: Use folio_next_pos()
  netfs: Use folio_next_pos()
  iomap: Use folio_next_pos()
  gfs2: Use folio_next_pos()
  f2fs: Use folio_next_pos()
  ext4: Use folio_next_pos()
  buffer: Use folio_next_pos()
  btrfs: Use folio_next_pos()
  filemap: Add folio_next_pos()

13 files changed:
1  2 
fs/btrfs/extent_io.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/buffer.c
fs/ext4/inode.c
fs/gfs2/aops.c
fs/iomap/buffered-io.c
fs/netfs/misc.c
fs/xfs/xfs_aops.c
include/linux/mm.h
include/linux/pagemap.h
mm/shmem.c
mm/truncate.c

Simple merge
diff --cc fs/btrfs/file.c
Simple merge
Simple merge
diff --cc fs/buffer.c
Simple merge
diff --cc fs/ext4/inode.c
Simple merge
diff --cc fs/gfs2/aops.c
Simple merge
index f68fc6ac15e0c54ada4d1b1ba5340e8f9e3ed2a7,32a27f36372d7357d977a71d3c1ed4c6247fcaf8..e5c1ca440d93bd7468eb2fbf37760295672622e9
@@@ -1214,15 -1097,13 +1214,14 @@@ static void iomap_write_delalloc_ifs_pu
        if (!ifs)
                return;
  
-       last_byte = min_t(loff_t, end_byte - 1,
-                       folio_pos(folio) + folio_size(folio) - 1);
+       last_byte = min_t(loff_t, end_byte - 1, folio_next_pos(folio) - 1);
        first_blk = offset_in_folio(folio, start_byte) >> blkbits;
        last_blk = offset_in_folio(folio, last_byte) >> blkbits;
 -      for (i = first_blk; i <= last_blk; i++) {
 -              if (!ifs_block_is_dirty(folio, ifs, i))
 -                      punch(inode, folio_pos(folio) + (i << blkbits),
 -                                  1 << blkbits, iomap);
 +      while ((first_blk = ifs_next_clean_block(folio, first_blk, last_blk))
 +                     <= last_blk) {
 +              punch(inode, folio_pos(folio) + (first_blk << blkbits),
 +                              1 << blkbits, iomap);
 +              first_blk++;
        }
  }
  
diff --cc fs/netfs/misc.c
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc mm/shmem.c
Simple merge
diff --cc mm/truncate.c
Simple merge