xfs
[Top] [All Lists]

Re: [patch 18/19] xfs: kill xfs_qm_idtodq

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [patch 18/19] xfs: kill xfs_qm_idtodq
From: Ben Myers <bpm@xxxxxxx>
Date: Thu, 15 Dec 2011 14:07:36 -0600
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20111206215855.775568812@xxxxxxxxxxxxxxxxxxxxxx>
References: <20111206215806.844405397@xxxxxxxxxxxxxxxxxxxxxx> <20111206215855.775568812@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.18 (2008-05-17)
On Tue, Dec 06, 2011 at 04:58:24PM -0500, Christoph Hellwig wrote:
> This function doesn't help the code flow, so merge the dquot allocation and
> transaction handling into xfs_qm_dqread.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

Looks good.
Reviewed-by: Ben Myers <bpm@xxxxxxx>

> ---
>  fs/xfs/xfs_dquot.c |  137 
> +++++++++++++++++++----------------------------------
>  1 file changed, 50 insertions(+), 87 deletions(-)
> 
> Index: xfs/fs/xfs/xfs_dquot.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_dquot.c       2011-12-06 15:53:53.153697880 +0100
> +++ xfs/fs/xfs/xfs_dquot.c    2011-12-06 15:56:37.910367600 +0100
> @@ -550,36 +550,62 @@ xfs_qm_dqtobp(
>   * 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.
>   */
> -/* ARGSUSED */
>  STATIC int
>  xfs_qm_dqread(
> -     xfs_trans_t     **tpp,
> -     xfs_dqid_t      id,
> -     xfs_dquot_t     *dqp,   /* dquot to get filled in */
> -     uint            flags)
> +     struct xfs_mount        *mp,
> +     xfs_dqid_t              id,
> +     uint                    type,
> +     uint                    flags,
> +     struct xfs_dquot        **O_dqpp)
>  {
> -     xfs_disk_dquot_t *ddqp;
> -     xfs_buf_t        *bp;
> -     int              error;
> -     xfs_trans_t      *tp;
> +     struct xfs_dquot        *dqp;
> +     struct xfs_disk_dquot   *ddqp;
> +     struct xfs_buf          *bp;
> +     struct xfs_trans        *tp = NULL;
> +     int                     error;
> +     int                     cancelflags = 0;
>  
> -     ASSERT(tpp);
> +     dqp = xfs_qm_dqinit(mp, id, type);
>  
>       trace_xfs_dqread(dqp);
>  
> +     if (flags & XFS_QMOPT_DQALLOC) {
> +             tp = xfs_trans_alloc(mp, XFS_TRANS_QM_DQALLOC);
> +             error = xfs_trans_reserve(tp, XFS_QM_DQALLOC_SPACE_RES(mp),
> +                             XFS_WRITE_LOG_RES(mp) +
> +                             /*
> +                              * Round the chunklen up to the next multiple
> +                              * of 128 (buf log item chunk size)).
> +                              */

Thanks for the comment.  ;)

> +                             BBTOB(mp->m_quotainfo->qi_dqchunklen) - 1 + 128,
> +                             0,
> +                             XFS_TRANS_PERM_LOG_RES,
> +                             XFS_WRITE_LOG_COUNT);
> +             if (error)
> +                     goto error1;
> +             cancelflags = XFS_TRANS_RELEASE_LOG_RES;
> +     }

<Prev in Thread] Current Thread [Next in Thread>