Lines Matching refs:bh
59 #define BHDR(bh) ((struct ext3_xattr_header *)((bh)->b_data)) argument
61 #define BFIRST(bh) ENTRY(BHDR(bh)+1) argument
78 # define ea_bdebug(bh, f...) do { \ argument
81 bdevname(bh->b_bdev, b), \
82 (unsigned long) bh->b_blocknr); \
161 ext3_xattr_check_block(struct buffer_head *bh) in ext3_xattr_check_block() argument
165 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || in ext3_xattr_check_block()
166 BHDR(bh)->h_blocks != cpu_to_le32(1)) in ext3_xattr_check_block()
168 error = ext3_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size); in ext3_xattr_check_block()
214 struct buffer_head *bh = NULL; in ext3_xattr_block_get() local
226 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); in ext3_xattr_block_get()
227 if (!bh) in ext3_xattr_block_get()
229 ea_bdebug(bh, "b_count=%d, refcount=%d", in ext3_xattr_block_get()
230 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); in ext3_xattr_block_get()
231 if (ext3_xattr_check_block(bh)) { in ext3_xattr_block_get()
238 ext3_xattr_cache_insert(bh); in ext3_xattr_block_get()
239 entry = BFIRST(bh); in ext3_xattr_block_get()
240 error = ext3_xattr_find_entry(&entry, name_index, name, bh->b_size, 1); in ext3_xattr_block_get()
250 memcpy(buffer, bh->b_data + le16_to_cpu(entry->e_value_offs), in ext3_xattr_block_get()
256 brelse(bh); in ext3_xattr_block_get()
299 brelse(iloc.bh); in ext3_xattr_ibody_get()
359 struct buffer_head *bh = NULL; in ext3_xattr_block_list() local
369 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); in ext3_xattr_block_list()
371 if (!bh) in ext3_xattr_block_list()
373 ea_bdebug(bh, "b_count=%d, refcount=%d", in ext3_xattr_block_list()
374 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); in ext3_xattr_block_list()
375 if (ext3_xattr_check_block(bh)) { in ext3_xattr_block_list()
382 ext3_xattr_cache_insert(bh); in ext3_xattr_block_list()
383 error = ext3_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size); in ext3_xattr_block_list()
386 brelse(bh); in ext3_xattr_block_list()
416 brelse(iloc.bh); in ext3_xattr_ibody_list()
474 struct buffer_head *bh) in ext3_xattr_release_block() argument
479 ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev, bh->b_blocknr); in ext3_xattr_release_block()
480 error = ext3_journal_get_write_access(handle, bh); in ext3_xattr_release_block()
484 lock_buffer(bh); in ext3_xattr_release_block()
486 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) { in ext3_xattr_release_block()
487 ea_bdebug(bh, "refcount now=0; freeing"); in ext3_xattr_release_block()
490 ext3_free_blocks(handle, inode, bh->b_blocknr, 1); in ext3_xattr_release_block()
491 get_bh(bh); in ext3_xattr_release_block()
492 ext3_forget(handle, 1, inode, bh, bh->b_blocknr); in ext3_xattr_release_block()
494 le32_add_cpu(&BHDR(bh)->h_refcount, -1); in ext3_xattr_release_block()
495 error = ext3_journal_dirty_metadata(handle, bh); in ext3_xattr_release_block()
499 ea_bdebug(bh, "refcount now=%d; releasing", in ext3_xattr_release_block()
500 le32_to_cpu(BHDR(bh)->h_refcount)); in ext3_xattr_release_block()
504 unlock_buffer(bh); in ext3_xattr_release_block()
627 struct buffer_head *bh; member
642 bs->bh = sb_bread(sb, EXT3_I(inode)->i_file_acl); in ext3_xattr_block_find()
644 if (!bs->bh) in ext3_xattr_block_find()
646 ea_bdebug(bs->bh, "b_count=%d, refcount=%d", in ext3_xattr_block_find()
647 atomic_read(&(bs->bh->b_count)), in ext3_xattr_block_find()
648 le32_to_cpu(BHDR(bs->bh)->h_refcount)); in ext3_xattr_block_find()
649 if (ext3_xattr_check_block(bs->bh)) { in ext3_xattr_block_find()
657 bs->s.base = BHDR(bs->bh); in ext3_xattr_block_find()
658 bs->s.first = BFIRST(bs->bh); in ext3_xattr_block_find()
659 bs->s.end = bs->bh->b_data + bs->bh->b_size; in ext3_xattr_block_find()
662 i->name, bs->bh->b_size, 1); in ext3_xattr_block_find()
689 ce = mb_cache_entry_get(ext3_xattr_cache, bs->bh->b_bdev, in ext3_xattr_block_set()
690 bs->bh->b_blocknr); in ext3_xattr_block_set()
691 error = ext3_journal_get_write_access(handle, bs->bh); in ext3_xattr_block_set()
694 lock_buffer(bs->bh); in ext3_xattr_block_set()
701 ea_bdebug(bs->bh, "modifying in-place"); in ext3_xattr_block_set()
707 ext3_xattr_cache_insert(bs->bh); in ext3_xattr_block_set()
709 unlock_buffer(bs->bh); in ext3_xattr_block_set()
714 bs->bh); in ext3_xattr_block_set()
719 int offset = (char *)s->here - bs->bh->b_data; in ext3_xattr_block_set()
721 unlock_buffer(bs->bh); in ext3_xattr_block_set()
722 journal_release_buffer(handle, bs->bh); in ext3_xattr_block_set()
728 ea_bdebug(bs->bh, "cloning"); in ext3_xattr_block_set()
729 s->base = kmalloc(bs->bh->b_size, GFP_NOFS); in ext3_xattr_block_set()
733 memcpy(s->base, BHDR(bs->bh), bs->bh->b_size); in ext3_xattr_block_set()
737 s->end = s->base + bs->bh->b_size; in ext3_xattr_block_set()
767 if (new_bh == bs->bh) in ext3_xattr_block_set()
791 } else if (bs->bh && s->base == bs->bh->b_data) { in ext3_xattr_block_set()
793 ea_bdebug(bs->bh, "keeping this block"); in ext3_xattr_block_set()
794 new_bh = bs->bh; in ext3_xattr_block_set()
841 if (bs->bh && bs->bh != new_bh) in ext3_xattr_block_set()
842 ext3_xattr_release_block(handle, inode, bs->bh); in ext3_xattr_block_set()
849 if (!(bs->bh && s->base == bs->bh->b_data)) in ext3_xattr_block_set()
968 error = ext3_journal_get_write_access(handle, is.iloc.bh); in ext3_xattr_set_handle()
1031 is.iloc.bh = NULL; in ext3_xattr_set_handle()
1037 brelse(is.iloc.bh); in ext3_xattr_set_handle()
1038 brelse(bs.bh); in ext3_xattr_set_handle()
1088 struct buffer_head *bh = NULL; in ext3_xattr_delete_inode() local
1092 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); in ext3_xattr_delete_inode()
1093 if (!bh) { in ext3_xattr_delete_inode()
1099 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || in ext3_xattr_delete_inode()
1100 BHDR(bh)->h_blocks != cpu_to_le32(1)) { in ext3_xattr_delete_inode()
1106 ext3_xattr_release_block(handle, inode, bh); in ext3_xattr_delete_inode()
1110 brelse(bh); in ext3_xattr_delete_inode()
1133 ext3_xattr_cache_insert(struct buffer_head *bh) in ext3_xattr_cache_insert() argument
1135 __u32 hash = le32_to_cpu(BHDR(bh)->h_hash); in ext3_xattr_cache_insert()
1141 ea_bdebug(bh, "out of memory"); in ext3_xattr_cache_insert()
1144 error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash); in ext3_xattr_cache_insert()
1148 ea_bdebug(bh, "already in cache"); in ext3_xattr_cache_insert()
1152 ea_bdebug(bh, "inserting [%x]", (int)hash); in ext3_xattr_cache_insert()
1219 struct buffer_head *bh; in ext3_xattr_cache_find() local
1226 bh = sb_bread(inode->i_sb, ce->e_block); in ext3_xattr_cache_find()
1227 if (!bh) { in ext3_xattr_cache_find()
1231 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= in ext3_xattr_cache_find()
1235 le32_to_cpu(BHDR(bh)->h_refcount), in ext3_xattr_cache_find()
1237 } else if (ext3_xattr_cmp(header, BHDR(bh)) == 0) { in ext3_xattr_cache_find()
1239 return bh; in ext3_xattr_cache_find()
1241 brelse(bh); in ext3_xattr_cache_find()