f2fs: give a try to do atomic write in -ENOMEM case
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 19 Jul 2017 17:59:55 +0000 (10:59 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 29 Jul 2017 00:49:00 +0000 (17:49 -0700)
It'd be better to retry writing atomic pages when we get -ENOMEM.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index f964b68718c18f5953971351a5358ccaa841a6ca..f5d139f897dc9a73ba254ad956677b2e6442ea3f 100644 (file)
@@ -309,17 +309,21 @@ static int __commit_inmem_pages(struct inode *inode,
                                inode_dec_dirty_pages(inode);
                                remove_dirty_inode(inode);
                        }
-
+retry:
                        fio.page = page;
                        fio.old_blkaddr = NULL_ADDR;
                        fio.encrypted_page = NULL;
                        fio.need_lock = LOCK_DONE;
                        err = do_write_data_page(&fio);
                        if (err) {
+                               if (err == -ENOMEM) {
+                                       congestion_wait(BLK_RW_ASYNC, HZ/50);
+                                       cond_resched();
+                                       goto retry;
+                               }
                                unlock_page(page);
                                break;
                        }
-
                        /* record old blkaddr for revoking */
                        cur->old_addr = fio.old_blkaddr;
                        last_idx = page->index;