Lines Matching refs:dip
36 * dip->i_diskflags & GFS2_DIF_EXHASH is true
606 static int dirent_check_reclen(struct gfs2_inode *dip,
620 gfs2_consist_inode(dip);
626 * @dip: the directory
633 static int dirent_next(struct gfs2_inode *dip, struct buffer_head *bh,
640 ret = dirent_check_reclen(dip, cur, bh_end);
645 ret = dirent_check_reclen(dip, tmp, bh_end);
651 gfs2_consist_inode(dip);
661 * @dip: The GFS2 inode
668 static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh,
674 gfs2_consist_inode(dip);
678 gfs2_trans_add_meta(dip->i_gl, bh);
696 gfs2_consist_inode(dip);
698 gfs2_consist_inode(dip);
755 static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
760 error = gfs2_meta_read(dip->i_gl, leaf_no, DIO_WAIT, 0, bhp);
761 if (!error && gfs2_metatype_check(GFS2_SB(&dip->i_inode), *bhp, GFS2_METATYPE_LF)) {
771 * @dip: The GFS2 inode
778 static int get_leaf_nr(struct gfs2_inode *dip, u32 index, u64 *leaf_out)
783 hash = gfs2_dir_get_hash_table(dip);
792 static int get_first_leaf(struct gfs2_inode *dip, u32 index,
798 error = get_leaf_nr(dip, index, &leaf_no);
800 error = get_leaf(dip, leaf_no, bh_out);
906 struct gfs2_inode *dip = GFS2_I(inode);
918 error = gfs2_meta_inode_buffer(dip, &dibh);
929 gfs2_assert(sdp, dip->i_entries < BIT(16));
930 leaf->lf_entries = cpu_to_be16(dip->i_entries);
943 dent = gfs2_dirent_scan(&dip->i_inode, bh->b_data, bh->b_size,
968 gfs2_trans_add_meta(dip->i_gl, dibh);
977 gfs2_add_inode_blocks(&dip->i_inode, 1);
978 dip->i_diskflags |= GFS2_DIF_EXHASH;
981 dip->i_depth = y;
983 gfs2_dinode_out(dip, dibh->b_data);
1000 struct gfs2_inode *dip = GFS2_I(inode);
1011 index = name->hash >> (32 - dip->i_depth);
1012 error = get_leaf_nr(dip, index, &leaf_no);
1017 error = get_leaf(dip, leaf_no, &obh);
1022 if (dip->i_depth == be16_to_cpu(oleaf->lf_depth)) {
1027 gfs2_trans_add_meta(dip->i_gl, obh);
1037 len = BIT(dip->i_depth - be16_to_cpu(oleaf->lf_depth));
1041 dip->i_depth, be16_to_cpu(oleaf->lf_depth), index);
1042 gfs2_consist_inode(dip);
1062 gfs2_dir_hash_inval(dip);
1064 error = gfs2_dir_write_data(dip, (char *)lp, start * sizeof(u64),
1075 divider = (start + half_len) << (32 - dip->i_depth);
1082 if (dirent_next(dip, obh, &next))
1102 dirent_del(dip, obh, prev, dent);
1105 gfs2_consist_inode(dip);
1118 error = gfs2_meta_inode_buffer(dip, &dibh);
1119 if (!gfs2_assert_withdraw(GFS2_SB(&dip->i_inode), !error)) {
1120 gfs2_trans_add_meta(dip->i_gl, dibh);
1121 gfs2_add_inode_blocks(&dip->i_inode, 1);
1122 gfs2_dinode_out(dip, dibh->b_data);
1142 * @dip: The GFS2 dinode
1147 static int dir_double_exhash(struct gfs2_inode *dip)
1157 hsize = BIT(dip->i_depth);
1160 hc = gfs2_dir_get_hash_table(dip);
1172 error = gfs2_meta_inode_buffer(dip, &dibh);
1182 error = gfs2_dir_write_data(dip, (char *)hc2, 0, hsize_bytes * 2);
1186 gfs2_dir_hash_inval(dip);
1187 dip->i_hash_cache = hc2;
1188 dip->i_depth++;
1189 gfs2_dinode_out(dip, dibh->b_data);
1195 gfs2_dir_write_data(dip, (char *)hc, 0, hsize_bytes);
1196 i_size_write(&dip->i_inode, hsize_bytes);
1197 gfs2_dinode_out(dip, dibh->b_data);
1248 * @dip: The GFS2 inode
1263 static int do_filldir_main(struct gfs2_inode *dip, struct dir_context *ctx,
1531 struct gfs2_inode *dip = GFS2_I(inode);
1539 hsize = BIT(dip->i_depth);
1541 index = hash >> (32 - dip->i_depth);
1543 if (dip->i_hash_cache == NULL)
1545 lp = gfs2_dir_get_hash_table(dip);
1558 len = BIT(dip->i_depth - depth);
1570 struct gfs2_inode *dip = GFS2_I(inode);
1578 if (!dip->i_entries)
1581 if (dip->i_diskflags & GFS2_DIF_EXHASH)
1584 if (!gfs2_is_stuffed(dip)) {
1585 gfs2_consist_inode(dip);
1589 error = gfs2_meta_inode_buffer(dip, &dibh);
1605 if (dip->i_entries != g.offset) {
1608 (unsigned long long)dip->i_no_addr,
1609 dip->i_entries,
1611 gfs2_consist_inode(dip);
1615 gfs2_set_cookies(sdp, dibh, 0, darr, dip->i_entries);
1616 error = do_filldir_main(dip, ctx, darr,
1617 dip->i_entries, 0, &copied);
1637 * Assumes a glock is held on dip.
1868 * @dip: The GFS2 inode
1874 int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
1883 dent = gfs2_dirent_search(&dip->i_inode, name, gfs2_dirent_prev, &bh);
1885 gfs2_consist_inode(dip);
1889 gfs2_consist_inode(dip);
1898 dirent_del(dip, bh, prev, dent);
1899 tv = inode_set_ctime_current(&dip->i_inode);
1900 if (dip->i_diskflags & GFS2_DIF_EXHASH) {
1904 gfs2_consist_inode(dip);
1911 if (!dip->i_entries)
1912 gfs2_consist_inode(dip);
1913 dip->i_entries--;
1914 dip->i_inode.i_mtime = tv;
1916 drop_nlink(&dip->i_inode);
1917 mark_inode_dirty(&dip->i_inode);
1924 * @dip: The GFS2 directory inode
1936 int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1942 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh);
1944 gfs2_consist_inode(dip);
1950 gfs2_trans_add_meta(dip->i_gl, bh);
1955 dip->i_inode.i_mtime = inode_set_ctime_current(&dip->i_inode);
1956 mark_inode_dirty_sync(&dip->i_inode);
1962 * @dip: the directory
1972 static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
1976 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
1998 error = gfs2_quota_hold(dip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
2007 error = get_leaf(dip, blk, &bh);
2016 gfs2_rlist_add(dip, &rlist, blk);
2045 error = get_leaf(dip, blk, &bh);
2055 gfs2_free_meta(dip, rgd, blk, 1);
2056 gfs2_add_inode_blocks(&dip->i_inode, -1);
2059 error = gfs2_dir_write_data(dip, ht, index * sizeof(u64), size);
2066 error = gfs2_meta_inode_buffer(dip, &dibh);
2070 gfs2_trans_add_meta(dip->i_gl, dibh);
2074 dip->i_inode.i_mode = S_IFREG;
2075 gfs2_dinode_out(dip, dibh->b_data);
2084 gfs2_quota_unhold(dip);
2092 * @dip: the directory
2100 int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
2110 hsize = BIT(dip->i_depth);
2112 lp = gfs2_dir_get_hash_table(dip);
2119 error = get_leaf(dip, leaf_no, &bh);
2123 len = BIT(dip->i_depth - be16_to_cpu(leaf->lf_depth));
2127 error = leaf_dealloc(dip, index, len, leaf_no, bh,
2138 gfs2_consist_inode(dip);