]> Git Repo - J-linux.git/commitdiff
Merge tag 'vfs-6.11.pg_error' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
authorLinus Torvalds <[email protected]>
Mon, 15 Jul 2024 18:08:14 +0000 (11:08 -0700)
committerLinus Torvalds <[email protected]>
Mon, 15 Jul 2024 18:08:14 +0000 (11:08 -0700)
Pull PG_error removal updates from Christian Brauner:
 "This contains work to remove almost all remaining users of PG_error
  from filesystems and filesystem helper libraries. An additional patch
  will be coming in via the jfs tree which tests the PG_error bit.

  Afterwards nothing will be testing it anymore and it's safe to remove
  all places which set or clear the PG_error bit.

  The goal is to fully remove PG_error by the next merge window"

* tag 'vfs-6.11.pg_error' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  buffer: Remove calls to set and clear the folio error flag
  iomap: Remove calls to set and clear folio error flag
  vboxsf: Convert vboxsf_read_folio() to use a folio
  ufs: Remove call to set the folio error flag
  romfs: Convert romfs_read_folio() to use a folio
  reiserfs: Remove call to folio_set_error()
  orangefs: Remove calls to set/clear the error flag
  nfs: Remove calls to folio_set_error
  jffs2: Remove calls to set/clear the folio error flag
  hostfs: Convert hostfs_read_folio() to use a folio
  isofs: Convert rock_ridge_symlink_read_folio to use a folio
  hpfs: Convert hpfs_symlink_read_folio to use a folio
  efs: Convert efs_symlink_read_folio to use a folio
  cramfs: Convert cramfs_read_folio to use a folio
  coda: Convert coda_symlink_filler() to use folio_end_read()
  befs: Convert befs_symlink_read_folio() to use folio_end_read()

1  2 
fs/iomap/buffered-io.c

diff --combined fs/iomap/buffered-io.c
index d46558990279055cb148495a0cfc5c36a92c47d6,4175578aeeededd83fb61cc77f0044bad645eae6..95750fc8c66f82acdc8e8e6b29803a1a4938f0cb
@@@ -241,7 -241,6 +241,7 @@@ static void iomap_adjust_read_range(str
        unsigned block_size = (1 << block_bits);
        size_t poff = offset_in_folio(folio, *pos);
        size_t plen = min_t(loff_t, folio_size(folio) - poff, length);
 +      size_t orig_plen = plen;
        unsigned first = poff >> block_bits;
        unsigned last = (poff + plen - 1) >> block_bits;
  
         * handle both halves separately so that we properly zero data in the
         * page cache for blocks that are entirely outside of i_size.
         */
 -      if (orig_pos <= isize && orig_pos + length > isize) {
 +      if (orig_pos <= isize && orig_pos + orig_plen > isize) {
                unsigned end = offset_in_folio(folio, isize - 1) >> block_bits;
  
                if (first <= end && last > end)
@@@ -307,8 -306,6 +307,6 @@@ static void iomap_finish_folio_read(str
                spin_unlock_irqrestore(&ifs->state_lock, flags);
        }
  
-       if (error)
-               folio_set_error(folio);
        if (finished)
                folio_end_read(folio, uptodate);
  }
@@@ -461,9 -458,6 +459,6 @@@ int iomap_read_folio(struct folio *foli
        while ((ret = iomap_iter(&iter, ops)) > 0)
                iter.processed = iomap_readpage_iter(&iter, &ctx, 0);
  
-       if (ret < 0)
-               folio_set_error(folio);
        if (ctx.bio) {
                submit_bio(ctx.bio);
                WARN_ON_ONCE(!ctx.cur_folio_in_bio);
@@@ -698,7 -692,6 +693,6 @@@ static int __iomap_write_begin(const st
  
        if (folio_test_uptodate(folio))
                return 0;
-       folio_clear_error(folio);
  
        do {
                iomap_adjust_read_range(iter->inode, folio, &block_start,
@@@ -878,51 -871,37 +872,51 @@@ static bool iomap_write_end(struct ioma
                size_t copied, struct folio *folio)
  {
        const struct iomap *srcmap = iomap_iter_srcmap(iter);
 +      loff_t old_size = iter->inode->i_size;
 +      size_t written;
  
        if (srcmap->type == IOMAP_INLINE) {
                iomap_write_end_inline(iter, folio, pos, copied);
 -              return true;
 +              written = copied;
 +      } else if (srcmap->flags & IOMAP_F_BUFFER_HEAD) {
 +              written = block_write_end(NULL, iter->inode->i_mapping, pos,
 +                                      len, copied, &folio->page, NULL);
 +              WARN_ON_ONCE(written != copied && written != 0);
 +      } else {
 +              written = __iomap_write_end(iter->inode, pos, len, copied,
 +                                          folio) ? copied : 0;
        }
  
 -      if (srcmap->flags & IOMAP_F_BUFFER_HEAD) {
 -              size_t bh_written;
 -
 -              bh_written = block_write_end(NULL, iter->inode->i_mapping, pos,
 -                                      len, copied, &folio->page, NULL);
 -              WARN_ON_ONCE(bh_written != copied && bh_written != 0);
 -              return bh_written == copied;
 +      /*
 +       * Update the in-memory inode size after copying the data into the page
 +       * cache.  It's up to the file system to write the updated size to disk,
 +       * preferably after I/O completion so that no stale data is exposed.
 +       * Only once that's done can we unlock and release the folio.
 +       */
 +      if (pos + written > old_size) {
 +              i_size_write(iter->inode, pos + written);
 +              iter->iomap.flags |= IOMAP_F_SIZE_CHANGED;
        }
 +      __iomap_put_folio(iter, pos, written, folio);
  
 -      return __iomap_write_end(iter->inode, pos, len, copied, folio);
 +      if (old_size < pos)
 +              pagecache_isize_extended(iter->inode, old_size, pos);
 +
 +      return written == copied;
  }
  
  static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i)
  {
        loff_t length = iomap_length(iter);
 -      size_t chunk = PAGE_SIZE << MAX_PAGECACHE_ORDER;
        loff_t pos = iter->pos;
        ssize_t total_written = 0;
        long status = 0;
        struct address_space *mapping = iter->inode->i_mapping;
 +      size_t chunk = mapping_max_folio_size(mapping);
        unsigned int bdp_flags = (iter->flags & IOMAP_NOWAIT) ? BDP_ASYNC : 0;
  
        do {
                struct folio *folio;
 -              loff_t old_size;
                size_t offset;          /* Offset into folio */
                size_t bytes;           /* Bytes to write to folio */
                size_t copied;          /* Bytes copied from user */
@@@ -974,6 -953,23 +968,6 @@@ retry
                written = iomap_write_end(iter, pos, bytes, copied, folio) ?
                          copied : 0;
  
 -              /*
 -               * Update the in-memory inode size after copying the data into
 -               * the page cache.  It's up to the file system to write the
 -               * updated size to disk, preferably after I/O completion so that
 -               * no stale data is exposed.  Only once that's done can we
 -               * unlock and release the folio.
 -               */
 -              old_size = iter->inode->i_size;
 -              if (pos + written > old_size) {
 -                      i_size_write(iter->inode, pos + written);
 -                      iter->iomap.flags |= IOMAP_F_SIZE_CHANGED;
 -              }
 -              __iomap_put_folio(iter, pos, written, folio);
 -
 -              if (old_size < pos)
 -                      pagecache_isize_extended(iter->inode, old_size, pos);
 -
                cond_resched();
                if (unlikely(written == 0)) {
                        /*
@@@ -1344,6 -1340,7 +1338,6 @@@ static loff_t iomap_unshare_iter(struc
                        bytes = folio_size(folio) - offset;
  
                ret = iomap_write_end(iter, pos, bytes, bytes, folio);
 -              __iomap_put_folio(iter, pos, bytes, folio);
                if (WARN_ON_ONCE(!ret))
                        return -EIO;
  
@@@ -1409,6 -1406,7 +1403,6 @@@ static loff_t iomap_zero_iter(struct io
                folio_mark_accessed(folio);
  
                ret = iomap_write_end(iter, pos, bytes, bytes, folio);
 -              __iomap_put_folio(iter, pos, bytes, folio);
                if (WARN_ON_ONCE(!ret))
                        return -EIO;
  
@@@ -1539,8 -1537,6 +1533,6 @@@ iomap_finish_ioend(struct iomap_ioend *
  
        /* walk all folios in bio, ending page IO on them */
        bio_for_each_folio_all(fi, bio) {
-               if (error)
-                       folio_set_error(fi.folio);
                iomap_finish_folio_write(inode, fi.folio, fi.length);
                folio_count++;
        }
This page took 0.063801 seconds and 4 git commands to generate.