f2fs: allow readpages with NULL file pointer
Hi Chao,
Quoted 21 lines · Chao Yu
Hi Xiang Gao,
Quoted 4 lines · gaoxiang (P)
Hi Chao,
Thanks for your reply.
This patch originates from the our sdcardfs compatiblecase-insensitive lookup acceleration.
Quoted 2 lines
For the customized case-insensitive create operation since f2fs has
no hash and it needs to decrypt all the dirent name,
Quoted 3 lines
it is recommended to read ahead the whole dir data in advance.
However I found f2fs cannot use
page_cache_sync_readaheadwith null@file pointer as the other common Linux file system,
Quoted 1 line
this feature is something like a bonus and I know that Linux has no
written words that we should support null @file pointer, yet
Quoted 1 line
page_cache_sync_readaheadis anEXPORT_SYMBOL_GPLand could be usedby other non-standard 3rd kernel modules and
Quoted 1 line
of course I think it is really no problem.
Quoted 8 lines
Looks like some filesystems store private data in
file->private_datafor some purpose during ->open, and will use the data in late ->readpages. So passing @file with NULL value will simply cause kernel bug for these filesystems.As I checked, most generic local filesystems just use
mapping->hostinstead offile->f_mapping->host, so look this patch again, following generic filesystem looks not bad. ;)
I'm glad to hear that the community could apply it. :)
Quoted 1 line
How about just changing
file->f_mapping->hosttomapping->hostin out patch?
To my knowledge of f2fs, I am not quite sure whether f_mapping in f2fs is really equal to mapping or not. Therefore I add a extra BUG_ON and do some stress tests to re-confirm that.
Yes, it's fine with me that we only change file->f_mapping->host to mapping->host.
Thanks,
Quoted 49 lines
Thanks,
Quoted 2 lines
Anyway, if it has no use to the community, I will apply it only on
the internal branch.
Quoted 8 lines
And I will also find some common examples of data page readahead. :)
Thanks,
Quoted 4 lines
-----Original Message-----
From: Chao Yu [mailto:[email protected]]
Sent: Thursday, September 21, 2017 10:33 PM
To: gaoxiang (P) <[email protected]>; [email protected];Yuchao (T)
Quoted 3 lines
Quoted 3 lines
<[email protected]>
Cc: [email protected]
Subject: Re: [f2fs-dev] [PATCH] f2fs: allow readpages with NULLfile pointer
Quoted 8 lines
Quoted 8 lines · gaoxiang (P)
Quoted 4 lines
Keep in line with the other Linux file system implementations since
page_cache_sync_readaheadsupports NULL file pointer, and thus we can readahead data by f2fs itself without file opening (something like the btrfs behavior).Let's keep what it is until there is an example doing readahead
passing @file
Quoted 21 lines
Quoted 21 lines
with NULL.
Thanks,
Quoted 17 lines
Signed-off-by Gao Xiang <[email protected]>--- fs/f2fs/data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/f2fs/data.c index 95f30f0..afa12f1 renamed from fs/f2fs/data.c +0
-0100644
fs/f2fs/data.c +1
-1@@ -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);
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
fs/f2fs/data.c static int f2fs_read_data_pages(struct file *file, · line 1343
Quoted 6 lines
fs/f2fs/data.c +2
-0+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 */
------------------------------------------------------------------------------
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