* [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
* Re: [PATCH] xfs: simplify the local variables assignment
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
1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2022-04-19 17:13 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, Kaixu Xia
On Tue, Apr 19, 2022 at 11:36:46PM +0800, xiakaixu1987@gmail.com wrote:
> 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>
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@kernel.org>
--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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: simplify the local variables assignment
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
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-04-24 5:30 UTC (permalink / raw)
To: xiakaixu1987; +Cc: linux-xfs, djwong, Kaixu Xia
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [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.