[PATCH] tmp debug

Jingbo Xu jefflexu at linux.alibaba.com
Tue Apr 4 18:02:24 AEST 2023


Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
 lib/inode.c | 7 ++++++-
 lib/xattr.c | 3 +++
 mkfs/main.c | 4 ++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/lib/inode.c b/lib/inode.c
index 6861b99..b252904 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -272,8 +272,11 @@ erofs_nid_t erofs_lookupnid(struct erofs_inode *inode)
 	struct erofs_buffer_head *const bh = inode->bh;
 	erofs_off_t off, meta_offset;
 
-	if (!bh || (long long)inode->nid > 0)
+	if (!bh || (long long)inode->nid > 0) {
+		erofs_dbg(" nid %llu to file %s, bh %p",
+		  inode->nid, inode->i_srcpath, inode->bh);
 		return inode->nid;
+	}
 
 	erofs_mapbh(bh->block);
 	off = erofs_btell(bh, false);
@@ -1266,6 +1269,8 @@ struct erofs_inode *erofs_mkfs_build_special_from_fd(int fd, const char *name)
 	if (name == EROFS_PACKED_INODE) {
 		sbi.packed_nid = EROFS_PACKED_NID_UNALLOCATED;
 		inode->nid = sbi.packed_nid;
+		erofs_dbg("erofs_mkfs_build_special_from_fd: nid %llu to file %s, bh %p",
+		  inode->nid, inode->i_srcpath, inode->bh);
 	}
 
 	ret = erofs_write_compressed_file(inode, fd);
diff --git a/lib/xattr.c b/lib/xattr.c
index de462ab..c336d9d 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -141,11 +141,14 @@ static bool match_prefix(const char *key, u8 *index, u16 *len)
 	struct xattr_prefix *p;
 	struct extra_xattr_type_node *tnode;
 
+	printf("[match_prefix]: enter extra_xattr_types_count++ is %u\n", extra_xattr_types_count);
 	list_for_each_entry(tnode, &extra_xattr_types, list) {
 		p = &tnode->type;
+		printf("[iterating]: key %s, prefix %s\n", key, p->prefix);
 		if (p->prefix && !strncmp(p->prefix, key, p->prefix_len)) {
 			*len = p->prefix_len;
 			*index = tnode->index;
+			printf("match_prefix: key %s, matches prefix %s, index %u\n", key, p->prefix, tnode->index);
 			return true;
 		}
 	}
diff --git a/mkfs/main.c b/mkfs/main.c
index d06f6f5..ce220c7 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -911,13 +911,17 @@ int main(int argc, char **argv)
 			erofs_update_progressinfo("Handling packed_file ...");
 			packed_inode = erofs_mkfs_build_packedfile();
 			if (IS_ERR(packed_inode)) {
+				printf("[%s %d] erofs_mkfs_build_packedfile failed\n", __func__, __LINE__);
 				err = PTR_ERR(packed_inode);
 				goto exit;
 			}
+			printf("[%s %d] start erofs_lookupnid...\n", __func__, __LINE__);
 			packed_nid = erofs_lookupnid(packed_inode);
+			printf("[%s %d] packed_nid %lu\n", __func__, __LINE__, packed_nid);
 			erofs_iput(packed_inode);
 		}
 	}
+	printf("[%s %d] packed_nid %lu\n", __func__, __LINE__, packed_nid);
 
 	err = erofs_mkfs_update_super_block(sb_bh, root_nid, &nblocks,
 					    packed_nid);
-- 
2.19.1.6.gb485710b



More information about the Linux-erofs mailing list