LOGSYNC_LOCK(log); 
LOGSYNC_LOCK(log, flags); 
diUpdatePMap(struct inode *ipimap,	     unsigned long inum, boolean_t is_free, struct tblock * tblk){	int rc;	struct iag *iagp;	struct metapage *mp;	int iagno, ino, extno, bitno;	struct inomap *imap;	u32 mask;	struct jfs_log *log;	int lsn, difft, diffp;	imap = JFS_IP(ipimap)->i_imap;	/* get the iag number containing the inode */	iagno = INOTOIAG(inum);	/* make sure that the iag is contained within the map */	if (iagno >= imap->im_nextiag) {		jfs_error(ipimap->i_sb,			  "diUpdatePMap: the iag is outside the map");		return -EIO;	}	/* read the iag */	IREAD_LOCK(ipimap);	rc = diIAGRead(imap, iagno, &mp);	IREAD_UNLOCK(ipimap);	if (rc)		return (rc);	iagp = (struct iag *) mp->data;	/* get the inode number and extent number of the inode within	 * the iag and the inode number within the extent.	 */	ino = inum & (INOSPERIAG - 1);	extno = ino >> L2INOSPEREXT;	bitno = ino & (INOSPEREXT - 1);	mask = HIGHORDER >> bitno;	/* 	 * mark the inode free in persistent map:	 */	if (is_free == TRUE) {		/* The inode should have been allocated both in working		 * map and in persistent map;		 * the inode will be freed from working map at the release		 * of last reference release;		 */		if (!(le32_to_cpu(iagp->wmap[extno]) & mask)) {			jfs_error(ipimap->i_sb, 				  "diUpdatePMap: inode %ld not marked as "				  "allocated in wmap!", inum);		}		if (!(le32_to_cpu(iagp->pmap[extno]) & mask)) {			jfs_error(ipimap->i_sb,				  "diUpdatePMap: inode %ld not marked as "				  "allocated in pmap!", inum);		}		/* update the bitmap for the extent of the freed inode */		iagp->pmap[extno] &= cpu_to_le32(~mask);	}	/*	 * mark the inode allocated in persistent map:	 */	else {		/* The inode should be already allocated in the working map		 * and should be free in persistent map;		 */		if (!(le32_to_cpu(iagp->wmap[extno]) & mask)) {			release_metapage(mp);			jfs_error(ipimap->i_sb,				  "diUpdatePMap: the inode is not allocated in "				  "the working map");			return -EIO;		}		if ((le32_to_cpu(iagp->pmap[extno]) & mask) != 0) {			release_metapage(mp);			jfs_error(ipimap->i_sb,				  "diUpdatePMap: the inode is not free in the "				  "persistent map");			return -EIO;		}		/* update the bitmap for the extent of the allocated inode */		iagp->pmap[extno] |= cpu_to_le32(mask);	}	/*	 * update iag lsn	 */	lsn = tblk->lsn;	log = JFS_SBI(tblk->sb)->log;	if (mp->lsn != 0) {		/* inherit older/smaller lsn */		logdiff(difft, lsn, log);		logdiff(diffp, mp->lsn, log);		if (difft < diffp) {			mp->lsn = lsn;			/* move mp after tblock in logsync list */			LOGSYNC_LOCK(log);			list_move(&mp->synclist, &tblk->synclist);			LOGSYNC_UNLOCK(log);		}		/* inherit younger/larger clsn */		LOGSYNC_LOCK(log);		assert(mp->clsn);		logdiff(difft, tblk->clsn, log);		logdiff(diffp, mp->clsn, log);		if (difft > diffp)			mp->clsn = tblk->clsn;		LOGSYNC_UNLOCK(log);	} else {		mp->log = log;		mp->lsn = lsn;		/* insert mp after tblock in logsync list */		LOGSYNC_LOCK(log);		log->count++;		list_add(&mp->synclist, &tblk->synclist);		mp->clsn = tblk->clsn;		LOGSYNC_UNLOCK(log);	}	write_metapage(mp);	return (0);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/7fab479bebb96b1b4888bdae9b42e1fa9c5d3f38/jfs_imap.c/buggy/fs/jfs/jfs_imap.c