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

tao.ma tao.ma at oracle.com
Wed Aug 15 14:46:59 PDT 2007


Mark Fasheh wrote:
> 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.
>   
yes, the incompat flag need to be checked here. Thanks.
>
>   
>> @@ -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.
>   
Hi, this is used for another special case ocfs2_truncate.
In ocfs2_truncate, when we find the first extent rec of a extent block 
need to be freed, we clean the extent rec and in this case the first 
extent rec is empty. See r1323 for more details.




More information about the Ocfs2-tools-devel mailing list