Merge tag 'platform-drivers-x86-v6.6-6' of git://git.kernel.org/pub/scm/linux/kernel...
[platform/kernel/linux-rpi.git] / fs / gfs2 / aops.c
index 9c4b26a..c26d483 100644 (file)
@@ -183,13 +183,13 @@ static int gfs2_writepages(struct address_space *mapping,
        int ret;
 
        /*
-        * Even if we didn't write any pages here, we might still be holding
+        * Even if we didn't write enough pages here, we might still be holding
         * dirty pages in the ail. We forcibly flush the ail because we don't
         * want balance_dirty_pages() to loop indefinitely trying to write out
         * pages held in the ail that it can't find.
         */
        ret = iomap_writepages(mapping, wbc, &wpc, &gfs2_writeback_ops);
-       if (ret == 0)
+       if (ret == 0 && wbc->nr_to_write > 0)
                set_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags);
        return ret;
 }
@@ -272,8 +272,7 @@ continue_unlock:
                                 * not be suitable for data integrity
                                 * writeout).
                                 */
-                               *done_index = folio->index +
-                                       folio_nr_pages(folio);
+                               *done_index = folio_next_index(folio);
                                ret = 1;
                                break;
                        }