How to free data block of ext2 fs?

Manish Katiyar mkatiyar at gmail.com
Wed Feb 16 13:24:45 EST 2011


On Wed, Feb 16, 2011 at 10:02 AM, kashish bhatia <koolest77 at gmail.com> wrote:
> Hi all ,
> I wanted to free a data block from disk. So I made a loop device for ext2 fs
> and inserted my module(code) through insmod command.
> Here are the details :
>  I found a function named ext2_free_data() which takes block numbers to be
> freed as a parameter. The declaration of the function is as follows :
>
> void ext2_free_data(struct inode *inode, __le32 *p, __le32 *q);
>
> As we can see this function use structure of inode object and it make
> changes in this inode object.
>
> This function changes the fields in in-core inode and mark the inode dirty.
> But I want the changes made in in-core inode to be reflected in disk inode
> immediately .

Incore it will be reflected immediately.

>
> Is there any command to flush the buffers ?

You can either try "sync" from command line, or remount the volume. Or
call ext2_sync_fs() from your module.

>
> --
> Regards,
> Kashish
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>



-- 
Thanks -
Manish



More information about the Kernelnewbies mailing list