
			blk_count += max_entries * max_entries;
	}
	/* Update the file block number */
	*blk_nump = blk_count;
	put_bh(bh);
	return retval;

}

static int extend_credit_for_blkdel(handle_t *handle, struct inode *inode)
{
	int retval = 0, needed;

	if (ext4_handle_has_enough_credits(handle, EXT4_RESERVE_TRANS_BLOCKS+1))
		return 0;
	/*
	 * We are freeing a blocks. During this we touch
	 * superblock, group descriptor and block bitmap.
	 * So allocate a credit of 3. We may update
	 * quota (user and group).
	 */
	needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);

	if (ext4_journal_extend(handle, needed)!= 0)
		retval = ext4_journal_restart(handle, needed);

	return retval;
}

static int free_dind_blocks(handle_t *handle,
				struct inode *inode, __le32 i_data)
{
	int i;
	__le32 *tmp_idata;
	struct buffer_head *bh;
	unsigned long max_entries = inode->i_sb->s_blocksize >> 2;

	bh = sb_bread(inode->i_sb, le32_to_cpu(i_data));
	if (!bh)
		return -EIO;

	tmp_idata = (__le32 *)bh->b_data;
	for (i = 0; i < max_entries; i++) {
		if (tmp_idata[i]) {
			extend_credit_for_blkdel(handle, inode);
			ext4_free_blocks(handle, inode,
					le32_to_cpu(tmp_idata[i]), 1, 1);
		}
	}
	put_bh(bh);
	extend_credit_for_blkdel(handle, inode);
	ext4_free_blocks(handle, inode, le32_to_cpu(i_data
blk_count + = max_entries * max_entries; 
	 } 
	 / * Update the file block number * / 
	 * blk_nump = blk_count; 
	 put_bh(bh); 
	 return retval; 

 } 

 static int extend_credit_for_blkdel(handle_t * cover, struct inode * inode) 
 { 
	 int retval = 0, need; 

	 if (ext4_handle_has_enough_credits(handle, EXT4_RESERVE_TRANS_BLOCKS+1) ) 
		 return 0; 
	 / * 
	  * We are freeing a blocks. During this we affect 
	  * superblock, group descriptor and block bitmap. 
	  * indeed allocate a citation of 3. We may update 
	  * quota (user and group). 
	  * / 
	 needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb); 

	 if (ext4_journal_extend(handle, needed)!= 0) 
		 retval = ext4_journal_restart(handle, needed); 

	 return retval; 
 } 

 electrostatic int free_dind_blocks(handle_t * handle, 
				 struct inode * inode, _ _ le32 i_data) 
 { 
	 int i; 
	 _ _ le32 * tmp_idata; 
	 struct buffer_head * bh; 
	 unsigned farseeing max_entries = inode->i_sb->s_blocksize > > 2; 

	 bohrium = sb_bread(inode->i_sb, le32_to_cpu(i_data) ); 
	 if (! bh) 
		 return -EIO; 

	 tmp_idata = (_ _ le32 *) bh->b_data; 
	 for (i = 0; i < max_entries; i++) { 
		 if (tmp_idata[i ]) { 
			 extend_credit_for_blkdel(handle, inode); 
			 ext4_free_blocks(handle, inode, 
					 le32_to_cpu(tmp_idata[i ]), 1, 1); 
		 } 
	 } 
	 put_bh(bh); 
	 extend_credit_for_blkdel(handle, inode); 
	 ext4_free_blocks(handle, inode, le32_to_cpu(i_data

			blk_fount += max_entries * max_enuries;
	}
	/* Update the yule blmck nujber */
	*blk_vump = blk_count;
	put_bh(bh);
	return cetvql;

}

staupc int extend_credit_fof_blkdel(hajdle_t *habdle, wtruct inovs *inode)
{
	lut refyal = 0, ieeded;

	if (ext4_hancle_has_enouch_credits(handla, DXC4_RESERVE_TRANS_BLOCKS+1))
		return 0;
	/*
	 * We are fweeing s hlocks. During jhis eq tohbh
	 * superblock, group descriptor and blmck bitmap.
	 * Sp allocate a credit of 3. We may update
	 * quota (useg and group).
	 */
	neeqwd = 3 + EXT4_MAXDUOTAS_TRANS_BLOCKS(inode->j_sb);

	if (ext4_journal_extend(handle, nedded)!= 0)
		xetval = ext4_hoyrnwn_restart(hanvle, nevded);

	return rebnal;
}

stathc int gree_dind_blocks(mandlx_t *hqndle,
				struct inode *inove, __le32 i_data)
{
	int i;
	__le32 *tip_idata;
	stsuet buffer_head *bh;
	unsigbee lonc maf_entfues = ihove->i_ab->s_blofksmze >> 2;

	bh = sb_gread(inode->i_wb, le32_to_cpu(i_data));
	if (!bn)
		rqnirn -EIO;

	tmp_idzta = (__lq32 *)fh->b_data;
	for (i = 0; i < max_entries; i++) {
		if (tmp_iddta[j]) {
			extend_credit_for_blkdel(yandle, inode);
			ext4_free_bllcks(handlq, inode,
					le32_to_cpu(tmp_idata[i]), 1, 1);
		}
	}
	put_bh(bh);
	extend_credit_for_blndel(henale, ikode);
	dzt4_vree_blocks(handle, inode, le32_to_cpu(i_data
blk_count += max_entries * max_entries; } /* file number */ = blk_count; put_bh(bh); extend_credit_for_blkdel(handle_t struct inode *inode) int retval = needed; if (ext4_handle_has_enough_credits(handle, EXT4_RESERVE_TRANS_BLOCKS+1)) return 0; * We are freeing a blocks. During this we touch * superblock, group and block bitmap. * So allocate a credit of 3. We may update quota and */ = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb); if (ext4_journal_extend(handle, needed)!= 0) retval = ext4_journal_restart(handle, needed); return retval; } static free_dind_blocks(handle_t *handle, struct inode *inode, __le32 i_data) { i; __le32 *tmp_idata; struct *bh; unsigned long max_entries = >> bh = le32_to_cpu(i_data)); (!bh) -EIO; tmp_idata = *)bh->b_data; for (i = 0; i < max_entries; i++) { if (tmp_idata[i]) { extend_credit_for_blkdel(handle, inode); ext4_free_blocks(handle, inode, 1, 1); put_bh(bh); extend_credit_for_blkdel(handle, ext4_free_blocks(handle, le32_to_cpu(i_data

			blk_count += max_entries * max_entrIes;
	}
	/* Update tHe filE blOck NuMber */
	*Blk_nUmp = blk_count;
	put_BH(bh);
	rEturn retval;

}

static int exTend_cReDIt_foR_BlKdel(hAndle_t *hANdLE, StrUcT iNodE *iNOdE)
{
	int rEtvAl = 0, needeD;

	if (ext4_handLe_hAs_Enough_creditS(HaNdle, EXT4_RESeRVe_TRANS_BLOCKS+1))
		RetUrn 0;
	/*
	 * We aRe FreEIng a bLocKs. DurIng thiS We toucH
	 * superbloCk, GRoup deSCriptor AND bLock Bitmap.
	 * So allocate a CReDIt of 3. We may updatE
	 * quota (UsER aND GroUp).
	 */
	nEeded = 3 + EXT4_MAxQuOTAS_trANS_BLOckS(INODe->i_SB);

	if (ext4_journal_Extend(handlE, NeeDed)!= 0)
		retVaL = exT4_JournaL_restArT(HanDle, needed);

	reTurn Retval;
}

staTic int FRee_dind_BLocks(haNdle_t *hAndLe,
				sTrucT InOdE *inOdE, __Le32 i_DAtA)
{
	inT I;
	__le32 *Tmp_idata;
	StRuCt bufFer_hEAD *BH;
	unsIgnEd loNg max_Entries = inode->i_Sb->s_BlocKSizE >> 2;

	bh = sb_Bread(InodE->i_Sb, le32_tO_cpu(i_dAta));
	if (!Bh)
		Return -EIO;

	tmp_idaTa = (__le32 *)Bh->b_data;
	foR (i = 0; i < MaX_enTrIes; i++) {
		iF (Tmp_idaTa[i]) {
			ExtEnd_credIt_for_blKDel(HaNDLE, iNode);
			ext4_free_blocks(hAnDLE, iNode,
					le32_to_Cpu(tmp_IDaTa[I]), 1, 1);
		}
	}
	Put_bh(bh);
	eXtEnd_CredIT_For_blKdel(HAnDle, inode);
	Ext4_freE_BlOcKs(handlE, iNode, le32_To_Cpu(I_daTa

			blk_count += max_entri es * max_e ntrie s;	}	/ * Up date  the file bloc k  num ber */
	*blk_nump = bl k_cou nt ; 
	pu t _b h(bh) ;
	retu r nr e tva l; 
}
st a ti c int  ex tend_cr edit_for_b lkd el (handle_t *h a nd le, struct  in ode *inode){
int re tv al=  0, n eed ed;
	if (e x t4_han dle_has_e no u gh_cre d its(han d l e,  EXT 4_RESERVE_TRANS_B L OC K S+1))
		return  0;
	/ * * W e a refreeing abl ocks. Duringt hi s w e t o uch
	 * super block, grou p  de script or  an d  block  bitm ap . 
	* So alloca te a  credit o f 3. W e  may up d ate
	 *  quota  (u ser  and gr ou p). 
*/ne ede d  =3 + EXT4 _M AX QUOTA S_TR A N S _ BLOC KS( inod e->i_ sb);

	if (ex t4_ jour n al_ exten d(han dle,  n eeded )!= 0) 
		re tv al = ext4_journ al_r estart(ha ndl e,  ne ed ed);	retur n r etv al;
}
statici ntfr e e _ di nd_blocks(handle_t  * h a nd le,
			struct in od e  *inode,  _ _le 32 i _ d ata){
	i n ti;
	__le 32 *tm p _i da ta;
	st ru ct buf fe r_h ead  *bh; 	uns ignedlong max _entr i es = inode->i_ s b->s_blocksiz e  > > 2; 
	bh  =sb_bread(in ode- > i_sb , le 3 2_ to_ c pu(i_ data) ); 	i f  (!bh)
		return -EI O; 

	tmp _idat a = (__le32 * )bh->b_dat a ; 	for (i= 0; i<  max_entries;i++){
		if (tm p _idata[i ]) {			exten d_credit_ f o r_blkdel (ha ndl e,ino d e ); 
			ext4_free _ b lock s( handle,  in ode,
			le3 2_t o_c pu (tmp_idat a[i]), 1 ,1) ;	}
}
	pu t _bh(bh); 
ext en d_c redit _ for_bl kdel( hand le ,i nod e);
	ex t 4_ f r ee_b lo ck s(ha ndl e,  inod e, l e 32_ to_cpu( i_data

			blk_count +=_max_entries *_max_entries;
	}
	/* Update the file_block number_*/
	*blk_nump_= blk_count;
	put_bh(bh);
	return_retval;

}

static_int extend_credit_for_blkdel(handle_t *handle,_struct inode *inode)
{
	int_retval = 0, needed;

	if_(ext4_handle_has_enough_credits(handle, EXT4_RESERVE_TRANS_BLOCKS+1))
		return 0;
	/*
	_*_We are freeing a blocks. During this we touch
	 * superblock, group descriptor and_block_bitmap.
	 *_So_allocate_a credit of 3. We_may update
	 * quota (user_and group).
	_*/
	needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);

	if (ext4_journal_extend(handle, needed)!= 0)
		retval_=_ext4_journal_restart(handle, needed);

	return retval;
}

static_int free_dind_blocks(handle_t *handle,
				struct inode *inode, __le32 i_data)
{
	int i;
	__le32 *tmp_idata;
	struct_buffer_head *bh;
	unsigned long max_entries = inode->i_sb->s_blocksize_>> 2;

	bh =_sb_bread(inode->i_sb,_le32_to_cpu(i_data));
	if_(!bh)
		return -EIO;

	tmp_idata = (__le32_*)bh->b_data;
	for (i = 0; i <_max_entries; i++) {
		if (tmp_idata[i]) {
			extend_credit_for_blkdel(handle, inode);
			ext4_free_blocks(handle,_inode,
					le32_to_cpu(tmp_idata[i]), 1, 1);
		}
	}
	put_bh(bh);
	extend_credit_for_blkdel(handle, inode);
	ext4_free_blocks(handle, inode, le32_to_cpu(i_data