linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, xfs@oss.sgi.com
Subject: [PATCH] xfs_db: pass the inode cluster offset when copying inodes
Date: Mon, 29 Aug 2016 20:46:32 -0700	[thread overview]
Message-ID: <20160830034631.GL22760@birch.djwong.org> (raw)

In copy_inode_chunk, we try to determine whether or not an inode is
free as part of copying the inode records.  The macros involved in
testing ir_free require both the inode record and the offset of an
inode within that chunk.  Prior to sparse inode support, the loop
index "i" was also the inode chunk offset; however, when sparse
support was added, "i" became the inode offset within a cluster and
"ioff" became the inode cluster offset within an inode chunk.
Therefore, it is necessary to pass "ioff + i" to do the free-ness
calculation correctly.

This was discovered while trying to take metadumps of fs images for
scrub testing.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 db/metadump.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/db/metadump.c b/db/metadump.c
index e82b660..c769958 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -2292,7 +2292,7 @@ copy_inode_chunk(
 
 			/* process_inode handles free inodes, too */
 			if (!process_inode(agno, agino + ioff + i, dip,
-			    XFS_INOBT_IS_FREE_DISK(rp, i)))
+			    XFS_INOBT_IS_FREE_DISK(rp, ioff + i)))
 				goto pop_out;
 
 			inodes_copied++;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

                 reply	other threads:[~2016-08-30  3:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160830034631.GL22760@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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).