[Ocfs2-tools-devel] debugfs.ocfs2 bmap command

Sunil Mushran Sunil.Mushran at oracle.com
Mon Aug 28 14:52:04 PDT 2006


Other than the ticky-tacky issues listed below, it looks good. I tested this
on a largish depth=0 file. Please can someone test this on a depth=1 file.

1. Fix the compiler warning.
commands.c: In function `do_bmap':
commands.c:1319: warning: suggest parentheses around && within ||

2. Change the help from "Calculate the logical->physical block mapping 
for an inode" to
" Print the corresponding physical block# for the inode".

3. dump_logical_blkno() should be in dump.c (debugfs style)

4. Output should have a tab... like all other commands. (debugfs style)

5. Code should not exceed 80 chars per line. (coding style)

GONG Jie wrote:
> Hi,
>
> On Monday 28 August 2006 15:45, tao.ma wrote:
>   
>> Hi,
>>     I have seen the code. And write some comments.
>>     Please Mark, Joel & Sunil rectify it if there is something wrong. :)
>>     
>
>   
>>> +/*
>>> + * dump_logical_blkno()
>>> + *
>>> + */
>>> +static errcode_t dump_logical_blkno(ocfs2_filesys *fs, struct
>>> ocfs2_extent_list *el, +	uint64_t loglblkno, FILE *out)
>>>       
>> As far as I know, for a file's extent record, it is stored in numbers of
>> cluster, not of block.  So rec->e_clusters is the size of clusters and
>> you can't just use loglblkno -= rec->e_clusters. See
>> ocfs2_clusters_to_blocks or ocfs2_blocks_to_clusters for how to transfer
>> between them.
>> So you may first find the start blkno of the cluster which your logical
>> blkno belongs to and then add the offset of this blkno in that cluster
>> for the real blkno.
>>
>>     
>
> I've fixed the cluster number to block number transfer error.
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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