Hi all,
does ext2_delete_inode guarantees the freeing all the data blocks held by the inode ?
df command after delete doesn't show the freed space?
Am I missing something there?
I wish to delete an inode and free all its data blocks, any other way to it ?
Thanks,
Sandeep.
ext2_delete_inode ?
I don't think that may be the end.....
reading the comment of fs/inode.c:generic_delete_inode() the inodes are still left on the hash even after generic_delete_inode() is called.
void generic_delete_inode(struct inode *inode)
{
const struct super_operations *op = inode->i_sb->s_op;
list_del_init(&inode->i_list);
list_del_init(&inode->i_sb_list);
inode->i_state |= I_FREEING;
inodes_stat.nr_inodes--;
spin_unlock(&inode_lock);
security_inode_delete(inode);
if (op->delete_inode) {
void (*delete)(struct inode *) = op->delete_inode;=========================>here your ext2_delete_inode() is called.
if (!is_bad_inode(inode))
DQUOT_INIT(inode);
/* Filesystems implementing their own
* s_op->delete_inode are required to call
* truncate_inode_pages and clear_inode()
* internally */
delete(inode);
} else {
truncate_inode_pages(&inode->i_data, 0);
clear_inode(inode);
}
spin_lock(&inode_lock);
hlist_del_init(&inode->i_hash);
spin_unlock(&inode_lock);
wake_up_inode(inode);
BUG_ON(inode->i_state != I_CLEAR);
destroy_inode(inode);==============>after ext2_delete_inode(), other API like clear_inode(), destroy_inode() etc are still needed to complete the deletion story.
}