Lines Matching refs:bh
70 # define ea_bdebug(bh, f...) do { \ argument
73 bdevname(bh->b_bdev, b), \
74 (unsigned long) bh->b_blocknr); \
80 # define ea_bdebug(bh, fmt, ...) no_printk(fmt, ##__VA_ARGS__) argument
142 struct buffer_head *bh) in ext4_xattr_block_csum_verify() argument
144 struct ext4_xattr_header *hdr = BHDR(bh); in ext4_xattr_block_csum_verify()
148 lock_buffer(bh); in ext4_xattr_block_csum_verify()
150 bh->b_blocknr, hdr)); in ext4_xattr_block_csum_verify()
151 unlock_buffer(bh); in ext4_xattr_block_csum_verify()
157 struct buffer_head *bh) in ext4_xattr_block_csum_set() argument
160 BHDR(bh)->h_checksum = ext4_xattr_block_csum(inode, in ext4_xattr_block_csum_set()
161 bh->b_blocknr, BHDR(bh)); in ext4_xattr_block_csum_set()
214 ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh) in ext4_xattr_check_block() argument
218 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || in ext4_xattr_check_block()
219 BHDR(bh)->h_blocks != cpu_to_le32(1)) in ext4_xattr_check_block()
221 if (buffer_verified(bh)) in ext4_xattr_check_block()
224 if (!ext4_xattr_block_csum_verify(inode, bh)) in ext4_xattr_check_block()
226 error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size, in ext4_xattr_check_block()
227 bh->b_data); in ext4_xattr_check_block()
229 set_buffer_verified(bh); in ext4_xattr_check_block()
296 struct buffer_head *bh = NULL; in ext4_xattr_block_get() local
310 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_get()
311 if (!bh) in ext4_xattr_block_get()
313 ea_bdebug(bh, "b_count=%d, refcount=%d", in ext4_xattr_block_get()
314 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_block_get()
315 if (ext4_xattr_check_block(inode, bh)) { in ext4_xattr_block_get()
322 ext4_xattr_cache_insert(ext4_mb_cache, bh); in ext4_xattr_block_get()
323 entry = BFIRST(bh); in ext4_xattr_block_get()
324 error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1); in ext4_xattr_block_get()
334 memcpy(buffer, bh->b_data + le16_to_cpu(entry->e_value_offs), in ext4_xattr_block_get()
340 brelse(bh); in ext4_xattr_block_get()
383 brelse(iloc.bh); in ext4_xattr_ibody_get()
445 struct buffer_head *bh = NULL; in ext4_xattr_block_list() local
457 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_list()
459 if (!bh) in ext4_xattr_block_list()
461 ea_bdebug(bh, "b_count=%d, refcount=%d", in ext4_xattr_block_list()
462 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_block_list()
463 if (ext4_xattr_check_block(inode, bh)) { in ext4_xattr_block_list()
469 ext4_xattr_cache_insert(ext4_mb_cache, bh); in ext4_xattr_block_list()
470 error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size); in ext4_xattr_block_list()
473 brelse(bh); in ext4_xattr_block_list()
503 brelse(iloc.bh); in ext4_xattr_ibody_list()
562 struct buffer_head *bh) in ext4_xattr_release_block() argument
566 BUFFER_TRACE(bh, "get_write_access"); in ext4_xattr_release_block()
567 error = ext4_journal_get_write_access(handle, bh); in ext4_xattr_release_block()
571 lock_buffer(bh); in ext4_xattr_release_block()
572 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) { in ext4_xattr_release_block()
573 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); in ext4_xattr_release_block()
575 ea_bdebug(bh, "refcount now=0; freeing"); in ext4_xattr_release_block()
581 bh->b_blocknr); in ext4_xattr_release_block()
582 get_bh(bh); in ext4_xattr_release_block()
583 unlock_buffer(bh); in ext4_xattr_release_block()
584 ext4_free_blocks(handle, inode, bh, 0, 1, in ext4_xattr_release_block()
588 le32_add_cpu(&BHDR(bh)->h_refcount, -1); in ext4_xattr_release_block()
590 ext4_xattr_block_csum_set(inode, bh); in ext4_xattr_release_block()
602 error = ext4_handle_dirty_metadata(handle, inode, bh); in ext4_xattr_release_block()
603 unlock_buffer(bh); in ext4_xattr_release_block()
605 error = ext4_handle_dirty_metadata(handle, inode, bh); in ext4_xattr_release_block()
609 ea_bdebug(bh, "refcount now=%d; releasing", in ext4_xattr_release_block()
610 le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_release_block()
754 struct buffer_head *bh; member
769 bs->bh = sb_bread(sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_find()
771 if (!bs->bh) in ext4_xattr_block_find()
773 ea_bdebug(bs->bh, "b_count=%d, refcount=%d", in ext4_xattr_block_find()
774 atomic_read(&(bs->bh->b_count)), in ext4_xattr_block_find()
775 le32_to_cpu(BHDR(bs->bh)->h_refcount)); in ext4_xattr_block_find()
776 if (ext4_xattr_check_block(inode, bs->bh)) { in ext4_xattr_block_find()
783 bs->s.base = BHDR(bs->bh); in ext4_xattr_block_find()
784 bs->s.first = BFIRST(bs->bh); in ext4_xattr_block_find()
785 bs->s.end = bs->bh->b_data + bs->bh->b_size; in ext4_xattr_block_find()
788 i->name, bs->bh->b_size, 1); in ext4_xattr_block_find()
816 BUFFER_TRACE(bs->bh, "get_write_access"); in ext4_xattr_block_set()
817 error = ext4_journal_get_write_access(handle, bs->bh); in ext4_xattr_block_set()
820 lock_buffer(bs->bh); in ext4_xattr_block_set()
823 __u32 hash = le32_to_cpu(BHDR(bs->bh)->h_hash); in ext4_xattr_block_set()
831 bs->bh->b_blocknr); in ext4_xattr_block_set()
832 ea_bdebug(bs->bh, "modifying in-place"); in ext4_xattr_block_set()
839 ext4_xattr_block_csum_set(inode, bs->bh); in ext4_xattr_block_set()
840 unlock_buffer(bs->bh); in ext4_xattr_block_set()
846 bs->bh); in ext4_xattr_block_set()
851 int offset = (char *)s->here - bs->bh->b_data; in ext4_xattr_block_set()
853 unlock_buffer(bs->bh); in ext4_xattr_block_set()
854 ea_bdebug(bs->bh, "cloning"); in ext4_xattr_block_set()
855 s->base = kmalloc(bs->bh->b_size, GFP_NOFS); in ext4_xattr_block_set()
859 memcpy(s->base, BHDR(bs->bh), bs->bh->b_size); in ext4_xattr_block_set()
863 s->end = s->base + bs->bh->b_size; in ext4_xattr_block_set()
893 if (new_bh == bs->bh) in ext4_xattr_block_set()
947 } else if (bs->bh && s->base == bs->bh->b_data) { in ext4_xattr_block_set()
949 ea_bdebug(bs->bh, "keeping this block"); in ext4_xattr_block_set()
950 ext4_xattr_cache_insert(ext4_mb_cache, bs->bh); in ext4_xattr_block_set()
951 new_bh = bs->bh; in ext4_xattr_block_set()
1006 if (bs->bh && bs->bh != new_bh) in ext4_xattr_block_set()
1007 ext4_xattr_release_block(handle, inode, bs->bh); in ext4_xattr_block_set()
1014 if (!(bs->bh && s->base == bs->bh->b_data)) in ext4_xattr_block_set()
1188 brelse(bs.bh); in ext4_xattr_set_handle()
1189 bs.bh = NULL; in ext4_xattr_set_handle()
1214 is.iloc.bh = NULL; in ext4_xattr_set_handle()
1220 brelse(is.iloc.bh); in ext4_xattr_set_handle()
1221 brelse(bs.bh); in ext4_xattr_set_handle()
1296 struct buffer_head *bh = NULL; in ext4_expand_extra_isize_ea() local
1351 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_expand_extra_isize_ea()
1353 if (!bh) in ext4_expand_extra_isize_ea()
1355 if (ext4_xattr_check_block(inode, bh)) { in ext4_expand_extra_isize_ea()
1361 base = BHDR(bh); in ext4_expand_extra_isize_ea()
1362 first = BFIRST(bh); in ext4_expand_extra_isize_ea()
1363 end = bh->b_data + bh->b_size; in ext4_expand_extra_isize_ea()
1370 brelse(bh); in ext4_expand_extra_isize_ea()
1400 is->iloc.bh = NULL; in ext4_expand_extra_isize_ea()
1401 bs->bh = NULL; in ext4_expand_extra_isize_ea()
1435 brelse(bh); in ext4_expand_extra_isize_ea()
1503 brelse(is->iloc.bh); in ext4_expand_extra_isize_ea()
1507 brelse(bh); in ext4_expand_extra_isize_ea()
1516 brelse(is->iloc.bh); in ext4_expand_extra_isize_ea()
1518 brelse(bs->bh); in ext4_expand_extra_isize_ea()
1521 brelse(bh); in ext4_expand_extra_isize_ea()
1542 struct buffer_head *bh = NULL; in ext4_xattr_delete_inode() local
1546 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_delete_inode()
1547 if (!bh) { in ext4_xattr_delete_inode()
1552 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || in ext4_xattr_delete_inode()
1553 BHDR(bh)->h_blocks != cpu_to_le32(1)) { in ext4_xattr_delete_inode()
1558 ext4_xattr_release_block(handle, inode, bh); in ext4_xattr_delete_inode()
1562 brelse(bh); in ext4_xattr_delete_inode()
1574 ext4_xattr_cache_insert(struct mb2_cache *ext4_mb_cache, struct buffer_head *bh) in ext4_xattr_cache_insert() argument
1576 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); in ext4_xattr_cache_insert()
1580 bh->b_blocknr); in ext4_xattr_cache_insert()
1583 ea_bdebug(bh, "already in cache"); in ext4_xattr_cache_insert()
1585 ea_bdebug(bh, "inserting [%x]", (int)hash); in ext4_xattr_cache_insert()
1649 struct buffer_head *bh; in ext4_xattr_cache_find() local
1651 bh = sb_bread(inode->i_sb, ce->e_block); in ext4_xattr_cache_find()
1652 if (!bh) { in ext4_xattr_cache_find()
1655 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= in ext4_xattr_cache_find()
1659 le32_to_cpu(BHDR(bh)->h_refcount), in ext4_xattr_cache_find()
1661 } else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) { in ext4_xattr_cache_find()
1663 return bh; in ext4_xattr_cache_find()
1665 brelse(bh); in ext4_xattr_cache_find()