/* It is being called in three cases: ext2_release_file(): last writer closes the file ext2_clear_inode(): last iput(), when nobody links to this file. ext2_truncate(): when the block indirect map is about to change.  */
void ext2_discard_reservation(struct inode *inode)
/* It is being called in three cases: ext2_release_file(): last writer closes the file ext2_clear_inode(): last iput(), when nobody links to this file. ext2_truncate(): when the block indirect map is about to change.  */
void ext2_discard_reservation(struct inode *inode)
{
	struct ext2_inode_info *ei = EXT2_I(inode);
	struct ext2_block_alloc_info *block_i = ei->i_block_alloc_info;
	struct ext2_reserve_window_node *rsv;
	spinlock_t *rsv_lock = &EXT2_SB(inode->i_sb)->s_rsv_window_lock;
	if (!block_i)
		return;
	rsv = &block_i->rsv_window_node;
	if (!rsv_is_empty(&rsv->rsv_window)) {
		spin_lock(rsv_lock);
		if (!rsv_is_empty(&rsv->rsv_window))
			rsv_window_remove(inode->i_sb, rsv);
		spin_unlock(rsv_lock);
	}
}