/* Called at the last iput() if i_nlink is zero.  */
void ext3_delete_inode(struct inode *inode)
/* Called at the last iput() if i_nlink is zero.  */
void ext3_delete_inode(struct inode *inode)
{
	handle_t *handle;
	truncate_inode_pages(&inode->i_data, 0);
	if (is_bad_inode(inode))
		goto no_delete;
	handle = start_transaction(inode);
	if (IS_ERR(handle)) {
		ext3_orphan_del(NULL, inode);
		goto no_delete;
	}
	if (IS_SYNC(inode))
		handle->h_sync = 1;
	inode->i_size = 0;
	if (inode->i_blocks)
		ext3_truncate(inode);
	ext3_orphan_del(handle, inode);
	EXT3_I(inode)->i_dtime	= get_seconds();
	if (ext3_mark_inode_dirty(handle, inode))
		clear_inode(inode);
	else
		ext3_free_inode(handle, inode);
	ext3_journal_stop(handle);
	return;
no_delete:
	clear_inode(inode);
}