]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/f2fs/node.c
f2fs: modify the readahead method in ra_node_page()
[karo-tx-linux.git] / fs / f2fs / node.c
index 68506f46a479a5ad8d772f48ecbde7f97a3a42f6..7b805f7f63409bbbc2ef9be01bb4988f9d034eb2 100644 (file)
@@ -1084,12 +1084,11 @@ void ra_node_page(struct f2fs_sb_info *sbi, nid_t nid)
                return;
        f2fs_bug_on(sbi, check_nid_range(sbi, nid));
 
-       apage = find_get_page(NODE_MAPPING(sbi), nid);
-       if (apage && PageUptodate(apage)) {
-               f2fs_put_page(apage, 0);
+       rcu_read_lock();
+       apage = radix_tree_lookup(&NODE_MAPPING(sbi)->page_tree, nid);
+       rcu_read_unlock();
+       if (apage)
                return;
-       }
-       f2fs_put_page(apage, 0);
 
        apage = grab_cache_page(NODE_MAPPING(sbi), nid);
        if (!apage)
@@ -1203,10 +1202,13 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)
        if (!inode)
                return;
 
-       page = pagecache_get_page(inode->i_mapping, 0, FGP_LOCK|FGP_NOWAIT, 0);
+       page = pagecache_get_page(inode->i_mapping, 0, FGP_NOWAIT, 0);
        if (!page)
                goto iput_out;
 
+       if (!trylock_page(page))
+               goto release_out;
+
        if (!PageUptodate(page))
                goto page_out;
 
@@ -1221,7 +1223,9 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino)
        else
                set_page_dirty(page);
 page_out:
-       f2fs_put_page(page, 1);
+       unlock_page(page);
+release_out:
+       f2fs_put_page(page, 0);
 iput_out:
        iput(inode);
 }
@@ -1238,7 +1242,7 @@ int sync_node_pages(struct f2fs_sb_info *sbi, nid_t ino,
 
 next_step:
        index = 0;
-       end = LONG_MAX;
+       end = ULONG_MAX;
 
        while (index <= end) {
                int i, nr_pages;
@@ -1354,7 +1358,7 @@ continue_unlock:
 
 int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino)
 {
-       pgoff_t index = 0, end = LONG_MAX;
+       pgoff_t index = 0, end = ULONG_MAX;
        struct pagevec pvec;
        int ret2 = 0, ret = 0;