From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs: use generic fillattr to reduce redundant code
Date: Tue, 15 Jan 2019 09:08:49 -0800 [thread overview]
Message-ID: <20190115170849.GC12689@magnolia> (raw)
From: Darrick J. Wong <darrick.wong@oracle.com>
Refactor xfs_vn_getattr to use generic_fillattr to fill out parts of the
kstat structure instead of open-coding the same pieces. This eliminates
redundant code and fixes a bug where we fail to set the AUTOMOUNT
attribute. Obviously, we retain all the xfs-specific parts.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/xfs_iops.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index f48ffd7a8d3e..169bd7824479 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -501,16 +501,9 @@ xfs_vn_getattr(
if (XFS_FORCED_SHUTDOWN(mp))
return -EIO;
+ generic_fillattr(inode, stat);
stat->size = XFS_ISIZE(ip);
- stat->dev = inode->i_sb->s_dev;
- stat->mode = inode->i_mode;
- stat->nlink = inode->i_nlink;
- stat->uid = inode->i_uid;
- stat->gid = inode->i_gid;
stat->ino = ip->i_ino;
- stat->atime = inode->i_atime;
- stat->mtime = inode->i_mtime;
- stat->ctime = inode->i_ctime;
stat->blocks =
XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
@@ -533,7 +526,6 @@ xfs_vn_getattr(
case S_IFBLK:
case S_IFCHR:
stat->blksize = BLKDEV_IOSIZE;
- stat->rdev = inode->i_rdev;
break;
default:
if (XFS_IS_REALTIME_INODE(ip)) {
next reply other threads:[~2019-01-15 17:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-15 17:08 Darrick J. Wong [this message]
2019-01-15 20:25 ` [PATCH] xfs: use generic fillattr to reduce redundant code Dave Chinner
2019-01-15 21:13 ` Christoph Hellwig
2019-01-15 21:34 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190115170849.GC12689@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox