Lines Matching refs:dip
36 * dip->i_diskflags & GFS2_DIF_EXHASH is true
607 static int dirent_check_reclen(struct gfs2_inode *dip,
621 gfs2_consist_inode(dip);
627 * @dip: the directory
634 static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh,
641 ret = dirent_check_reclen(dip, cur, bh_end);
646 ret = dirent_check_reclen(dip, tmp, bh_end);
652 gfs2_consist_inode(dip);
662 * @dip: The GFS2 inode
669 static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh,
675 gfs2_consist_inode(dip);
679 gfs2_trans_add_meta(dip->i_gl, bh);
697 gfs2_consist_inode(dip);
699 gfs2_consist_inode(dip);
756 static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
761 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, 0, bhp);
762 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
772 * @dip: The GFS2 inode
779 static int get_leaf_nr(struct gfs2_inode *dip, u32 index,
785 hash = gfs2_dir_get_hash_table(dip);
794 static int get_first_leaf(struct gfs2_inode *dip, u32 index,
800 error = get_leaf_nr(dip, index, &leaf_no);
802 error = get_leaf(dip, leaf_no, bh_out);
901 * @dip: The GFS2 inode
908 struct gfs2_inode *dip = GFS2_I(inode);
920 error = gfs2_meta_inode_buffer(dip, &dibh);
931 gfs2_assert(sdp, dip->i_entries < BIT(16));
932 leaf->lf_entries = cpu_to_be16(dip->i_entries);
945 dent = gfs2_dirent_scan(&dip->i_inode, bh->b_data, bh->b_size,
970 gfs2_trans_add_meta(dip->i_gl, dibh);
979 gfs2_add_inode_blocks(&dip->i_inode, 1);
980 dip->i_diskflags |= GFS2_DIF_EXHASH;
983 dip->i_depth = y;
985 gfs2_dinode_out(dip, dibh->b_data);
994 * @dip: The GFS2 inode
1003 struct gfs2_inode *dip = GFS2_I(inode);
1014 index = name->hash >> (32 - dip->i_depth);
1015 error = get_leaf_nr(dip, index, &leaf_no);
1020 error = get_leaf(dip, leaf_no, &obh);
1025 if (dip->i_depth == be16_to_cpu(oleaf->lf_depth)) {
1030 gfs2_trans_add_meta(dip->i_gl, obh);
1040 len = BIT(dip->i_depth - be16_to_cpu(oleaf->lf_depth));
1044 dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
1045 gfs2_consist_inode(dip);
1065 gfs2_dir_hash_inval(dip);
1067 error = gfs2_dir_write_data(dip, (char *)lp, start * sizeof(u64),
1078 divider = (start + half_len) << (32 - dip->i_depth);
1085 if (dirent_next(dip, obh, &next))
1105 dirent_del(dip, obh, prev, dent);
1108 gfs2_consist_inode(dip);
1121 error = gfs2_meta_inode_buffer(dip, &dibh);
1122 if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) {
1123 gfs2_trans_add_meta(dip->i_gl, dibh);
1124 gfs2_add_inode_blocks(&dip->i_inode, 1);
1125 gfs2_dinode_out(dip, dibh->b_data);
1145 * @dip: The GFS2 dinode
1150 static int dir_double_exhash(struct gfs2_inode *dip)
1160 hsize = BIT(dip->i_depth);
1163 hc = gfs2_dir_get_hash_table(dip);
1175 error = gfs2_meta_inode_buffer(dip, &dibh);
1185 error = gfs2_dir_write_data(dip, (char *)hc2, 0, hsize_bytes * 2);
1189 gfs2_dir_hash_inval(dip);
1190 dip->i_hash_cache = hc2;
1191 dip->i_depth++;
1192 gfs2_dinode_out(dip, dibh->b_data);
1198 gfs2_dir_write_data(dip, (char *)hc, 0, hsize_bytes);
1199 i_size_write(&dip->i_inode, hsize_bytes);
1200 gfs2_dinode_out(dip, dibh->b_data);
1251 * @dip: The GFS2 inode
1265 static int do_filldir_main(struct gfs2_inode *dip, struct dir_context *ctx,
1520 * @dip: dinode pointer
1529 struct gfs2_inode *dip = GFS2_I(inode);
1537 hsize = BIT(dip->i_depth);
1539 index = hash >> (32 - dip->i_depth);
1541 if (dip->i_hash_cache == NULL)
1543 lp = gfs2_dir_get_hash_table(dip);
1556 len = BIT(dip->i_depth - depth);
1568 struct gfs2_inode *dip = GFS2_I(inode);
1576 if (!dip->i_entries)
1579 if (dip->i_diskflags & GFS2_DIF_EXHASH)
1582 if (!gfs2_is_stuffed(dip)) {
1583 gfs2_consist_inode(dip);
1587 error = gfs2_meta_inode_buffer(dip, &dibh);
1603 if (dip->i_entries != g.offset) {
1606 (unsigned long long)dip->i_no_addr,
1607 dip->i_entries,
1609 gfs2_consist_inode(dip);
1613 gfs2_set_cookies(sdp, dibh, 0, darr, dip->i_entries);
1614 error = do_filldir_main(dip, ctx, darr,
1615 dip->i_entries, 0, &copied);
1630 * @dip: The GFS2 dir inode
1635 * Assumes a glock is held on dip.
1866 * @dip: The GFS2 inode
1872 int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
1877 struct timespec64 tv = current_time(&dip->i_inode);
1881 dent = gfs2_dirent_search(&dip->i_inode, name, gfs2_dirent_prev, &bh);
1883 gfs2_consist_inode(dip);
1887 gfs2_consist_inode(dip);
1896 dirent_del(dip, bh, prev, dent);
1897 if (dip->i_diskflags & GFS2_DIF_EXHASH) {
1901 gfs2_consist_inode(dip);
1908 if (!dip->i_entries)
1909 gfs2_consist_inode(dip);
1910 dip->i_entries--;
1911 dip->i_inode.i_mtime = dip->i_inode.i_ctime = tv;
1913 drop_nlink(&dip->i_inode);
1914 mark_inode_dirty(&dip->i_inode);
1921 * @dip: The GFS2 inode
1932 int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1938 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh);
1940 gfs2_consist_inode(dip);
1946 gfs2_trans_add_meta(dip->i_gl, bh);
1951 dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode);
1952 mark_inode_dirty_sync(&dip->i_inode);
1958 * @dip: the directory
1968 static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
1972 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
1994 error = gfs2_quota_hold(dip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
2003 error = get_leaf(dip, blk, &bh);
2012 gfs2_rlist_add(dip, &rlist, blk);
2041 error = get_leaf(dip, blk, &bh);
2051 gfs2_free_meta(dip, rgd, blk, 1);
2052 gfs2_add_inode_blocks(&dip->i_inode, -1);
2055 error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size);
2062 error = gfs2_meta_inode_buffer(dip, &dibh);
2066 gfs2_trans_add_meta(dip->i_gl, dibh);
2070 dip->i_inode.i_mode = S_IFREG;
2071 gfs2_dinode_out(dip, dibh->b_data);
2080 gfs2_quota_unhold(dip);
2088 * @dip: the directory
2096 int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
2106 hsize = BIT(dip->i_depth);
2108 lp = gfs2_dir_get_hash_table(dip);
2115 error = get_leaf(dip, leaf_no, &bh);
2119 len = BIT(dip->i_depth - be16_to_cpu(leaf->lf_depth));
2123 error = leaf_dealloc(dip, index, len, leaf_no, bh,
2134 gfs2_consist_inode(dip);