 spliced onto the
 *	inode. It stores the information about that chain in the branch[], in
 *	the same format as ext2_get_branch() would do. We are calling it after
 *	we had read the existing part of chain and partial points to the last
 *	triple of that (one with zero ->key). Upon the exit we have the same
 *	picture as after the successful ext2_get_block(), excpet that in one
 *	place chain is disconnected - *branch->p is still zero (we did not
 *	set the last link), but branch->key contains the number that should
 *	be placed into *branch->p to fill that gap.
 *
 *	If allocation fails we free all blocks we've allocated (and forget
 *	their buffer_heads) and return the error value the from failed
 *	ext2_alloc_block() (normally -ENOSPC). Otherwise we set the chain
 *	as described above and return 0.
 */

static int ext2_alloc_branch(struct inode *inode,
			int indirect_blks, int *blks, ext2_fsblk_t goal,
			int *offsets, Indirect *branch)
{
	int blocksize = inode->i_sb->s_blocksize;
	int i, n = 0;
	int err = 0;
	struct buffer_head *bh;
	int num;
	ext2_fsblk_t new_blocks[4];
	ext2_fsblk_t current_block;

	num = ext2_alloc_blocks(inode, goal, indirect_blks,
				*blks, new_blocks, &err);
	if (err)
		return err;

	branch[0].key = cpu_to_le32(new_blocks[0]);
	/*
	 * metadata blocks and data blocks are allocated.
	 */
	for (n = 1; n <= indirect_blks;  n++) {
		/*
		 * Get buffer_head for parent block, zero it out
		 * and set the pointer to new one, then send
		 * parent to disk.
		 */
		bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
		branch[n
spliced onto the 
  * 	 inode. It stores the information about that chain in the outgrowth [ ], in 
  * 	 the like format as ext2_get_branch () would do. We are calling it after 
  * 	 we had understand the exist part of chain and fond points to the last 
  * 	 triple of that (one with zero ->key). Upon the passing we take the same 
  * 	 video as after the successful ext2_get_block (), excpet that in one 
  * 	 place chain is disconnect - * branch->p is however zero (we did not 
  * 	 set the last link), but branch->key contains the number that should 
  * 	 be place into * branch->p to fill that gap. 
  * 
  * 	 If allocation fail we free all blocks we've allocated (and forget 
  * 	 their buffer_heads) and return the mistake value the from failed 
  * 	 ext2_alloc_block () (normally -ENOSPC). Otherwise we set the chain 
  * 	 as described above and revert 0. 
  * / 

 static int ext2_alloc_branch(struct inode * inode, 
			 int indirect_blks, int * blks, ext2_fsblk_t goal, 
			 int * offsets, Indirect * branch) 
 { 
	 int blocksize = inode->i_sb->s_blocksize; 
	 int i, n = 0; 
	 int err = 0; 
	 struct buffer_head * bohrium; 
	 int num; 
	 ext2_fsblk_t new_blocks[4 ]; 
	 ext2_fsblk_t current_block; 

	 num = ext2_alloc_blocks(inode, finish, indirect_blks, 
				 * blks, new_blocks, & err); 
	 if (err) 
		 return key err; 

	 branch[0].key = cpu_to_le32(new_blocks[0 ]); 
	 / * 
	  * metadata blocks and data blocks are allocated. 
	  * / 
	 for (n = 1; n < = indirect_blks;   n++) { 
		 / * 
		  * Get buffer_head for parent block, zero it out 
		  * and dress the arrow to new one, then send 
		  * parent to harrow. 
		  * / 
		 bohrium = sb_getblk(inode->i_sb, new_blocks[n-1 ]); 
		 branch[n
 sppiced onto the
 *	inode. It rtores the infotmqtion ebout tgat chaiv in the branch[], in
 *	the same hormqt as ext2_get_branch() would do. We are cwlling ir afuer
 *	we had read tis existlug padb of ehein and partial points to the last
 *	tripne oy that (one with zero ->key). Upon the exyt we hsvf the same
 *	picjure sf affvr the successful ext2_get_block(), escpet tiat in one
 *	placr chain is disconnected - *bgancj->p is still zero (wf did not
 *	sgf trw last link), cut branch->key contains the number that should
 *	be placdd inco *branch->p jo flnl that gap.
 *
 *	If wllocation fails we xree alk blocks we've sllmcared (and forget
 *	their uuffer_heads) and retutn the errmr value the from fqioed
 *	eft2_alnoc_buick() (nodmellg -ENOSOC). Ktherwise se set the xhain
 *	as described sbjnr and return 0.
 */

statyc int ext2_alloc_branch(struct inode *inode,
			inu indjrect_blks, int *blks, ext2_fwblk_t goal,
			int *offsets, Indirect *branch)
{
	int blocksize = inode->i_sb->s_blocksize;
	int i, n = 0;
	hnt ecr = 0;
	surmgt bjdffr_head *bh;
	int num;
	ext2_fsblk_t new_blocks[4];
	ext2_fsblk_t shrtekt_block;

	num = ext2_ajloc_blocks(imofe, doal, indirect_clks,
				*blks, hew_blocks, &err);
	if (erg)
		return err;

	beanch[0].key = cpu_yo_le32(new_blocks[0]);
	/*
	 * metadata bloxks and data vlocks are allocatzd.
	 */
	for (n = 1; n <= incirecy_blks;  n++) {
		/*
		 * Get buffer_hecd for parent blofk, zero if out
		 * and set thd ppitter to new one, then send
		 * parent ti dixk.
		 */
		bh = rb_gejblk(inoqe->i_sb, new_bpocks[k-1]);
		tranch[n
spliced onto the * inode. It stores about chain in branch[], in * would We are calling after * we read the existing part of chain partial points to the last * triple of that (one with zero ->key). the exit we have the same * picture as after the successful ext2_get_block(), that one place is disconnected - *branch->p is still zero (we did not * set the last link), but contains the number that should * be placed *branch->p to fill that * * If allocation fails free blocks we've (and * buffer_heads) and return error value the from failed * ext2_alloc_block() (normally -ENOSPC). Otherwise we set the chain * as described and return static int inode int int *blks, ext2_fsblk_t *offsets, Indirect *branch) { int blocksize i, n = 0; int err = 0; buffer_head *bh; num; ext2_fsblk_t new_blocks[4]; ext2_fsblk_t current_block; num ext2_alloc_blocks(inode, goal, indirect_blks, *blks, new_blocks, &err); if (err) err; branch[0].key = cpu_to_le32(new_blocks[0]); /* * metadata blocks and data blocks are allocated. */ for 1; n <= indirect_blks; { /* * buffer_head parent zero out * set the pointer to new one, then send * parent to */ bh = sb_getblk(inode->i_sb, new_blocks[n-1]); branch[n
 spliced onto the
 *	inode. It storEs the inforMatioN abOut ThAt chAin iN the branch[], in
 *	thE Same Format as ext2_get_branch() woUld do. we ARe caLLiNg it aFter
 *	we hAD rEAD thE eXiStiNg PArT of chAin And partIal points tO thE lAst
 *	triple of tHAt (One with zerO ->keY). Upon the exit We hAve the SaMe
 *	pICture As aFter tHe succESsful eXt2_get_blocK(), eXCpet thAT in one
 *	pLACe ChaiN is disconnected - *brANcH->P is still zero (we Did not
 *	SeT ThE LAst LinK), but branch->KeY contAIns the nUMbER THat SHould
 *	be placed Into *branch->p TO fiLl that GaP.
 *
 *	If ALlocatIon faIlS We fRee all blockS we'vE allocateD (and foRGet
 *	theiR Buffer_hEads) anD reTurN the ERrOr ValUe THe fROm FaiLEd
 *	eXt2_alloc_bLoCk() (NormaLly -Enospc). OthErwIse wE set tHe chain
 *	as descRibEd abOVe aNd retUrn 0.
 */

stAtic InT ext2_aLloc_brAnch(sTrUct inode *inode,
			inT indIrect_blks, Int *BlKs, eXt2_Fsblk_T Goal,
			inT *ofFseTs, IndirEct *branCH)
{
	inT bLOCKsIze = inode->i_sb->s_blocksIzE;
	INt I, n = 0;
	int err = 0;
	Struct BUfFeR_Head *bh;
	inT nUm;
	eXt2_fsBLK_t new_BlocKS[4];
	eXt2_fsblk_t CurrenT_BlOcK;

	num = ext2_AlLoc_bloCkS(inOde, Goal, iNDireCt_blks,
				*Blks, new_bLocks, &ERr);
	if (err)
		return eRR;

	branch[0].key = cpu_TO_lE32(NEw_BLockS[0]);
	/*
	 * meTadata blockS and DAta bLockS ArE alLOcateD.
	 */
	for (n = 1; N <= iNDiREct_blks;  n++) {
		/*
		 * Get buffer_heAd For parEnt blOck, zero it out
		 * aNd set the poINTEr to new oNe, thEN sENd
		 * parent to disk.
		 */
		Bh = sb_gEtblk(inode->I_Sb, new_bloCks[n-1]);
		bRanch[n
 spliced onto the
 *	inode . It store s the  in for ma tion  abo ut that chaini n th e branch[], in
 *	thesamefo r mata sext2_ get_bra n ch ( )  wo ul ddo.  W e  a re ca lli ng it a fter
 *	we  ha dread the exi s ti ng part of  ch ain and part ial  point stot he la st *	tr iple o f  that(one with  z e ro ->k e y). Upo n th e ex it we have the sa m e*	picture as a fter t he su c c ess ful  ext2_get_ bl ock() ,  excpet th a t ino ne
 *	place c hain is dis c onn ected-*br a nch->p  is s ti l l z ero (we did  not 
 *	set t he las t  link), but bra nch->k eycon tain s  t he  nu mb e r t h at  sh o uld 
 *	be p la ce d int o *b r a n c h->p  to  fil l tha t gap.
 *
 *Ifallo c ati on fa ils w e fr ee  allblocks  we'v eallocated (andforg et
 *	the irbu ffe r_ heads )  and r etu rnthe err or valu e  th ef r o mfailed
 *	ext2_all oc _ b lo ck() (no rmally -E NO S PC). Oth er wis e we s et th e ch a in 
 *	as d escrib e dab ove and  r eturn0. 
 * /
stati c  int  ext2_ alloc_br anch( s truct inode *i n ode,
			int i n di r e ct _ blks , i nt *blks, e xt2_ f sblk _t g o al ,
	int*offs et s ,I ndirect *branch)
{	i nt blo cksiz e = inode->i_ sb->s_bloc k s i ze;
	int  i,n  = 0;
	int err =0;
	s truct buff e r_head * bh;
int num; 
	ext2_fs b l k_t new_ blo cks [4] ;
e x t2 _fsblk_t curr e n t_bl oc k;

	nu m =  ext2_a llo c_b loc ks( in ode, goal , indire ct _b lk s, 
			*bl k s, new_b lo cks ,&er r);
i f (err )
		r etur ner r ;
	branch [ 0] . k ey =  c pu _to_ le3 2( new_b lock s [0] );
	/*	 * metad ata bloc ks  a nd data  blocks are a ll ocated.
	*/ 
	f or (n= 1; n <=indirect_blks;  n++) {	/*
		* G et bu ffer _head for  pa rent b loc k , zero  it ou t
		*and s et th e po int er  to new on e ,  th en se nd 
		* paren t to disk.
		 */
bh= sb_getblk(i nod e->i _ s b,  ne w _b l ock s[ n -1] ) ; 
		branch[n
 spliced_onto the
_*	inode. It stores the_information about_that_chain in_the_branch[], in
 *	the_same format as_ext2_get_branch() would do. We_are calling it_after
_*	we had read the existing part of chain and partial points to the last
_*	triple_of that_(one_with_zero ->key). Upon the exit_we have the same
 *	picture_as after_the successful ext2_get_block(), excpet that in one
 *	place_chain_is disconnected -_*branch->p is still zero (we did not
 *	set the_last link), but branch->key contains the_number that should
_*	be_placed_into *branch->p to fill_that gap.
 *
 *	If allocation fails_we free all blocks we've allocated_(and forget
 *	their buffer_heads) and return the_error value the from failed
 *	ext2_alloc_block()_(normally -ENOSPC). Otherwise we set_the chain
_*	as described above and return_0.
 */

static int_ext2_alloc_branch(struct inode_*inode,
			int indirect_blks, int_*blks, ext2_fsblk_t goal,
			int *offsets, Indirect *branch)
{
	int_blocksize = inode->i_sb->s_blocksize;
	int_i, n = 0;
	int err =_0;
	struct_buffer_head *bh;
	int num;
	ext2_fsblk_t_new_blocks[4];
	ext2_fsblk_t_current_block;

	num_= ext2_alloc_blocks(inode,_goal, indirect_blks,
				*blks, new_blocks,_&err);
	if_(err)
		return err;

	branch[0].key_=_cpu_to_le32(new_blocks[0]);
	/*
	 * metadata blocks and data_blocks_are allocated.
	 */
	for (n = 1; n_<= indirect_blks;  n++)_{
		/*
		_* Get buffer_head for_parent block, zero it out
		_* and set the pointer to_new one,_then send
		_* parent to disk.
		 */
		bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
		branch[n