Commit 36062b91 authored by zhangxirui's avatar zhangxirui Committed by Jaegeuk Kim

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: default avatarzhangxirui <xirui.zhang@vivo.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6bc40e44
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment