diff options
author | zhangxirui <xirui.zhang@vivo.com> | 2023-10-21 06:19:07 -0600 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2023-11-17 09:30:53 -0800 |
commit | 36062b91838753f444235842197feb7d78c87096 (patch) | |
tree | cf916408d966b1dea17338842a89d7b5f39f7c88 /fs/f2fs | |
parent | 6bc40e44f1ddef16a787f3501b97f1fff909177c (diff) | |
download | linux-36062b91838753f444235842197feb7d78c87096.tar.gz linux-36062b91838753f444235842197feb7d78c87096.tar.bz2 linux-36062b91838753f444235842197feb7d78c87096.zip |
f2fs: use inode_lock_shared instead of inode_lock in f2fs_seek_block()
inode_lock_shared() -> down_read(&inode->i_rwsem)
inode_lock() -> down_write(&inode->i_rwsem)
Inode is not updated in f2fs_seek_block(), so there is no need
to hold write lock, use read lock for more efficiency.
Signed-off-by: zhangxirui <xirui.zhang@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/file.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index e50363583f01..325dab01a29d 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -418,7 +418,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence) loff_t isize; int err = 0; - inode_lock(inode); + inode_lock_shared(inode); isize = i_size_read(inode); if (offset >= isize) @@ -483,10 +483,10 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence) found: if (whence == SEEK_HOLE && data_ofs > isize) data_ofs = isize; - inode_unlock(inode); + inode_unlock_shared(inode); return vfs_setpos(file, data_ofs, maxbytes); fail: - inode_unlock(inode); + inode_unlock_shared(inode); return -ENXIO; } |