All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: simplify the local variables assignment
@ 2022-04-19 15:36 xiakaixu1987
  2022-04-19 17:13 ` Darrick J. Wong
  2022-04-24  5:30 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: xiakaixu1987 @ 2022-04-19 15:36 UTC (permalink / raw)
  To: linux-xfs; +Cc: djwong, Kaixu Xia

From: Kaixu Xia <kaixuxia@tencent.com>

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-24  5:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 15:36 [PATCH] xfs: simplify the local variables assignment xiakaixu1987
2022-04-19 17:13 ` Darrick J. Wong
2022-04-24  5:30 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.