Skip to contentSkip to conversation

xfs_db: pass the inode cluster offset when copying inodes

PATCH New Darrick J. Wong 1 participant 1 message Aug 30, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_db: pass the inode cluster offset when copying inodes

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.

---
 db/metadump.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
db/metadump.c +1 -1
index e82b660..c769958 100644
@@ -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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs