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); 
struct inode * ufs_new_inode(struct inode * dir, int mode){	struct super_block * sb;	struct ufs_sb_info * sbi;	struct ufs_sb_private_info * uspi;	struct ufs_super_block_first * usb1;	struct ufs_cg_private_info * ucpi;	struct ufs_cylinder_group * ucg;	struct inode * inode;	unsigned cg, bit, i, j, start;	struct ufs_inode_info *ufsi;	UFSD(("ENTER\n"))		/* Cannot create files in a deleted directory */	if (!dir || !dir->i_nlink)		return ERR_PTR(-EPERM);	sb = dir->i_sb;	inode = new_inode(sb);	if (!inode)		return ERR_PTR(-ENOMEM);	ufsi = UFS_I(inode);	sbi = UFS_SB(sb);	uspi = sbi->s_uspi;	usb1 = ubh_get_usb_first(USPI_UBH);	lock_super (sb);	/*	 * Try to place the inode in its parent directory	 */	i = ufs_inotocg(dir->i_ino);	if (sbi->fs_cs(i).cs_nifree) {		cg = i;		goto cg_found;	}	/*	 * Use a quadratic hash to find a group with a free inode	 */	for ( j = 1; j < uspi->s_ncg; j <<= 1 ) {		i += j;		if (i >= uspi->s_ncg)			i -= uspi->s_ncg;		if (sbi->fs_cs(i).cs_nifree) {			cg = i;			goto cg_found;		}	}	/*	 * That failed: try linear search for a free inode	 */	i = ufs_inotocg(dir->i_ino) + 1;	for (j = 2; j < uspi->s_ncg; j++) {		i++;		if (i >= uspi->s_ncg)			i = 0;		if (sbi->fs_cs(i).cs_nifree) {			cg = i;			goto cg_found;		}	}		goto failed;cg_found:	ucpi = ufs_load_cylinder (sb, cg);	if (!ucpi)		goto failed;	ucg = ubh_get_ucg(UCPI_UBH);	if (!ufs_cg_chkmagic(sb, ucg)) 		ufs_panic (sb, "ufs_new_inode", "internal error, bad cg magic number");	start = ucpi->c_irotor;	bit = ubh_find_next_zero_bit (UCPI_UBH, ucpi->c_iusedoff, uspi->s_ipg, start);	if (!(bit < uspi->s_ipg)) {		bit = ubh_find_first_zero_bit (UCPI_UBH, ucpi->c_iusedoff, start);		if (!(bit < start)) {			ufs_error (sb, "ufs_new_inode",			    "cylinder group %u corrupted - error in inode bitmap\n", cg);			goto failed;		}	}	UFSD(("start = %u, bit = %u, ipg = %u\n", start, bit, uspi->s_ipg))	if (ubh_isclr (UCPI_UBH, ucpi->c_iusedoff, bit))		ubh_setbit (UCPI_UBH, ucpi->c_iusedoff, bit);	else {		ufs_panic (sb, "ufs_new_inode", "internal error");		goto failed;	}		fs32_sub(sb, &ucg->cg_cs.cs_nifree, 1);	fs32_sub(sb, &usb1->fs_cstotal.cs_nifree, 1);	fs32_sub(sb, &sbi->fs_cs(cg).cs_nifree, 1);		if (S_ISDIR(mode)) {		fs32_add(sb, &ucg->cg_cs.cs_ndir, 1);		fs32_add(sb, &usb1->fs_cstotal.cs_ndir, 1);		fs32_add(sb, &sbi->fs_cs(cg).cs_ndir, 1);	}	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;	inode->i_mode = mode;	inode->i_uid = current->fsuid;	if (dir->i_mode & S_ISGID) {		inode->i_gid = dir->i_gid;		if (S_ISDIR(mode))			inode->i_mode |= S_ISGID;	} else		inode->i_gid = current->fsgid;	inode->i_ino = cg * uspi->s_ipg + bit;	inode->i_blksize = PAGE_SIZE;	/* This is the optimal IO size (for stat), not the fs block size */	inode->i_blocks = 0;	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;	ufsi->i_flags = UFS_I(dir)->i_flags;	ufsi->i_lastfrag = 0;	ufsi->i_gen = 0;	ufsi->i_shadow = 0;	ufsi->i_osync = 0;	ufsi->i_oeftflag = 0;	memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1));	insert_inode_hash(inode);	mark_inode_dirty(inode);	unlock_super (sb);	if (DQUOT_ALLOC_INODE(inode)) {		DQUOT_DROP(inode);		inode->i_flags |= S_NOQUOTA;		inode->i_nlink = 0;		iput(inode);		return ERR_PTR(-EDQUOT);	}	UFSD(("allocating inode %lu\n", inode->i_ino))	UFSD(("EXIT\n"))	return inode;failed:	unlock_super (sb);	make_bad_inode(inode);	iput (inode);	UFSD(("EXIT (FAILED)\n"))	return ERR_PTR(-ENOSPC);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/096125f31ae3aa2c7271463b9986dd228e0da089/ialloc.c/clean/fs/ufs/ialloc.c