*/
/* get/pin the parent page <sp> */
XT_GETPAGE(ip, parent->bn, smp, PSIZE, sp, rc);
- if (rc)
- goto errout2;
+ if (rc) {
+ XT_PUTPAGE(rcmp);
+ return rc;
+ }
/*
* The new key entry goes ONE AFTER the index of parent entry,
rc = (sp->header.flag & BT_ROOT) ?
xtSplitRoot(tid, ip, split, &rmp) :
xtSplitPage(tid, ip, split, &rmp, &rbn);
- if (rc)
- goto errout1;
+ if (rc) {
+ XT_PUTPAGE(smp);
+ return rc;
+ }
XT_PUTPAGE(smp);
/* keep new child page <rp> pinned */
XT_PUTPAGE(rmp);
return 0;
-
- /*
- * If something fails in the above loop we were already walking back
- * up the tree and the tree is now inconsistent.
- * release all pages we're holding.
- */
- errout1:
- XT_PUTPAGE(smp);
-
- errout2:
- XT_PUTPAGE(rcmp);
-
- return rc;
}
struct pxdlist *pxdlist;
pxd_t *pxd;
struct tlock *tlck;
- struct xtlock *sxtlck = 0, *rxtlck = 0;
+ struct xtlock *sxtlck = NULL, *rxtlck = NULL;
smp = split->mp;
sp = XT_PAGE(ip, smp);
xad_t *xad;
s64 xaddr;
struct tlock *tlck;
- struct xtlock *xtlck = 0;
+ struct xtlock *xtlck = NULL;
int rootsplit = 0;
jfs_info("xtExtend: nxoff:0x%lx nxlen:0x%x", (ulong) xoff, xlen);
int nxlen, xlen, lxlen, rxlen;
s64 nxaddr, xaddr;
struct tlock *tlck;
- struct xtlock *xtlck = 0;
+ struct xtlock *xtlck = NULL;
int rootsplit = 0, newpage = 0;
/* there must exist extent to be tailgated */
int xlen, len, freexlen;
struct btstack btstack;
struct btframe *parent;
- struct tblock *tblk = 0;
- struct tlock *tlck = 0;
- struct xtlock *xtlck = 0;
+ struct tblock *tblk = NULL;
+ struct tlock *tlck = NULL;
+ struct xtlock *xtlck = NULL;
struct xdlistlock xadlock; /* maplock for COMMIT_WMAP */
struct pxd_lock *pxdlock; /* maplock for COMMIT_WMAP */
s64 nfreed;
* a page that was formerly to the right, let's make sure that the
* next pointer is zero.
*/
- p->header.next = 0;
+ if (p->header.next) {
+ if (log)
+ /*
+ * Make sure this change to the header is logged.
+ * If we really truncate this leaf, the flag
+ * will be changed to tlckTRUNCATE
+ */
+ tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
+ BT_MARK_DIRTY(mp, ip);
+ p->header.next = 0;
+ }
freed = 0;
pxdlock->flag = mlckFREEPXD;
PXDaddress(&pxdlock->pxd, xaddr);
PXDlength(&pxdlock->pxd, freexlen);
- txFreeMap(ip, pxdlock, 0, COMMIT_WMAP);
+ txFreeMap(ip, pxdlock, NULL, COMMIT_WMAP);
/* reset map lock */
xadlock.flag = mlckFREEXADLIST;
xadlock.count =
le16_to_cpu(p->header.nextindex) -
nextindex;
- txFreeMap(ip, (struct maplock *) & xadlock, 0,
- COMMIT_WMAP);
+ txFreeMap(ip, (struct maplock *) & xadlock,
+ NULL, COMMIT_WMAP);
}
p->header.nextindex = cpu_to_le16(nextindex);
}
xadlock.xdlist = &p->xad[XTENTRYSTART];
xadlock.count =
le16_to_cpu(p->header.nextindex) - XTENTRYSTART;
- txFreeMap(ip, (struct maplock *) & xadlock, 0, COMMIT_WMAP);
+ txFreeMap(ip, (struct maplock *) & xadlock, NULL, COMMIT_WMAP);
}
if (p->header.flag & BT_ROOT) {
xadlock.count =
le16_to_cpu(p->header.nextindex) -
index - 1;
- txFreeMap(ip, (struct maplock *) & xadlock, 0,
- COMMIT_WMAP);
+ txFreeMap(ip, (struct maplock *) & xadlock,
+ NULL, COMMIT_WMAP);
}
BT_MARK_DIRTY(mp, ip);
xadlock.count =
le16_to_cpu(p->header.nextindex) -
XTENTRYSTART;
- txFreeMap(ip, (struct maplock *) & xadlock, 0,
+ txFreeMap(ip, (struct maplock *) & xadlock, NULL,
COMMIT_WMAP);
}
BT_MARK_DIRTY(mp, ip);
struct btframe *parent;
int rc;
struct tblock *tblk;
- struct tlock *tlck = 0;
+ struct tlock *tlck = NULL;
xad_t *xad;
int xlen;
s64 xoff;
- struct xtlock *xtlck = 0;
+ struct xtlock *xtlck = NULL;
/* save object truncation type */
tblk = tid_to_tblock(tid);