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()
427 struct buffer_head *bh = NULL; in ext4_xattr_block_list() local
439 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_list()
441 if (!bh) in ext4_xattr_block_list()
443 ea_bdebug(bh, "b_count=%d, refcount=%d", in ext4_xattr_block_list()
444 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_block_list()
445 if (ext4_xattr_check_block(inode, bh)) { in ext4_xattr_block_list()
451 ext4_xattr_cache_insert(ext4_mb_cache, bh); in ext4_xattr_block_list()
452 error = ext4_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size); in ext4_xattr_block_list()
455 brelse(bh); in ext4_xattr_block_list()
485 brelse(iloc.bh); in ext4_xattr_ibody_list()
544 struct buffer_head *bh) in ext4_xattr_release_block() argument
550 ce = mb_cache_entry_get(ext4_mb_cache, bh->b_bdev, bh->b_blocknr); in ext4_xattr_release_block()
551 BUFFER_TRACE(bh, "get_write_access"); in ext4_xattr_release_block()
552 error = ext4_journal_get_write_access(handle, bh); in ext4_xattr_release_block()
556 lock_buffer(bh); in ext4_xattr_release_block()
557 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) { in ext4_xattr_release_block()
558 ea_bdebug(bh, "refcount now=0; freeing"); in ext4_xattr_release_block()
561 get_bh(bh); in ext4_xattr_release_block()
562 unlock_buffer(bh); in ext4_xattr_release_block()
563 ext4_free_blocks(handle, inode, bh, 0, 1, in ext4_xattr_release_block()
567 le32_add_cpu(&BHDR(bh)->h_refcount, -1); in ext4_xattr_release_block()
582 bh); in ext4_xattr_release_block()
583 unlock_buffer(bh); in ext4_xattr_release_block()
586 bh); in ext4_xattr_release_block()
590 ea_bdebug(bh, "refcount now=%d; releasing", in ext4_xattr_release_block()
591 le32_to_cpu(BHDR(bh)->h_refcount)); in ext4_xattr_release_block()
729 struct buffer_head *bh; member
744 bs->bh = sb_bread(sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_block_find()
746 if (!bs->bh) in ext4_xattr_block_find()
748 ea_bdebug(bs->bh, "b_count=%d, refcount=%d", in ext4_xattr_block_find()
749 atomic_read(&(bs->bh->b_count)), in ext4_xattr_block_find()
750 le32_to_cpu(BHDR(bs->bh)->h_refcount)); in ext4_xattr_block_find()
751 if (ext4_xattr_check_block(inode, bs->bh)) { in ext4_xattr_block_find()
758 bs->s.base = BHDR(bs->bh); in ext4_xattr_block_find()
759 bs->s.first = BFIRST(bs->bh); in ext4_xattr_block_find()
760 bs->s.end = bs->bh->b_data + bs->bh->b_size; in ext4_xattr_block_find()
763 i->name, bs->bh->b_size, 1); in ext4_xattr_block_find()
791 ce = mb_cache_entry_get(ext4_mb_cache, bs->bh->b_bdev, in ext4_xattr_block_set()
792 bs->bh->b_blocknr); in ext4_xattr_block_set()
793 BUFFER_TRACE(bs->bh, "get_write_access"); in ext4_xattr_block_set()
794 error = ext4_journal_get_write_access(handle, bs->bh); in ext4_xattr_block_set()
797 lock_buffer(bs->bh); in ext4_xattr_block_set()
804 ea_bdebug(bs->bh, "modifying in-place"); in ext4_xattr_block_set()
811 bs->bh); in ext4_xattr_block_set()
813 unlock_buffer(bs->bh); in ext4_xattr_block_set()
819 bs->bh); in ext4_xattr_block_set()
824 int offset = (char *)s->here - bs->bh->b_data; in ext4_xattr_block_set()
826 unlock_buffer(bs->bh); in ext4_xattr_block_set()
831 ea_bdebug(bs->bh, "cloning"); in ext4_xattr_block_set()
832 s->base = kmalloc(bs->bh->b_size, GFP_NOFS); in ext4_xattr_block_set()
836 memcpy(s->base, BHDR(bs->bh), bs->bh->b_size); in ext4_xattr_block_set()
840 s->end = s->base + bs->bh->b_size; in ext4_xattr_block_set()
870 if (new_bh == bs->bh) in ext4_xattr_block_set()
897 } else if (bs->bh && s->base == bs->bh->b_data) { in ext4_xattr_block_set()
899 ea_bdebug(bs->bh, "keeping this block"); in ext4_xattr_block_set()
900 new_bh = bs->bh; in ext4_xattr_block_set()
954 if (bs->bh && bs->bh != new_bh) in ext4_xattr_block_set()
955 ext4_xattr_release_block(handle, inode, bs->bh); in ext4_xattr_block_set()
962 if (!(bs->bh && s->base == bs->bh->b_data)) in ext4_xattr_block_set()
1177 is.iloc.bh = NULL; in ext4_xattr_set_handle()
1183 brelse(is.iloc.bh); in ext4_xattr_set_handle()
1184 brelse(bs.bh); in ext4_xattr_set_handle()
1261 struct buffer_head *bh = NULL; in ext4_expand_extra_isize_ea() local
1310 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_expand_extra_isize_ea()
1312 if (!bh) in ext4_expand_extra_isize_ea()
1314 if (ext4_xattr_check_block(inode, bh)) { in ext4_expand_extra_isize_ea()
1320 base = BHDR(bh); in ext4_expand_extra_isize_ea()
1321 first = BFIRST(bh); in ext4_expand_extra_isize_ea()
1322 end = bh->b_data + bh->b_size; in ext4_expand_extra_isize_ea()
1329 brelse(bh); in ext4_expand_extra_isize_ea()
1359 is->iloc.bh = NULL; in ext4_expand_extra_isize_ea()
1360 bs->bh = NULL; in ext4_expand_extra_isize_ea()
1389 brelse(bh); in ext4_expand_extra_isize_ea()
1457 brelse(is->iloc.bh); in ext4_expand_extra_isize_ea()
1461 brelse(bh); in ext4_expand_extra_isize_ea()
1469 brelse(is->iloc.bh); in ext4_expand_extra_isize_ea()
1472 brelse(bh); in ext4_expand_extra_isize_ea()
1489 struct buffer_head *bh = NULL; in ext4_xattr_delete_inode() local
1493 bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); in ext4_xattr_delete_inode()
1494 if (!bh) { in ext4_xattr_delete_inode()
1499 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || in ext4_xattr_delete_inode()
1500 BHDR(bh)->h_blocks != cpu_to_le32(1)) { in ext4_xattr_delete_inode()
1505 ext4_xattr_release_block(handle, inode, bh); in ext4_xattr_delete_inode()
1509 brelse(bh); in ext4_xattr_delete_inode()
1532 ext4_xattr_cache_insert(struct mb_cache *ext4_mb_cache, struct buffer_head *bh) in ext4_xattr_cache_insert() argument
1534 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); in ext4_xattr_cache_insert()
1540 ea_bdebug(bh, "out of memory"); in ext4_xattr_cache_insert()
1543 error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash); in ext4_xattr_cache_insert()
1547 ea_bdebug(bh, "already in cache"); in ext4_xattr_cache_insert()
1551 ea_bdebug(bh, "inserting [%x]", (int)hash); in ext4_xattr_cache_insert()
1619 struct buffer_head *bh; in ext4_xattr_cache_find() local
1626 bh = sb_bread(inode->i_sb, ce->e_block); in ext4_xattr_cache_find()
1627 if (!bh) { in ext4_xattr_cache_find()
1630 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= in ext4_xattr_cache_find()
1634 le32_to_cpu(BHDR(bh)->h_refcount), in ext4_xattr_cache_find()
1636 } else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) { in ext4_xattr_cache_find()
1638 return bh; in ext4_xattr_cache_find()
1640 brelse(bh); in ext4_xattr_cache_find()