[Ocfs2-tools-devel] Patch for debugfs.ocfs2 ``icheck'' command

tao.ma tao.ma at oracle.com
Thu Nov 2 01:12:31 PST 2006


GONG Jie wrote:

>+static int is_block_in_known_hole(uint64_t blkno)
>+{
>+	if (blkno < 4)
>+		return 1;
>  
>
why "<4"? I am a little curious about this.
Do you mean the blocks before the superblock? If yes, it can be 
calculated by block size and cluster size and I think it should be put 
before the  "for" loop so that we don't need to read all the inode and 
compare it in every loop time. :)

>+
>+static int walk_chain_func(ocfs2_filesys *fs, uint64_t gd_blkno,
>+			int chain_num, void *priv_data)
>+{
>+	struct walk_it *wi = priv_data;
>+	struct ocfs2_group_desc *gd;
>+	errcode_t ret;
>+
>+	if (wi->is_found)
>+		return 0;
>+
>+	ret = ocfs2_read_group_desc(fs, gd_blkno, wi->gd_buf);
>+	if (ret)
>+		return OCFS2_CHAIN_ERROR;
>+
>+	gd = (struct ocfs2_group_desc *)wi->gd_buf;
>+	if (wi->blkno == gd->bg_blkno)
>+		wi->is_found = 1;
>  
>
Although a group descriptor only fill one block, the system will 
allocate a cluster to it, so I think from gd->bg_blkno to gd->bg->blkno 
+ cluster_size should all be considered as occupied by the chain.
Not sure. Just a tip. :)

>+
>+	return 0;	
>+}
>+
>  
>
>_______________________________________________
>Ocfs2-tools-devel mailing list
>Ocfs2-tools-devel at oss.oracle.com
>http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
>  
>
 



More information about the Ocfs2-tools-devel mailing list