Skip to content

Commit 84c5d16

Browse files
Christoph HellwigJaegeuk Kim
authored andcommitted
f2fs: always unlock the page in f2fs_write_single_data_page
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>
1 parent 402dd9f commit 84c5d16

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

fs/f2fs/compress.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,8 +1565,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,
15651565
NULL, NULL, wbc, io_type,
15661566
compr_blocks, false);
15671567
if (ret) {
1568-
if (ret == AOP_WRITEPAGE_ACTIVATE) {
1569-
folio_unlock(folio);
1568+
if (ret == 1) {
15701569
ret = 0;
15711570
} else if (ret == -EAGAIN) {
15721571
ret = 0;

fs/f2fs/data.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,9 +2917,9 @@ int f2fs_write_single_data_page(struct folio *folio, int *submitted,
29172917
* file_write_and_wait_range() will see EIO error, which is critical
29182918
* to return value of fsync() followed by atomic_write failure to user.
29192919
*/
2920-
if (!err)
2921-
return AOP_WRITEPAGE_ACTIVATE;
29222920
folio_unlock(folio);
2921+
if (!err)
2922+
return 1;
29232923
return err;
29242924
}
29252925

@@ -3133,8 +3133,6 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
31333133
ret = f2fs_write_single_data_page(folio,
31343134
&submitted, &bio, &last_block,
31353135
wbc, io_type, 0, true);
3136-
if (ret == AOP_WRITEPAGE_ACTIVATE)
3137-
folio_unlock(folio);
31383136
#ifdef CONFIG_F2FS_FS_COMPRESSION
31393137
result:
31403138
#endif
@@ -3146,7 +3144,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
31463144
* keep nr_to_write, since vfs uses this to
31473145
* get # of written pages.
31483146
*/
3149-
if (ret == AOP_WRITEPAGE_ACTIVATE) {
3147+
if (ret == 1) {
31503148
ret = 0;
31513149
goto next;
31523150
} else if (ret == -EAGAIN) {

0 commit comments

Comments
 (0)