Lines Matching refs:dip
606 static int dirent_check_reclen(struct gfs2_inode *dip, in dirent_check_reclen() argument
620 gfs2_consist_inode(dip); in dirent_check_reclen()
633 static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh, in dirent_next() argument
640 ret = dirent_check_reclen(dip, cur, bh_end); in dirent_next()
645 ret = dirent_check_reclen(dip, tmp, bh_end); in dirent_next()
651 gfs2_consist_inode(dip); in dirent_next()
668 static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh, in dirent_del() argument
674 gfs2_consist_inode(dip); in dirent_del()
678 gfs2_trans_add_meta(dip->i_gl, bh); in dirent_del()
696 gfs2_consist_inode(dip); in dirent_del()
698 gfs2_consist_inode(dip); in dirent_del()
755 static int get_leaf(struct gfs2_inode *dip, u64 leaf_no, in get_leaf() argument
760 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, 0, bhp); in get_leaf()
761 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) { in get_leaf()
778 static int get_leaf_nr(struct gfs2_inode *dip, u32 index, u64 *leaf_out) in get_leaf_nr() argument
783 hash = gfs2_dir_get_hash_table(dip); in get_leaf_nr()
792 static int get_first_leaf(struct gfs2_inode *dip, u32 index, in get_first_leaf() argument
798 error = get_leaf_nr(dip, index, &leaf_no); in get_first_leaf()
800 error = get_leaf(dip, leaf_no, bh_out); in get_first_leaf()
906 struct gfs2_inode *dip = GFS2_I(inode); in dir_make_exhash() local
918 error = gfs2_meta_inode_buffer(dip, &dibh); in dir_make_exhash()
929 gfs2_assert(sdp, dip->i_entries < BIT(16)); in dir_make_exhash()
930 leaf->lf_entries = cpu_to_be16(dip->i_entries); in dir_make_exhash()
943 dent = gfs2_dirent_scan(&dip->i_inode, bh->b_data, bh->b_size, in dir_make_exhash()
968 gfs2_trans_add_meta(dip->i_gl, dibh); in dir_make_exhash()
977 gfs2_add_inode_blocks(&dip->i_inode, 1); in dir_make_exhash()
978 dip->i_diskflags |= GFS2_DIF_EXHASH; in dir_make_exhash()
981 dip->i_depth = y; in dir_make_exhash()
983 gfs2_dinode_out(dip, dibh->b_data); in dir_make_exhash()
1000 struct gfs2_inode *dip = GFS2_I(inode); in dir_split_leaf() local
1011 index = name->hash >> (32 - dip->i_depth); in dir_split_leaf()
1012 error = get_leaf_nr(dip, index, &leaf_no); in dir_split_leaf()
1017 error = get_leaf(dip, leaf_no, &obh); in dir_split_leaf()
1022 if (dip->i_depth == be16_to_cpu(oleaf->lf_depth)) { in dir_split_leaf()
1027 gfs2_trans_add_meta(dip->i_gl, obh); in dir_split_leaf()
1037 len = BIT(dip->i_depth - be16_to_cpu(oleaf->lf_depth)); in dir_split_leaf()
1041 dip->i_depth, be16_to_cpu(oleaf->lf_depth), index); in dir_split_leaf()
1042 gfs2_consist_inode(dip); in dir_split_leaf()
1062 gfs2_dir_hash_inval(dip); in dir_split_leaf()
1064 error = gfs2_dir_write_data(dip, (char *)lp, start * sizeof(u64), in dir_split_leaf()
1075 divider = (start + half_len) << (32 - dip->i_depth); in dir_split_leaf()
1082 if (dirent_next(dip, obh, &next)) in dir_split_leaf()
1102 dirent_del(dip, obh, prev, dent); in dir_split_leaf()
1105 gfs2_consist_inode(dip); in dir_split_leaf()
1118 error = gfs2_meta_inode_buffer(dip, &dibh); in dir_split_leaf()
1119 if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) { in dir_split_leaf()
1120 gfs2_trans_add_meta(dip->i_gl, dibh); in dir_split_leaf()
1121 gfs2_add_inode_blocks(&dip->i_inode, 1); in dir_split_leaf()
1122 gfs2_dinode_out(dip, dibh->b_data); in dir_split_leaf()
1147 static int dir_double_exhash(struct gfs2_inode *dip) in dir_double_exhash() argument
1157 hsize = BIT(dip->i_depth); in dir_double_exhash()
1160 hc = gfs2_dir_get_hash_table(dip); in dir_double_exhash()
1172 error = gfs2_meta_inode_buffer(dip, &dibh); in dir_double_exhash()
1182 error = gfs2_dir_write_data(dip, (char *)hc2, 0, hsize_bytes * 2); in dir_double_exhash()
1186 gfs2_dir_hash_inval(dip); in dir_double_exhash()
1187 dip->i_hash_cache = hc2; in dir_double_exhash()
1188 dip->i_depth++; in dir_double_exhash()
1189 gfs2_dinode_out(dip, dibh->b_data); in dir_double_exhash()
1195 gfs2_dir_write_data(dip, (char *)hc, 0, hsize_bytes); in dir_double_exhash()
1196 i_size_write(&dip->i_inode, hsize_bytes); in dir_double_exhash()
1197 gfs2_dinode_out(dip, dibh->b_data); in dir_double_exhash()
1263 static int do_filldir_main(struct gfs2_inode *dip, struct dir_context *ctx, in do_filldir_main() argument
1532 struct gfs2_inode *dip = GFS2_I(inode); in dir_e_read() local
1540 hsize = BIT(dip->i_depth); in dir_e_read()
1542 index = hash >> (32 - dip->i_depth); in dir_e_read()
1544 if (dip->i_hash_cache == NULL) in dir_e_read()
1546 lp = gfs2_dir_get_hash_table(dip); in dir_e_read()
1559 len = BIT(dip->i_depth - depth); in dir_e_read()
1571 struct gfs2_inode *dip = GFS2_I(inode); in gfs2_dir_read() local
1579 if (!dip->i_entries) in gfs2_dir_read()
1582 if (dip->i_diskflags & GFS2_DIF_EXHASH) in gfs2_dir_read()
1585 if (!gfs2_is_stuffed(dip)) { in gfs2_dir_read()
1586 gfs2_consist_inode(dip); in gfs2_dir_read()
1590 error = gfs2_meta_inode_buffer(dip, &dibh); in gfs2_dir_read()
1606 if (dip->i_entries != g.offset) { in gfs2_dir_read()
1609 (unsigned long long)dip->i_no_addr, in gfs2_dir_read()
1610 dip->i_entries, in gfs2_dir_read()
1612 gfs2_consist_inode(dip); in gfs2_dir_read()
1616 gfs2_set_cookies(sdp, dibh, 0, darr, dip->i_entries); in gfs2_dir_read()
1617 error = do_filldir_main(dip, ctx, darr, in gfs2_dir_read()
1618 dip->i_entries, 0, &copied); in gfs2_dir_read()
1875 int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry) in gfs2_dir_del() argument
1880 struct timespec64 tv = current_time(&dip->i_inode); in gfs2_dir_del()
1884 dent = gfs2_dirent_search(&dip->i_inode, name, gfs2_dirent_prev, &bh); in gfs2_dir_del()
1886 gfs2_consist_inode(dip); in gfs2_dir_del()
1890 gfs2_consist_inode(dip); in gfs2_dir_del()
1899 dirent_del(dip, bh, prev, dent); in gfs2_dir_del()
1900 if (dip->i_diskflags & GFS2_DIF_EXHASH) { in gfs2_dir_del()
1904 gfs2_consist_inode(dip); in gfs2_dir_del()
1911 if (!dip->i_entries) in gfs2_dir_del()
1912 gfs2_consist_inode(dip); in gfs2_dir_del()
1913 dip->i_entries--; in gfs2_dir_del()
1914 dip->i_inode.i_mtime = dip->i_inode.i_ctime = tv; in gfs2_dir_del()
1916 drop_nlink(&dip->i_inode); in gfs2_dir_del()
1917 mark_inode_dirty(&dip->i_inode); in gfs2_dir_del()
1936 int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, in gfs2_dir_mvino() argument
1942 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh); in gfs2_dir_mvino()
1944 gfs2_consist_inode(dip); in gfs2_dir_mvino()
1950 gfs2_trans_add_meta(dip->i_gl, bh); in gfs2_dir_mvino()
1955 dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode); in gfs2_dir_mvino()
1956 mark_inode_dirty_sync(&dip->i_inode); in gfs2_dir_mvino()
1972 static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, in leaf_dealloc() argument
1976 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in leaf_dealloc()
1998 error = gfs2_quota_hold(dip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE); in leaf_dealloc()
2007 error = get_leaf(dip, blk, &bh); in leaf_dealloc()
2016 gfs2_rlist_add(dip, &rlist, blk); in leaf_dealloc()
2045 error = get_leaf(dip, blk, &bh); in leaf_dealloc()
2055 gfs2_free_meta(dip, rgd, blk, 1); in leaf_dealloc()
2056 gfs2_add_inode_blocks(&dip->i_inode, -1); in leaf_dealloc()
2059 error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size); in leaf_dealloc()
2066 error = gfs2_meta_inode_buffer(dip, &dibh); in leaf_dealloc()
2070 gfs2_trans_add_meta(dip->i_gl, dibh); in leaf_dealloc()
2074 dip->i_inode.i_mode = S_IFREG; in leaf_dealloc()
2075 gfs2_dinode_out(dip, dibh->b_data); in leaf_dealloc()
2084 gfs2_quota_unhold(dip); in leaf_dealloc()
2100 int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip) in gfs2_dir_exhash_dealloc() argument
2110 hsize = BIT(dip->i_depth); in gfs2_dir_exhash_dealloc()
2112 lp = gfs2_dir_get_hash_table(dip); in gfs2_dir_exhash_dealloc()
2119 error = get_leaf(dip, leaf_no, &bh); in gfs2_dir_exhash_dealloc()
2123 len = BIT(dip->i_depth - be16_to_cpu(leaf->lf_depth)); in gfs2_dir_exhash_dealloc()
2127 error = leaf_dealloc(dip, index, len, leaf_no, bh, in gfs2_dir_exhash_dealloc()
2138 gfs2_consist_inode(dip); in gfs2_dir_exhash_dealloc()