/* ext4_ext_calc_credits_for_single_extent: This routine returns max. credits that needed to insert an extent to the extent tree. When pass the actual path, the caller should calculate credits under i_data_sem.  */
int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int nrblocks, struct ext4_ext_path *path)
/* ext4_ext_calc_credits_for_single_extent: This routine returns max. credits that needed to insert an extent to the extent tree. When pass the actual path, the caller should calculate credits under i_data_sem.  */
int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int nrblocks, struct ext4_ext_path *path)
{
	if (path) {
		int depth = ext_depth(inode);
		int ret = 0;
		if (le16_to_cpu(path[depth].p_hdr->eh_entries)
				< le16_to_cpu(path[depth].p_hdr->eh_max)) {
			ret = 2 + EXT4_META_TRANS_BLOCKS(inode->i_sb);
			return ret;
		}
	}
	return ext4_chunk_trans_blocks(inode, nrblocks);
}