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
1531 struct gfs2_inode *dip = GFS2_I(inode); in dir_e_read() local
1539 hsize = BIT(dip->i_depth); in dir_e_read()
1541 index = hash >> (32 - dip->i_depth); in dir_e_read()
1543 if (dip->i_hash_cache == NULL) in dir_e_read()
1545 lp = gfs2_dir_get_hash_table(dip); in dir_e_read()
1558 len = BIT(dip->i_depth - depth); in dir_e_read()
1570 struct gfs2_inode *dip = GFS2_I(inode); in gfs2_dir_read() local
1578 if (!dip->i_entries) in gfs2_dir_read()
1581 if (dip->i_diskflags & GFS2_DIF_EXHASH) in gfs2_dir_read()
1584 if (!gfs2_is_stuffed(dip)) { in gfs2_dir_read()
1585 gfs2_consist_inode(dip); in gfs2_dir_read()
1589 error = gfs2_meta_inode_buffer(dip, &dibh); in gfs2_dir_read()
1605 if (dip->i_entries != g.offset) { in gfs2_dir_read()
1608 (unsigned long long)dip->i_no_addr, in gfs2_dir_read()
1609 dip->i_entries, in gfs2_dir_read()
1611 gfs2_consist_inode(dip); in gfs2_dir_read()
1615 gfs2_set_cookies(sdp, dibh, 0, darr, dip->i_entries); in gfs2_dir_read()
1616 error = do_filldir_main(dip, ctx, darr, in gfs2_dir_read()
1617 dip->i_entries, 0, &copied); in gfs2_dir_read()
1874 int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry) in gfs2_dir_del() argument
1879 struct timespec64 tv = current_time(&dip->i_inode); in gfs2_dir_del()
1883 dent = gfs2_dirent_search(&dip->i_inode, name, gfs2_dirent_prev, &bh); in gfs2_dir_del()
1885 gfs2_consist_inode(dip); in gfs2_dir_del()
1889 gfs2_consist_inode(dip); in gfs2_dir_del()
1898 dirent_del(dip, bh, prev, dent); in gfs2_dir_del()
1899 if (dip->i_diskflags & GFS2_DIF_EXHASH) { in gfs2_dir_del()
1903 gfs2_consist_inode(dip); in gfs2_dir_del()
1910 if (!dip->i_entries) in gfs2_dir_del()
1911 gfs2_consist_inode(dip); in gfs2_dir_del()
1912 dip->i_entries--; in gfs2_dir_del()
1913 dip->i_inode.i_mtime = dip->i_inode.i_ctime = tv; in gfs2_dir_del()
1915 drop_nlink(&dip->i_inode); in gfs2_dir_del()
1916 mark_inode_dirty(&dip->i_inode); in gfs2_dir_del()
1935 int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename, in gfs2_dir_mvino() argument
1941 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh); in gfs2_dir_mvino()
1943 gfs2_consist_inode(dip); in gfs2_dir_mvino()
1949 gfs2_trans_add_meta(dip->i_gl, bh); in gfs2_dir_mvino()
1954 dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode); in gfs2_dir_mvino()
1955 mark_inode_dirty_sync(&dip->i_inode); in gfs2_dir_mvino()
1971 static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, in leaf_dealloc() argument
1975 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); in leaf_dealloc()
1997 error = gfs2_quota_hold(dip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE); in leaf_dealloc()
2006 error = get_leaf(dip, blk, &bh); in leaf_dealloc()
2015 gfs2_rlist_add(dip, &rlist, blk); in leaf_dealloc()
2044 error = get_leaf(dip, blk, &bh); in leaf_dealloc()
2054 gfs2_free_meta(dip, rgd, blk, 1); in leaf_dealloc()
2055 gfs2_add_inode_blocks(&dip->i_inode, -1); in leaf_dealloc()
2058 error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size); in leaf_dealloc()
2065 error = gfs2_meta_inode_buffer(dip, &dibh); in leaf_dealloc()
2069 gfs2_trans_add_meta(dip->i_gl, dibh); in leaf_dealloc()
2073 dip->i_inode.i_mode = S_IFREG; in leaf_dealloc()
2074 gfs2_dinode_out(dip, dibh->b_data); in leaf_dealloc()
2083 gfs2_quota_unhold(dip); in leaf_dealloc()
2099 int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip) in gfs2_dir_exhash_dealloc() argument
2109 hsize = BIT(dip->i_depth); in gfs2_dir_exhash_dealloc()
2111 lp = gfs2_dir_get_hash_table(dip); in gfs2_dir_exhash_dealloc()
2118 error = get_leaf(dip, leaf_no, &bh); in gfs2_dir_exhash_dealloc()
2122 len = BIT(dip->i_depth - be16_to_cpu(leaf->lf_depth)); in gfs2_dir_exhash_dealloc()
2126 error = leaf_dealloc(dip, index, len, leaf_no, bh, in gfs2_dir_exhash_dealloc()
2137 gfs2_consist_inode(dip); in gfs2_dir_exhash_dealloc()