aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-08-12 03:00:46 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-08-12 03:00:46 -0400
commit9c02740c0174932162531a28ba8593e82884a9d7 (patch)
tree3aa3cb92f8b28462f9fb14e608975306b594d84e /fs
parent41dfde135f9169948dd0c9bba948774f2e521210 (diff)
f2fs: check the free space first in new_node_page
Let's check the free space in prior to the main process of allocating a new node page. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/node.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index bb8fbda43669..858a333f6ab9 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -833,29 +833,29 @@ struct page *new_node_page(struct dnode_of_data *dn,
833 if (!page) 833 if (!page)
834 return ERR_PTR(-ENOMEM); 834 return ERR_PTR(-ENOMEM);
835 835
836 get_node_info(sbi, dn->nid, &old_ni); 836 if (!inc_valid_node_count(sbi, dn->inode, 1)) {
837 err = -ENOSPC;
838 goto fail;
839 }
837 840
838 SetPageUptodate(page); 841 get_node_info(sbi, dn->nid, &old_ni);
839 fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true);
840 842
841 /* Reinitialize old_ni with new node page */ 843 /* Reinitialize old_ni with new node page */
842 BUG_ON(old_ni.blk_addr != NULL_ADDR); 844 BUG_ON(old_ni.blk_addr != NULL_ADDR);
843 new_ni = old_ni; 845 new_ni = old_ni;
844 new_ni.ino = dn->inode->i_ino; 846 new_ni.ino = dn->inode->i_ino;
845
846 if (!inc_valid_node_count(sbi, dn->inode, 1)) {
847 err = -ENOSPC;
848 goto fail;
849 }
850 set_node_addr(sbi, &new_ni, NEW_ADDR); 847 set_node_addr(sbi, &new_ni, NEW_ADDR);
848
849 fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true);
851 set_cold_node(dn->inode, page); 850 set_cold_node(dn->inode, page);
851 SetPageUptodate(page);
852 set_page_dirty(page);
852 853
853 dn->node_page = page; 854 dn->node_page = page;
854 if (ipage) 855 if (ipage)
855 update_inode(dn->inode, ipage); 856 update_inode(dn->inode, ipage);
856 else 857 else
857 sync_inode_page(dn); 858 sync_inode_page(dn);
858 set_page_dirty(page);
859 if (ofs == 0) 859 if (ofs == 0)
860 inc_valid_inode_count(sbi); 860 inc_valid_inode_count(sbi);
861 861