diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-04-28 17:59:43 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-05-07 10:21:57 +0900 |
commit | 817202d937e6cca7e60f42e6495aaa51d70d9d7e (patch) | |
tree | 24ea4565ddf464250fa39a0e4735d01b14ebf6d6 /fs/f2fs/dir.c | |
parent | 5c1f9927ec1a4753e845193bde99ac3b03b08818 (diff) | |
download | blackbird-op-linux-817202d937e6cca7e60f42e6495aaa51d70d9d7e.tar.gz blackbird-op-linux-817202d937e6cca7e60f42e6495aaa51d70d9d7e.zip |
f2fs: readahead multi pages of directory for performance
We have no so such readahead mechanism in ->iterate() path as the one in
->read() path, it cause low performance when we read large directory.
This patch add readahead in f2fs_readdir() for better performance.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/dir.c')
-rw-r--r-- | fs/f2fs/dir.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 972fd0ef230f..3581c2bde21b 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -637,11 +637,17 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx) struct f2fs_dentry_block *dentry_blk = NULL; struct f2fs_dir_entry *de = NULL; struct page *dentry_page = NULL; + struct file_ra_state *ra = &file->f_ra; unsigned int n = ((unsigned long)ctx->pos / NR_DENTRY_IN_BLOCK); unsigned char d_type = DT_UNKNOWN; bit_pos = ((unsigned long)ctx->pos % NR_DENTRY_IN_BLOCK); + /* readahead for multi pages of dir */ + if (npages - n > 1 && !ra_has_index(ra, n)) + page_cache_sync_readahead(inode->i_mapping, ra, file, n, + min(npages - n, (pgoff_t)MAX_DIR_RA_PAGES)); + for (; n < npages; n++) { dentry_page = get_lock_data_page(inode, n); if (IS_ERR(dentry_page)) |