public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_repair: fix libxfs api violations in quota repair code
@ 2018-05-29 20:40 Eric Sandeen
  2018-05-29 21:14 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2018-05-29 20:40 UTC (permalink / raw)
  To: linux-xfs

My "repair quotas" patch forgot about our libxfs API tricks,
fix that.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
index 56f9f8c..63bf27e 100644
--- a/libxfs/libxfs_api_defs.h
+++ b/libxfs/libxfs_api_defs.h
@@ -126,6 +126,10 @@
  #define xfs_sb_quota_from_disk		libxfs_sb_quota_from_disk
  #define xfs_sb_to_disk			libxfs_sb_to_disk
  
+#define xfs_calc_dquots_per_chunk	libxfs_calc_dquots_per_chunk
+#define xfs_dquot_verify		libxfs_dquot_verify
+#define xfs_dquot_repair		libxfs_dquot_repair
+
  #define xfs_symlink_blocks		libxfs_symlink_blocks
  #define xfs_symlink_hdr_ok		libxfs_symlink_hdr_ok
  
diff --git a/repair/dinode.c b/repair/dinode.c
index e8edcd4..49d5d05 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -1345,7 +1345,7 @@ process_quota_inode(
  	}
  
  	dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
-	dqperchunk = xfs_calc_dquots_per_chunk(dqchunklen);
+	dqperchunk = libxfs_calc_dquots_per_chunk(dqchunklen);
  	dqid = 0;
  	qbno = NULLFILEOFF;
  
@@ -1367,12 +1367,12 @@ _("cannot read inode %" PRIu64 ", file block %" PRIu64 ", disk block %" PRIu64 "
  
  		dqb = bp->b_addr;
  		for (i = 0; i < dqperchunk; i++, dqid++, dqb++) {
-			xfs_failaddr_t	fa;
  			int		bad_dqb = 0;
  
  			/* We only print the first problem we find */
  			if (xfs_sb_version_hascrc(&mp->m_sb)) {
-				if (!xfs_verify_cksum((char *)dqb, sizeof(*dqb),
+				if (!libxfs_verify_cksum((char *)dqb,
+							sizeof(*dqb),
  							XFS_DQUOT_CRC_OFF)) {
  					do_warn(_("%s: bad CRC for id %u. "),
  							quota_string, dqid);
@@ -1388,8 +1388,8 @@ _("cannot read inode %" PRIu64 ", file block %" PRIu64 ", disk block %" PRIu64 "
  					goto bad;
  				}
  			}
-			fa = xfs_dquot_verify(mp, &dqb->dd_diskdq, dqid, quota_type, 0);
-			if (fa) {
+			if (libxfs_dquot_verify(mp, &dqb->dd_diskdq, dqid,
+						quota_type, 0) != NULL) {
  				do_warn(_("%s: Corrupt quota for id %u. "),
  						quota_string, dqid);
  				bad_dqb = 1;
@@ -1401,7 +1401,8 @@ bad:
  					do_warn(_("Would correct.\n"));
  				else {
  					do_warn(_("Corrected.\n"));
-					xfs_dquot_repair(mp, &dqb->dd_diskdq, dqid, quota_type);
+					libxfs_dquot_repair(mp, &dqb->dd_diskdq,
+							    dqid, quota_type);
  					writebuf = 1;
  				}
  			}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_repair: fix libxfs api violations in quota repair code
  2018-05-29 20:40 [PATCH] xfs_repair: fix libxfs api violations in quota repair code Eric Sandeen
@ 2018-05-29 21:14 ` Darrick J. Wong
  2018-05-29 21:41   ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2018-05-29 21:14 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

On Tue, May 29, 2018 at 03:40:14PM -0500, Eric Sandeen wrote:
> My "repair quotas" patch forgot about our libxfs API tricks,
> fix that.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok, with a suggestion for another patch...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

> ---
> 
> diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
> index 56f9f8c..63bf27e 100644
> --- a/libxfs/libxfs_api_defs.h
> +++ b/libxfs/libxfs_api_defs.h
> @@ -126,6 +126,10 @@
>  #define xfs_sb_quota_from_disk		libxfs_sb_quota_from_disk
>  #define xfs_sb_to_disk			libxfs_sb_to_disk
> +#define xfs_calc_dquots_per_chunk	libxfs_calc_dquots_per_chunk
> +#define xfs_dquot_verify		libxfs_dquot_verify
> +#define xfs_dquot_repair		libxfs_dquot_repair
> +
>  #define xfs_symlink_blocks		libxfs_symlink_blocks
>  #define xfs_symlink_hdr_ok		libxfs_symlink_hdr_ok
> diff --git a/repair/dinode.c b/repair/dinode.c
> index e8edcd4..49d5d05 100644
> --- a/repair/dinode.c
> +++ b/repair/dinode.c
> @@ -1345,7 +1345,7 @@ process_quota_inode(
>  	}
>  	dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
> -	dqperchunk = xfs_calc_dquots_per_chunk(dqchunklen);
> +	dqperchunk = libxfs_calc_dquots_per_chunk(dqchunklen);
>  	dqid = 0;
>  	qbno = NULLFILEOFF;
> @@ -1367,12 +1367,12 @@ _("cannot read inode %" PRIu64 ", file block %" PRIu64 ", disk block %" PRIu64 "
>  		dqb = bp->b_addr;
>  		for (i = 0; i < dqperchunk; i++, dqid++, dqb++) {
> -			xfs_failaddr_t	fa;
>  			int		bad_dqb = 0;
>  			/* We only print the first problem we find */
>  			if (xfs_sb_version_hascrc(&mp->m_sb)) {
> -				if (!xfs_verify_cksum((char *)dqb, sizeof(*dqb),
> +				if (!libxfs_verify_cksum((char *)dqb,
> +							sizeof(*dqb),
>  							XFS_DQUOT_CRC_OFF)) {
>  					do_warn(_("%s: bad CRC for id %u. "),
>  							quota_string, dqid);
> @@ -1388,8 +1388,8 @@ _("cannot read inode %" PRIu64 ", file block %" PRIu64 ", disk block %" PRIu64 "
>  					goto bad;
>  				}
>  			}
> -			fa = xfs_dquot_verify(mp, &dqb->dd_diskdq, dqid, quota_type, 0);
> -			if (fa) {
> +			if (libxfs_dquot_verify(mp, &dqb->dd_diskdq, dqid,
> +						quota_type, 0) != NULL) {
>  				do_warn(_("%s: Corrupt quota for id %u. "),
>  						quota_string, dqid);
>  				bad_dqb = 1;
> @@ -1401,7 +1401,8 @@ bad:
>  					do_warn(_("Would correct.\n"));
>  				else {
>  					do_warn(_("Corrected.\n"));
> -					xfs_dquot_repair(mp, &dqb->dd_diskdq, dqid, quota_type);
> +					libxfs_dquot_repair(mp, &dqb->dd_diskdq,
> +							    dqid, quota_type);

Repair ought to check that return value, right?

--D

>  					writebuf = 1;
>  				}
>  			}
> 
> --
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_repair: fix libxfs api violations in quota repair code
  2018-05-29 21:14 ` Darrick J. Wong
@ 2018-05-29 21:41   ` Eric Sandeen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2018-05-29 21:41 UTC (permalink / raw)
  To: Darrick J. Wong, Eric Sandeen; +Cc: linux-xfs



On 5/29/18 4:14 PM, Darrick J. Wong wrote:
>>   					do_warn(_("Corrected.\n"));
>> -					xfs_dquot_repair(mp, &dqb->dd_diskdq, dqid, quota_type);
>> +					libxfs_dquot_repair(mp, &dqb->dd_diskdq,
>> +							    dqid, quota_type);
> Repair ought to check that return value, right?
> 
> --D
> 

yeah, though it only return 0 today.

And I need to refactor this for 4.18 to match kernel changes anyhoo so
it might go away, not sure.

Thanks,
-Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-29 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-29 20:40 [PATCH] xfs_repair: fix libxfs api violations in quota repair code Eric Sandeen
2018-05-29 21:14 ` Darrick J. Wong
2018-05-29 21:41   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox