[Ocfs2-tools-devel] [RFC] fsck.ocfs2 refcount.v3

Joel Becker Joel.Becker at oracle.com
Wed Dec 2 18:40:34 PST 2009


On Mon, Nov 23, 2009 at 04:12:34PM +0800, Tao Ma wrote:
> 3. in o2fsck_check_blocks and o2fsck_check_xattr, if the ocfs2_extent_rec
>    is refcounted, add it to the refcount_extent rb-tree(discribed below),
>    and the file which share the same refcount tree will be in a list.
>    Please note that we don't call o2fsck_mark_cluster_allocated against
>    refcounted clusters. It will be handled in step 4.

	Just make sure that step 4 is completed before we write out the
bitmaps.

> 		o2fsck_mark_cluster_allocated(p_cpos, clusters, &has_setted);
> 		if (has_setted) {
> 			/*
> 			 * There is other system file which has already set
> 			 * the used clusters bitmap. So we have to add them
> 			 * to duplicate clusters and let ocfs2_pass1_dup
> 			 * handle them.
> 			 */
> 			add_to_dup_clusters(p_cpos, clusters);
> 			ocfs2_refcount_punch_hole(p_cpos, p_cpos + clusters);
> 			ref_rec = NULL;
> 			r_offset = 0;
> 			if (old_p_cpos < p_cpos + clusters)
> 				old_p_pos = p_cpos + clusters;
> 			goto next;
> 		}

	First, o2fsck_mark_cluster_allocated() takes one cluster at a
time.  You'll have to loop on it.  It doesn't return has_setted, but you
can easily check the dup map after you've called it.  You don't need to
add to dup clusters, because o2fsck_mark_cluster_allocated() will do
that for you.
	I see that you have changed the (old_cpos > p_cpos) to
has_setted.  I assume you think anything less than old_cpos will have
been set.  But couldn't certain corrupt overlaps have holes we wouldn't
set?  I'm not sure if this is possible.
	The rest looks good.

Joel

-- 

"The question of whether computers can think is just like the question
 of whether submarines can swim."
	- Edsger W. Dijkstra

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list