Hello,<br> Can we change both the fields(struct ext4_extent_header and struct ext4_extent) from i_blocks[..] of any file manually? <br>from i_block I got header & first extent of file as follows.<br><br> struct ext4_extent_header *eeh = (struct ext4_extent_header *)EXT4_I(d_inode1)->i_data;<br>
struct ext4_extent *eex = EXT_FIRST_EXTENT(eeh);<br> <br>from extent I got physical block numbers of file as follows.<br><br> printk(KERN_INFO "high 16 bits of physical block=%d",eex->ee_start_hi);<br>
printk(KERN_INFO "low 32 bits of physical block=%d", eex->ee_start_lo); <br><br>Now,I have to change this whole structure of i_blocks[..] so that new structure of i_blocks[..] contains new header as well as new physical blocks. I have tried in following way:<br>
<br>**for ext4_extent_header:<br> eeh->eh_entries=myeeh->eh_entries;<br> eeh->eh_magic=myeeh->eh_magic;<br> eeh->eh_max=myeeh->eh_max;<br> eeh->eh_depth=myeeh->eh_depth;<br>
eeh->eh_generation=myeeh->eh_generation<br> where myeeh is the old ext4_extent_header from which I have to copy fields in to new header i.e in eeh which contains the current header of file.<br><br>**for ext4_extent :<br>
eex->ee_block=myeex->ee_block;<br> eex->ee_len=myeex->ee_len;<br> eex->ee_start_hi=eex->ee_start_hi;<br> eex->ee_start_lo=myeex->ee_start_lo;<br> <br clear="all"> where myeex is the old ext4_extent from which I have to copy fields in to new extent i.e in eex which contain the current extent of file.<br>
<br>I have done above code by writing my own module but it is not directly making change in files ext4_inode i.e file content does not change even though I have changed physical block numbers. If above method is wrong then what is the correct way?<br>
-- <br>Regards,<br>Ganesh Patil.<br><br>