Lines Matching refs:ip
116 static int xtSearch(struct inode *ip, s64 xoff, s64 *next, int *cmpp,
120 struct inode *ip,
123 static int xtSplitPage(tid_t tid, struct inode *ip, struct xtsplit * split,
126 static int xtSplitRoot(tid_t tid, struct inode *ip,
130 static int xtDeleteUp(tid_t tid, struct inode *ip, struct metapage * fmp,
133 static int xtSearchNode(struct inode *ip,
137 static int xtRelink(tid_t tid, struct inode *ip, xtpage_t * fp);
145 int xtLookup(struct inode *ip, s64 lstart,
165 size = ((u64) ip->i_size + (JFS_SBI(ip->i_sb)->bsize - 1)) >>
166 JFS_SBI(ip->i_sb)->l2bsize;
175 if ((rc = xtSearch(ip, lstart, &next, &cmp, &btstack, 0))) {
187 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
226 * ip - file object;
238 static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp,
241 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
278 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
502 jfs_error(ip->i_sb, "stack overrun in xtSearch!");
523 * ip - file object;
537 struct inode *ip, int xflag, s64 xoff, s32 xlen, s64 * xaddrp,
564 if ((rc = xtSearch(ip, xoff, &next, &cmp, &btstack, XT_INSERT)))
568 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
588 if ((rc = dquot_alloc_block(ip, xlen)))
590 if ((rc = dbAlloc(ip, hint, (s64) xlen, &xaddr))) {
591 dquot_free_block(ip, xlen);
616 if ((rc = xtSplitUp(tid, ip, &split, &btstack))) {
619 dbFree(ip, xaddr, (s64) xlen);
620 dquot_free_block(ip, xlen);
637 BT_MARK_DIRTY(mp, ip);
652 if (!test_cflag(COMMIT_Nolink, ip)) {
653 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW);
680 * ip - file object;
688 struct inode *ip, struct xtsplit * split, struct btstack * btstack)
711 sp = XT_PAGE(ip, smp);
714 if ((sp->header.flag & BT_ROOT) && (!S_ISDIR(ip->i_mode)) &&
716 (JFS_IP(ip)->mode2 & INLINEEA)) {
718 JFS_IP(ip)->mode2 &= ~INLINEEA;
720 BT_MARK_DIRTY(smp, ip);
743 if (!test_cflag(COMMIT_Nolink, ip)) {
744 tlck = txLock(tid, ip, smp, tlckXTREE | tlckGROW);
766 xlen = JFS_SBI(ip->i_sb)->nbperpage;
768 if ((rc = dbAlloc(ip, (s64) 0, (s64) xlen, &xaddr))
793 xtSplitRoot(tid, ip, split, &rmp) :
794 xtSplitPage(tid, ip, split, &rmp, &rbn);
827 rcp = XT_PAGE(ip, rcmp);
833 XT_GETPAGE(ip, parent->bn, smp, PSIZE, sp, rc);
858 split->len = JFS_SBI(ip->i_sb)->nbperpage;
869 xtSplitRoot(tid, ip, split, &rmp) :
870 xtSplitPage(tid, ip, split, &rmp, &rbn);
892 BT_MARK_DIRTY(smp, ip);
906 JFS_SBI(ip->i_sb)->nbperpage, rcbn);
912 if (!test_cflag(COMMIT_Nolink, ip)) {
913 tlck = txLock(tid, ip, smp,
948 * struct inode *ip,
957 xtSplitPage(tid_t tid, struct inode *ip,
978 sp = XT_PAGE(ip, smp);
988 rc = dquot_alloc_block(ip, lengthPXD(pxd));
997 rmp = get_metapage(ip, rbn, PSIZE, 1);
1003 jfs_info("xtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp);
1005 BT_MARK_DIRTY(rmp, ip);
1016 BT_MARK_DIRTY(smp, ip);
1018 if (!test_cflag(COMMIT_Nolink, ip)) {
1022 tlck = txLock(tid, ip, rmp, tlckXTREE | tlckNEW);
1028 tlck = txLock(tid, ip, smp, tlckXTREE | tlckGROW);
1068 if (!test_cflag(COMMIT_Nolink, ip)) {
1088 XT_GETPAGE(ip, nextbn, mp, PSIZE, p, rc);
1094 BT_MARK_DIRTY(mp, ip);
1100 if (!test_cflag(COMMIT_Nolink, ip))
1101 tlck = txLock(tid, ip, mp, tlckXTREE | tlckRELINK);
1139 if (!test_cflag(COMMIT_Nolink, ip)) {
1169 if (!test_cflag(COMMIT_Nolink, ip)) {
1178 if (!test_cflag(COMMIT_Nolink, ip)) {
1197 dquot_free_block(ip, quota_allocation);
1216 * struct inode *ip,
1225 struct inode *ip, struct xtsplit * split, struct metapage ** rmpp)
1239 sp = &JFS_IP(ip)->i_xtroot;
1250 rmp = get_metapage(ip, rbn, PSIZE, 1);
1255 rc = dquot_alloc_block(ip, lengthPXD(pxd));
1261 jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp);
1268 BT_MARK_DIRTY(rmp, ip);
1304 if (!test_cflag(COMMIT_Nolink, ip)) {
1305 tlck = txLock(tid, ip, rmp, tlckXTREE | tlckNEW);
1324 BT_MARK_DIRTY(split->mp, ip);
1327 XT_PUTENTRY(xad, XAD_NEW, 0, JFS_SBI(ip->i_sb)->nbperpage, rbn);
1335 if (!test_cflag(COMMIT_Nolink, ip)) {
1336 tlck = txLock(tid, ip, split->mp, tlckXTREE | tlckGROW);
1360 struct inode *ip, s64 xoff, /* delta extent offset */
1380 if ((rc = xtSearch(ip, xoff - 1, NULL, &cmp, &btstack, XT_INSERT)))
1384 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
1388 jfs_error(ip->i_sb, "xtExtend: xtSearch did not find extent");
1396 jfs_error(ip->i_sb, "xtExtend: extension is not contiguous");
1405 BT_MARK_DIRTY(mp, ip);
1406 if (!test_cflag(COMMIT_Nolink, ip)) {
1407 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW);
1439 if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
1443 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
1459 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
1463 BT_MARK_DIRTY(mp, ip);
1464 if (!test_cflag(COMMIT_Nolink, ip)) {
1465 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
1494 if (!test_cflag(COMMIT_Nolink, ip)) {
1522 struct inode *ip, s64 xoff, /* split/new extent offset */
1547 if ((rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, XT_INSERT)))
1551 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
1555 jfs_error(ip->i_sb, "xtTailgate: couldn't find extent");
1563 jfs_error(ip->i_sb,
1568 BT_MARK_DIRTY(mp, ip);
1572 if (!test_cflag(COMMIT_Nolink, ip)) {
1573 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW);
1605 if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
1609 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
1625 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
1629 BT_MARK_DIRTY(mp, ip);
1630 if (!test_cflag(COMMIT_Nolink, ip)) {
1631 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
1659 if (!test_cflag(COMMIT_Nolink, ip)) {
1660 mtlck = txMaplock(tid, ip, tlckMAP);
1669 dbFree(ip, addressXAD(xad) + llen, (s64) rlen);
1678 if (!test_cflag(COMMIT_Nolink, ip)) {
1705 int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad)
1729 if ((rc = xtSearch(ip, nxoff, NULL, &cmp, &btstack, XT_INSERT)))
1733 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index0);
1737 jfs_error(ip->i_sb, "xtUpdate: Could not find extent");
1741 BT_MARK_DIRTY(mp, ip);
1745 if (!test_cflag(COMMIT_Nolink, ip)) {
1746 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW);
1760 jfs_error(ip->i_sb,
1910 jfs_error(ip->i_sb, "xtUpdate: xoff >= nxoff");
1938 if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
1942 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
1958 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
1962 BT_MARK_DIRTY(mp, ip);
1963 if (!test_cflag(COMMIT_Nolink, ip)) {
1964 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
2007 if (!test_cflag(COMMIT_Nolink, ip)) {
2019 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
2023 BT_MARK_DIRTY(mp, ip);
2024 if (!test_cflag(COMMIT_Nolink, ip)) {
2025 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW);
2043 if ((rc = xtSearch(ip, nxoff, NULL, &cmp, &btstack, XT_INSERT)))
2047 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index0);
2051 jfs_error(ip->i_sb, "xtUpdate: xtSearch failed");
2057 jfs_error(ip->i_sb,
2092 if ((rc = xtSplitUp(tid, ip, &split, &btstack)))
2096 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
2113 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
2117 BT_MARK_DIRTY(mp, ip);
2118 if (!test_cflag(COMMIT_Nolink, ip)) {
2119 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
2139 if (!test_cflag(COMMIT_Nolink, ip)) {
2160 * ip - file object;
2171 struct inode *ip, int xflag, s64 xoff, s32 maxblocks,
2205 if ((rc = xtSearch(ip, xoff, &next, &cmp, &btstack, XT_INSERT)))
2209 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
2241 nblocks = JFS_SBI(ip->i_sb)->nbperpage;
2243 if ((rc = dbAllocBottomUp(ip, xaddr, (s64) nblocks)) == 0) {
2262 if ((rc = dbAllocBottomUp(ip, xaddr, (s64) xlen)))
2271 if ((rc = xtSplitUp(tid, ip, &split, &btstack))) {
2273 dbFree(ip, *xaddrp, (s64) * xlenp);
2289 if ((rc = dbAllocBottomUp(ip, xaddr, (s64) xlen)))
2292 BT_MARK_DIRTY(mp, ip);
2298 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW);
2340 int xtDelete(tid_t tid, struct inode *ip, s64 xoff, s32 xlen, int flag)
2355 if ((rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0)))
2358 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
2375 return (xtDeleteUp(tid, ip, mp, p, &btstack));
2377 BT_MARK_DIRTY(mp, ip);
2383 tlck = txLock(tid, ip, mp, tlckXTREE);
2411 xtDeleteUp(tid_t tid, struct inode *ip,
2441 if ((rc = xtRelink(tid, ip, fp))) {
2449 dbFree(ip, xaddr, (s64) xlen);
2464 XT_GETPAGE(ip, parent->bn, mp, PSIZE, p, rc);
2491 if ((rc = xtRelink(tid, ip, p)))
2496 dbFree(ip, xaddr,
2497 (s64) JFS_SBI(ip->i_sb)->nbperpage);
2511 BT_MARK_DIRTY(mp, ip);
2517 tlck = txLock(tid, ip, mp, tlckXTREE);
2560 xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */
2591 offset = xoff << JFS_SBI(ip->i_sb)->l2bsize;
2592 if (offset >= ip->i_size)
2604 rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0);
2609 XT_GETSEARCH(ip, btstack.top, bn, pmp, pp, index);
2625 rc = xtSearchNode(ip, oxad, &cmp, &btstack, 0);
2630 XT_GETSEARCH(ip, btstack.top, bn, pmp, pp, index);
2673 offset = xoff << JFS_SBI(ip->i_sb)->l2bsize;
2675 nbytes = xlen << JFS_SBI(ip->i_sb)->l2bsize;
2692 if (rc = cmRead(ip, offset, npages, &cp))
2699 nblks = nb >> JFS_IP(ip->i_sb)->l2bsize;
2700 cmSetXD(ip, cp, pno, dxaddr, nblks);
2710 if ((rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0)))
2713 XT_GETSEARCH(ip, btstack.top, bn, pmp, pp, index);
2720 XT_GETPAGE(ip, oxaddr, mp, PSIZE, p, rc);
2732 XT_GETPAGE(ip, nextbn, rmp, PSIZE, rp, rc);
2743 XT_GETPAGE(ip, prevbn, lmp, PSIZE, lp, rc);
2759 BT_MARK_DIRTY(lmp, ip);
2760 tlck = txLock(tid, ip, lmp, tlckXTREE | tlckRELINK);
2766 BT_MARK_DIRTY(rmp, ip);
2767 tlck = txLock(tid, ip, rmp, tlckXTREE | tlckRELINK);
2793 BT_MARK_DIRTY(mp, ip);
2795 tlck = txLock(tid, ip, mp, tlckXTREE | tlckNEW);
2807 xsize = xlen << JFS_SBI(ip->i_sb)->l2bsize;
2828 tlck = txMaplock(tid, ip, tlckMAP);
2838 tlck = txMaplock(tid, ip, tlckMAP | tlckRELOCATE);
2854 BT_MARK_DIRTY(pmp, ip);
2855 tlck = txLock(tid, ip, pmp, tlckXTREE | tlckGROW);
2881 * ip - file object;
2892 static int xtSearchNode(struct inode *ip, xad_t * xad, /* required XAD entry */
2930 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
3007 * struct inode *ip,
3012 static int xtRelink(tid_t tid, struct inode *ip, xtpage_t * p)
3024 XT_GETPAGE(ip, nextbn, mp, PSIZE, p, rc);
3033 BT_MARK_DIRTY(mp, ip);
3034 tlck = txLock(tid, ip, mp, tlckXTREE | tlckRELINK);
3045 XT_GETPAGE(ip, prevbn, mp, PSIZE, p, rc);
3054 BT_MARK_DIRTY(mp, ip);
3055 tlck = txLock(tid, ip, mp, tlckXTREE | tlckRELINK);
3074 void xtInitRoot(tid_t tid, struct inode *ip)
3083 txLock(tid, ip, (struct metapage *) &JFS_IP(ip)->bxflag,
3085 p = &JFS_IP(ip)->i_xtroot;
3090 if (S_ISDIR(ip->i_mode))
3094 ip->i_size = 0;
3127 * struct inode *ip,
3163 s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
3229 teof = (newsize + (JFS_SBI(ip->i_sb)->bsize - 1)) >>
3230 JFS_SBI(ip->i_sb)->l2bsize;
3246 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
3265 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW);
3266 BT_MARK_DIRTY(mp, ip);
3295 newsize = (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize;
3298 tlck = txLock(tid, ip, mp, tlckXTREE);
3303 BT_MARK_DIRTY(mp, ip);
3319 if (S_ISDIR(ip->i_mode) && (teof == 0))
3320 invalidate_xad_metapages(ip, *xad);
3384 txFreeMap(ip, pxdlock, NULL, COMMIT_WMAP);
3412 txFreeMap(ip, (struct maplock *) & xadlock,
3442 txFreeMap(ip, (struct maplock *) & xadlock, NULL, COMMIT_WMAP);
3484 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
3501 tlck = txLock(tid, ip, mp, tlckXTREE);
3517 txFreeMap(ip, (struct maplock *) & xadlock,
3520 BT_MARK_DIRTY(mp, ip);
3577 tlck = txLock(tid, ip, mp, tlckXTREE);
3589 txFreeMap(ip, (struct maplock *) & xadlock, NULL,
3592 BT_MARK_DIRTY(mp, ip);
3605 JFS_IP(ip)->mode2 |= INLINEEA;
3653 jfs_error(ip->i_sb, "stack overrun in xtTruncate!");
3678 if (S_ISDIR(ip->i_mode) && !newsize)
3679 ip->i_size = 1; /* fsck hates zero-length directories */
3681 ip->i_size = newsize;
3684 dquot_free_block(ip, nfreed);
3690 txFreelock(ip);
3707 * struct inode *ip,
3719 s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
3745 xoff = (committed_size >> JFS_SBI(ip->i_sb)->l2bsize) - 1;
3746 rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0);
3750 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index);
3754 jfs_error(ip->i_sb,
3770 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
3794 return (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize;
3796 tlck = txLock(tid, ip, mp, tlckXTREE);
3815 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
3829 tlck = txLock(tid, ip, mp, tlckXTREE);
3854 jfs_error(ip->i_sb, "stack overrun in xtTruncate_pmap!");