From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, hch@lst.de
Subject: Re: [PATCH 09/13] xfs: remove xfs_qm_dqread flags argument
Date: Tue, 1 May 2018 09:44:54 -0400 [thread overview]
Message-ID: <20180501134454.GB4525@bfoster.bfoster> (raw)
In-Reply-To: <152506705098.21553.6894396720813018127.stgit@magnolia>
On Sun, Apr 29, 2018 at 10:44:11PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Move the _qm_dqread functionality to _qm_dqensure, then remove the flags
> argument from xfs_qm_dqread since the only DQALLOC users were internal
> to xfs_dquot.c anyway.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/xfs_dquot.c | 37 +++++++++++++++++++++++--------------
> fs/xfs/xfs_dquot.h | 6 +++---
> fs/xfs/xfs_qm.c | 4 ++--
> 3 files changed, 28 insertions(+), 19 deletions(-)
>
>
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index d8730f6110b8..7a343b571ea9 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -521,16 +521,15 @@ xfs_dquot_from_disk(
>
> /*
> * Read in the ondisk dquot using dqtobp() then copy it to an incore version,
> - * and release the buffer immediately.
> - *
> - * If XFS_QMOPT_DQALLOC is set, allocate a dquot on disk if it needed.
> + * and release the buffer immediately. If @can_alloc is specified, fill any
> + * holes in the on-disk metadata.
> */
> -int
> -xfs_qm_dqread(
> +STATIC int
> +xfs_dquot_setup(
> struct xfs_mount *mp,
> xfs_dqid_t id,
> uint type,
> - uint flags,
> + bool can_alloc,
> struct xfs_dquot **dqpp)
> {
> struct xfs_dquot *dqp;
> @@ -543,7 +542,7 @@ xfs_qm_dqread(
>
> /* Try to read the buffer... */
> error = xfs_dquot_disk_read(mp, dqp, &bp);
> - if (error == -ENOENT && (flags & XFS_QMOPT_DQALLOC)) {
> + if (error == -ENOENT && can_alloc) {
> /* ...or allocate a new block and buffer. */
> error = xfs_trans_alloc(mp, &M_RES(mp)->tr_qm_dqalloc,
> XFS_QM_DQALLOC_SPACE_RES(mp), 0, 0, &tp);
> @@ -581,6 +580,20 @@ xfs_qm_dqread(
> return error;
> }
>
> +/*
> + * Read in the ondisk dquot using dqtobp() then copy it to an incore version,
> + * and release the buffer immediately.
> + */
> +int
> +xfs_qm_dqread(
> + struct xfs_mount *mp,
> + xfs_dqid_t id,
> + uint type,
> + struct xfs_dquot **dqpp)
> +{
> + return xfs_dquot_setup(mp, id, type, false, dqpp);
> +}
> +
> /*
> * Advance to the next id in the current chunk, or if at the
> * end of the chunk, skip ahead to first id in next allocated chunk
> @@ -746,7 +759,7 @@ xfs_qm_dqget(
> struct xfs_mount *mp,
> xfs_dqid_t id,
> uint type,
> - uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */
> + uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */
> struct xfs_dquot **O_dqpp)
> {
> struct xfs_quotainfo *qi = mp->m_quotainfo;
> @@ -765,7 +778,7 @@ xfs_qm_dqget(
> return 0;
> }
>
> - error = xfs_qm_dqread(mp, id, type, flags, &dqp);
> + error = xfs_dquot_setup(mp, id, type, flags & XFS_QMOPT_DQALLOC, &dqp);
> if (error)
> return error;
>
> @@ -820,16 +833,12 @@ xfs_qm_dqget_inode(
> struct radix_tree_root *tree = xfs_dquot_tree(qi, type);
> struct xfs_dquot *dqp;
> xfs_dqid_t id;
> - uint flags = 0;
> int error;
>
> error = xfs_qm_dqget_checks(mp, type);
> if (error)
> return error;
>
> - if (can_alloc)
> - flags |= XFS_QMOPT_DQALLOC;
> -
> ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> ASSERT(xfs_inode_dquot(ip, type) == NULL);
>
> @@ -850,7 +859,7 @@ xfs_qm_dqget_inode(
> * we re-acquire the lock.
> */
> xfs_iunlock(ip, XFS_ILOCK_EXCL);
> - error = xfs_qm_dqread(mp, id, type, flags, &dqp);
> + error = xfs_dquot_setup(mp, id, type, can_alloc, &dqp);
> xfs_ilock(ip, XFS_ILOCK_EXCL);
> if (error)
> return error;
> diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
> index 8a5b30e952b0..486a1b475574 100644
> --- a/fs/xfs/xfs_dquot.h
> +++ b/fs/xfs/xfs_dquot.h
> @@ -160,8 +160,8 @@ 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 int xfs_qm_dqread(struct xfs_mount *mp, xfs_dqid_t id,
> + uint type, struct xfs_dquot **dqpp);
> 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 *);
> @@ -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 flags,
> + uint type, uint 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 fb14954610ee..9f646222c4ac 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -569,7 +569,7 @@ xfs_qm_set_defquota(
> struct xfs_def_quota *defq;
> int error;
>
> - error = xfs_qm_dqread(mp, 0, type, 0, &dqp);
> + error = xfs_qm_dqread(mp, 0, type, &dqp);
>
> if (!error) {
> xfs_disk_dquot_t *ddqp = &dqp->q_core;
> @@ -647,7 +647,7 @@ xfs_qm_init_quotainfo(
> XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER :
> (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP :
> XFS_DQ_PROJ),
> - 0, &dqp);
> + &dqp);
>
> if (!error) {
> xfs_disk_dquot_t *ddqp = &dqp->q_core;
>
> --
> 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
next prev parent reply other threads:[~2018-05-01 13:44 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 5:43 [PATCH v2 00/13] xfs-4.18: quota refactor Darrick J. Wong
2018-04-30 5:43 ` [PATCH 01/13] xfs: refactor XFS_QMOPT_DQNEXT out of existence Darrick J. Wong
2018-04-30 5:43 ` [PATCH 02/13] xfs: refactor dquot cache handling Darrick J. Wong
2018-04-30 5:43 ` [PATCH 03/13] xfs: delegate dqget input checks to helper function Darrick J. Wong
2018-04-30 5:43 ` [PATCH 04/13] xfs: remove unnecessary xfs_qm_dqattach parameter Darrick J. Wong
2018-04-30 5:43 ` [PATCH 05/13] xfs: split out dqget for inodes from regular dqget Darrick J. Wong
2018-04-30 5:43 ` [PATCH 06/13] xfs: fetch dquots directly during quotacheck Darrick J. Wong
2018-04-30 5:43 ` [PATCH 07/13] xfs: refactor incore dquot initialization functions Darrick J. Wong
2018-04-30 5:44 ` [PATCH 08/13] xfs: refactor xfs_qm_dqtobp and xfs_qm_dqalloc Darrick J. Wong
2018-05-01 13:44 ` Brian Foster
2018-05-02 16:32 ` Christoph Hellwig
2018-05-03 0:10 ` Darrick J. Wong
2018-04-30 5:44 ` [PATCH 09/13] xfs: remove xfs_qm_dqread flags argument Darrick J. Wong
2018-05-01 13:44 ` Brian Foster [this message]
2018-05-02 16:34 ` Christoph Hellwig
2018-05-02 16:58 ` Darrick J. Wong
2018-05-07 14:41 ` Christoph Hellwig
2018-05-08 0:04 ` Darrick J. Wong
2018-05-08 0:05 ` [PATCH 09/13] xfs: remove direct calls to _qm_dqread Darrick J. Wong
2018-05-09 16:40 ` Brian Foster
2018-05-10 8:26 ` Christoph Hellwig
2018-05-10 15:20 ` Darrick J. Wong
2018-04-30 5:44 ` [PATCH 10/13] xfs: replace XFS_QMOPT_DQALLOC with XFS_DQGET_{ALLOC, EXISTS} Darrick J. Wong
2018-04-30 5:47 ` [PATCH v2 10/13] xfs: replace XFS_QMOPT_DQALLOC with boolean Darrick J. Wong
2018-05-01 13:45 ` Brian Foster
2018-05-01 15:52 ` Darrick J. Wong
2018-05-02 16:35 ` Christoph Hellwig
2018-04-30 5:44 ` [PATCH 11/13] xfs: report failing address when dquot verifier fails Darrick J. Wong
2018-04-30 5:44 ` [PATCH 12/13] xfs: rename on-disk dquot counter zap functions Darrick J. Wong
2018-05-01 13:45 ` Brian Foster
2018-05-02 16:35 ` Christoph Hellwig
2018-04-30 5:44 ` [PATCH 13/13] xfs: refactor dquot iteration Darrick J. Wong
2018-05-01 13:45 ` Brian Foster
2018-05-01 15:53 ` Darrick J. Wong
2018-05-02 16:37 ` Christoph Hellwig
2018-05-02 16:43 ` [PATCH v2 " Darrick J. Wong
2018-05-03 17:53 ` [PATCH 0.1/13] xfs: release new dquot buffer on defer_finish error Darrick J. Wong
2018-05-04 11:31 ` Brian Foster
2018-05-04 15:12 ` Darrick J. Wong
2018-05-04 15:41 ` Brian Foster
2018-05-04 15:52 ` Darrick J. Wong
2018-05-04 16:03 ` Brian Foster
2018-05-04 20:05 ` Darrick J. Wong
2018-05-04 21:19 ` [PATCH v2 " Darrick J. Wong
2018-05-07 11:03 ` Brian Foster
2018-05-03 17:54 ` [PATCH 0.2/13] xfs: don't spray logs when dquot flush/purge fail Darrick J. Wong
2018-05-04 11:32 ` Brian Foster
-- strict thread matches above, loose matches on Subject: below --
2018-04-22 15:05 [PATCH 00/13] xfs-4.18: quota refactor Darrick J. Wong
2018-04-22 15:06 ` [PATCH 09/13] xfs: remove xfs_qm_dqread flags argument Darrick J. Wong
2018-04-23 17:32 ` Christoph Hellwig
2018-04-28 6:38 ` Darrick J. Wong
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=20180501134454.GB4525@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=hch@lst.de \
--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;
as well as URLs for NNTP newsgroup(s).