if (!DO_INDEX(ip)) ip->i_size -= PSIZE;  
static int dtDeleteUp(tid_t tid, struct inode *ip,	   struct metapage * fmp, dtpage_t * fp, struct btstack * btstack){	int rc = 0;	struct metapage *mp;	dtpage_t *p;	int index, nextindex;	int xlen;	struct btframe *parent;	struct dt_lock *dtlck;	struct tlock *tlck;	struct lv *lv;	struct pxd_lock *pxdlock;	int i;	/*	 *      keep the root leaf page which has become empty	 */	if (BT_IS_ROOT(fmp)) {		/*		 * reset the root		 *		 * dtInitRoot() acquires txlock on the root		 */		dtInitRoot(tid, ip, PARENT(ip));		DT_PUTPAGE(fmp);		return 0;	}	/*	 *      free the non-root leaf page	 */	/*	 * acquire a transaction lock on the page	 *	 * write FREEXTENT|NOREDOPAGE log record	 * N.B. linelock is overlaid as freed extent descriptor, and	 * the buffer page is freed;	 */	tlck = txMaplock(tid, ip, tlckDTREE | tlckFREE);	pxdlock = (struct pxd_lock *) & tlck->lock;	pxdlock->flag = mlckFREEPXD;	pxdlock->pxd = fp->header.self;	pxdlock->index = 1;	/* update sibling pointers */	if ((rc = dtRelink(tid, ip, fp))) {		BT_PUTPAGE(fmp);		return rc;	}	xlen = lengthPXD(&fp->header.self);	/* Free quota allocation. */	DQUOT_FREE_BLOCK(ip, xlen);	/* free/invalidate its buffer page */	discard_metapage(fmp);	/*	 *      propagate page deletion up the directory tree	 *	 * If the delete from the parent page makes it empty,	 * continue all the way up the tree.	 * stop if the root page is reached (which is never deleted) or	 * if the entry deletion does not empty the page.	 */	while ((parent = BT_POP(btstack)) != NULL) {		/* pin the parent page <sp> */		DT_GETPAGE(ip, parent->bn, mp, PSIZE, p, rc);		if (rc)			return rc;		/*		 * free the extent of the child page deleted		 */		index = parent->index;		/*		 * delete the entry for the child page from parent		 */		nextindex = p->header.nextindex;		/*		 * the parent has the single entry being deleted:		 *		 * free the parent page which has become empty.		 */		if (nextindex == 1) {			/*			 * keep the root internal page which has become empty			 */			if (p->header.flag & BT_ROOT) {				/*				 * reset the root				 *				 * dtInitRoot() acquires txlock on the root				 */				dtInitRoot(tid, ip, PARENT(ip));				DT_PUTPAGE(mp);				return 0;			}			/*			 * free the parent page			 */			else {				/*				 * acquire a transaction lock on the page				 *				 * write FREEXTENT|NOREDOPAGE log record				 */				tlck =				    txMaplock(tid, ip,					      tlckDTREE | tlckFREE);				pxdlock = (struct pxd_lock *) & tlck->lock;				pxdlock->flag = mlckFREEPXD;				pxdlock->pxd = p->header.self;				pxdlock->index = 1;				/* update sibling pointers */				if ((rc = dtRelink(tid, ip, p))) {					DT_PUTPAGE(mp);					return rc;				}				xlen = lengthPXD(&p->header.self);				/* Free quota allocation */				DQUOT_FREE_BLOCK(ip, xlen);				/* free/invalidate its buffer page */				discard_metapage(mp);				/* propagate up */				continue;			}		}		/*		 * the parent has other entries remaining:		 *		 * delete the router entry from the parent page.		 */		BT_MARK_DIRTY(mp, ip);		/*		 * acquire a transaction lock on the page		 *		 * action: router entry deletion		 */		tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY);		dtlck = (struct dt_lock *) & tlck->lock;		/* linelock header */		if (dtlck->index >= dtlck->maxcnt)			dtlck = (struct dt_lock *) txLinelock(dtlck);		lv = & dtlck->lv[dtlck->index];		lv->offset = 0;		lv->length = 1;		dtlck->index++;		/* linelock stbl of non-root leaf page */		if (!(p->header.flag & BT_ROOT)) {			if (dtlck->index < dtlck->maxcnt)				lv++;			else {				dtlck = (struct dt_lock *) txLinelock(dtlck);				lv = & dtlck->lv[0];			}			i = index >> L2DTSLOTSIZE;			lv->offset = p->header.stblindex + i;			lv->length =			    ((p->header.nextindex - 1) >> L2DTSLOTSIZE) -			    i + 1;			dtlck->index++;		}		/* free the router entry */		dtDeleteEntry(p, index, &dtlck);		/* reset key of new leftmost entry of level (for consistency) */		if (index == 0 &&		    ((p->header.flag & BT_ROOT) || p->header.prev == 0))			dtTruncateEntry(p, 0, &dtlck);		/* unpin the parent page */		DT_PUTPAGE(mp);		/* exit propagation up */		break;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/dd8a306ac0c918268bd2ae89da2dea627f6e352d/jfs_dtree.c/buggy/fs/jfs/jfs_dtree.c