Commit 84c5d167 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jaegeuk Kim
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 402dd9f0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1565,8 +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);
			if (ret == 1) {
				ret = 0;
			} else if (ret == -EAGAIN) {
				ret = 0;
+3 −5
Original line number Diff line number Diff line
@@ -2917,9 +2917,9 @@ 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)
		return AOP_WRITEPAGE_ACTIVATE;
	folio_unlock(folio);
	if (!err)
		return 1;
	return err;
}

@@ -3133,8 +3133,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
@@ -3146,7 +3144,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) {
				if (ret == 1) {
					ret = 0;
					goto next;
				} else if (ret == -EAGAIN) {