On Tue, Apr 19, 2022 at 11:36:46PM +0800, xiakaixu1987@xxxxxxxxx wrote: > From: Kaixu Xia <kaixuxia@xxxxxxxxxxx> > > 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@xxxxxxxxxxx> Assuming this compiles on the maintainer's for-next branch, I think you're correct that @file and @mapping are no longer needed. Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx> --D > --- > fs/xfs/xfs_file.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > index 5bddb1e9e0b3..691e98fe4eee 100644 > --- a/fs/xfs/xfs_file.c > +++ b/fs/xfs/xfs_file.c > @@ -694,9 +694,7 @@ xfs_file_buffered_write( > struct kiocb *iocb, > struct iov_iter *from) > { > - struct file *file = iocb->ki_filp; > - struct address_space *mapping = file->f_mapping; > - struct inode *inode = mapping->host; > + struct inode *inode = iocb->ki_filp->f_mapping->host; > struct xfs_inode *ip = XFS_I(inode); > ssize_t ret; > bool cleared_space = false; > @@ -767,9 +765,7 @@ xfs_file_write_iter( > struct kiocb *iocb, > struct iov_iter *from) > { > - struct file *file = iocb->ki_filp; > - struct address_space *mapping = file->f_mapping; > - struct inode *inode = mapping->host; > + struct inode *inode = iocb->ki_filp->f_mapping->host; > struct xfs_inode *ip = XFS_I(inode); > ssize_t ret; > size_t ocount = iov_iter_count(from); > -- > 2.27.0 >