[Ocfs2-tools-devel] [patch 02/11] Modify e_clusters used in the ocfs2-tools.

Mark Fasheh mark.fasheh at oracle.com
Wed Aug 15 13:44:30 PDT 2007


On Thu, Aug 16, 2007 at 01:54:47AM +0800, tao.ma wrote:
> @@ -286,6 +289,13 @@ static errcode_t check_el(o2fsck_state *
>  
>  	for (i = 0; i < max_recs; i++) {
>  		er = &el->l_recs[i];
> +		clusters = ocfs2_rec_clusters(el->l_tree_depth, er);
> +
> +		/* For a sparse file, we may find an empty record
> +		 * in the left most record. Just skip it.
> +		 */
> +		if (el->l_tree_depth && !i && !clusters)
> +			continue;

Fsck probably wants to be extra conservative and only skip it if the sparse
files flag is set.


> @@ -334,9 +344,11 @@ static int extent_iterate_eb(struct ocfs
>  	if (flags & (OCFS2_EXTENT_ABORT | OCFS2_EXTENT_ERROR))
>  		iret |= flags & (OCFS2_EXTENT_ABORT | OCFS2_EXTENT_ERROR);
>  
> -	/* if the list was changed and we still have recs then we need
> -	 * to write the changes to disk */
> -	if (changed & OCFS2_EXTENT_CHANGED && el->l_next_free_rec) {
> +	/* If the list was changed, we should write the changes to disk.
> +	 * Note:
> +	 * For a sparse file, we may have an empty extent block.
> +	 */
> +	if (changed & OCFS2_EXTENT_CHANGED) {
>  		ctxt->errcode = ocfs2_write_extent_block(ctxt->fs,
>  							 eb_rec->e_blkno,
>  						ctxt->eb_bufs[tree_depth]);

Hmm, not quite. I don't believe any version of ocfs2 should ever be writing out
extent blocks with l_next_free_rec == 0. What we'd really have is an extent
block with l_next_free_rec == 1 and an empty extent in index 0.
	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh at oracle.com



More information about the Ocfs2-tools-devel mailing list