[Ocfs2-tools-devel] [PATCH 03/44] libocfs2: Add ocfs2_read_refcount_block().

Tao Ma tao.ma at oracle.com
Thu Dec 31 06:27:30 PST 2009



Tao Ma wrote:
> 
> Joel Becker wrote:
>> On Mon, Dec 28, 2009 at 05:00:48PM +0800, Tao Ma wrote:
>>   
>>> +errcode_t ocfs2_read_refcount_block(ocfs2_filesys *fs, uint64_t blkno,
>>> +				    char *rb_buf)
>>> +{
>>> +	errcode_t ret;
>>> +	struct ocfs2_refcount_block *rb =
>>> +		(struct ocfs2_refcount_block *)rb_buf;
>>> +
>>> +	ret = ocfs2_read_refcount_block_nocheck(fs, blkno, rb_buf);
>>> +
>>> +	if (ret == 0 && rb->rf_list.l_next_free_rec > rb->rf_list.l_count)
>>> +		ret = OCFS2_ET_CORRUPT_EXTENT_BLOCK;
oh, actually here is a bug. rf_list is only valid in case it is a tree, 
not a leaf refcount block.
We can't test this until we trust the flag.
So my opinion here is that we remove this check and rename 
ocfs2_read_refcount_block_no_check to ocfs2_read_refcount_block.

Regards,
Tao
>>> +
>>> +	return ret;
>>> +}
>>>     
>> 	Do you know why we have a nocheck version?  Because I can't
>> remember why.  Is it useful?
>>   
> the only place we call it is fsck.ocfs2. And I guess we just copied the 
> functions we wrote for extent block and modified it to work for refcount 
> block. ;)
> 
> Regards,
> Tao
>> Joel
>>



More information about the Ocfs2-tools-devel mailing list