mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-10 19:35:21 +02:00
UPSTREAM: f2fs: convert f2fs_write_end() to use folio
Convert to use folio, so that we can get rid of 'page->index' to
prepare for removal of 'index' field in structure page [1].
[1] https://lore.kernel.org/all/Zp8fgUSIBGQ1TN0D@casper.infradead.org/
Cc: Matthew Wilcox <willy@infradead.org>
Change-Id: I3f4e5c84f86b9d0894857b25cf37cf019035e894
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Li Zetao <lizetao1@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 3c86d1eec7
)
This commit is contained in:
parent
ddcf5fda13
commit
bd5de9c701
|
@ -3720,7 +3720,8 @@ static int f2fs_write_end(struct file *file,
|
||||||
loff_t pos, unsigned len, unsigned copied,
|
loff_t pos, unsigned len, unsigned copied,
|
||||||
struct page *page, void *fsdata)
|
struct page *page, void *fsdata)
|
||||||
{
|
{
|
||||||
struct inode *inode = page->mapping->host;
|
struct folio *folio = page_folio(page);
|
||||||
|
struct inode *inode = folio->mapping->host;
|
||||||
|
|
||||||
trace_f2fs_write_end(inode, pos, len, copied);
|
trace_f2fs_write_end(inode, pos, len, copied);
|
||||||
|
|
||||||
|
@ -3729,17 +3730,17 @@ static int f2fs_write_end(struct file *file,
|
||||||
* should be PAGE_SIZE. Otherwise, we treat it with zero copied and
|
* should be PAGE_SIZE. Otherwise, we treat it with zero copied and
|
||||||
* let generic_perform_write() try to copy data again through copied=0.
|
* let generic_perform_write() try to copy data again through copied=0.
|
||||||
*/
|
*/
|
||||||
if (!PageUptodate(page)) {
|
if (!folio_test_uptodate(folio)) {
|
||||||
if (unlikely(copied != len))
|
if (unlikely(copied != len))
|
||||||
copied = 0;
|
copied = 0;
|
||||||
else
|
else
|
||||||
SetPageUptodate(page);
|
folio_mark_uptodate(folio);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_F2FS_FS_COMPRESSION
|
#ifdef CONFIG_F2FS_FS_COMPRESSION
|
||||||
/* overwrite compressed file */
|
/* overwrite compressed file */
|
||||||
if (f2fs_compressed_file(inode) && fsdata) {
|
if (f2fs_compressed_file(inode) && fsdata) {
|
||||||
f2fs_compress_write_end(inode, fsdata, page->index, copied);
|
f2fs_compress_write_end(inode, fsdata, folio->index, copied);
|
||||||
f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
|
f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
|
||||||
|
|
||||||
if (pos + copied > i_size_read(inode) &&
|
if (pos + copied > i_size_read(inode) &&
|
||||||
|
@ -3752,10 +3753,10 @@ static int f2fs_write_end(struct file *file,
|
||||||
if (!copied)
|
if (!copied)
|
||||||
goto unlock_out;
|
goto unlock_out;
|
||||||
|
|
||||||
set_page_dirty(page);
|
folio_mark_dirty(folio);
|
||||||
|
|
||||||
if (f2fs_is_atomic_file(inode))
|
if (f2fs_is_atomic_file(inode))
|
||||||
set_page_private_atomic(page);
|
set_page_private_atomic(folio_page(folio, 0));
|
||||||
|
|
||||||
if (pos + copied > i_size_read(inode) &&
|
if (pos + copied > i_size_read(inode) &&
|
||||||
!f2fs_verity_in_progress(inode)) {
|
!f2fs_verity_in_progress(inode)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user