All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 3/5 V2] xfs: pass full xfs_dqblk to repair during quotacheck
Date: Mon, 7 May 2018 09:15:05 -0700	[thread overview]
Message-ID: <20180507161505.GY26569@magnolia> (raw)
In-Reply-To: <67f3c686-78f4-9aa1-78b7-e80fc6700f1e@sandeen.net>

On Mon, May 07, 2018 at 10:22:05AM -0500, Eric Sandeen wrote:
> It's a bit dicey to pass in the smaller xfs_disk_dquot and then cast it to
> something larger; pass in the full xfs_dqblk so we know the caller has sent
> us the right thing.  Rename the function to xfs_dqblk_repair for
> clarity.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
> 
> V2: More precise commit summary
> 
>  fs/xfs/libxfs/xfs_dquot_buf.c  | 21 +++++++++------------
>  fs/xfs/libxfs/xfs_quota_defs.h |  2 +-
>  fs/xfs/xfs_qm.c                |  2 +-
>  3 files changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
> index c00174f32f0d..3b92427883fa 100644
> --- a/fs/xfs/libxfs/xfs_dquot_buf.c
> +++ b/fs/xfs/libxfs/xfs_dquot_buf.c
> @@ -104,29 +104,26 @@ xfs_dquot_verify(
>   * Do some primitive error checking on ondisk dquot data structures.
>   */
>  int
> -xfs_dquot_repair(
> +xfs_dqblk_repair(
>  	struct xfs_mount	*mp,
> -	struct xfs_disk_dquot	*ddq,
> +	struct xfs_dqblk	*dqb,
>  	xfs_dqid_t		id,
>  	uint			type)
>  {
> -	struct xfs_dqblk	*d = (struct xfs_dqblk *)ddq;
> -
> -
>  	/*
>  	 * Typically, a repair is only requested by quotacheck.
>  	 */
>  	ASSERT(id != -1);
> -	memset(d, 0, sizeof(xfs_dqblk_t));
> +	memset(dqb, 0, sizeof(xfs_dqblk_t));
>  
> -	d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
> -	d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
> -	d->dd_diskdq.d_flags = type;
> -	d->dd_diskdq.d_id = cpu_to_be32(id);
> +	dqb->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC);
> +	dqb->dd_diskdq.d_version = XFS_DQUOT_VERSION;
> +	dqb->dd_diskdq.d_flags = type;
> +	dqb->dd_diskdq.d_id = cpu_to_be32(id);
>  
>  	if (xfs_sb_version_hascrc(&mp->m_sb)) {
> -		uuid_copy(&d->dd_uuid, &mp->m_sb.sb_meta_uuid);
> -		xfs_update_cksum((char *)d, sizeof(struct xfs_dqblk),
> +		uuid_copy(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid);
> +		xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
>  				 XFS_DQUOT_CRC_OFF);
>  	}
>  
> diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
> index 8433656af0da..a2f8cb334bb3 100644
> --- a/fs/xfs/libxfs/xfs_quota_defs.h
> +++ b/fs/xfs/libxfs/xfs_quota_defs.h
> @@ -154,7 +154,7 @@ typedef uint16_t	xfs_qwarncnt_t;
>  extern xfs_failaddr_t xfs_dquot_verify(struct xfs_mount *mp,
>  		struct xfs_disk_dquot *ddq, xfs_dqid_t id, uint type);
>  extern int xfs_calc_dquots_per_chunk(unsigned int nbblks);
> -extern int xfs_dquot_repair(struct xfs_mount *mp, struct xfs_disk_dquot *ddq,
> +extern int xfs_dqblk_repair(struct xfs_mount *mp, struct xfs_dqblk *dqb,
>  		xfs_dqid_t id, uint type);
>  
>  #endif	/* __XFS_QUOTA_H__ */
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index c71ad79bb2e6..6690b938d450 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -867,7 +867,7 @@ xfs_qm_reset_dqcounts(
>  		 */
>  		fa = xfs_dquot_verify(mp, ddq, id + j, type);
>  		if (fa)
> -			xfs_dquot_repair(mp, ddq, id + j, type);
> +			xfs_dqblk_repair(mp, &dqb[j], id + j, type);
>  
>  		/*
>  		 * Reset type in case we are reusing group quota file for
> -- 
> 2.17.0
> 
> --
> 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
> 
> 
> --
> 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

  reply	other threads:[~2018-05-07 16:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 17:33 [PATCH 0/5] xfs: quota verifier/repair improvements take 2 Eric Sandeen
2018-05-04 17:34 ` [PATCH 1/5] xfs: remove unused flags arg from xfs_dquot_verify Eric Sandeen
2018-05-04 17:34 ` [PATCH 2/5] xfs: check type in quota verifier during quotacheck Eric Sandeen
2018-05-04 22:08   ` Darrick J. Wong
2018-05-07 15:07   ` Christoph Hellwig
2018-05-04 17:34 ` [PATCH 3/5] xfs: repair full xfs_dqblk " Eric Sandeen
2018-05-04 22:09   ` Darrick J. Wong
2018-05-07 15:09   ` Christoph Hellwig
2018-05-07 15:22   ` [PATCH 3/5 V2] xfs: pass full xfs_dqblk to repair " Eric Sandeen
2018-05-07 16:15     ` Darrick J. Wong [this message]
2018-05-04 17:35 ` [PATCH 4/5] xfs: add full xfs_dqblk verifier Eric Sandeen
2018-05-04 22:09   ` Darrick J. Wong
2018-05-07 15:10   ` Christoph Hellwig
2018-05-07 15:20   ` [PATCH 4/5 V2] " Eric Sandeen
2018-05-04 17:35 ` [PATCH 5/5] xfs: print specific dqblk that failed verifiers Eric Sandeen
2018-05-04 21:46   ` [PATCH 6/5] xfs: make several functions void Eric Sandeen
2018-05-04 22:29     ` Darrick J. Wong
2018-05-04 22:36       ` Eric Sandeen
2018-05-04 22:10   ` [PATCH 5/5] xfs: print specific dqblk that failed verifiers Darrick J. Wong
2018-05-07 15:11   ` Christoph Hellwig

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=20180507161505.GY26569@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.