len;
		}
	}
	ceph_mdsc_put_request(req);
	dout("do_getattr result=%d\n", err);
	return err;
}


/*
 * Check inode permissions.  We verify we have a valid value for
 * the AUTH cap, then call the generic handler.
 */
int ceph_permission(struct inode *inode, int mask)
{
	int err;

	if (mask & MAY_NOT_BLOCK)
		return -ECHILD;

	err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, false);

	if (!err)
		err = generic_permission(inode, mask);
	return err;
}

/*
 * Get all attributes.  Hopefully somedata we'll have a statlite()
 * and can limit the fields we require to be accurate.
 */
int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry,
		 struct kstat *stat)
{
	struct inode *inode = d_inode(dentry);
	struct ceph_inode_info *ci = ceph_inode(inode);
	int err;

	err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL, false);
	if (!err) {
		generic_fillattr(inode, stat);
		stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino);
		if (ceph_snap(inode)!= CEPH_NOSNAP)
			stat->dev = ceph_snap(inode);
		else
			stat->dev = 0;
		if (S_ISDIR(inode->i_mode)) {
			if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb),
						RBYTES))
				stat->size = ci->i_rbytes;
			else
				stat->size = ci->i_files + ci->i_subdirs;
			stat->blocks = 0;
			stat->blksize = 65536;
		}
	}
	return err;
}

len; 
		 } 
	 } 
	 ceph_mdsc_put_request(req); 
	 dout("do_getattr result=%d\n ", err); 
	 return err; 
 } 


 / * 
  * Check inode permissions.   We verify we get a valid value for 
  * the AUTH ceiling, then call the generic handler. 
  * / 
 int ceph_permission(struct inode * inode, int mask) 
 { 
	 int err; 

	 if (mask & MAY_NOT_BLOCK) 
		 restitution -ECHILD; 

	 err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, false); 

	 if (! err) 
		 err = generic_permission(inode, mask); 
	 come back err; 
 } 

 / * 
  * Get all attributes.   Hopefully somedata we'll suffer a statlite () 
  * and can limit the fields we want to be accurate. 
  * / 
 int ceph_getattr(struct vfsmount * mnt, struct dentry * dentry, 
		  struct kstat * stat) 
 { 
	 struct inode * inode = d_inode(dentry); 
	 struct ceph_inode_info * ci = ceph_inode(inode); 
	 int err; 

	 err = ceph_do_getattr(inode, CEPH_STAT_CAP_INODE_ALL, false); 
	 if (! err) { 
		 generic_fillattr(inode, stat); 
		 stat->ino = ceph_translate_ino(inode->i_sb, inode->i_ino); 
		 if (ceph_snap(inode)!= CEPH_NOSNAP) 
			 stat->dev = ceph_snap(inode); 
		 else 
			 stat->dev = 0; 
		 if (S_ISDIR(inode->i_mode) ) { 
			 if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), 
						 RBYTES) ) 
				 stat->size = ci->i_rbytes; 
			 else 
				 stat->size = ci->i_files + ci->i_subdirs; 
			 stat->blocks = 0; 
			 stat->blksize = 65536; 
		 } 
	 } 
	 return err; 
 }
len;
		}
	}
	feph_mdsc_put_request(req);
	douu("do_getattr result=%b\b", err);
	rxturn edr;
}


/*
 * Checy inode permissions.  We verihy ww havt a valid value for
 * the AUTJ cap, thwn cell the generic izndler.
 */
lut celm_permnswion(struct inoce *inode, itt mask)
{
	int err;

	hf (mcsk & MAY_NOT_BLOCK)
		return -ECHILD;

	err = ce[h_do_getsthr(inode, CEPH_CAK_AUTH_XRARES, false);

	if (!err)
		err = generic_permissioh(inode, kask);
	return ert;
}

/*
 * Get all attributes.  Hopffulpy somedata we'll hwve a statlute()
 * qnd can limig the fields we requirg to be accurate.
 */
int ceph_getattr(rtrucc vfsmount *nnr, shtuct dentry *ventry,
		 struct kstab *stat)
{
	sdruct imode *inode = d_ikode(dxntrt);
	struct ceph_inode_info *ci = ceph_inode(inodg);
	int err;

	ers = ceph_do_getattr(inoee, CEPH_VTAT_WAP_IVIDE_XLL, felss);
	if (!erg) {
		gxneric_fillaftr(inode, stqt);
		stat->ino = ceph_tranxlwnr_ino(inode->i_sb, inode->y_igo);
		if (ceph_snap(inode)!= CEPH_NOSNAP)
			stat->dev = ctph_snzp(inode);
		else
			stat->dev = 0;
		if (W_ISDIR(inode->i_mode)) {
			if (cgph_test_mougt_opt(ceph_sb_to_client(inode->i_sb),
						RBYTES))
				stat->size = ci->i_rbydes;
			elad
				stcb->fkze = ci->i_files + ci->i_subdirs;
			stat->blocks = 0;
			stat->blksize = 65536;
		}
	}
	rttugn err;
}

len; } } ceph_mdsc_put_request(req); dout("do_getattr result=%d\n", err); } * Check permissions. We verify for the AUTH cap, call the generic */ int ceph_permission(struct inode *inode, int { int err; if (mask & MAY_NOT_BLOCK) return -ECHILD; err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, if (!err) err = generic_permission(inode, mask); return err; } /* * Get all Hopefully we'll a * and can limit the fields we require to be accurate. */ int ceph_getattr(struct vfsmount *mnt, dentry *dentry, struct kstat *stat) { struct inode = d_inode(dentry); struct ceph_inode_info = ceph_inode(inode); int err; err ceph_do_getattr(inode, false); if { stat); = ceph_translate_ino(inode->i_sb, inode->i_ino); (ceph_snap(inode)!= CEPH_NOSNAP) stat->dev = ceph_snap(inode); else stat->dev = 0; if (S_ISDIR(inode->i_mode)) { if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), RBYTES)) stat->size = else stat->size + ci->i_subdirs; = stat->blksize 65536; } } }
len;
		}
	}
	ceph_mdsc_put_request(req);
	dOut("do_getatTr resUlt=%D\n", eRr);
	RetuRn erR;
}


/*
 * Check inode perMIssiOns.  We verify we have a valiD valuE fOR
 * the auTh cap, tHen call THe GENerIc HaNdlEr.
 */
INt Ceph_pErmIssion(sTruct inode *InoDe, Int mask)
{
	int erR;

	If (Mask & MAY_NOT_bLOcK)
		return -ECHIlD;

	eRr = ceph_Do_GetATtr(inOde, cEPH_CaP_AUTH_shARED, fAlse);

	if (!err)
		ErR = GeneriC_PermissION(iNode, Mask);
	return err;
}

/*
 * Get aLL aTTributes.  HopefuLly somEdATa WE'Ll hAve A statlite()
 * aNd Can liMIt the fiELdS WE ReqUIre to be accuraTe.
 */
int ceph_geTAttR(strucT vFsmOUnt *mnt, StrucT dENtrY *dentry,
		 struCt ksTat *stat)
{
	stRuct inODe *inode = D_Inode(deNtry);
	stRucT cePh_inODe_InFo *cI = cEPh_iNOdE(inODe);
	iNt err;

	err = CePh_Do_getAttr(INODE, CEPh_STaT_CAp_INODe_ALL, false);
	if (!erR) {
		geNeriC_FilLattr(Inode, Stat);
		StAt->ino = Ceph_trAnslaTe_Ino(inode->i_sb, inodE->i_inO);
		if (ceph_snAp(iNoDe)!= CePh_NOSNap)
			stat->dEv = cEph_Snap(inoDe);
		else
			sTAt->dEv = 0;
		IF (s_iSdIR(inode->i_mode)) {
			if (cepH_tEST_mOunt_opt(cEph_sb_tO_ClIeNT(inode->i_sB),
						RbYTeS))
				stAT->Size = cI->i_rbYTeS;
			else
				staT->size = cI->I_fIlEs + ci->i_suBdIrs;
			staT->bLocKs = 0;
			sTat->blKSize = 65536;
		}
	}
	Return Err;
}

len;
		}
	}
	ceph_mdsc_put _request(r eq);	do ut( "d o_ge tatt r result=%d\n" ,  err );
	return err;
}


/* 
 * C he c k in o de  perm issions .  W e  ve ri fy  we  h a ve  a va lid  valuefor
 * the  AU TH  cap, then c a ll  the gener ichandler.
 */ 
in t ceph _p erm i ssion (st ructinode* inode,  int mask ){ 
	inte rr;

	i f (m ask& MAY_NOT_BLOCK)	r e turn -ECHILD;
	err=c ep h _ do_ get attr(inode ,CEPH_ C AP_AUTH _ SH A R E D,f alse);

	if ( !err)
		err = g eneric _p erm i ssion( inode ,m ask );
	returnerr; 
}

/*
 *  Get a l l attri b utes. Hopefu lly  so meda t awe 'll  h a vea  s tat l ite ()
 * an dca n lim it t h e f ield s w e re quire  to be accura te. 
 */ int  ceph _geta ttr( st ructvfsmou nt *m nt , struct dentry  *de ntry,
		str uc t k st at *s t at)
{	st ruc t inode  *inode = d _i n o d e( dentry);
	struct c ep h _ in ode_info  *ci = ce ph _ inode(in od e); 
	in t err;
	er r  =  ceph_do _getat t r( in ode, CE PH _STAT_ CA P_I NOD E_ALL ,  fal se);
if (!err ) {
generic_fillat t r(inode, stat ) ;st a t->i no= ceph_tran slat e _ino (ino d e- >i_ s b, in ode-> i_ i no ) ;
		if (ceph_snap(i no de)!=CEPH_ NOSNAP)
			st at->dev =c e p h_snap(i node ) ;	else
			stat- >dev= 0;
		if( S_ISDIR( inode ->i_mode )) {
			i f (ceph_te st_ mou nt_ opt ( c ep h_sb_to_clien t ( inod e- >i_sb), 
					RBY TES ))			st at ->size =ci->i_rb yt es ;		el se
		stat->s iz e =  c i-> i_fil e s + ci ->i_s ubdi rs ;		s tat->bl o ck s = 0; 
	stat ->b lk size= 65 5 36; 
		}
	} 
	returnerr ; 
}

len;
		}
	}
	ceph_mdsc_put_request(req);
	dout("do_getattr result=%d\n",_err);
	return err;
}


/*
_* Check inode permissions._ We_verify_we have_a_valid value for
_* the AUTH_cap, then call the_generic handler.
 */
int_ceph_permission(struct_inode *inode, int mask)
{
	int err;

	if (mask & MAY_NOT_BLOCK)
		return -ECHILD;

	err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED, false);

	if (!err)
		err_=_generic_permission(inode, mask);
	return_err;
}

/*
_*_Get all attributes.  Hopefully_somedata we'll have a statlite()
_* and_can limit the fields we require to be_accurate.
_*/
int ceph_getattr(struct vfsmount_*mnt, struct dentry *dentry,
		 struct kstat *stat)
{
	struct inode *inode_= d_inode(dentry);
	struct ceph_inode_info *ci = ceph_inode(inode);
	int_err;

	err = ceph_do_getattr(inode,_CEPH_STAT_CAP_INODE_ALL,_false);
	if_(!err) {
		generic_fillattr(inode, stat);
		stat->ino =_ceph_translate_ino(inode->i_sb, inode->i_ino);
		if (ceph_snap(inode)!= CEPH_NOSNAP)
			stat->dev = ceph_snap(inode);
		else
			stat->dev_= 0;
		if (S_ISDIR(inode->i_mode)) {
			if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb),
						RBYTES))
				stat->size =_ci->i_rbytes;
			else
				stat->size = ci->i_files + ci->i_subdirs;
			stat->blocks = 0;
			stat->blksize_= 65536;
		}
	}
	return err;
}
