Lines Matching refs:dir
156 static unsigned dx_root_limit (struct inode *dir, unsigned infosize);
157 static unsigned dx_node_limit (struct inode *dir);
159 struct inode *dir,
171 static int ext3_htree_next_block(struct inode *dir, __u32 hash,
175 static struct buffer_head * ext3_dx_find_entry(struct inode *dir,
236 static inline unsigned dx_root_limit (struct inode *dir, unsigned infosize) in dx_root_limit() argument
238 unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(1) - in dx_root_limit()
243 static inline unsigned dx_node_limit (struct inode *dir) in dx_node_limit() argument
245 unsigned entry_space = dir->i_sb->s_blocksize - EXT3_DIR_REC_LEN(0); in dx_node_limit()
301 struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir, in dx_show_entries() argument
304 unsigned blocksize = dir->i_sb->s_blocksize; in dx_show_entries()
316 if (!(bh = ext3_bread (NULL,dir, block, 0,&err))) continue; in dx_show_entries()
318 dx_show_entries(hinfo, dir, ((struct dx_node *) bh->b_data)->entries, levels - 1): in dx_show_entries()
342 dx_probe(struct qstr *entry, struct inode *dir, in dx_probe() argument
353 if (!(bh = ext3_bread (NULL,dir, 0, 0, err))) in dx_probe()
359 ext3_warning(dir->i_sb, __func__, in dx_probe()
368 hinfo->hash_version += EXT3_SB(dir->i_sb)->s_hash_unsigned; in dx_probe()
369 hinfo->seed = EXT3_SB(dir->i_sb)->s_hash_seed; in dx_probe()
375 ext3_warning(dir->i_sb, __func__, in dx_probe()
384 ext3_warning(dir->i_sb, __func__, in dx_probe()
395 if (dx_get_limit(entries) != dx_root_limit(dir, in dx_probe()
397 ext3_warning(dir->i_sb, __func__, in dx_probe()
409 ext3_warning(dir->i_sb, __func__, in dx_probe()
450 if (!(bh = ext3_bread (NULL,dir, dx_get_block(at), 0, err))) in dx_probe()
453 if (dx_get_limit(entries) != dx_node_limit (dir)) { in dx_probe()
454 ext3_warning(dir->i_sb, __func__, in dx_probe()
470 ext3_warning(dir->i_sb, __func__, in dx_probe()
472 "recommended.", dir->i_ino); in dx_probe()
503 static int ext3_htree_next_block(struct inode *dir, __u32 hash, in ext3_htree_next_block() argument
549 if (!(bh = ext3_bread(NULL, dir, dx_get_block(p->at), in ext3_htree_next_block()
567 struct inode *dir, int block, in htree_dirblock_to_tree() argument
576 if (!(bh = ext3_bread (NULL, dir, block, 0, &err))) in htree_dirblock_to_tree()
581 dir->i_sb->s_blocksize - in htree_dirblock_to_tree()
584 if (!ext3_check_dir_entry("htree_dirblock_to_tree", dir, de, bh, in htree_dirblock_to_tree()
585 (block<<EXT3_BLOCK_SIZE_BITS(dir->i_sb)) in htree_dirblock_to_tree()
589 (dir->i_sb->s_blocksize - 1)) + 1; in htree_dirblock_to_tree()
626 struct inode *dir; in ext3_htree_fill_tree() local
634 dir = dir_file->f_path.dentry->d_inode; in ext3_htree_fill_tree()
635 if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) { in ext3_htree_fill_tree()
636 hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; in ext3_htree_fill_tree()
639 EXT3_SB(dir->i_sb)->s_hash_unsigned; in ext3_htree_fill_tree()
640 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed; in ext3_htree_fill_tree()
641 count = htree_dirblock_to_tree(dir_file, dir, 0, &hinfo, in ext3_htree_fill_tree()
669 ret = htree_dirblock_to_tree(dir_file, dir, block, &hinfo, in ext3_htree_fill_tree()
677 ret = ext3_htree_next_block(dir, HASH_NB_ALWAYS, in ext3_htree_fill_tree()
805 struct inode *dir, in search_dirblock() argument
817 dlimit = bh->b_data + dir->i_sb->s_blocksize; in search_dirblock()
826 dir, de, bh, offset)) in search_dirblock()
853 static struct buffer_head *ext3_find_entry(struct inode *dir, in ext3_find_entry() argument
870 sb = dir->i_sb; in ext3_find_entry()
874 if (is_dx(dir)) { in ext3_find_entry()
875 bh = ext3_dx_find_entry(dir, entry, res_dir, &err); in ext3_find_entry()
885 nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb); in ext3_find_entry()
886 start = EXT3_I(dir)->i_dir_start_lookup; in ext3_find_entry()
910 bh = ext3_getblk(NULL, dir, b++, 0, &err); in ext3_find_entry()
922 "offset %lu", dir->i_ino, block); in ext3_find_entry()
926 i = search_dirblock(bh, dir, entry, in ext3_find_entry()
929 EXT3_I(dir)->i_dir_start_lookup = block; in ext3_find_entry()
947 nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb); in ext3_find_entry()
960 static struct buffer_head * ext3_dx_find_entry(struct inode *dir, in ext3_dx_find_entry() argument
975 sb = dir->i_sb; in ext3_dx_find_entry()
978 if (!(frame = dx_probe(entry, dir, &hinfo, frames, err))) in ext3_dx_find_entry()
989 if (!(bh = ext3_bread (NULL,dir, block, 0, err))) in ext3_dx_find_entry()
998 if (!ext3_check_dir_entry(__func__, dir, de, bh, off)) { in ext3_dx_find_entry()
1012 retval = ext3_htree_next_block(dir, hash, frame, in ext3_dx_find_entry()
1017 dir->i_ino); in ext3_dx_find_entry()
1030 static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) in ext3_lookup() argument
1039 bh = ext3_find_entry(dir, &dentry->d_name, &de); in ext3_lookup()
1044 if (!ext3_valid_inum(dir->i_sb, ino)) { in ext3_lookup()
1045 ext3_error(dir->i_sb, "ext3_lookup", in ext3_lookup()
1049 inode = ext3_iget(dir->i_sb, ino); in ext3_lookup()
1149 static struct ext3_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, in do_split() argument
1153 unsigned blocksize = dir->i_sb->s_blocksize; in do_split()
1164 bh2 = ext3_append (handle, dir, &newblock, &err); in do_split()
1235 ext3_std_error(dir->i_sb, err); in do_split()
1257 struct inode *dir = dentry->d_parent->d_inode; in add_dirent_to_buf() local
1268 top = bh->b_data + dir->i_sb->s_blocksize - reclen; in add_dirent_to_buf()
1270 if (!ext3_check_dir_entry("ext3_add_entry", dir, de, in add_dirent_to_buf()
1292 ext3_std_error(dir->i_sb, err); in add_dirent_to_buf()
1309 ext3_set_de_type(dir->i_sb, de, inode->i_mode); in add_dirent_to_buf()
1325 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; in add_dirent_to_buf()
1326 ext3_update_dx_flag(dir); in add_dirent_to_buf()
1327 dir->i_version++; in add_dirent_to_buf()
1328 ext3_mark_inode_dirty(handle, dir); in add_dirent_to_buf()
1332 ext3_std_error(dir->i_sb, err); in add_dirent_to_buf()
1344 struct inode *dir = dentry->d_parent->d_inode; in make_indexed_dir() local
1360 blocksize = dir->i_sb->s_blocksize; in make_indexed_dir()
1361 dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino)); in make_indexed_dir()
1364 ext3_std_error(dir->i_sb, retval); in make_indexed_dir()
1375 ext3_error(dir->i_sb, __func__, in make_indexed_dir()
1377 dir->i_ino); in make_indexed_dir()
1383 bh2 = ext3_append (handle, dir, &block, &retval); in make_indexed_dir()
1388 EXT3_I(dir)->i_flags |= EXT3_INDEX_FL; in make_indexed_dir()
1402 root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version; in make_indexed_dir()
1406 dx_set_limit (entries, dx_root_limit(dir, sizeof(root->info))); in make_indexed_dir()
1411 hinfo.hash_version += EXT3_SB(dir->i_sb)->s_hash_unsigned; in make_indexed_dir()
1412 hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed; in make_indexed_dir()
1419 de = do_split(handle,dir, &bh, frame, &hinfo, &retval); in make_indexed_dir()
1440 struct inode *dir = dentry->d_parent->d_inode; in ext3_add_entry() local
1450 sb = dir->i_sb; in ext3_add_entry()
1454 if (is_dx(dir)) { in ext3_add_entry()
1458 EXT3_I(dir)->i_flags &= ~EXT3_INDEX_FL; in ext3_add_entry()
1460 ext3_mark_inode_dirty(handle, dir); in ext3_add_entry()
1462 blocks = dir->i_size >> sb->s_blocksize_bits; in ext3_add_entry()
1464 bh = ext3_bread(handle, dir, block, 0, &retval); in ext3_add_entry()
1476 bh = ext3_append(handle, dir, &block, &retval); in ext3_add_entry()
1495 struct inode *dir = dentry->d_parent->d_inode; in ext3_dx_add_entry() local
1496 struct super_block * sb = dir->i_sb; in ext3_dx_add_entry()
1500 frame = dx_probe(&dentry->d_name, dir, &hinfo, frames, &err); in ext3_dx_add_entry()
1506 if (!(bh = ext3_bread(handle,dir, dx_get_block(frame->at), 0, &err))) in ext3_dx_add_entry()
1539 bh2 = ext3_append (handle, dir, &newblock, &err); in ext3_dx_add_entry()
1565 dx_set_limit (entries2, dx_node_limit(dir)); in ext3_dx_add_entry()
1585 dx_set_limit(entries2, dx_node_limit(dir)); in ext3_dx_add_entry()
1604 de = do_split(handle, dir, &bh, frame, &hinfo, &err); in ext3_dx_add_entry()
1612 ext3_std_error(dir->i_sb, err); in ext3_dx_add_entry()
1625 struct inode * dir, in ext3_delete_entry() argument
1636 if (!ext3_check_dir_entry("ext3_delete_entry", dir, de, bh, i)) in ext3_delete_entry()
1647 dir->i_version++; in ext3_delete_entry()
1683 static int ext3_create (struct inode * dir, struct dentry * dentry, int mode, in ext3_create() argument
1691 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + in ext3_create()
1693 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); in ext3_create()
1697 if (IS_DIRSYNC(dir)) in ext3_create()
1700 inode = ext3_new_inode (handle, dir, mode); in ext3_create()
1709 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) in ext3_create()
1714 static int ext3_mknod (struct inode * dir, struct dentry *dentry, in ext3_mknod() argument
1725 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + in ext3_mknod()
1727 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); in ext3_mknod()
1731 if (IS_DIRSYNC(dir)) in ext3_mknod()
1734 inode = ext3_new_inode (handle, dir, mode); in ext3_mknod()
1744 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) in ext3_mknod()
1749 static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode) in ext3_mkdir() argument
1757 if (dir->i_nlink >= EXT3_LINK_MAX) in ext3_mkdir()
1761 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + in ext3_mkdir()
1763 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); in ext3_mkdir()
1767 if (IS_DIRSYNC(dir)) in ext3_mkdir()
1770 inode = ext3_new_inode (handle, dir, S_IFDIR | mode); in ext3_mkdir()
1793 ext3_set_de_type(dir->i_sb, de, S_IFDIR); in ext3_mkdir()
1795 de->inode = cpu_to_le32(dir->i_ino); in ext3_mkdir()
1800 ext3_set_de_type(dir->i_sb, de, S_IFDIR); in ext3_mkdir()
1814 inc_nlink(dir); in ext3_mkdir()
1815 ext3_update_dx_flag(dir); in ext3_mkdir()
1816 ext3_mark_inode_dirty(handle, dir); in ext3_mkdir()
1821 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) in ext3_mkdir()
2042 static int ext3_rmdir (struct inode * dir, struct dentry *dentry) in ext3_rmdir() argument
2053 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); in ext3_rmdir()
2058 bh = ext3_find_entry(dir, &dentry->d_name, &de); in ext3_rmdir()
2062 if (IS_DIRSYNC(dir)) in ext3_rmdir()
2075 retval = ext3_delete_entry(handle, dir, de, bh); in ext3_rmdir()
2089 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; in ext3_rmdir()
2091 drop_nlink(dir); in ext3_rmdir()
2092 ext3_update_dx_flag(dir); in ext3_rmdir()
2093 ext3_mark_inode_dirty(handle, dir); in ext3_rmdir()
2101 static int ext3_unlink(struct inode * dir, struct dentry *dentry) in ext3_unlink() argument
2112 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); in ext3_unlink()
2116 if (IS_DIRSYNC(dir)) in ext3_unlink()
2120 bh = ext3_find_entry(dir, &dentry->d_name, &de); in ext3_unlink()
2136 retval = ext3_delete_entry(handle, dir, de, bh); in ext3_unlink()
2139 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; in ext3_unlink()
2140 ext3_update_dx_flag(dir); in ext3_unlink()
2141 ext3_mark_inode_dirty(handle, dir); in ext3_unlink()
2145 inode->i_ctime = dir->i_ctime; in ext3_unlink()
2155 static int ext3_symlink (struct inode * dir, in ext3_symlink() argument
2163 if (l > dir->i_sb->s_blocksize) in ext3_symlink()
2167 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + in ext3_symlink()
2169 2*EXT3_QUOTA_INIT_BLOCKS(dir->i_sb)); in ext3_symlink()
2173 if (IS_DIRSYNC(dir)) in ext3_symlink()
2176 inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO); in ext3_symlink()
2206 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) in ext3_symlink()
2212 struct inode * dir, struct dentry *dentry) in ext3_link() argument
2228 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + in ext3_link()
2233 if (IS_DIRSYNC(dir)) in ext3_link()
2249 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) in ext3_link()