f2fs: inject ENOSPC failures
[deliverable/linux.git] / fs / f2fs / checkpoint.c
index 0955312e5ca042fe45f88e0c10714d79f3fb8778..79da86d6cf5cb9ec7035e187b30b24961f37da09 100644 (file)
@@ -34,7 +34,7 @@ struct page *grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
        struct address_space *mapping = META_MAPPING(sbi);
        struct page *page = NULL;
 repeat:
-       page = grab_cache_page(mapping, index);
+       page = f2fs_grab_cache_page(mapping, index, false);
        if (!page) {
                cond_resched();
                goto repeat;
@@ -64,7 +64,7 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index,
        if (unlikely(!is_meta))
                fio.rw &= ~REQ_META;
 repeat:
-       page = grab_cache_page(mapping, index);
+       page = f2fs_grab_cache_page(mapping, index, false);
        if (!page) {
                cond_resched();
                goto repeat;
@@ -186,7 +186,8 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
                        BUG();
                }
 
-               page = grab_cache_page(META_MAPPING(sbi), fio.new_blkaddr);
+               page = f2fs_grab_cache_page(META_MAPPING(sbi),
+                                               fio.new_blkaddr, false);
                if (!page)
                        continue;
                if (PageUptodate(page)) {
@@ -211,7 +212,7 @@ void ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index)
        bool readahead = false;
 
        page = find_get_page(META_MAPPING(sbi), index);
-       if (!page || (page && !PageUptodate(page)))
+       if (!page || !PageUptodate(page))
                readahead = true;
        f2fs_put_page(page, 0);
 
@@ -473,6 +474,13 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)
        int err = 0;
 
        spin_lock(&im->ino_lock);
+
+#ifdef CONFIG_F2FS_FAULT_INJECTION
+       if (time_to_inject(FAULT_ORPHAN)) {
+               spin_unlock(&im->ino_lock);
+               return -ENOSPC;
+       }
+#endif
        if (unlikely(im->ino_num >= sbi->max_orphans))
                err = -ENOSPC;
        else
@@ -892,7 +900,7 @@ retry_flush_nodes:
 
        if (get_pages(sbi, F2FS_DIRTY_NODES)) {
                up_write(&sbi->node_write);
-               err = sync_node_pages(sbi, 0, &wbc);
+               err = sync_node_pages(sbi, &wbc);
                if (err) {
                        f2fs_unlock_all(sbi);
                        goto out;
This page took 0.030754 seconds and 5 git commands to generate.