ubh_wait_on_buffer (UCPI_UBH); ubh_ll_rw_block (WRITE, 1, (struct ufs_buffer_head **)&ucpi); 
ubh_ll_rw_block (SWRITE, 1, (struct ufs_buffer_head **)&ucpi); 
static unsigned ufs_alloc_fragments (struct inode * inode, unsigned cgno,	unsigned goal, unsigned count, int * err){	struct super_block * sb;	struct ufs_sb_private_info * uspi;	struct ufs_super_block_first * usb1;	struct ufs_cg_private_info * ucpi;	struct ufs_cylinder_group * ucg;	unsigned oldcg, i, j, k, result, allocsize;		UFSD(("ENTER, ino %lu, cgno %u, goal %u, count %u\n", inode->i_ino, cgno, goal, count))	sb = inode->i_sb;	uspi = UFS_SB(sb)->s_uspi;	usb1 = ubh_get_usb_first(USPI_UBH);	oldcg = cgno;		/*	 * 1. searching on preferred cylinder group	 */	UFS_TEST_FREE_SPACE_CG	/*	 * 2. quadratic rehash	 */	for (j = 1; j < uspi->s_ncg; j *= 2) {		cgno += j;		if (cgno >= uspi->s_ncg) 			cgno -= uspi->s_ncg;		UFS_TEST_FREE_SPACE_CG	}	/*	 * 3. brute force search	 * We start at i = 2 ( 0 is checked at 1.step, 1 at 2.step )	 */	cgno = (oldcg + 1) % uspi->s_ncg;	for (j = 2; j < uspi->s_ncg; j++) {		cgno++;		if (cgno >= uspi->s_ncg)			cgno = 0;		UFS_TEST_FREE_SPACE_CG	}		UFSD(("EXIT (FAILED)\n"))	return 0;cg_found:	ucpi = ufs_load_cylinder (sb, cgno);	if (!ucpi)		return 0;	ucg = ubh_get_ucg (UCPI_UBH);	if (!ufs_cg_chkmagic(sb, ucg)) 		ufs_panic (sb, "ufs_alloc_fragments",			"internal error, bad magic number on cg %u", cgno);	ucg->cg_time = cpu_to_fs32(sb, get_seconds());	if (count == uspi->s_fpb) {		result = ufs_alloccg_block (inode, ucpi, goal, err);		if (result == (unsigned)-1)			return 0;		goto succed;	}	for (allocsize = count; allocsize < uspi->s_fpb; allocsize++)		if (fs32_to_cpu(sb, ucg->cg_frsum[allocsize]) != 0)			break;		if (allocsize == uspi->s_fpb) {		result = ufs_alloccg_block (inode, ucpi, goal, err);		if (result == (unsigned)-1)			return 0;		goal = ufs_dtogd (result);		for (i = count; i < uspi->s_fpb; i++)			ubh_setbit (UCPI_UBH, ucpi->c_freeoff, goal + i);		i = uspi->s_fpb - count;		DQUOT_FREE_BLOCK(inode, i);		fs32_add(sb, &ucg->cg_cs.cs_nffree, i);		fs32_add(sb, &usb1->fs_cstotal.cs_nffree, i);		fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, i);		fs32_add(sb, &ucg->cg_frsum[i], 1);		goto succed;	}	result = ufs_bitmap_search (sb, ucpi, goal, allocsize);	if (result == (unsigned)-1)		return 0;	if(DQUOT_ALLOC_BLOCK(inode, count)) {		*err = -EDQUOT;		return 0;	}	for (i = 0; i < count; i++)		ubh_clrbit (UCPI_UBH, ucpi->c_freeoff, result + i);		fs32_sub(sb, &ucg->cg_cs.cs_nffree, count);	fs32_sub(sb, &usb1->fs_cstotal.cs_nffree, count);	fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count);	fs32_sub(sb, &ucg->cg_frsum[allocsize], 1);	if (count != allocsize)		fs32_add(sb, &ucg->cg_frsum[allocsize - count], 1);succed:	ubh_mark_buffer_dirty (USPI_UBH);	ubh_mark_buffer_dirty (UCPI_UBH);	if (sb->s_flags & MS_SYNCHRONOUS) {		ubh_wait_on_buffer (UCPI_UBH);		ubh_ll_rw_block (WRITE, 1, (struct ufs_buffer_head **)&ucpi);		ubh_wait_on_buffer (UCPI_UBH);	}	sb->s_dirt = 1;	result += cgno * uspi->s_fpg;	UFSD(("EXIT3, result %u\n", result))	return result;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/096125f31ae3aa2c7271463b9986dd228e0da089/balloc.c/clean/fs/ufs/balloc.c