Lines Matching refs:dip
85 typedef int (*leaf_call_t) (struct gfs2_inode *dip, u32 index, u32 len,
532 static int dirent_check_reclen(struct gfs2_inode *dip, in dirent_check_reclen() argument
546 gfs2_consist_inode(dip); in dirent_check_reclen()
559 static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh, in dirent_next() argument
566 ret = dirent_check_reclen(dip, cur, bh_end); in dirent_next()
571 ret = dirent_check_reclen(dip, tmp, bh_end); in dirent_next()
577 gfs2_consist_inode(dip); in dirent_next()
594 static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, in dirent_del() argument
600 gfs2_consist_inode(dip); in dirent_del()
604 gfs2_trans_add_bh(dip->i_gl, bh, 1); in dirent_del()
622 gfs2_consist_inode(dip); in dirent_del()
624 gfs2_consist_inode(dip); in dirent_del()
666 static int get_leaf(struct gfs2_inode *dip, u64 leaf_no, in get_leaf() argument
671 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, bhp); in get_leaf()
672 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) { in get_leaf()
689 static int get_leaf_nr(struct gfs2_inode *dip, u32 index, in get_leaf_nr() argument
695 error = gfs2_dir_read_data(dip, (char *)&leaf_no, in get_leaf_nr()
706 static int get_first_leaf(struct gfs2_inode *dip, u32 index, in get_first_leaf() argument
712 error = get_leaf_nr(dip, index, &leaf_no); in get_first_leaf()
714 error = get_leaf(dip, leaf_no, bh_out); in get_first_leaf()
816 struct gfs2_inode *dip = GFS2_I(inode); in dir_make_exhash() local
828 error = gfs2_meta_inode_buffer(dip, &dibh); in dir_make_exhash()
839 gfs2_assert(sdp, dip->i_entries < (1 << 16)); in dir_make_exhash()
840 leaf->lf_entries = cpu_to_be16(dip->i_entries); in dir_make_exhash()
853 dent = gfs2_dirent_scan(&dip->i_inode, bh->b_data, bh->b_size, in dir_make_exhash()
878 gfs2_trans_add_bh(dip->i_gl, dibh, 1); in dir_make_exhash()
887 gfs2_add_inode_blocks(&dip->i_inode, 1); in dir_make_exhash()
888 dip->i_diskflags |= GFS2_DIF_EXHASH; in dir_make_exhash()
891 dip->i_depth = y; in dir_make_exhash()
893 gfs2_dinode_out(dip, dibh->b_data); in dir_make_exhash()
911 struct gfs2_inode *dip = GFS2_I(inode); in dir_split_leaf() local
922 index = name->hash >> (32 - dip->i_depth); in dir_split_leaf()
923 error = get_leaf_nr(dip, index, &leaf_no); in dir_split_leaf()
928 error = get_leaf(dip, leaf_no, &obh); in dir_split_leaf()
933 if (dip->i_depth == be16_to_cpu(oleaf->lf_depth)) { in dir_split_leaf()
938 gfs2_trans_add_bh(dip->i_gl, obh, 1); in dir_split_leaf()
948 len = 1 << (dip->i_depth - be16_to_cpu(oleaf->lf_depth)); in dir_split_leaf()
951 …printk(KERN_WARNING "i_depth %u lf_depth %u index %u\n", dip->i_depth, be16_to_cpu(oleaf->lf_depth… in dir_split_leaf()
952 gfs2_consist_inode(dip); in dir_split_leaf()
972 error = gfs2_dir_write_data(dip, (char *)lp, start * sizeof(u64), in dir_split_leaf()
983 divider = (start + half_len) << (32 - dip->i_depth); in dir_split_leaf()
990 if (dirent_next(dip, obh, &next)) in dir_split_leaf()
1009 dirent_del(dip, obh, prev, dent); in dir_split_leaf()
1012 gfs2_consist_inode(dip); in dir_split_leaf()
1027 error = gfs2_meta_inode_buffer(dip, &dibh); in dir_split_leaf()
1028 if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) { in dir_split_leaf()
1029 gfs2_trans_add_bh(dip->i_gl, dibh, 1); in dir_split_leaf()
1030 gfs2_add_inode_blocks(&dip->i_inode, 1); in dir_split_leaf()
1031 gfs2_dinode_out(dip, dibh->b_data); in dir_split_leaf()
1056 static int dir_double_exhash(struct gfs2_inode *dip) in dir_double_exhash() argument
1058 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in dir_double_exhash()
1064 u64 disksize = i_size_read(&dip->i_inode); in dir_double_exhash()
1068 hsize = 1 << dip->i_depth; in dir_double_exhash()
1070 gfs2_consist_inode(dip); in dir_double_exhash()
1081 error = gfs2_dir_read_data(dip, (char *)buf, in dir_double_exhash()
1098 error = gfs2_dir_write_data(dip, in dir_double_exhash()
1111 error = gfs2_meta_inode_buffer(dip, &dibh); in dir_double_exhash()
1113 dip->i_depth++; in dir_double_exhash()
1114 gfs2_dinode_out(dip, dibh->b_data); in dir_double_exhash()
1185 static int do_filldir_main(struct gfs2_inode *dip, u64 *offset, in do_filldir_main() argument
1367 struct gfs2_inode *dip = GFS2_I(inode); in dir_e_read() local
1377 hsize = 1 << dip->i_depth; in dir_e_read()
1379 gfs2_consist_inode(dip); in dir_e_read()
1384 index = hash >> (32 - dip->i_depth); in dir_e_read()
1395 error = gfs2_dir_read_data(dip, (char *)lp, in dir_e_read()
1412 len = 1 << (dip->i_depth - depth); in dir_e_read()
1426 struct gfs2_inode *dip = GFS2_I(inode); in gfs2_dir_read() local
1434 if (!dip->i_entries) in gfs2_dir_read()
1437 if (dip->i_diskflags & GFS2_DIF_EXHASH) in gfs2_dir_read()
1440 if (!gfs2_is_stuffed(dip)) { in gfs2_dir_read()
1441 gfs2_consist_inode(dip); in gfs2_dir_read()
1445 error = gfs2_meta_inode_buffer(dip, &dibh); in gfs2_dir_read()
1461 if (dip->i_entries != g.offset) { in gfs2_dir_read()
1464 (unsigned long long)dip->i_no_addr, in gfs2_dir_read()
1465 dip->i_entries, in gfs2_dir_read()
1470 error = do_filldir_main(dip, offset, opaque, filldir, darr, in gfs2_dir_read()
1471 dip->i_entries, &copied); in gfs2_dir_read()
1675 int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name) in gfs2_dir_del() argument
1683 dent = gfs2_dirent_search(&dip->i_inode, name, gfs2_dirent_prev, &bh); in gfs2_dir_del()
1685 gfs2_consist_inode(dip); in gfs2_dir_del()
1689 gfs2_consist_inode(dip); in gfs2_dir_del()
1698 dirent_del(dip, bh, prev, dent); in gfs2_dir_del()
1699 if (dip->i_diskflags & GFS2_DIF_EXHASH) { in gfs2_dir_del()
1703 gfs2_consist_inode(dip); in gfs2_dir_del()
1708 error = gfs2_meta_inode_buffer(dip, &bh); in gfs2_dir_del()
1712 if (!dip->i_entries) in gfs2_dir_del()
1713 gfs2_consist_inode(dip); in gfs2_dir_del()
1714 gfs2_trans_add_bh(dip->i_gl, bh, 1); in gfs2_dir_del()
1715 dip->i_entries--; in gfs2_dir_del()
1716 dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME; in gfs2_dir_del()
1717 gfs2_dinode_out(dip, bh->b_data); in gfs2_dir_del()
1719 mark_inode_dirty(&dip->i_inode); in gfs2_dir_del()
1737 int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, in gfs2_dir_mvino() argument
1744 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh); in gfs2_dir_mvino()
1746 gfs2_consist_inode(dip); in gfs2_dir_mvino()
1752 gfs2_trans_add_bh(dip->i_gl, bh, 1); in gfs2_dir_mvino()
1756 if (dip->i_diskflags & GFS2_DIF_EXHASH) { in gfs2_dir_mvino()
1758 error = gfs2_meta_inode_buffer(dip, &bh); in gfs2_dir_mvino()
1761 gfs2_trans_add_bh(dip->i_gl, bh, 1); in gfs2_dir_mvino()
1764 dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME; in gfs2_dir_mvino()
1765 gfs2_dinode_out(dip, bh->b_data); in gfs2_dir_mvino()
1779 static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) in foreach_leaf() argument
1781 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in foreach_leaf()
1791 hsize = 1 << dip->i_depth; in foreach_leaf()
1792 if (hsize * sizeof(u64) != i_size_read(&dip->i_inode)) { in foreach_leaf()
1793 gfs2_consist_inode(dip); in foreach_leaf()
1806 error = gfs2_dir_read_data(dip, (char *)lp, in foreach_leaf()
1819 error = get_leaf(dip, leaf_no, &bh); in foreach_leaf()
1823 len = 1 << (dip->i_depth - be16_to_cpu(leaf->lf_depth)); in foreach_leaf()
1826 error = lc(dip, index, len, leaf_no, data); in foreach_leaf()
1836 gfs2_consist_inode(dip); in foreach_leaf()
1857 static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, in leaf_dealloc() argument
1860 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in leaf_dealloc()
1876 if (!gfs2_alloc_get(dip)) { in leaf_dealloc()
1881 error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); in leaf_dealloc()
1885 error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh); in leaf_dealloc()
1892 error = get_leaf(dip, blk, &bh); in leaf_dealloc()
1922 error = get_leaf(dip, blk, &bh); in leaf_dealloc()
1929 gfs2_free_meta(dip, blk, 1); in leaf_dealloc()
1930 gfs2_add_inode_blocks(&dip->i_inode, -1); in leaf_dealloc()
1933 error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size); in leaf_dealloc()
1940 error = gfs2_meta_inode_buffer(dip, &dibh); in leaf_dealloc()
1944 gfs2_trans_add_bh(dip->i_gl, dibh, 1); in leaf_dealloc()
1945 gfs2_dinode_out(dip, dibh->b_data); in leaf_dealloc()
1954 gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh); in leaf_dealloc()
1956 gfs2_quota_unhold(dip); in leaf_dealloc()
1958 gfs2_alloc_put(dip); in leaf_dealloc()
1974 int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip) in gfs2_dir_exhash_dealloc() argument
1976 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in gfs2_dir_exhash_dealloc()
1981 error = foreach_leaf(dip, leaf_dealloc, NULL); in gfs2_dir_exhash_dealloc()
1992 error = gfs2_meta_inode_buffer(dip, &bh); in gfs2_dir_exhash_dealloc()
1994 gfs2_trans_add_bh(dip->i_gl, bh, 1); in gfs2_dir_exhash_dealloc()