aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 91ff104b3849..a7bb98f5831a 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -909,6 +909,10 @@ repeat:
909 page = grab_cache_page_write_begin(mapping, index, flags); 909 page = grab_cache_page_write_begin(mapping, index, flags);
910 if (!page) 910 if (!page)
911 return -ENOMEM; 911 return -ENOMEM;
912
913 /* to avoid latency during memory pressure */
914 unlock_page(page);
915
912 *pagep = page; 916 *pagep = page;
913 917
914 if (f2fs_has_inline_data(inode) && (pos + len) <= MAX_INLINE_DATA) 918 if (f2fs_has_inline_data(inode) && (pos + len) <= MAX_INLINE_DATA)
@@ -920,10 +924,18 @@ repeat:
920 f2fs_unlock_op(sbi); 924 f2fs_unlock_op(sbi);
921 925
922 if (err) { 926 if (err) {
923 f2fs_put_page(page, 1); 927 f2fs_put_page(page, 0);
924 return err; 928 return err;
925 } 929 }
926inline_data: 930inline_data:
931 lock_page(page);
932 if (unlikely(page->mapping != mapping)) {
933 f2fs_put_page(page, 1);
934 goto repeat;
935 }
936
937 f2fs_wait_on_page_writeback(page, DATA);
938
927 if ((len == PAGE_CACHE_SIZE) || PageUptodate(page)) 939 if ((len == PAGE_CACHE_SIZE) || PageUptodate(page))
928 return 0; 940 return 0;
929 941