Instead unlock the pages locally where that would happen and thus
consolidate the code in the callers.

Signed-off-by: Christoph Hellwig <h...@lst.de>
---
 fs/f2fs/compress.c |  5 +----
 fs/f2fs/data.c     | 13 ++++---------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index e016b0f96313..ce63b3bfb28f 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1565,10 +1565,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,
                                                NULL, NULL, wbc, io_type,
                                                compr_blocks, false);
                if (ret) {
-                       if (ret == AOP_WRITEPAGE_ACTIVATE) {
-                               folio_unlock(folio);
-                               ret = 0;
-                       } else if (ret == -EAGAIN) {
+                       if (ret == -EAGAIN) {
                                ret = 0;
                                /*
                                 * for quota file, just redirty left pages to
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 08a8a107adcb..e32c9cf5b4f5 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2930,10 +2930,10 @@ int f2fs_write_single_data_page(struct folio *folio, 
int *submitted,
         * file_write_and_wait_range() will see EIO error, which is critical
         * to return value of fsync() followed by atomic_write failure to user.
         */
-       if (!err || wbc->for_reclaim)
-               return AOP_WRITEPAGE_ACTIVATE;
        folio_unlock(folio);
-       return err;
+       if (err && !wbc->for_reclaim)
+               return err;
+       return 0;
 }
 
 /*
@@ -3146,8 +3146,6 @@ static int f2fs_write_cache_pages(struct address_space 
*mapping,
                        ret = f2fs_write_single_data_page(folio,
                                        &submitted, &bio, &last_block,
                                        wbc, io_type, 0, true);
-                       if (ret == AOP_WRITEPAGE_ACTIVATE)
-                               folio_unlock(folio);
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 result:
 #endif
@@ -3159,10 +3157,7 @@ static int f2fs_write_cache_pages(struct address_space 
*mapping,
                                 * keep nr_to_write, since vfs uses this to
                                 * get # of written pages.
                                 */
-                               if (ret == AOP_WRITEPAGE_ACTIVATE) {
-                                       ret = 0;
-                                       goto next;
-                               } else if (ret == -EAGAIN) {
+                               if (ret == -EAGAIN) {
                                        ret = 0;
                                        if (wbc->sync_mode == WB_SYNC_ALL) {
                                                f2fs_io_schedule_timeout(
-- 
2.47.2



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to