f2fs: always unlock the page in f2fs_write_single_data_page
authorChristoph Hellwig <hch@lst.de>
Thu, 8 May 2025 05:14:30 +0000 (07:14 +0200)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 8 May 2025 15:23:18 +0000 (15:23 +0000)
Consolidate the code to unlock the page in f2fs_write_single_data_page
instead of leaving it to the callers for the AOP_WRITEPAGE_ACTIVATE case.
Replace AOP_WRITEPAGE_ACTIVATE with a positive return of 1 as this case
now doesn't match the historic ->writepage special return code that is
on it's way out now that ->writepage has been removed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/compress.c
fs/f2fs/data.c

index e016b0f963137c922bf8ae49c9a47d259f0d6203..1e62fdffda0784d15d7a745b59d8f3248703ecf3 100644 (file)
@@ -1565,8 +1565,7 @@ continue_unlock:
                                                NULL, NULL, wbc, io_type,
                                                compr_blocks, false);
                if (ret) {
-                       if (ret == AOP_WRITEPAGE_ACTIVATE) {
-                               folio_unlock(folio);
+                       if (ret == 1) {
                                ret = 0;
                        } else if (ret == -EAGAIN) {
                                ret = 0;
index 160c7b39d9676b4d46e61cca53e98edd469288d8..8d8018083c31f56f59090fb2f27ce1ca671c755b 100644 (file)
@@ -2917,9 +2917,9 @@ redirty_out:
         * 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)
-               return AOP_WRITEPAGE_ACTIVATE;
        folio_unlock(folio);
+       if (!err)
+               return 1;
        return err;
 }
 
@@ -3133,8 +3133,6 @@ continue_unlock:
                        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
@@ -3146,7 +3144,7 @@ result:
                                 * keep nr_to_write, since vfs uses this to
                                 * get # of written pages.
                                 */
-                               if (ret == AOP_WRITEPAGE_ACTIVATE) {
+                               if (ret == 1) {
                                        ret = 0;
                                        goto next;
                                } else if (ret == -EAGAIN) {