Lines Matching refs:bh
58 struct buffer_head *bh; in ext4_append() local
83 bh = ext4_bread(handle, inode, *block, EXT4_GET_BLOCKS_CREATE); in ext4_append()
84 if (IS_ERR(bh)) in ext4_append()
85 return bh; in ext4_append()
91 BUFFER_TRACE(bh, "get_write_access"); in ext4_append()
92 err = ext4_journal_get_write_access(handle, inode->i_sb, bh, in ext4_append()
96 return bh; in ext4_append()
99 brelse(bh); in ext4_append()
130 struct buffer_head *bh; in __ext4_read_dirblock() local
142 bh = ERR_PTR(-EIO); in __ext4_read_dirblock()
144 bh = ext4_bread(NULL, inode, block, 0); in __ext4_read_dirblock()
145 if (IS_ERR(bh)) { in __ext4_read_dirblock()
150 current->comm, PTR_ERR(bh)); in __ext4_read_dirblock()
152 return bh; in __ext4_read_dirblock()
154 if (!bh && (type == INDEX || type == DIRENT_HTREE)) { in __ext4_read_dirblock()
160 if (!bh) in __ext4_read_dirblock()
162 dirent = (struct ext4_dir_entry *) bh->b_data; in __ext4_read_dirblock()
175 brelse(bh); in __ext4_read_dirblock()
179 buffer_verified(bh)) in __ext4_read_dirblock()
180 return bh; in __ext4_read_dirblock()
190 set_buffer_verified(bh); in __ext4_read_dirblock()
195 brelse(bh); in __ext4_read_dirblock()
200 if (ext4_dirblock_csum_verify(inode, bh) && in __ext4_read_dirblock()
202 set_buffer_verified(bh); in __ext4_read_dirblock()
207 brelse(bh); in __ext4_read_dirblock()
211 return bh; in __ext4_read_dirblock()
273 struct buffer_head *bh; member
308 static int dx_make_map(struct inode *dir, struct buffer_head *bh,
330 void ext4_initialize_dirent_tail(struct buffer_head *bh, in ext4_initialize_dirent_tail() argument
333 struct ext4_dir_entry_tail *t = EXT4_DIRENT_TAIL(bh->b_data, blocksize); in ext4_initialize_dirent_tail()
343 struct buffer_head *bh) in get_dirent_tail() argument
351 d = (struct ext4_dir_entry *)bh->b_data; in get_dirent_tail()
352 top = (struct ext4_dir_entry *)(bh->b_data + in get_dirent_tail()
363 t = EXT4_DIRENT_TAIL(bh->b_data, EXT4_BLOCK_SIZE(inode->i_sb)); in get_dirent_tail()
396 int ext4_dirblock_csum_verify(struct inode *inode, struct buffer_head *bh) in ext4_dirblock_csum_verify() argument
403 t = get_dirent_tail(inode, bh); in ext4_dirblock_csum_verify()
409 if (t->det_checksum != ext4_dirblock_csum(inode, bh->b_data, in ext4_dirblock_csum_verify()
410 (char *)t - bh->b_data)) in ext4_dirblock_csum_verify()
417 struct buffer_head *bh) in ext4_dirblock_csum_set() argument
424 t = get_dirent_tail(inode, bh); in ext4_dirblock_csum_set()
430 t->det_checksum = ext4_dirblock_csum(inode, bh->b_data, in ext4_dirblock_csum_set()
431 (char *)t - bh->b_data); in ext4_dirblock_csum_set()
436 struct buffer_head *bh) in ext4_handle_dirty_dirblock() argument
438 ext4_dirblock_csum_set(inode, bh); in ext4_handle_dirty_dirblock()
439 return ext4_handle_dirty_metadata(handle, inode, bh); in ext4_handle_dirty_dirblock()
547 struct buffer_head *bh) in ext4_handle_dirty_dx_node() argument
549 ext4_dx_csum_set(inode, (struct ext4_dir_entry *)bh->b_data); in ext4_handle_dirty_dx_node()
550 return ext4_handle_dirty_metadata(handle, inode, bh); in ext4_handle_dirty_dx_node()
747 struct buffer_head *bh; in dx_show_entries() local
756 bh = ext4_bread(NULL,dir, block, 0); in dx_show_entries()
757 if (!bh || IS_ERR(bh)) in dx_show_entries()
760 dx_show_entries(hinfo, dir, ((struct dx_node *) bh->b_data)->entries, levels - 1): in dx_show_entries()
762 bh->b_data, blocksize, 0); in dx_show_entries()
766 brelse(bh); in dx_show_entries()
822 frame->bh = ext4_read_dirblock(dir, 0, INDEX); in dx_probe()
823 if (IS_ERR(frame->bh)) in dx_probe()
824 return (struct dx_frame *) frame->bh; in dx_probe()
826 root = (struct dx_root *) frame->bh->b_data; in dx_probe()
941 frame->bh = ext4_read_dirblock(dir, block, INDEX); in dx_probe()
942 if (IS_ERR(frame->bh)) { in dx_probe()
943 ret_err = (struct dx_frame *) frame->bh; in dx_probe()
944 frame->bh = NULL; in dx_probe()
948 entries = ((struct dx_node *) frame->bh->b_data)->entries; in dx_probe()
959 brelse(frame->bh); in dx_probe()
975 if (frames[0].bh == NULL) in dx_release()
978 info = &((struct dx_root *)frames[0].bh->b_data)->info; in dx_release()
982 if (frames[i].bh == NULL) in dx_release()
984 brelse(frames[i].bh); in dx_release()
985 frames[i].bh = NULL; in dx_release()
1012 struct buffer_head *bh; in ext4_htree_next_block() local
1052 bh = ext4_read_dirblock(dir, dx_get_block(p->at), INDEX); in ext4_htree_next_block()
1053 if (IS_ERR(bh)) in ext4_htree_next_block()
1054 return PTR_ERR(bh); in ext4_htree_next_block()
1056 brelse(p->bh); in ext4_htree_next_block()
1057 p->bh = bh; in ext4_htree_next_block()
1058 p->at = p->entries = ((struct dx_node *) bh->b_data)->entries; in ext4_htree_next_block()
1074 struct buffer_head *bh; in htree_dirblock_to_tree() local
1082 bh = ext4_read_dirblock(dir, block, DIRENT_HTREE); in htree_dirblock_to_tree()
1083 if (IS_ERR(bh)) in htree_dirblock_to_tree()
1084 return PTR_ERR(bh); in htree_dirblock_to_tree()
1086 de = (struct ext4_dir_entry_2 *) bh->b_data; in htree_dirblock_to_tree()
1096 brelse(bh); in htree_dirblock_to_tree()
1102 brelse(bh); in htree_dirblock_to_tree()
1108 if (ext4_check_dir_entry(dir, NULL, de, bh, in htree_dirblock_to_tree()
1109 bh->b_data, bh->b_size, in htree_dirblock_to_tree()
1111 + ((char *)de - bh->b_data))) { in htree_dirblock_to_tree()
1168 brelse(bh); in htree_dirblock_to_tree()
1232 de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data; in ext4_htree_fill_tree()
1242 de = (struct ext4_dir_entry_2 *) frames[0].bh->b_data; in ext4_htree_fill_tree()
1293 static inline int search_dirblock(struct buffer_head *bh, in search_dirblock() argument
1299 return ext4_search_dir(bh, bh->b_data, dir->i_sb->s_blocksize, dir, in search_dirblock()
1311 static int dx_make_map(struct inode *dir, struct buffer_head *bh, in dx_make_map() argument
1316 struct ext4_dir_entry_2 *de = (struct ext4_dir_entry_2 *)bh->b_data; in dx_make_map()
1317 unsigned int buflen = bh->b_size; in dx_make_map()
1318 char *base = bh->b_data; in dx_make_map()
1326 if (ext4_check_dir_entry(dir, NULL, de, bh, base, buflen, in dx_make_map()
1530 int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size, in ext4_search_dir() argument
1547 if (ext4_check_dir_entry(dir, NULL, de, bh, search_buf, in ext4_search_dir()
1598 struct buffer_head *bh, *ret = NULL; in __ext4_find_entry() local
1678 if ((bh = bh_use[ra_ptr++]) == NULL) in __ext4_find_entry()
1680 wait_on_buffer(bh); in __ext4_find_entry()
1681 if (!buffer_uptodate(bh)) { in __ext4_find_entry()
1685 brelse(bh); in __ext4_find_entry()
1689 if (!buffer_verified(bh) && in __ext4_find_entry()
1691 (struct ext4_dir_entry *)bh->b_data) && in __ext4_find_entry()
1692 !ext4_dirblock_csum_verify(dir, bh)) { in __ext4_find_entry()
1696 brelse(bh); in __ext4_find_entry()
1700 set_buffer_verified(bh); in __ext4_find_entry()
1701 i = search_dirblock(bh, dir, fname, in __ext4_find_entry()
1705 ret = bh; in __ext4_find_entry()
1708 brelse(bh); in __ext4_find_entry()
1742 struct buffer_head *bh; in ext4_find_entry() local
1750 bh = __ext4_find_entry(dir, &fname, res_dir, inlined); in ext4_find_entry()
1753 return bh; in ext4_find_entry()
1762 struct buffer_head *bh; in ext4_lookup_entry() local
1771 bh = __ext4_find_entry(dir, &fname, res_dir, NULL); in ext4_lookup_entry()
1774 return bh; in ext4_lookup_entry()
1783 struct buffer_head *bh; in ext4_dx_find_entry() local
1795 bh = ext4_read_dirblock(dir, block, DIRENT_HTREE); in ext4_dx_find_entry()
1796 if (IS_ERR(bh)) in ext4_dx_find_entry()
1799 retval = search_dirblock(bh, dir, fname, in ext4_dx_find_entry()
1804 brelse(bh); in ext4_dx_find_entry()
1806 bh = ERR_PTR(ERR_BAD_DX_DIR); in ext4_dx_find_entry()
1817 bh = ERR_PTR(retval); in ext4_dx_find_entry()
1822 bh = NULL; in ext4_dx_find_entry()
1827 return bh; in ext4_dx_find_entry()
1834 struct buffer_head *bh; in ext4_lookup() local
1839 bh = ext4_lookup_entry(dir, dentry, &de); in ext4_lookup()
1840 if (IS_ERR(bh)) in ext4_lookup()
1841 return ERR_CAST(bh); in ext4_lookup()
1843 if (bh) { in ext4_lookup()
1845 brelse(bh); in ext4_lookup()
1891 struct buffer_head *bh; in ext4_get_parent() local
1893 bh = ext4_find_entry(d_inode(child), &dotdot_name, &de, NULL); in ext4_get_parent()
1894 if (IS_ERR(bh)) in ext4_get_parent()
1895 return ERR_CAST(bh); in ext4_get_parent()
1896 if (!bh) in ext4_get_parent()
1899 brelse(bh); in ext4_get_parent()
1975 struct buffer_head **bh,struct dx_frame *frame, in do_split() argument
1985 char *data1 = (*bh)->b_data, *data2; in do_split()
1996 brelse(*bh); in do_split()
1997 *bh = NULL; in do_split()
2001 BUFFER_TRACE(*bh, "get_write_access"); in do_split()
2002 err = ext4_journal_get_write_access(handle, dir->i_sb, *bh, in do_split()
2007 BUFFER_TRACE(frame->bh, "get_write_access"); in do_split()
2008 err = ext4_journal_get_write_access(handle, dir->i_sb, frame->bh, in do_split()
2017 count = dx_make_map(dir, *bh, hinfo, map); in do_split()
2063 ext4_initialize_dirent_tail(*bh, blocksize); in do_split()
2074 swap(*bh, bh2); in do_split()
2081 err = ext4_handle_dirty_dx_node(handle, dir, frame->bh); in do_split()
2089 brelse(*bh); in do_split()
2091 *bh = NULL; in do_split()
2097 struct buffer_head *bh, in ext4_find_dest_de() argument
2111 if (ext4_check_dir_entry(dir, NULL, de, bh, in ext4_find_dest_de()
2173 struct buffer_head *bh) in add_dirent_to_buf() argument
2183 err = ext4_find_dest_de(dir, inode, bh, bh->b_data, in add_dirent_to_buf()
2188 BUFFER_TRACE(bh, "get_write_access"); in add_dirent_to_buf()
2189 err = ext4_journal_get_write_access(handle, dir->i_sb, bh, in add_dirent_to_buf()
2214 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); in add_dirent_to_buf()
2215 err = ext4_handle_dirty_dirblock(handle, dir, bh); in add_dirent_to_buf()
2227 struct inode *inode, struct buffer_head *bh) in make_indexed_dir() argument
2247 BUFFER_TRACE(bh, "get_write_access"); in make_indexed_dir()
2248 retval = ext4_journal_get_write_access(handle, dir->i_sb, bh, in make_indexed_dir()
2252 brelse(bh); in make_indexed_dir()
2255 root = (struct dx_root *) bh->b_data; in make_indexed_dir()
2263 brelse(bh); in make_indexed_dir()
2271 brelse(bh); in make_indexed_dir()
2286 brelse(bh); in make_indexed_dir()
2326 brelse(bh); in make_indexed_dir()
2334 frame->bh = bh; in make_indexed_dir()
2336 retval = ext4_handle_dirty_dx_node(handle, dir, frame->bh); in make_indexed_dir()
2377 struct buffer_head *bh = NULL; in ext4_add_entry() local
2437 bh = ext4_read_dirblock(dir, block, DIRENT); in ext4_add_entry()
2438 if (bh == NULL) { in ext4_add_entry()
2439 bh = ext4_bread(handle, dir, block, in ext4_add_entry()
2443 if (IS_ERR(bh)) { in ext4_add_entry()
2444 retval = PTR_ERR(bh); in ext4_add_entry()
2445 bh = NULL; in ext4_add_entry()
2449 NULL, bh); in ext4_add_entry()
2456 inode, bh); in ext4_add_entry()
2457 bh = NULL; /* make_indexed_dir releases bh */ in ext4_add_entry()
2460 brelse(bh); in ext4_add_entry()
2462 bh = ext4_append(handle, dir, &block); in ext4_add_entry()
2464 if (IS_ERR(bh)) { in ext4_add_entry()
2465 retval = PTR_ERR(bh); in ext4_add_entry()
2466 bh = NULL; in ext4_add_entry()
2469 de = (struct ext4_dir_entry_2 *) bh->b_data; in ext4_add_entry()
2474 ext4_initialize_dirent_tail(bh, blocksize); in ext4_add_entry()
2476 retval = add_dirent_to_buf(handle, &fname, dir, inode, de, bh); in ext4_add_entry()
2479 brelse(bh); in ext4_add_entry()
2493 struct buffer_head *bh; in ext4_dx_add_entry() local
2506 bh = ext4_read_dirblock(dir, dx_get_block(frame->at), DIRENT_HTREE); in ext4_dx_add_entry()
2507 if (IS_ERR(bh)) { in ext4_dx_add_entry()
2508 err = PTR_ERR(bh); in ext4_dx_add_entry()
2509 bh = NULL; in ext4_dx_add_entry()
2513 BUFFER_TRACE(bh, "get_write_access"); in ext4_dx_add_entry()
2514 err = ext4_journal_get_write_access(handle, sb, bh, EXT4_JTR_NONE); in ext4_dx_add_entry()
2518 err = add_dirent_to_buf(handle, fname, dir, inode, NULL, bh); in ext4_dx_add_entry()
2570 BUFFER_TRACE(frame->bh, "get_write_access"); in ext4_dx_add_entry()
2571 err = ext4_journal_get_write_access(handle, sb, frame->bh, in ext4_dx_add_entry()
2581 BUFFER_TRACE(frame->bh, "get_write_access"); /* index root */ in ext4_dx_add_entry()
2583 (frame - 1)->bh, in ext4_dx_add_entry()
2598 swap(frame->bh, bh2); in ext4_dx_add_entry()
2609 (frame - 1)->bh); in ext4_dx_add_entry()
2613 frame->bh); in ext4_dx_add_entry()
2625 dxroot = (struct dx_root *)frames[0].bh->b_data; in ext4_dx_add_entry()
2630 err = ext4_handle_dirty_dx_node(handle, dir, frame->bh); in ext4_dx_add_entry()
2639 de = do_split(handle, dir, &bh, frame, &fname->hinfo); in ext4_dx_add_entry()
2644 err = add_dirent_to_buf(handle, fname, dir, inode, de, bh); in ext4_dx_add_entry()
2650 brelse(bh); in ext4_dx_add_entry()
2666 struct buffer_head *bh, in ext4_generic_delete_entry() argument
2679 if (ext4_check_dir_entry(dir, NULL, de, bh, in ext4_generic_delete_entry()
2717 struct buffer_head *bh) in ext4_delete_entry() argument
2723 err = ext4_delete_inline_entry(handle, dir, de_del, bh, in ext4_delete_entry()
2732 BUFFER_TRACE(bh, "get_write_access"); in ext4_delete_entry()
2733 err = ext4_journal_get_write_access(handle, dir->i_sb, bh, in ext4_delete_entry()
2738 err = ext4_generic_delete_entry(dir, de_del, bh, bh->b_data, in ext4_delete_entry()
2743 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); in ext4_delete_entry()
2744 err = ext4_handle_dirty_dirblock(handle, dir, bh); in ext4_delete_entry()
3071 struct buffer_head *bh; in ext4_empty_dir() local
3093 bh = ext4_read_dirblock(inode, 0, DIRENT_HTREE); in ext4_empty_dir()
3094 if (IS_ERR(bh)) in ext4_empty_dir()
3097 de = (struct ext4_dir_entry_2 *) bh->b_data; in ext4_empty_dir()
3098 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, in ext4_empty_dir()
3102 brelse(bh); in ext4_empty_dir()
3107 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size, in ext4_empty_dir()
3111 brelse(bh); in ext4_empty_dir()
3118 brelse(bh); in ext4_empty_dir()
3120 bh = ext4_read_dirblock(inode, lblock, EITHER); in ext4_empty_dir()
3121 if (bh == NULL) { in ext4_empty_dir()
3125 if (IS_ERR(bh)) in ext4_empty_dir()
3128 de = (struct ext4_dir_entry_2 *) (bh->b_data + in ext4_empty_dir()
3130 if (ext4_check_dir_entry(inode, NULL, de, bh, in ext4_empty_dir()
3131 bh->b_data, bh->b_size, offset) || in ext4_empty_dir()
3133 brelse(bh); in ext4_empty_dir()
3138 brelse(bh); in ext4_empty_dir()
3146 struct buffer_head *bh; in ext4_rmdir() local
3163 bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); in ext4_rmdir()
3164 if (IS_ERR(bh)) in ext4_rmdir()
3165 return PTR_ERR(bh); in ext4_rmdir()
3166 if (!bh) in ext4_rmdir()
3190 retval = ext4_delete_entry(handle, dir, de, bh); in ext4_rmdir()
3226 brelse(bh); in ext4_rmdir()
3237 struct buffer_head *bh; in __ext4_unlink() local
3246 bh = ext4_find_entry(dir, d_name, &de, NULL); in __ext4_unlink()
3247 if (IS_ERR(bh)) in __ext4_unlink()
3248 return PTR_ERR(bh); in __ext4_unlink()
3250 if (!bh) in __ext4_unlink()
3276 retval = ext4_delete_entry(handle, dir, de, bh); in __ext4_unlink()
3301 brelse(bh); in __ext4_unlink()
3545 struct buffer_head *bh; in ext4_get_first_dir_block() local
3554 bh = ext4_read_dirblock(inode, 0, DIRENT_HTREE); in ext4_get_first_dir_block()
3555 if (IS_ERR(bh)) { in ext4_get_first_dir_block()
3556 *retval = PTR_ERR(bh); in ext4_get_first_dir_block()
3560 de = (struct ext4_dir_entry_2 *) bh->b_data; in ext4_get_first_dir_block()
3561 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, in ext4_get_first_dir_block()
3562 bh->b_size, 0) || in ext4_get_first_dir_block()
3566 brelse(bh); in ext4_get_first_dir_block()
3573 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, in ext4_get_first_dir_block()
3574 bh->b_size, offset) || in ext4_get_first_dir_block()
3577 brelse(bh); in ext4_get_first_dir_block()
3583 return bh; in ext4_get_first_dir_block()
3598 struct buffer_head *bh; member
3655 BUFFER_TRACE(ent->bh, "get write access"); in ext4_setent()
3656 retval = ext4_journal_get_write_access(handle, ent->dir->i_sb, ent->bh, in ext4_setent()
3667 BUFFER_TRACE(ent->bh, "call ext4_handle_dirty_metadata"); in ext4_setent()
3669 retval2 = ext4_handle_dirty_dirblock(handle, ent->dir, ent->bh); in ext4_setent()
3689 old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, in ext4_resetent()
3691 if (IS_ERR(old.bh)) in ext4_resetent()
3692 retval = PTR_ERR(old.bh); in ext4_resetent()
3693 if (!old.bh) in ext4_resetent()
3701 brelse(old.bh); in ext4_resetent()
3708 struct buffer_head *bh; in ext4_find_delete_entry() local
3711 bh = ext4_find_entry(dir, d_name, &de, NULL); in ext4_find_delete_entry()
3712 if (IS_ERR(bh)) in ext4_find_delete_entry()
3713 return PTR_ERR(bh); in ext4_find_delete_entry()
3714 if (bh) { in ext4_find_delete_entry()
3715 retval = ext4_delete_entry(handle, dir, de, bh); in ext4_find_delete_entry()
3716 brelse(bh); in ext4_find_delete_entry()
3739 retval = ext4_delete_entry(handle, ent->dir, ent->de, ent->bh); in ext4_rename_delete()
3857 old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, in ext4_rename()
3859 if (IS_ERR(old.bh)) in ext4_rename()
3860 return PTR_ERR(old.bh); in ext4_rename()
3869 if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino) in ext4_rename()
3872 new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, in ext4_rename()
3874 if (IS_ERR(new.bh)) { in ext4_rename()
3875 retval = PTR_ERR(new.bh); in ext4_rename()
3876 new.bh = NULL; in ext4_rename()
3879 if (new.bh) { in ext4_rename()
3881 brelse(new.bh); in ext4_rename()
3882 new.bh = NULL; in ext4_rename()
3946 if (!new.bh) { in ext4_rename()
4048 brelse(old.bh); in ext4_rename()
4049 brelse(new.bh); in ext4_rename()
4087 old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, in ext4_cross_rename()
4089 if (IS_ERR(old.bh)) in ext4_cross_rename()
4090 return PTR_ERR(old.bh); in ext4_cross_rename()
4098 if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino) in ext4_cross_rename()
4101 new.bh = ext4_find_entry(new.dir, &new.dentry->d_name, in ext4_cross_rename()
4103 if (IS_ERR(new.bh)) { in ext4_cross_rename()
4104 retval = PTR_ERR(new.bh); in ext4_cross_rename()
4105 new.bh = NULL; in ext4_cross_rename()
4110 if (!new.bh || le32_to_cpu(new.de->inode) != new.inode->i_ino) in ext4_cross_rename()
4192 brelse(old.bh); in ext4_cross_rename()
4193 brelse(new.bh); in ext4_cross_rename()