Lines Matching refs:ip
104 static int xtSearch(struct inode *ip, s64 xoff, s64 *next, int *cmpp,
108 struct inode *ip,
111 static int xtSplitPage(tid_t tid, struct inode *ip, struct xtsplit * split,
114 static int xtSplitRoot(tid_t tid, struct inode *ip,
122 int xtLookup(struct inode *ip, s64 lstart, in xtLookup() argument
142 size = ((u64) ip->i_size + (JFS_SBI(ip->i_sb)->bsize - 1)) >> in xtLookup()
143 JFS_SBI(ip->i_sb)->l2bsize; in xtLookup()
152 if ((rc = xtSearch(ip, lstart, &next, &cmp, &btstack, 0))) { in xtLookup()
164 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in xtLookup()
215 static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, in xtSearch() argument
218 struct jfs_inode_info *jfs_ip = JFS_IP(ip); in xtSearch()
255 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtSearch()
479 jfs_error(ip->i_sb, "stack overrun!\n"); in xtSearch()
514 struct inode *ip, int xflag, s64 xoff, s32 xlen, s64 * xaddrp, in xtInsert() argument
541 if ((rc = xtSearch(ip, xoff, &next, &cmp, &btstack, XT_INSERT))) in xtInsert()
545 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in xtInsert()
565 if ((rc = dquot_alloc_block(ip, xlen))) in xtInsert()
567 if ((rc = dbAlloc(ip, hint, (s64) xlen, &xaddr))) { in xtInsert()
568 dquot_free_block(ip, xlen); in xtInsert()
593 if ((rc = xtSplitUp(tid, ip, &split, &btstack))) { in xtInsert()
596 dbFree(ip, xaddr, (s64) xlen); in xtInsert()
597 dquot_free_block(ip, xlen); in xtInsert()
614 BT_MARK_DIRTY(mp, ip); in xtInsert()
629 if (!test_cflag(COMMIT_Nolink, ip)) { in xtInsert()
630 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW); in xtInsert()
665 struct inode *ip, struct xtsplit * split, struct btstack * btstack) in xtSplitUp() argument
688 sp = XT_PAGE(ip, smp); in xtSplitUp()
691 if ((sp->header.flag & BT_ROOT) && (!S_ISDIR(ip->i_mode)) && in xtSplitUp()
693 (JFS_IP(ip)->mode2 & INLINEEA)) { in xtSplitUp()
695 JFS_IP(ip)->mode2 &= ~INLINEEA; in xtSplitUp()
697 BT_MARK_DIRTY(smp, ip); in xtSplitUp()
720 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitUp()
721 tlck = txLock(tid, ip, smp, tlckXTREE | tlckGROW); in xtSplitUp()
743 xlen = JFS_SBI(ip->i_sb)->nbperpage; in xtSplitUp()
745 if ((rc = dbAlloc(ip, (s64) 0, (s64) xlen, &xaddr)) in xtSplitUp()
770 xtSplitRoot(tid, ip, split, &rmp) : in xtSplitUp()
771 xtSplitPage(tid, ip, split, &rmp, &rbn); in xtSplitUp()
804 rcp = XT_PAGE(ip, rcmp); in xtSplitUp()
810 XT_GETPAGE(ip, parent->bn, smp, PSIZE, sp, rc); in xtSplitUp()
835 split->len = JFS_SBI(ip->i_sb)->nbperpage; in xtSplitUp()
846 xtSplitRoot(tid, ip, split, &rmp) : in xtSplitUp()
847 xtSplitPage(tid, ip, split, &rmp, &rbn); in xtSplitUp()
869 BT_MARK_DIRTY(smp, ip); in xtSplitUp()
883 JFS_SBI(ip->i_sb)->nbperpage, rcbn); in xtSplitUp()
889 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitUp()
890 tlck = txLock(tid, ip, smp, in xtSplitUp()
934 xtSplitPage(tid_t tid, struct inode *ip, in xtSplitPage() argument
955 sp = XT_PAGE(ip, smp); in xtSplitPage()
965 rc = dquot_alloc_block(ip, lengthPXD(pxd)); in xtSplitPage()
974 rmp = get_metapage(ip, rbn, PSIZE, 1); in xtSplitPage()
980 jfs_info("xtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp); in xtSplitPage()
982 BT_MARK_DIRTY(rmp, ip); in xtSplitPage()
993 BT_MARK_DIRTY(smp, ip); in xtSplitPage()
995 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitPage()
999 tlck = txLock(tid, ip, rmp, tlckXTREE | tlckNEW); in xtSplitPage()
1005 tlck = txLock(tid, ip, smp, tlckXTREE | tlckGROW); in xtSplitPage()
1045 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitPage()
1065 XT_GETPAGE(ip, nextbn, mp, PSIZE, p, rc); in xtSplitPage()
1071 BT_MARK_DIRTY(mp, ip); in xtSplitPage()
1077 if (!test_cflag(COMMIT_Nolink, ip)) in xtSplitPage()
1078 tlck = txLock(tid, ip, mp, tlckXTREE | tlckRELINK); in xtSplitPage()
1116 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitPage()
1146 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitPage()
1155 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitPage()
1174 dquot_free_block(ip, quota_allocation); in xtSplitPage()
1202 struct inode *ip, struct xtsplit * split, struct metapage ** rmpp) in xtSplitRoot() argument
1216 sp = (xtpage_t *) &JFS_IP(ip)->i_xtroot; in xtSplitRoot()
1227 rmp = get_metapage(ip, rbn, PSIZE, 1); in xtSplitRoot()
1232 rc = dquot_alloc_block(ip, lengthPXD(pxd)); in xtSplitRoot()
1238 jfs_info("xtSplitRoot: ip:0x%p rmp:0x%p", ip, rmp); in xtSplitRoot()
1245 BT_MARK_DIRTY(rmp, ip); in xtSplitRoot()
1281 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitRoot()
1282 tlck = txLock(tid, ip, rmp, tlckXTREE | tlckNEW); in xtSplitRoot()
1301 BT_MARK_DIRTY(split->mp, ip); in xtSplitRoot()
1304 XT_PUTENTRY(xad, XAD_NEW, 0, JFS_SBI(ip->i_sb)->nbperpage, rbn); in xtSplitRoot()
1312 if (!test_cflag(COMMIT_Nolink, ip)) { in xtSplitRoot()
1313 tlck = txLock(tid, ip, split->mp, tlckXTREE | tlckGROW); in xtSplitRoot()
1337 struct inode *ip, s64 xoff, /* delta extent offset */ in xtExtend() argument
1357 if ((rc = xtSearch(ip, xoff - 1, NULL, &cmp, &btstack, XT_INSERT))) in xtExtend()
1361 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in xtExtend()
1365 jfs_error(ip->i_sb, "xtSearch did not find extent\n"); in xtExtend()
1373 jfs_error(ip->i_sb, "extension is not contiguous\n"); in xtExtend()
1382 BT_MARK_DIRTY(mp, ip); in xtExtend()
1383 if (!test_cflag(COMMIT_Nolink, ip)) { in xtExtend()
1384 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW); in xtExtend()
1416 if ((rc = xtSplitUp(tid, ip, &split, &btstack))) in xtExtend()
1420 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtExtend()
1436 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtExtend()
1440 BT_MARK_DIRTY(mp, ip); in xtExtend()
1441 if (!test_cflag(COMMIT_Nolink, ip)) { in xtExtend()
1442 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW); in xtExtend()
1471 if (!test_cflag(COMMIT_Nolink, ip)) { in xtExtend()
1498 int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) in xtUpdate() argument
1522 if ((rc = xtSearch(ip, nxoff, NULL, &cmp, &btstack, XT_INSERT))) in xtUpdate()
1526 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index0); in xtUpdate()
1530 jfs_error(ip->i_sb, "Could not find extent\n"); in xtUpdate()
1534 BT_MARK_DIRTY(mp, ip); in xtUpdate()
1538 if (!test_cflag(COMMIT_Nolink, ip)) { in xtUpdate()
1539 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW); in xtUpdate()
1553 jfs_error(ip->i_sb, in xtUpdate()
1683 jfs_error(ip->i_sb, "xoff >= nxoff\n"); in xtUpdate()
1710 if ((rc = xtSplitUp(tid, ip, &split, &btstack))) in xtUpdate()
1714 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtUpdate()
1730 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtUpdate()
1734 BT_MARK_DIRTY(mp, ip); in xtUpdate()
1735 if (!test_cflag(COMMIT_Nolink, ip)) { in xtUpdate()
1736 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW); in xtUpdate()
1779 if (!test_cflag(COMMIT_Nolink, ip)) { in xtUpdate()
1791 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtUpdate()
1795 BT_MARK_DIRTY(mp, ip); in xtUpdate()
1796 if (!test_cflag(COMMIT_Nolink, ip)) { in xtUpdate()
1797 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW); in xtUpdate()
1815 if ((rc = xtSearch(ip, nxoff, NULL, &cmp, &btstack, XT_INSERT))) in xtUpdate()
1819 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index0); in xtUpdate()
1823 jfs_error(ip->i_sb, "xtSearch failed\n"); in xtUpdate()
1829 jfs_error(ip->i_sb, "unexpected value of index\n"); in xtUpdate()
1863 if ((rc = xtSplitUp(tid, ip, &split, &btstack))) in xtUpdate()
1867 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtUpdate()
1884 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtUpdate()
1888 BT_MARK_DIRTY(mp, ip); in xtUpdate()
1889 if (!test_cflag(COMMIT_Nolink, ip)) { in xtUpdate()
1890 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW); in xtUpdate()
1910 if (!test_cflag(COMMIT_Nolink, ip)) { in xtUpdate()
1942 struct inode *ip, int xflag, s64 xoff, s32 maxblocks, in xtAppend() argument
1976 if ((rc = xtSearch(ip, xoff, &next, &cmp, &btstack, XT_INSERT))) in xtAppend()
1980 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in xtAppend()
2012 nblocks = JFS_SBI(ip->i_sb)->nbperpage; in xtAppend()
2014 if ((rc = dbAllocBottomUp(ip, xaddr, (s64) nblocks)) == 0) { in xtAppend()
2033 if ((rc = dbAllocBottomUp(ip, xaddr, (s64) xlen))) in xtAppend()
2042 if ((rc = xtSplitUp(tid, ip, &split, &btstack))) { in xtAppend()
2044 dbFree(ip, *xaddrp, (s64) * xlenp); in xtAppend()
2060 if ((rc = dbAllocBottomUp(ip, xaddr, (s64) xlen))) in xtAppend()
2063 BT_MARK_DIRTY(mp, ip); in xtAppend()
2069 tlck = txLock(tid, ip, mp, tlckXTREE | tlckGROW); in xtAppend()
2099 void xtInitRoot(tid_t tid, struct inode *ip) in xtInitRoot() argument
2108 txLock(tid, ip, (struct metapage *) &JFS_IP(ip)->bxflag, in xtInitRoot()
2110 p = &JFS_IP(ip)->i_xtroot; in xtInitRoot()
2115 if (S_ISDIR(ip->i_mode)) in xtInitRoot()
2119 ip->i_size = 0; in xtInitRoot()
2188 s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag) in xtTruncate() argument
2254 teof = (newsize + (JFS_SBI(ip->i_sb)->bsize - 1)) >> in xtTruncate()
2255 JFS_SBI(ip->i_sb)->l2bsize; in xtTruncate()
2271 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtTruncate()
2290 tlck = txLock(tid, ip, mp, tlckXTREE|tlckGROW); in xtTruncate()
2291 BT_MARK_DIRTY(mp, ip); in xtTruncate()
2320 newsize = (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize; in xtTruncate()
2323 tlck = txLock(tid, ip, mp, tlckXTREE); in xtTruncate()
2328 BT_MARK_DIRTY(mp, ip); in xtTruncate()
2344 if (S_ISDIR(ip->i_mode) && (teof == 0)) in xtTruncate()
2345 invalidate_xad_metapages(ip, *xad); in xtTruncate()
2409 txFreeMap(ip, pxdlock, NULL, COMMIT_WMAP); in xtTruncate()
2437 txFreeMap(ip, (struct maplock *) & xadlock, in xtTruncate()
2467 txFreeMap(ip, (struct maplock *) & xadlock, NULL, COMMIT_WMAP); in xtTruncate()
2509 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtTruncate()
2526 tlck = txLock(tid, ip, mp, tlckXTREE); in xtTruncate()
2542 txFreeMap(ip, (struct maplock *) & xadlock, in xtTruncate()
2545 BT_MARK_DIRTY(mp, ip); in xtTruncate()
2602 tlck = txLock(tid, ip, mp, tlckXTREE); in xtTruncate()
2614 txFreeMap(ip, (struct maplock *) & xadlock, NULL, in xtTruncate()
2617 BT_MARK_DIRTY(mp, ip); in xtTruncate()
2630 JFS_IP(ip)->mode2 |= INLINEEA; in xtTruncate()
2678 jfs_error(ip->i_sb, "stack overrun!\n"); in xtTruncate()
2703 if (S_ISDIR(ip->i_mode) && !newsize) in xtTruncate()
2704 ip->i_size = 1; /* fsck hates zero-length directories */ in xtTruncate()
2706 ip->i_size = newsize; in xtTruncate()
2709 dquot_free_block(ip, nfreed); in xtTruncate()
2715 txFreelock(ip); in xtTruncate()
2744 s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) in xtTruncate_pmap() argument
2770 xoff = (committed_size >> JFS_SBI(ip->i_sb)->l2bsize) - 1; in xtTruncate_pmap()
2771 rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0); in xtTruncate_pmap()
2775 XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in xtTruncate_pmap()
2779 jfs_error(ip->i_sb, "did not find extent\n"); in xtTruncate_pmap()
2794 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtTruncate_pmap()
2818 return (xoff + xlen) << JFS_SBI(ip->i_sb)->l2bsize; in xtTruncate_pmap()
2820 tlck = txLock(tid, ip, mp, tlckXTREE); in xtTruncate_pmap()
2839 XT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in xtTruncate_pmap()
2853 tlck = txLock(tid, ip, mp, tlckXTREE); in xtTruncate_pmap()
2878 jfs_error(ip->i_sb, "stack overrun!\n"); in xtTruncate_pmap()