if (cmp == 0) { 
if ((cmp == 0) || (next && (xlen > next - xoff))) { 
int xtInsert(tid_t tid,		/* transaction id */	     struct inode *ip, int xflag, s64 xoff, s32 xlen, s64 * xaddrp,	     int flag){	int rc = 0;	s64 xaddr, hint;	struct metapage *mp;	/* meta-page buffer */	xtpage_t *p;		/* base B+-tree index page */	s64 bn;	int index, nextindex;	struct btstack btstack;	/* traverse stack */	struct xtsplit split;	/* split information */	xad_t *xad;	int cmp;	struct tlock *tlck;	struct xtlock *xtlck;	jfs_info("xtInsert: nxoff:0x%lx nxlen:0x%x", (ulong) xoff, xlen);	/*	 *      search for the entry location at which to insert:	 *	 * xtFastSearch() and xtSearch() both returns (leaf page	 * pinned, index at which to insert).	 * n.b. xtSearch() may return index of maxentry of	 * the full page.	 */	if ((rc = xtSearch(ip, xoff, &cmp, &btstack, XT_INSERT)))		return rc;	/* retrieve search result */	XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);	/* This test must follow XT_GETSEARCH since mp must be valid if	 * we branch to out: */	if (cmp == 0) {		rc = -EEXIST;		goto out;	}	/*	 * allocate data extent requested	 *	 * allocation hint: last xad	 */	if ((xaddr = *xaddrp) == 0) {		if (index > XTENTRYSTART) {			xad = &p->xad[index - 1];			hint = addressXAD(xad) + lengthXAD(xad) - 1;		} else			hint = 0;		if ((rc = DQUOT_ALLOC_BLOCK(ip, xlen)))			goto out;		if ((rc = dbAlloc(ip, hint, (s64) xlen, &xaddr))) {			DQUOT_FREE_BLOCK(ip, xlen);			goto out;		}	}	/*	 *      insert entry for new extent	 */	xflag |= XAD_NEW;	/*	 *      if the leaf page is full, split the page and	 *      propagate up the router entry for the new page from split	 *	 * The xtSplitUp() will insert the entry and unpin the leaf page.	 */	nextindex = le16_to_cpu(p->header.nextindex);	if (nextindex == le16_to_cpu(p->header.maxentry)) {		split.mp = mp;		split.index = index;		split.flag = xflag;		split.off = xoff;		split.len = xlen;		split.addr = xaddr;		split.pxdlist = NULL;		if ((rc = xtSplitUp(tid, ip, &split, &btstack))) {			/* undo data extent allocation */			if (*xaddrp == 0) {				dbFree(ip, xaddr, (s64) xlen);				DQUOT_FREE_BLOCK(ip, xlen);			}			return rc;		}		*xaddrp = xaddr;		return 0;	}	/*	 *      insert the new entry into the leaf page	 */	/*	 * acquire a transaction lock on the leaf page;	 *	 * action: xad insertion/extension;	 */	BT_MARK_DIRTY(mp, ip);	/* if insert into middle, shift right remaining entries. */	if (index < nextindex)		memmove(&p->xad[index + 1], &p->xad[index],			(nextindex - index) * sizeof(xad_t));	/* insert the new entry: mark the entry NEW */	xad = &p->xad[index];	XT_PUTENTRY(xad, xflag, xoff, xlen, xaddr);	/* advance next available entry index */	p->header.nextindex =	    cpu_to_le16(le16_to_cpu(p->header.nextindex) + 1);	/* Don't log it if there are no links to the file */	if (!test_cflag(COMMIT_Nolink, ip)) {		tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW);		xtlck = (struct xtlock *) & tlck->lock;		xtlck->lwm.offset =		    (xtlck->lwm.offset) ? min(index,					      (int)xtlck->lwm.offset) : index;		xtlck->lwm.length =		    le16_to_cpu(p->header.nextindex) - xtlck->lwm.offset;	}	*xaddrp = xaddr;      out:	/* unpin the leaf page */	XT_PUTPAGE(mp);	return rc;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/6628465e33ca694bd8fd5c3cf4eb7ff9177bc694/jfs_xtree.c/clean/fs/jfs/jfs_xtree.c