f2fs: merge f2fs_show_injection_info() into time_to_inject()
[sfrench/cifs-2.6.git] / fs / f2fs / node.c
index 84b147966080e3906a1a5d04745f09fc238e7ba1..fbd1d25fecc22e1935ec3e9884fc8fb0bf7b1735 100644 (file)
@@ -60,7 +60,7 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type)
        avail_ram = val.totalram - val.totalhigh;
 
        /*
-        * give 25%, 25%, 50%, 50%, 50% memory for each components respectively
+        * give 25%, 25%, 50%, 50%, 25%, 25% memory for each components respectively
         */
        if (type == FREE_NIDS) {
                mem_size = (nm_i->nid_cnt[FREE_NID] *
@@ -85,12 +85,16 @@ bool f2fs_available_free_memory(struct f2fs_sb_info *sbi, int type)
                                                sizeof(struct ino_entry);
                mem_size >>= PAGE_SHIFT;
                res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
-       } else if (type == READ_EXTENT_CACHE) {
-               mem_size = (atomic_read(&sbi->total_ext_tree) *
+       } else if (type == READ_EXTENT_CACHE || type == AGE_EXTENT_CACHE) {
+               enum extent_type etype = type == READ_EXTENT_CACHE ?
+                                               EX_READ : EX_BLOCK_AGE;
+               struct extent_tree_info *eti = &sbi->extent_tree[etype];
+
+               mem_size = (atomic_read(&eti->total_ext_tree) *
                                sizeof(struct extent_tree) +
-                               atomic_read(&sbi->total_ext_node) *
+                               atomic_read(&eti->total_ext_node) *
                                sizeof(struct extent_node)) >> PAGE_SHIFT;
-               res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
+               res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2);
        } else if (type == DISCARD_CACHE) {
                mem_size = (atomic_read(&dcc->discard_cmd_cnt) *
                                sizeof(struct discard_cmd)) >> PAGE_SHIFT;
@@ -859,7 +863,7 @@ int f2fs_get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
                        blkaddr = data_blkaddr(dn->inode, dn->node_page,
                                                dn->ofs_in_node + 1);
 
-               f2fs_update_extent_tree_range_compressed(dn->inode,
+               f2fs_update_read_extent_tree_range_compressed(dn->inode,
                                        index, blkaddr,
                                        F2FS_I(dn->inode)->i_cluster_size,
                                        c_len);
@@ -1646,7 +1650,6 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted,
        }
 
        set_page_writeback(page);
-       ClearPageError(page);
 
        fio.old_blkaddr = ni.blk_addr;
        f2fs_do_write_node_page(nid, &fio);
@@ -2075,8 +2078,6 @@ int f2fs_wait_on_node_pages_writeback(struct f2fs_sb_info *sbi,
                spin_unlock_irqrestore(&sbi->fsync_node_lock, flags);
 
                f2fs_wait_on_page_writeback(page, NODE, true, false);
-               if (TestClearPageError(page))
-                       ret = -EIO;
 
                put_page(page);
 
@@ -2540,10 +2541,8 @@ bool f2fs_alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid)
        struct f2fs_nm_info *nm_i = NM_I(sbi);
        struct free_nid *i = NULL;
 retry:
-       if (time_to_inject(sbi, FAULT_ALLOC_NID)) {
-               f2fs_show_injection_info(sbi, FAULT_ALLOC_NID);
+       if (time_to_inject(sbi, FAULT_ALLOC_NID))
                return false;
-       }
 
        spin_lock(&nm_i->nid_list_lock);