From patchwork Tue Jan 15 17:08:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10764843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 004926C5 for ; Tue, 15 Jan 2019 17:08:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1C062CF31 for ; Tue, 15 Jan 2019 17:08:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C26932CF4A; Tue, 15 Jan 2019 17:08:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 713E52CF31 for ; Tue, 15 Jan 2019 17:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731568AbfAORIx (ORCPT ); Tue, 15 Jan 2019 12:08:53 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:46056 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728566AbfAORIw (ORCPT ); Tue, 15 Jan 2019 12:08:52 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0FH4QTe004309 for ; Tue, 15 Jan 2019 17:08:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=Q9g4jta0oK3J1pJ7b+r3NL5Q2vLdt+hO7fhMmdjqTGg=; b=E4SrwpPjP00ab3r1B/YhVRBtfmDTR9t4hHbYbz4+OxYdCiUiyw4CzQVlT3PZJn8n9FlE 8JYfZYUovyAt+xt39baEdQHSd2o8fomCiwxwgrLmaktqcLP7C2uZgu1APl2VqBEy2Xic FpuZyb4jPhSwWLiDnnVrt8X37hMmnsCuhO1qveW4cPqLAXo1zykEKayQKmkCOiBau+Mi 8zNgVEw6BY2FIx2sAa6RXBa6lG30wObzGhioajMK8OqKXWrFsOqS0JcUPyrvfBBuSY/O QzsBV+QK89zONyXP6wBWLlT7dxuLTRMiZF5JGfwAJVk4t89vsM1rfYXZToVpodyi7j7L UA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2pybjnn530-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 15 Jan 2019 17:08:51 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0FH8otX025587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 15 Jan 2019 17:08:50 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0FH8obL016855 for ; Tue, 15 Jan 2019 17:08:50 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 15 Jan 2019 09:08:49 -0800 Date: Tue, 15 Jan 2019 09:08:49 -0800 From: "Darrick J. Wong" To: xfs Subject: [PATCH] xfs: use generic fillattr to reduce redundant code Message-ID: <20190115170849.GC12689@magnolia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9137 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=842 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901150142 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong 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 Signed-off-by: Christoph Hellwig --- 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)) {