Keep in line with the other Linux file system implementations
since page_cache_sync_readahead supports NULL file pointer,
and thus we can readahead data by f2fs itself without file opening
(something like the btrfs behavior).

Signed-off-by: Gao Xiang <[email protected]>
---
 fs/f2fs/data.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 95f30f0..afa12f1 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1333,9 +1333,11 @@ static int f2fs_read_data_pages(struct file *file,
                        struct address_space *mapping,
                        struct list_head *pages, unsigned nr_pages)
 {
-       struct inode *inode = file->f_mapping->host;
+       struct inode *inode = mapping->host;
        struct page *page = list_last_entry(pages, struct page, lru);
 
+       if (likely(file != NULL))
+               BUG_ON(file->f_mapping != mapping);
        trace_f2fs_readpages(inode, page, nr_pages);
 
        /* If the file has inline data, skip readpages */
-- 
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to