Merge tag 'fs_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 May 2022 02:24:06 +0000 (19:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 May 2022 02:24:06 +0000 (19:24 -0700)
Pull writeback and ext2 cleanups from Jan Kara:
 "One small ext2 cleanup and one writeback spelling fix"

* tag 'fs_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  writeback: fix typo in comment
  fs: ext2: Fix duplicate included linux/dax.h

1  2 
fs/ext2/inode.c
fs/fs-writeback.c

diff --combined fs/ext2/inode.c
@@@ -36,7 -36,6 +36,6 @@@
  #include <linux/iomap.h>
  #include <linux/namei.h>
  #include <linux/uio.h>
- #include <linux/dax.h>
  #include "ext2.h"
  #include "acl.h"
  #include "xattr.h"
@@@ -875,9 -874,9 +874,9 @@@ static int ext2_writepage(struct page *
        return block_write_full_page(page, ext2_get_block, wbc);
  }
  
 -static int ext2_readpage(struct file *file, struct page *page)
 +static int ext2_read_folio(struct file *file, struct folio *folio)
  {
 -      return mpage_readpage(page, ext2_get_block);
 +      return mpage_read_folio(folio, ext2_get_block);
  }
  
  static void ext2_readahead(struct readahead_control *rac)
  
  static int
  ext2_write_begin(struct file *file, struct address_space *mapping,
 -              loff_t pos, unsigned len, unsigned flags,
 -              struct page **pagep, void **fsdata)
 +              loff_t pos, unsigned len, struct page **pagep, void **fsdata)
  {
        int ret;
  
 -      ret = block_write_begin(mapping, pos, len, flags, pagep,
 -                              ext2_get_block);
 +      ret = block_write_begin(mapping, pos, len, pagep, ext2_get_block);
        if (ret < 0)
                ext2_write_failed(mapping, pos + len);
        return ret;
@@@ -911,11 -912,12 +910,11 @@@ static int ext2_write_end(struct file *
  
  static int
  ext2_nobh_write_begin(struct file *file, struct address_space *mapping,
 -              loff_t pos, unsigned len, unsigned flags,
 -              struct page **pagep, void **fsdata)
 +              loff_t pos, unsigned len, struct page **pagep, void **fsdata)
  {
        int ret;
  
 -      ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata,
 +      ret = nobh_write_begin(mapping, pos, len, pagep, fsdata,
                               ext2_get_block);
        if (ret < 0)
                ext2_write_failed(mapping, pos + len);
@@@ -966,7 -968,7 +965,7 @@@ ext2_dax_writepages(struct address_spac
  const struct address_space_operations ext2_aops = {
        .dirty_folio            = block_dirty_folio,
        .invalidate_folio       = block_invalidate_folio,
 -      .readpage               = ext2_readpage,
 +      .read_folio             = ext2_read_folio,
        .readahead              = ext2_readahead,
        .writepage              = ext2_writepage,
        .write_begin            = ext2_write_begin,
  const struct address_space_operations ext2_nobh_aops = {
        .dirty_folio            = block_dirty_folio,
        .invalidate_folio       = block_invalidate_folio,
 -      .readpage               = ext2_readpage,
 +      .read_folio             = ext2_read_folio,
        .readahead              = ext2_readahead,
        .writepage              = ext2_nobh_writepage,
        .write_begin            = ext2_nobh_write_begin,
diff --combined fs/fs-writeback.c
@@@ -738,7 -738,7 +738,7 @@@ EXPORT_SYMBOL_GPL(wbc_attach_and_unlock
   * incorrectly attributed).
   *
   * To resolve this issue, cgroup writeback detects the majority dirtier of
-  * an inode and transfers the ownership to it.  To avoid unnnecessary
+  * an inode and transfers the ownership to it.  To avoid unnecessary
   * oscillation, the detection mechanism keeps track of history and gives
   * out the switch verdict only if the foreign usage pattern is stable over
   * a certain amount of time and/or writeback attempts.
@@@ -1712,10 -1712,6 +1712,10 @@@ static int writeback_single_inode(struc
         */
        if (!(inode->i_state & I_DIRTY_ALL))
                inode_cgwb_move_to_attached(inode, wb);
 +      else if (!(inode->i_state & I_SYNC_QUEUED) &&
 +               (inode->i_state & I_DIRTY))
 +              redirty_tail_locked(inode, wb);
 +
        spin_unlock(&wb->list_lock);
        inode_sync_complete(inode);
  out:
@@@ -1779,12 -1775,11 +1779,12 @@@ static long writeback_sb_inodes(struct 
        };
        unsigned long start_time = jiffies;
        long write_chunk;
 -      long wrote = 0;  /* count both pages and inodes */
 +      long total_wrote = 0;  /* count both pages and inodes */
  
        while (!list_empty(&wb->b_io)) {
                struct inode *inode = wb_inode(wb->b_io.prev);
                struct bdi_writeback *tmp_wb;
 +              long wrote;
  
                if (inode->i_sb != sb) {
                        if (work->sb) {
  
                wbc_detach_inode(&wbc);
                work->nr_pages -= write_chunk - wbc.nr_to_write;
 -              wrote += write_chunk - wbc.nr_to_write;
 +              wrote = write_chunk - wbc.nr_to_write - wbc.pages_skipped;
 +              wrote = wrote < 0 ? 0 : wrote;
 +              total_wrote += wrote;
  
                if (need_resched()) {
                        /*
                tmp_wb = inode_to_wb_and_lock_list(inode);
                spin_lock(&inode->i_lock);
                if (!(inode->i_state & I_DIRTY_ALL))
 -                      wrote++;
 +                      total_wrote++;
                requeue_inode(inode, tmp_wb, &wbc);
                inode_sync_complete(inode);
                spin_unlock(&inode->i_lock);
                 * bail out to wb_writeback() often enough to check
                 * background threshold and other termination conditions.
                 */
 -              if (wrote) {
 +              if (total_wrote) {
                        if (time_is_before_jiffies(start_time + HZ / 10UL))
                                break;
                        if (work->nr_pages <= 0)
                                break;
                }
        }
 -      return wrote;
 +      return total_wrote;
  }
  
  static long __writeback_inodes_wb(struct bdi_writeback *wb,