Skip to content

Commit 2d9ac43

Browse files
kaixuxiakxdchinner
authored andcommitted
xfs: simplify local variable assignment in file write code
Get the struct inode pointer from iocb->ki_filp->f_mapping->host directly and the other variables are unnecessary, so simplify the local variables assignment. Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent 2229276 commit 2d9ac43

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

fs/xfs/xfs_file.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,7 @@ xfs_file_buffered_write(
694694
struct kiocb *iocb,
695695
struct iov_iter *from)
696696
{
697-
struct file *file = iocb->ki_filp;
698-
struct address_space *mapping = file->f_mapping;
699-
struct inode *inode = mapping->host;
697+
struct inode *inode = iocb->ki_filp->f_mapping->host;
700698
struct xfs_inode *ip = XFS_I(inode);
701699
ssize_t ret;
702700
bool cleared_space = false;
@@ -767,9 +765,7 @@ xfs_file_write_iter(
767765
struct kiocb *iocb,
768766
struct iov_iter *from)
769767
{
770-
struct file *file = iocb->ki_filp;
771-
struct address_space *mapping = file->f_mapping;
772-
struct inode *inode = mapping->host;
768+
struct inode *inode = iocb->ki_filp->f_mapping->host;
773769
struct xfs_inode *ip = XFS_I(inode);
774770
ssize_t ret;
775771
size_t ocount = iov_iter_count(from);

0 commit comments

Comments
 (0)