From patchwork Mon Apr 30 05:47:52 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: 10370791 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 14B6460384 for ; Mon, 30 Apr 2018 05:48:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC7B828A11 for ; Mon, 30 Apr 2018 05:48:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCBCA28A13; Mon, 30 Apr 2018 05:48:15 +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 2678A28A11 for ; Mon, 30 Apr 2018 05:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751583AbeD3FsO (ORCPT ); Mon, 30 Apr 2018 01:48:14 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:39164 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751575AbeD3FsO (ORCPT ); Mon, 30 Apr 2018 01:48:14 -0400 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 w3U5fDSL035109; Mon, 30 Apr 2018 05:47:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=2RXv3CabpxbryWbm7WZb+9gdKNSlStyqvCaZA9qwCoY=; b=Lp1sJYIwvppWbWBrFwMH/lyGR9dRUB7akV5+VezxjW5eDdAR6ourIpQyypT9q9CADFTd oWIV2K5cyXfRBStxOKZTDHjAJ0GbTRtY9kXRC8vlrccltmg7MhysSgdUN21IywU5/Wmy ng9qFi8PL43okvcFpLeAabFNI5bOumw1H3f+ghaCOJsuUGocQGjs4i+b3KQCXIpqezEm lzOI+AhB5cQAw+82ixRR6IOdUsbKOVMpjYqTlEfzL7RiV0l8YqrBSwRmP0GETXi2dXlb M+jjv9tMj04eYVNKsjJBXVhCCEYk4zH/6ZJkbGk9ABaajvQG1XvSSHtcX5fmk33Ha4j4 kA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2hmeg5jrgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Apr 2018 05:47:54 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3U5lrCR024036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Apr 2018 05:47:53 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 w3U5lqrI015072; Mon, 30 Apr 2018 05:47:52 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 29 Apr 2018 22:47:52 -0700 Date: Sun, 29 Apr 2018 22:47:52 -0700 From: "Darrick J. Wong" To: linux-xfs@vger.kernel.org, bfoster@redhat.com, hch@lst.de Subject: [PATCH v2 10/13] xfs: replace XFS_QMOPT_DQALLOC with boolean Message-ID: <20180430054752.GB21688@magnolia> References: <152506698177.21553.13500862866416804148.stgit@magnolia> <152506705736.21553.3142275765217711989.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <152506705736.21553.3142275765217711989.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8878 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 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-1804300057 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 Ugh, wrong commit message. Here's an updated one now that the flag is gone entirely. --D Reviewed-by: Brian Foster Reviewed-by: Christoph Hellwig --- Subject: [PATCH] xfs: replace XFS_QMOPT_DQALLOC with a simple boolean DQALLOC is only ever used with xfs_qm_dqget*, and the only flag that the _dqget family of functions cares about is DQALLOC. Therefore, change it to a boolean 'can alloc?' flag for the dqget interfaces where that makes sense. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_quota_defs.h | 1 - fs/xfs/xfs_dquot.c | 8 ++++---- fs/xfs/xfs_dquot.h | 2 +- fs/xfs/xfs_qm.c | 12 +++++------- fs/xfs/xfs_qm_bhv.c | 2 +- fs/xfs/xfs_qm_syscalls.c | 9 ++++----- 6 files changed, 15 insertions(+), 19 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/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h index c80b22629c78..bfe03fd3aa8e 100644 --- a/fs/xfs/libxfs/xfs_quota_defs.h +++ b/fs/xfs/libxfs/xfs_quota_defs.h @@ -107,7 +107,6 @@ typedef uint16_t xfs_qwarncnt_t; * to a single function. None of these XFS_QMOPT_* flags are meant to have * persistent values (ie. their values can and will change between versions) */ -#define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */ #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 7a343b571ea9..301a96d70785 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c @@ -521,7 +521,7 @@ xfs_dquot_from_disk( /* * Read in the ondisk dquot using dqtobp() then copy it to an incore version, - * and release the buffer immediately. If @can_alloc is specified, fill any + * and release the buffer immediately. If @can_alloc is true, fill any * holes in the on-disk metadata. */ STATIC int @@ -759,7 +759,7 @@ xfs_qm_dqget( struct xfs_mount *mp, xfs_dqid_t id, uint type, - uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */ + bool can_alloc, struct xfs_dquot **O_dqpp) { struct xfs_quotainfo *qi = mp->m_quotainfo; @@ -778,7 +778,7 @@ xfs_qm_dqget( return 0; } - error = xfs_dquot_setup(mp, id, type, flags & XFS_QMOPT_DQALLOC, &dqp); + error = xfs_dquot_setup(mp, id, type, can_alloc, &dqp); if (error) return error; @@ -918,7 +918,7 @@ xfs_qm_dqget_next( *dqpp = NULL; for (; !error; error = xfs_dq_get_next_id(mp, type, &id)) { - error = xfs_qm_dqget(mp, id, type, 0, &dqp); + error = xfs_qm_dqget(mp, id, type, false, &dqp); if (error == -ENOENT) continue; else if (error != 0) diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h index 486a1b475574..6959f0135f36 100644 --- a/fs/xfs/xfs_dquot.h +++ b/fs/xfs/xfs_dquot.h @@ -172,7 +172,7 @@ extern void xfs_qm_adjust_dqlimits(struct xfs_mount *, extern xfs_dqid_t xfs_qm_id_for_quotatype(struct xfs_inode *ip, uint type); extern int xfs_qm_dqget(struct xfs_mount *mp, xfs_dqid_t id, - uint type, uint can_alloc, + uint type, bool can_alloc, struct xfs_dquot **dqpp); extern int xfs_qm_dqget_inode(struct xfs_inode *ip, uint type, bool can_alloc, diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 9f646222c4ac..c6b1e9bd7a3e 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -326,7 +326,7 @@ xfs_qm_need_dqattach( /* * Given a locked inode, attach dquot(s) to it, taking U/G/P-QUOTAON * into account. - * If XFS_QMOPT_DQALLOC, the dquot(s) will be allocated if needed. + * If @doalloc is true, the dquot(s) will be allocated if needed. * Inode may get unlocked and relocked in here, and the caller must deal with * the consequences. */ @@ -1072,7 +1072,7 @@ xfs_qm_quotacheck_dqadjust( int error; id = xfs_qm_id_for_quotatype(ip, type); - error = xfs_qm_dqget(mp, id, type, XFS_QMOPT_DQALLOC, &dqp); + error = xfs_qm_dqget(mp, id, type, true, &dqp); if (error) { /* * Shouldn't be able to turn off quotas here. @@ -1686,8 +1686,7 @@ xfs_qm_vop_dqalloc( * holding ilock. */ xfs_iunlock(ip, lockflags); - error = xfs_qm_dqget(mp, uid, XFS_DQ_USER, - XFS_QMOPT_DQALLOC, &uq); + error = xfs_qm_dqget(mp, uid, XFS_DQ_USER, true, &uq); if (error) { ASSERT(error != -ENOENT); return error; @@ -1710,8 +1709,7 @@ xfs_qm_vop_dqalloc( if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { if (ip->i_d.di_gid != gid) { xfs_iunlock(ip, lockflags); - error = xfs_qm_dqget(mp, gid, XFS_DQ_GROUP, - XFS_QMOPT_DQALLOC, &gq); + error = xfs_qm_dqget(mp, gid, XFS_DQ_GROUP, true, &gq); if (error) { ASSERT(error != -ENOENT); goto error_rele; @@ -1728,7 +1726,7 @@ xfs_qm_vop_dqalloc( if (xfs_get_projid(ip) != prid) { xfs_iunlock(ip, lockflags); error = xfs_qm_dqget(mp, (xfs_dqid_t)prid, XFS_DQ_PROJ, - XFS_QMOPT_DQALLOC, &pq); + true, &pq); if (error) { ASSERT(error != -ENOENT); goto error_rele; diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c index 531e8224dcb6..1fa3d6d6db40 100644 --- a/fs/xfs/xfs_qm_bhv.c +++ b/fs/xfs/xfs_qm_bhv.c @@ -72,7 +72,7 @@ xfs_qm_statvfs( xfs_mount_t *mp = ip->i_mount; xfs_dquot_t *dqp; - if (!xfs_qm_dqget(mp, xfs_get_projid(ip), XFS_DQ_PROJ, 0, &dqp)) { + if (!xfs_qm_dqget(mp, xfs_get_projid(ip), XFS_DQ_PROJ, true, &dqp)) { xfs_fill_statvfs_from_dquot(statp, dqp); xfs_qm_dqput(dqp); } diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index b9243f554697..3e05d300b14e 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c @@ -425,7 +425,7 @@ xfs_qm_scall_setqlim( * a reference to the dquot, so it's safe to do this unlock/lock without * it being reclaimed in the mean time. */ - error = xfs_qm_dqget(mp, id, type, XFS_QMOPT_DQALLOC, &dqp); + error = xfs_qm_dqget(mp, id, type, true, &dqp); if (error) { ASSERT(error != -ENOENT); goto out_unlock; @@ -696,11 +696,10 @@ xfs_qm_scall_getquota( int error; /* - * Try to get the dquot. We don't want it allocated on disk, so - * we aren't passing the XFS_QMOPT_DOALLOC flag. If it doesn't - * exist, we'll get ENOENT back. + * Try to get the dquot. We don't want it allocated on disk, so don't + * set doalloc. If it doesn't exist, we'll get ENOENT back. */ - error = xfs_qm_dqget(mp, id, type, 0, &dqp); + error = xfs_qm_dqget(mp, id, type, false, &dqp); if (error) return error;