Lines Matching refs:ip

152 static int dtSplitUp(tid_t tid, struct inode *ip,
155 static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split,
158 static int dtExtendPage(tid_t tid, struct inode *ip,
161 static int dtSplitRoot(tid_t tid, struct inode *ip,
164 static int dtDeleteUp(tid_t tid, struct inode *ip, struct metapage * fmp,
167 static int dtRelink(tid_t tid, struct inode *ip, dtpage_t * p);
169 static int dtReadFirst(struct inode *ip, struct btstack * btstack);
171 static int dtReadNext(struct inode *ip,
249 static struct dir_table_slot *find_index(struct inode *ip, u32 index, in find_index() argument
252 struct jfs_inode_info *jfs_ip = JFS_IP(ip); in find_index()
272 if (jfs_dirtable_inline(ip)) { in find_index()
282 JFS_SBI(ip->i_sb)->l2nbperpage; in find_index()
290 *mp = read_index_page(ip, blkno); in find_index()
304 static inline void lock_index(tid_t tid, struct inode *ip, struct metapage * mp, in lock_index() argument
311 tlck = txLock(tid, ip, mp, tlckDATA); in lock_index()
334 static u32 add_index(tid_t tid, struct inode *ip, s64 bn, int slot) in add_index() argument
336 struct super_block *sb = ip->i_sb; in add_index()
338 struct jfs_inode_info *jfs_ip = JFS_IP(ip); in add_index()
350 ASSERT(DO_INDEX(ip)); in add_index()
364 ip->i_size = (loff_t) (index - 1) << 3; in add_index()
374 set_cflag(COMMIT_Dirtable, ip); in add_index()
385 if (dquot_alloc_block(ip, sbi->nbperpage)) in add_index()
387 if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr)) { in add_index()
388 dquot_free_block(ip, sbi->nbperpage); in add_index()
401 xtInitRoot(tid, ip); in add_index()
406 if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) { in add_index()
411 dbFree(ip, xaddr, sbi->nbperpage); in add_index()
412 dquot_free_block(ip, sbi->nbperpage); in add_index()
415 ip->i_size = PSIZE; in add_index()
417 mp = get_index_page(ip, 0); in add_index()
420 xtTruncate(tid, ip, 0, COMMIT_PWMAP); in add_index()
425 tlck = txLock(tid, ip, mp, tlckDATA); in add_index()
442 clear_cflag(COMMIT_Dirtable, ip); in add_index()
453 if (xtInsert(tid, ip, 0, blkno, sbi->nbperpage, &xaddr, 0)) { in add_index()
457 ip->i_size += PSIZE; in add_index()
459 if ((mp = get_index_page(ip, blkno))) in add_index()
462 xtTruncate(tid, ip, offset, COMMIT_PWMAP); in add_index()
464 mp = read_index_page(ip, blkno); in add_index()
471 lock_index(tid, ip, mp, index); in add_index()
496 static void free_index(tid_t tid, struct inode *ip, u32 index, u32 next) in free_index() argument
502 dirtab_slot = find_index(ip, index, &mp, &lblock); in free_index()
512 lock_index(tid, ip, mp, index); in free_index()
516 set_cflag(COMMIT_Dirtable, ip); in free_index()
524 static void modify_index(tid_t tid, struct inode *ip, u32 index, s64 bn, in modify_index() argument
529 dirtab_slot = find_index(ip, index, mp, lblock); in modify_index()
538 lock_index(tid, ip, *mp, index); in modify_index()
541 set_cflag(COMMIT_Dirtable, ip); in modify_index()
549 static int read_index(struct inode *ip, u32 index, in read_index() argument
556 slot = find_index(ip, index, &mp, &lblock); in read_index()
580 int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, in dtSearch() argument
595 struct super_block *sb = ip->i_sb; in dtSearch()
635 DT_GETPAGE(ip, bn, mp, psize, p, rc); in dtSearch()
792 psize = lengthPXD(pxd) << JFS_SBI(ip->i_sb)->l2bsize; in dtSearch()
821 int dtInsert(tid_t tid, struct inode *ip, in dtInsert() argument
843 DT_GETSEARCH(ip, btstack->top, bn, mp, p, index); in dtInsert()
848 if (DO_INDEX(ip)) { in dtInsert()
849 if (JFS_IP(ip)->next_index == DIREND) { in dtInsert()
855 data.leaf.ip = ip; in dtInsert()
858 data.leaf.ip = NULL; /* signifies legacy directory format */ in dtInsert()
875 rc = dtSplitUp(tid, ip, &split, btstack); in dtInsert()
884 BT_MARK_DIRTY(mp, ip); in dtInsert()
888 tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY); in dtInsert()
931 struct inode *ip, struct dtsplit * split, struct btstack * btstack) in dtSplitUp() argument
933 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb); in dtSplitUp()
958 sp = DT_PAGE(ip, smp); in dtSplitUp()
986 if ((rc = dbAlloc(ip, 0, (s64) xlen, &xaddr))) { in dtSplitUp()
997 rc = dtSplitRoot(tid, ip, split, &rmp); in dtSplitUp()
1000 dbFree(ip, xaddr, xlen); in dtSplitUp()
1006 if (!DO_INDEX(ip)) in dtSplitUp()
1007 ip->i_size = xlen << sbi->l2bsize; in dtSplitUp()
1031 rc = dquot_alloc_block(ip, n); in dtSplitUp()
1046 if ((rc = dtExtendPage(tid, ip, split, btstack))) { in dtSplitUp()
1051 dbFree(ip, nxaddr, (s64) xlen); in dtSplitUp()
1056 dbFree(ip, xaddr, (s64) n); in dtSplitUp()
1058 } else if (!DO_INDEX(ip)) in dtSplitUp()
1059 ip->i_size = lengthPXD(pxd) << sbi->l2bsize; in dtSplitUp()
1082 if ((rc = dbAlloc(ip, 0, (s64) xlen, &xaddr)) == 0) { in dtSplitUp()
1096 if ((rc = dtSplitPage(tid, ip, split, &rmp, &rp, &rpxd))) { in dtSplitUp()
1103 if (!DO_INDEX(ip)) in dtSplitUp()
1104 ip->i_size += PSIZE; in dtSplitUp()
1138 DT_GETPAGE(ip, parent->bn, smp, PSIZE, sp, rc); in dtSplitUp()
1248 dtSplitRoot(tid, ip, split, &rmp) : in dtSplitUp()
1249 dtSplitPage(tid, ip, split, &rmp, &rp, &rpxd); in dtSplitUp()
1261 BT_MARK_DIRTY(smp, ip); in dtSplitUp()
1265 tlck = txLock(tid, ip, smp, tlckDTREE | tlckENTRY); in dtSplitUp()
1304 dbFree(ip, addressPXD(pxd), (s64) lengthPXD(pxd)); in dtSplitUp()
1311 dquot_free_block(ip, quota_allocation); in dtSplitUp()
1330 static int dtSplitPage(tid_t tid, struct inode *ip, struct dtsplit * split, in dtSplitPage() argument
1358 sp = DT_PAGE(ip, smp); in dtSplitPage()
1367 rmp = get_metapage(ip, rbn, PSIZE, 1); in dtSplitPage()
1372 rc = dquot_alloc_block(ip, lengthPXD(pxd)); in dtSplitPage()
1378 jfs_info("dtSplitPage: ip:0x%p smp:0x%p rmp:0x%p", ip, smp, rmp); in dtSplitPage()
1380 BT_MARK_DIRTY(rmp, ip); in dtSplitPage()
1384 tlck = txLock(tid, ip, rmp, tlckDTREE | tlckNEW); in dtSplitPage()
1391 BT_MARK_DIRTY(smp, ip); in dtSplitPage()
1397 tlck = txLock(tid, ip, smp, tlckDTREE | tlckENTRY); in dtSplitPage()
1475 DT_GETPAGE(ip, nextbn, mp, PSIZE, p, rc); in dtSplitPage()
1481 BT_MARK_DIRTY(mp, ip); in dtSplitPage()
1485 tlck = txLock(tid, ip, mp, tlckDTREE | tlckRELINK); in dtSplitPage()
1487 tlck, ip, mp); in dtSplitPage()
1525 if (DO_INDEX(ip)) in dtSplitPage()
1565 dtMoveEntry(sp, nxt, rp, &sdtlck, &rdtlck, DO_INDEX(ip)); in dtSplitPage()
1581 if ((rp->header.flag & BT_LEAF) && DO_INDEX(ip)) { in dtSplitPage()
1588 modify_index(tid, ip, le32_to_cpu(ldtentry->index), in dtSplitPage()
1643 struct inode *ip, struct dtsplit * split, struct btstack * btstack) in dtExtendPage() argument
1645 struct super_block *sb = ip->i_sb; in dtExtendPage()
1669 sp = DT_PAGE(ip, smp); in dtExtendPage()
1673 DT_GETPAGE(ip, parent->bn, pmp, PSIZE, pp, rc); in dtExtendPage()
1696 tlck = txMaplock(tid, ip, tlckDTREE | tlckRELOCATE); in dtExtendPage()
1705 if (DO_INDEX(ip)) { in dtExtendPage()
1713 modify_index(tid, ip, in dtExtendPage()
1727 jfs_info("dtExtendPage: ip:0x%p smp:0x%p sp:0x%p", ip, smp, sp); in dtExtendPage()
1729 BT_MARK_DIRTY(smp, ip); in dtExtendPage()
1733 tlck = txLock(tid, ip, smp, tlckDTREE | type); in dtExtendPage()
1823 BT_MARK_DIRTY(pmp, ip); in dtExtendPage()
1839 tlck = txLock(tid, ip, pmp, tlckDTREE | tlckENTRY); in dtExtendPage()
1876 struct inode *ip, struct dtsplit * split, struct metapage ** rmpp) in dtSplitRoot() argument
1878 struct super_block *sb = ip->i_sb; in dtSplitRoot()
1900 sp = &JFS_IP(ip)->i_dtroot; in dtSplitRoot()
1914 rmp = get_metapage(ip, rbn, xsize, 1); in dtSplitRoot()
1921 rc = dquot_alloc_block(ip, lengthPXD(pxd)); in dtSplitRoot()
1927 BT_MARK_DIRTY(rmp, ip); in dtSplitRoot()
1931 tlck = txLock(tid, ip, rmp, tlckDTREE | tlckNEW); in dtSplitRoot()
1995 if ((rp->header.flag & BT_LEAF) && DO_INDEX(ip)) { in dtSplitRoot()
2003 modify_index(tid, ip, le32_to_cpu(ldtentry->index), in dtSplitRoot()
2024 BT_MARK_DIRTY(smp, ip); in dtSplitRoot()
2028 tlck = txLock(tid, ip, smp, tlckDTREE | tlckNEW | tlckBTROOT); in dtSplitRoot()
2083 struct inode *ip, struct component_name * key, ino_t * ino, int flag) in dtDelete() argument
2106 if ((rc = dtSearch(ip, key, ino, &btstack, flag))) in dtDelete()
2110 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in dtDelete()
2117 if (DO_INDEX(ip)) { in dtDelete()
2130 DT_GETPAGE(ip, le64_to_cpu(p->header.next), in dtDelete()
2149 free_index(tid, ip, table_index, next_index); in dtDelete()
2156 rc = dtDeleteUp(tid, ip, mp, p, &btstack); in dtDelete()
2164 BT_MARK_DIRTY(mp, ip); in dtDelete()
2168 tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY); in dtDelete()
2204 if (DO_INDEX(ip) && index < p->header.nextindex) { in dtDelete()
2212 modify_index(tid, ip, in dtDelete()
2237 static int dtDeleteUp(tid_t tid, struct inode *ip, in dtDeleteUp() argument
2261 dtInitRoot(tid, ip, PARENT(ip)); in dtDeleteUp()
2278 tlck = txMaplock(tid, ip, tlckDTREE | tlckFREE); in dtDeleteUp()
2285 if ((rc = dtRelink(tid, ip, fp))) { in dtDeleteUp()
2293 dquot_free_block(ip, xlen); in dtDeleteUp()
2308 DT_GETPAGE(ip, parent->bn, mp, PSIZE, p, rc); in dtDeleteUp()
2337 dtInitRoot(tid, ip, PARENT(ip)); in dtDeleteUp()
2353 txMaplock(tid, ip, in dtDeleteUp()
2361 if ((rc = dtRelink(tid, ip, p))) { in dtDeleteUp()
2369 dquot_free_block(ip, xlen); in dtDeleteUp()
2384 BT_MARK_DIRTY(mp, ip); in dtDeleteUp()
2390 tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY); in dtDeleteUp()
2432 if (!DO_INDEX(ip)) in dtDeleteUp()
2433 ip->i_size -= PSIZE; in dtDeleteUp()
2445 int dtRelocate(tid_t tid, struct inode *ip, s64 lmxaddr, pxd_t * opxd, in dtRelocate() argument
2474 rc = dtSearchNode(ip, lmxaddr, opxd, &btstack); in dtRelocate()
2479 DT_GETSEARCH(ip, btstack.top, bn, pmp, pp, index); in dtRelocate()
2486 DT_GETPAGE(ip, oxaddr, mp, PSIZE, p, rc); in dtRelocate()
2499 DT_GETPAGE(ip, nextbn, rmp, PSIZE, rp, rc); in dtRelocate()
2510 DT_GETPAGE(ip, prevbn, lmp, PSIZE, lp, rc); in dtRelocate()
2526 tlck = txLock(tid, ip, lmp, tlckDTREE | tlckRELINK); in dtRelocate()
2540 tlck = txLock(tid, ip, rmp, tlckDTREE | tlckRELINK); in dtRelocate()
2562 tlck = txLock(tid, ip, mp, tlckDTREE | tlckNEW); in dtRelocate()
2580 xsize = xlen << JFS_SBI(ip->i_sb)->l2bsize; in dtRelocate()
2599 tlck = txMaplock(tid, ip, tlckDTREE | tlckFREE); in dtRelocate()
2613 tlck = txLock(tid, ip, pmp, tlckDTREE | tlckENTRY); in dtRelocate()
2642 static int dtSearchNode(struct inode *ip, s64 lmxaddr, pxd_t * kpxd, in dtSearchNode() argument
2664 DT_GETPAGE(ip, bn, mp, psize, p, rc); in dtSearchNode()
2691 psize = lengthPXD(pxd) << JFS_SBI(ip->i_sb)->l2bsize; in dtSearchNode()
2728 DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in dtSearchNode()
2747 static int dtRelink(tid_t tid, struct inode *ip, dtpage_t * p) in dtRelink() argument
2761 DT_GETPAGE(ip, nextbn, mp, PSIZE, p, rc); in dtRelink()
2765 BT_MARK_DIRTY(mp, ip); in dtRelink()
2771 tlck = txLock(tid, ip, mp, tlckDTREE | tlckRELINK); in dtRelink()
2773 tlck, ip, mp); in dtRelink()
2790 DT_GETPAGE(ip, prevbn, mp, PSIZE, p, rc); in dtRelink()
2794 BT_MARK_DIRTY(mp, ip); in dtRelink()
2800 tlck = txLock(tid, ip, mp, tlckDTREE | tlckRELINK); in dtRelink()
2802 tlck, ip, mp); in dtRelink()
2826 void dtInitRoot(tid_t tid, struct inode *ip, u32 idotdot) in dtInitRoot() argument
2828 struct jfs_inode_info *jfs_ip = JFS_IP(ip); in dtInitRoot()
2841 if (DO_INDEX(ip)) { in dtInitRoot()
2842 if (!jfs_dirtable_inline(ip)) { in dtInitRoot()
2860 xtTruncate(tid, ip, 0, COMMIT_PWMAP); in dtInitRoot()
2861 set_cflag(COMMIT_Stale, ip); in dtInitRoot()
2865 ip->i_size = 1; in dtInitRoot()
2869 ip->i_size = IDATASIZE; in dtInitRoot()
2876 tlck = txLock(tid, ip, (struct metapage *) & jfs_ip->bxflag, in dtInitRoot()
3007 struct inode *ip = file_inode(file); in jfs_readdir() local
3008 struct nls_table *codepage = JFS_SBI(ip->i_sb)->nls_tab; in jfs_readdir()
3039 if (DO_INDEX(ip)) { in jfs_readdir()
3061 if (dtEmpty(ip) || in jfs_readdir()
3062 (dir_index >= JFS_IP(ip)->next_index)) { in jfs_readdir()
3068 rc = read_index(ip, dir_index, &dirtab_slot); in jfs_readdir()
3074 if (loop_count++ > JFS_IP(ip)->next_index) { in jfs_readdir()
3089 DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in jfs_readdir()
3106 if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR)) in jfs_readdir()
3113 if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR)) in jfs_readdir()
3119 if (dtEmpty(ip)) { in jfs_readdir()
3124 if ((rc = dtReadFirst(ip, &btstack))) in jfs_readdir()
3127 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in jfs_readdir()
3142 if (!dir_emit(ctx, ".", 1, ip->i_ino, DT_DIR)) in jfs_readdir()
3151 if (!dir_emit(ctx, "..", 2, PARENT(ip), DT_DIR)) in jfs_readdir()
3162 if (dtEmpty(ip)) { in jfs_readdir()
3167 if ((rc = dtReadNext(ip, &ctx->pos, &btstack))) { in jfs_readdir()
3174 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in jfs_readdir()
3225 JFS_IP(ip)->next_index)) { in jfs_readdir()
3226 if (!page_fixed && !isReadOnly(ip)) { in jfs_readdir()
3264 jfs_error(ip->i_sb, in jfs_readdir()
3266 (long)ip->i_ino, in jfs_readdir()
3316 add_missing_indices(ip, bn); in jfs_readdir()
3325 DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in jfs_readdir()
3344 static int dtReadFirst(struct inode *ip, struct btstack * btstack) in dtReadFirst() argument
3363 DT_GETPAGE(ip, bn, mp, psize, p, rc); in dtReadFirst()
3385 jfs_error(ip->i_sb, "btstack overrun\n"); in dtReadFirst()
3398 psize = lengthPXD(xd) << JFS_SBI(ip->i_sb)->l2bsize; in dtReadFirst()
3416 static int dtReadNext(struct inode *ip, loff_t * offset, in dtReadNext() argument
3437 if ((rc = dtReadFirst(ip, btstack))) in dtReadNext()
3441 DT_GETSEARCH(ip, btstack->top, bn, mp, p, index); in dtReadNext()
3500 DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in dtReadNext()
3521 DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in dtReadNext()
3541 DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in dtReadNext()
3562 DT_GETPAGE(ip, bn, mp, PSIZE, p, rc); in dtReadNext()
3947 if (data->leaf.ip) { in dtInsertEntry()
3952 data->leaf.ip, in dtInsertEntry()
4031 if ((p->header.flag & BT_LEAF) && data->leaf.ip) { in dtInsertEntry()
4041 modify_index(data->leaf.tid, data->leaf.ip, in dtInsertEntry()
4521 int dtModify(tid_t tid, struct inode *ip, in dtModify() argument
4542 if ((rc = dtSearch(ip, key, orig_ino, &btstack, flag))) in dtModify()
4546 DT_GETSEARCH(ip, btstack.top, bn, mp, p, index); in dtModify()
4548 BT_MARK_DIRTY(mp, ip); in dtModify()
4552 tlck = txLock(tid, ip, mp, tlckDTREE | tlckENTRY); in dtModify()