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
162 struct buffer_head *bh) in ext4_handle_dirty_xattr_block() argument
164 ext4_xattr_block_csum_set(inode, bh->b_blocknr, BHDR(bh)); in ext4_handle_dirty_xattr_block()
165 return ext4_handle_dirty_metadata(handle, inode, bh); in ext4_handle_dirty_xattr_block()
216 ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh) in ext4_xattr_check_block() argument
220 if (buffer_verified(bh)) in ext4_xattr_check_block()
223 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || in ext4_xattr_check_block()
224 BHDR(bh)->h_blocks != cpu_to_le32(1)) in ext4_xattr_check_block()
226 if (!ext4_xattr_block_csum_verify(inode, bh->b_blocknr, BHDR(bh))) in ext4_xattr_check_block()
228 error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size, in ext4_xattr_check_block()
229 bh->b_data); in ext4_xattr_check_block()
231 set_buffer_verified(bh); in ext4_xattr_check_block()
277 struct buffer_head *bh = NULL; in ext4_xattr_block_get() local
291 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_get()
292 if (!bh) in ext4_xattr_block_get()
294 ea_bdebug(bh, "b_count=%d, refcount=%d", in ext4_xattr_block_get()
295 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_block_get()
296 if (ext4_xattr_check_block(inode, bh)) { in ext4_xattr_block_get()
303 ext4_xattr_cache_insert(ext4_mb_cache, bh); in ext4_xattr_block_get()
304 entry = BFIRST(bh); in ext4_xattr_block_get()
305 error = ext4_xattr_find_entry(&entry, name_index, name, bh->b_size, 1); in ext4_xattr_block_get()
315 memcpy(buffer, bh->b_data + le16_to_cpu(entry->e_value_offs), in ext4_xattr_block_get()
321 brelse(bh); in ext4_xattr_block_get()
364 brelse(iloc.bh); in ext4_xattr_ibody_get()
426 struct buffer_head *bh = NULL; in ext4_xattr_block_list() local
438 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_list()
440 if (!bh) in ext4_xattr_block_list()
442 ea_bdebug(bh, "b_count=%d, refcount=%d", in ext4_xattr_block_list()
443 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_block_list()
444 if (ext4_xattr_check_block(inode, bh)) { in ext4_xattr_block_list()
450 ext4_xattr_cache_insert(ext4_mb_cache, bh); in ext4_xattr_block_list()
451 error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size); in ext4_xattr_block_list()
454 brelse(bh); in ext4_xattr_block_list()
484 brelse(iloc.bh); in ext4_xattr_ibody_list()
543 struct buffer_head *bh) in ext4_xattr_release_block() argument
549 ce = mb_cache_entry_get(ext4_mb_cache, bh->b_bdev, bh->b_blocknr); in ext4_xattr_release_block()
550 BUFFER_TRACE(bh, "get_write_access"); in ext4_xattr_release_block()
551 error = ext4_journal_get_write_access(handle, bh); in ext4_xattr_release_block()
555 lock_buffer(bh); in ext4_xattr_release_block()
556 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) { in ext4_xattr_release_block()
557 ea_bdebug(bh, "refcount now=0; freeing"); in ext4_xattr_release_block()
560 get_bh(bh); in ext4_xattr_release_block()
561 unlock_buffer(bh); in ext4_xattr_release_block()
562 ext4_free_blocks(handle, inode, bh, 0, 1, in ext4_xattr_release_block()
566 le32_add_cpu(&BHDR(bh)->h_refcount, -1); in ext4_xattr_release_block()
581 bh); in ext4_xattr_release_block()
582 unlock_buffer(bh); in ext4_xattr_release_block()
585 bh); in ext4_xattr_release_block()
589 ea_bdebug(bh, "refcount now=%d; releasing", in ext4_xattr_release_block()
590 le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_release_block()
728 struct buffer_head *bh; member
743 bs->bh = sb_bread(sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_find()
745 if (!bs->bh) in ext4_xattr_block_find()
747 ea_bdebug(bs->bh, "b_count=%d, refcount=%d", in ext4_xattr_block_find()
748 atomic_read(&(bs->bh->b_count)), in ext4_xattr_block_find()
749 le32_to_cpu(BHDR(bs->bh)->h_refcount)); in ext4_xattr_block_find()
750 if (ext4_xattr_check_block(inode, bs->bh)) { in ext4_xattr_block_find()
757 bs->s.base = BHDR(bs->bh); in ext4_xattr_block_find()
758 bs->s.first = BFIRST(bs->bh); in ext4_xattr_block_find()
759 bs->s.end = bs->bh->b_data + bs->bh->b_size; in ext4_xattr_block_find()
762 i->name, bs->bh->b_size, 1); in ext4_xattr_block_find()
790 ce = mb_cache_entry_get(ext4_mb_cache, bs->bh->b_bdev, in ext4_xattr_block_set()
791 bs->bh->b_blocknr); in ext4_xattr_block_set()
792 BUFFER_TRACE(bs->bh, "get_write_access"); in ext4_xattr_block_set()
793 error = ext4_journal_get_write_access(handle, bs->bh); in ext4_xattr_block_set()
796 lock_buffer(bs->bh); in ext4_xattr_block_set()
803 ea_bdebug(bs->bh, "modifying in-place"); in ext4_xattr_block_set()
810 bs->bh); in ext4_xattr_block_set()
812 unlock_buffer(bs->bh); in ext4_xattr_block_set()
818 bs->bh); in ext4_xattr_block_set()
823 int offset = (char *)s->here - bs->bh->b_data; in ext4_xattr_block_set()
825 unlock_buffer(bs->bh); in ext4_xattr_block_set()
830 ea_bdebug(bs->bh, "cloning"); in ext4_xattr_block_set()
831 s->base = kmalloc(bs->bh->b_size, GFP_NOFS); in ext4_xattr_block_set()
835 memcpy(s->base, BHDR(bs->bh), bs->bh->b_size); in ext4_xattr_block_set()
839 s->end = s->base + bs->bh->b_size; in ext4_xattr_block_set()
869 if (new_bh == bs->bh) in ext4_xattr_block_set()
896 } else if (bs->bh && s->base == bs->bh->b_data) { in ext4_xattr_block_set()
898 ea_bdebug(bs->bh, "keeping this block"); in ext4_xattr_block_set()
899 new_bh = bs->bh; in ext4_xattr_block_set()
953 if (bs->bh && bs->bh != new_bh) in ext4_xattr_block_set()
954 ext4_xattr_release_block(handle, inode, bs->bh); in ext4_xattr_block_set()
961 if (!(bs->bh && s->base == bs->bh->b_data)) in ext4_xattr_block_set()
1176 is.iloc.bh = NULL; in ext4_xattr_set_handle()
1182 brelse(is.iloc.bh); in ext4_xattr_set_handle()
1183 brelse(bs.bh); in ext4_xattr_set_handle()
1260 struct buffer_head *bh = NULL; in ext4_expand_extra_isize_ea() local
1309 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_expand_extra_isize_ea()
1311 if (!bh) in ext4_expand_extra_isize_ea()
1313 if (ext4_xattr_check_block(inode, bh)) { in ext4_expand_extra_isize_ea()
1319 base = BHDR(bh); in ext4_expand_extra_isize_ea()
1320 first = BFIRST(bh); in ext4_expand_extra_isize_ea()
1321 end = bh->b_data + bh->b_size; in ext4_expand_extra_isize_ea()
1328 brelse(bh); in ext4_expand_extra_isize_ea()
1358 is->iloc.bh = NULL; in ext4_expand_extra_isize_ea()
1359 bs->bh = NULL; in ext4_expand_extra_isize_ea()
1388 brelse(bh); in ext4_expand_extra_isize_ea()
1456 brelse(is->iloc.bh); in ext4_expand_extra_isize_ea()
1460 brelse(bh); in ext4_expand_extra_isize_ea()
1468 brelse(is->iloc.bh); in ext4_expand_extra_isize_ea()
1471 brelse(bh); in ext4_expand_extra_isize_ea()
1488 struct buffer_head *bh = NULL; in ext4_xattr_delete_inode() local
1492 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_delete_inode()
1493 if (!bh) { in ext4_xattr_delete_inode()
1498 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || in ext4_xattr_delete_inode()
1499 BHDR(bh)->h_blocks != cpu_to_le32(1)) { in ext4_xattr_delete_inode()
1504 ext4_xattr_release_block(handle, inode, bh); in ext4_xattr_delete_inode()
1508 brelse(bh); in ext4_xattr_delete_inode()
1531 ext4_xattr_cache_insert(struct mb_cache *ext4_mb_cache, struct buffer_head *bh) in ext4_xattr_cache_insert() argument
1533 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); in ext4_xattr_cache_insert()
1539 ea_bdebug(bh, "out of memory"); in ext4_xattr_cache_insert()
1542 error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash); in ext4_xattr_cache_insert()
1546 ea_bdebug(bh, "already in cache"); in ext4_xattr_cache_insert()
1550 ea_bdebug(bh, "inserting [%x]", (int)hash); in ext4_xattr_cache_insert()
1618 struct buffer_head *bh; in ext4_xattr_cache_find() local
1625 bh = sb_bread(inode->i_sb, ce->e_block); in ext4_xattr_cache_find()
1626 if (!bh) { in ext4_xattr_cache_find()
1629 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= in ext4_xattr_cache_find()
1633 le32_to_cpu(BHDR(bh)->h_refcount), in ext4_xattr_cache_find()
1635 } else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) { in ext4_xattr_cache_find()
1637 return bh; in ext4_xattr_cache_find()
1639 brelse(bh); in ext4_xattr_cache_find()