From patchwork Thu May 10 15:30:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10391949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ECE3A60353 for ; Thu, 10 May 2018 15:30:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE0EB28C86 for ; Thu, 10 May 2018 15:30:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A845728C7E; Thu, 10 May 2018 15:30:27 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 98B8228C9F for ; Thu, 10 May 2018 15:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966140AbeEJPaW (ORCPT ); Thu, 10 May 2018 11:30:22 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:40128 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965410AbeEJPaV (ORCPT ); Thu, 10 May 2018 11:30:21 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4AFPrHq165300; Thu, 10 May 2018 15:30:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=/7lBeYOyU3bGdA7+VSN0Pd23swito0+Rr0f9w2B3wGk=; b=KwTGd9tIP9c1LFIkMPcFX/wPwd18Y3PAn/uSjM9ztIXdQa891b+iNiIvTATuFuJyMFo7 wO1NcJr+8zEq37rlEQQgtew29SfJUn1JwoqAlZHKyzUqyNEgz8uBwjaCL1av4sn9GpAD oQb2WM+tD91DUZbv8Eys+dIgk50aq8YaIFa4h6AY8TrdEE7RqSaSCWn885/hMZYh+zKm Pxg62QSELq48Sw7mzb0Kt9O/8gswnJpwjwzIvZhahkmwOljJwaUPfdBnYYAR8ymeqWe1 okP8yi5+rp3CTgPSy9GCg15rma0Gd0XpcByOhQxoUNob4bnFsX51zEYF8MRmmJvx/pMg /A== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2hv6kp45rs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 May 2018 15:30:02 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4AFU2iQ031648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 May 2018 15:30:02 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4AFU1Ye006345; Thu, 10 May 2018 15:30:02 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 May 2018 08:30:01 -0700 Subject: [PATCH 11/14] xfs: remove direct calls to _qm_dqread From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, Brian Foster , hch@lst.de Date: Thu, 10 May 2018 08:30:00 -0700 Message-ID: <152596620070.27525.16420936769965860462.stgit@magnolia> In-Reply-To: <152596612549.27525.9876256551560849585.stgit@magnolia> References: <152596612549.27525.9876256551560849585.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8888 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805100146 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 The quota initialization code needs an "uncached" variant of _dqget to read in default quota limits and timers before the dquot cache is fully set up. We've already split up _dqget into its component pieces so create a fourth variant to address this need, and make dqread internal to xfs_dquot.c again. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_dquot.c | 24 +++++++++++++++++++++++- fs/xfs/xfs_dquot.h | 5 +++-- fs/xfs/xfs_qm.c | 25 +++++++++++++------------ 3 files changed, 39 insertions(+), 15 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 22bb52ee82c8..5593a344732c 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -586,7 +586,7 @@ xfs_qm_dqread_alloc( * * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed. */ -int +static int xfs_qm_dqread( struct xfs_mount *mp, xfs_dqid_t id, @@ -832,6 +832,28 @@ xfs_qm_dqget( return 0; } +/* + * Given a dquot id and type, read and initialize a dquot from the on-disk + * metadata. This function is only for use during quota initialization so + * it ignores the dquot cache assuming that the dquot shrinker isn't set up. + * The caller is responsible for _qm_dqdestroy'ing the returned dquot. + */ +int +xfs_qm_dqget_uncached( + struct xfs_mount *mp, + xfs_dqid_t id, + uint type, + struct xfs_dquot **dqpp) +{ + int error; + + error = xfs_qm_dqget_checks(mp, type); + if (error) + return error; + + return xfs_qm_dqread(mp, id, type, 0, dqpp); +} + /* Return the quota id for a given inode and type. */ xfs_dqid_t xfs_qm_id_for_quotatype( diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h index 8a5b30e952b0..38a42874a98c 100644 --- a/fs/xfs/xfs_dquot.h +++ b/fs/xfs/xfs_dquot.h @@ -160,8 +160,6 @@ static inline bool xfs_dquot_lowsp(struct xfs_dquot *dqp) #define XFS_QM_ISPDQ(dqp) ((dqp)->dq_flags & XFS_DQ_PROJ) #define XFS_QM_ISGDQ(dqp) ((dqp)->dq_flags & XFS_DQ_GROUP) -extern int xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint, - uint, struct xfs_dquot **); extern void xfs_qm_dqdestroy(xfs_dquot_t *); extern int xfs_qm_dqflush(struct xfs_dquot *, struct xfs_buf **); extern void xfs_qm_dqunpin_wait(xfs_dquot_t *); @@ -179,6 +177,9 @@ extern int xfs_qm_dqget_inode(struct xfs_inode *ip, uint type, struct xfs_dquot **dqpp); extern int xfs_qm_dqget_next(struct xfs_mount *mp, xfs_dqid_t id, uint type, struct xfs_dquot **dqpp); +extern int xfs_qm_dqget_uncached(struct xfs_mount *mp, + xfs_dqid_t id, uint type, + struct xfs_dquot **dqpp); extern void xfs_qm_dqput(xfs_dquot_t *); extern void xfs_dqlock2(struct xfs_dquot *, struct xfs_dquot *); diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index f86b3608567d..fac649518101 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -563,8 +563,7 @@ xfs_qm_set_defquota( struct xfs_def_quota *defq; int error; - error = xfs_qm_dqread(mp, 0, type, 0, &dqp); - + error = xfs_qm_dqget_uncached(mp, 0, type, &dqp); if (!error) { xfs_disk_dquot_t *ddqp = &dqp->q_core; @@ -590,11 +589,12 @@ xfs_qm_set_defquota( */ STATIC int xfs_qm_init_quotainfo( - xfs_mount_t *mp) + struct xfs_mount *mp) { - xfs_quotainfo_t *qinf; - int error; - xfs_dquot_t *dqp; + struct xfs_quotainfo *qinf; + struct xfs_dquot *dqp; + uint type; + int error; ASSERT(XFS_IS_QUOTA_RUNNING(mp)); @@ -637,12 +637,13 @@ xfs_qm_init_quotainfo( * user/group/proj quota types, otherwise a default value is used. * This should be split into different fields per quota type. */ - error = xfs_qm_dqread(mp, 0, - XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER : - (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP : - XFS_DQ_PROJ), - 0, &dqp); - + if (XFS_IS_UQUOTA_RUNNING(mp)) + type = XFS_DQ_USER; + else if (XFS_IS_GQUOTA_RUNNING(mp)) + type = XFS_DQ_GROUP; + else + type = XFS_DQ_PROJ; + error = xfs_qm_dqget_uncached(mp, 0, type, &dqp); if (!error) { xfs_disk_dquot_t *ddqp = &dqp->q_core;