Skip to contentSkip to conversation

f2fs: no need to take page lock in readdir

PATCH In review Gao Xiang 2 participants 2 messages Feb 21, 2019 – Feb 27, 2019

Subsystems (2)
lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 f2fs: no need to take page lock in readdir

VFS will take inode_lock for readdir, therefore no need to take page lock in readdir at all just as the majority of other generic filesystems.

This patch improves concurrency since .iterate_shared was introduced to VFS years ago.

---

personally tend to use read_mapping_page here, but it seems that f2fs has some remaining customized code since it was merged into Linux, use f2fs_find_data_page instead.

 fs/f2fs/dir.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/f2fs/dir.c +3 -3
index ecc3a4e2be96..64602bc1e092 100644
@@ -873,7 +873,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
 			page_cache_sync_readahead(inode->i_mapping, ra, file, n,
 				min(npages - n, (pgoff_t)MAX_DIR_RA_PAGES));
 
-		dentry_page = f2fs_get_lock_data_page(inode, n, false);
+		dentry_page = f2fs_find_data_page(inode, n);
 		if (IS_ERR(dentry_page)) {
 			err = PTR_ERR(dentry_page);
 			if (err == -ENOENT) {
@@ -891,11 +891,11 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx)
 		err = f2fs_fill_dentries(ctx, &d,
 				n * NR_DENTRY_IN_BLOCK, &fstr);
 		if (err) {
-			f2fs_put_page(dentry_page, 1);
+			f2fs_put_page(dentry_page, 0);
 			break;
 		}
 
-		f2fs_put_page(dentry_page, 1);
+		f2fs_put_page(dentry_page, 0);
 	}
 out_free:
 	fscrypt_fname_free_buffer(&fstr);
Signature · 1 line
2.14.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Gao Xiang

VFS will take inode_lock for readdir, therefore no need to take page lock in readdir at all just as the majority of other generic filesystems.

This patch improves concurrency since .iterate_shared was introduced to VFS years ago.

Thanks,