Lines Matching refs:bh
52 struct buffer_head *bh; in affs_grow_extcache() local
101 bh = affs_bread(sb, key); in affs_grow_extcache()
102 if (!bh) in affs_grow_extcache()
104 key = be32_to_cpu(AFFS_TAIL(sb, bh)->extension); in affs_grow_extcache()
105 affs_brelse(bh); in affs_grow_extcache()
119 affs_alloc_extblock(struct inode *inode, struct buffer_head *bh, u32 ext) in affs_alloc_extblock() argument
125 blocknr = affs_alloc_block(inode, bh->b_blocknr); in affs_alloc_extblock()
143 tmp = be32_to_cpu(AFFS_TAIL(sb, bh)->extension); in affs_alloc_extblock()
146 AFFS_TAIL(sb, bh)->extension = cpu_to_be32(blocknr); in affs_alloc_extblock()
147 affs_adjust_checksum(bh, blocknr - tmp); in affs_alloc_extblock()
148 mark_buffer_dirty_inode(bh, inode); in affs_alloc_extblock()
160 struct buffer_head *bh = AFFS_I(inode)->i_ext_bh; in affs_get_extblock() local
162 get_bh(bh); in affs_get_extblock()
165 bh = affs_get_extblock_slow(inode, ext); in affs_get_extblock()
167 return bh; in affs_get_extblock()
174 struct buffer_head *bh; in affs_get_extblock_slow() local
181 bh = AFFS_I(inode)->i_ext_bh; in affs_get_extblock_slow()
182 ext_key = be32_to_cpu(AFFS_TAIL(sb, bh)->extension); in affs_get_extblock_slow()
186 bh = affs_alloc_extblock(inode, bh, ext); in affs_get_extblock_slow()
187 if (IS_ERR(bh)) in affs_get_extblock_slow()
188 return bh; in affs_get_extblock_slow()
208 bh = affs_alloc_extblock(inode, prev_bh, ext); in affs_get_extblock_slow()
210 if (IS_ERR(bh)) in affs_get_extblock_slow()
211 return bh; in affs_get_extblock_slow()
259 bh = affs_bread(sb, ext_key); in affs_get_extblock_slow()
260 if (!bh) in affs_get_extblock_slow()
262 ext_key = be32_to_cpu(AFFS_TAIL(sb, bh)->extension); in affs_get_extblock_slow()
263 affs_brelse(bh); in affs_get_extblock_slow()
276 bh = affs_bread(sb, ext_key); in affs_get_extblock_slow()
277 if (!bh) in affs_get_extblock_slow()
285 AFFS_I(inode)->i_ext_bh = bh; in affs_get_extblock_slow()
286 get_bh(bh); in affs_get_extblock_slow()
288 return bh; in affs_get_extblock_slow()
291 affs_brelse(bh); in affs_get_extblock_slow()
468 struct buffer_head *bh, tmp_bh; in affs_bread_ino() local
474 bh = affs_bread(inode->i_sb, tmp_bh.b_blocknr); in affs_bread_ino()
475 if (bh) { in affs_bread_ino()
476 bh->b_state |= tmp_bh.b_state; in affs_bread_ino()
477 return bh; in affs_bread_ino()
487 struct buffer_head *bh, tmp_bh; in affs_getzeroblk_ino() local
493 bh = affs_getzeroblk(inode->i_sb, tmp_bh.b_blocknr); in affs_getzeroblk_ino()
494 if (bh) { in affs_getzeroblk_ino()
495 bh->b_state |= tmp_bh.b_state; in affs_getzeroblk_ino()
496 return bh; in affs_getzeroblk_ino()
506 struct buffer_head *bh, tmp_bh; in affs_getemptyblk_ino() local
512 bh = affs_getemptyblk(inode->i_sb, tmp_bh.b_blocknr); in affs_getemptyblk_ino()
513 if (bh) { in affs_getemptyblk_ino()
514 bh->b_state |= tmp_bh.b_state; in affs_getemptyblk_ino()
515 return bh; in affs_getemptyblk_ino()
527 struct buffer_head *bh; in affs_do_readpage_ofs() local
542 bh = affs_bread_ino(inode, bidx, create); in affs_do_readpage_ofs()
543 if (IS_ERR(bh)) in affs_do_readpage_ofs()
544 return PTR_ERR(bh); in affs_do_readpage_ofs()
548 memcpy(data + pos, AFFS_DATA(bh) + boff, tmp); in affs_do_readpage_ofs()
550 affs_brelse(bh); in affs_do_readpage_ofs()
563 struct buffer_head *bh, *prev_bh; in affs_extent_file_ofs() local
570 bh = NULL; in affs_extent_file_ofs()
575 bh = affs_bread_ino(inode, bidx, 0); in affs_extent_file_ofs()
576 if (IS_ERR(bh)) in affs_extent_file_ofs()
577 return PTR_ERR(bh); in affs_extent_file_ofs()
580 memset(AFFS_DATA(bh) + boff, 0, tmp); in affs_extent_file_ofs()
581 be32_add_cpu(&AFFS_DATA_HEAD(bh)->size, tmp); in affs_extent_file_ofs()
582 affs_fix_checksum(sb, bh); in affs_extent_file_ofs()
583 mark_buffer_dirty_inode(bh, inode); in affs_extent_file_ofs()
587 bh = affs_bread_ino(inode, bidx - 1, 0); in affs_extent_file_ofs()
588 if (IS_ERR(bh)) in affs_extent_file_ofs()
589 return PTR_ERR(bh); in affs_extent_file_ofs()
593 prev_bh = bh; in affs_extent_file_ofs()
594 bh = affs_getzeroblk_ino(inode, bidx); in affs_extent_file_ofs()
595 if (IS_ERR(bh)) in affs_extent_file_ofs()
599 AFFS_DATA_HEAD(bh)->ptype = cpu_to_be32(T_DATA); in affs_extent_file_ofs()
600 AFFS_DATA_HEAD(bh)->key = cpu_to_be32(inode->i_ino); in affs_extent_file_ofs()
601 AFFS_DATA_HEAD(bh)->sequence = cpu_to_be32(bidx); in affs_extent_file_ofs()
602 AFFS_DATA_HEAD(bh)->size = cpu_to_be32(tmp); in affs_extent_file_ofs()
603 affs_fix_checksum(sb, bh); in affs_extent_file_ofs()
604 bh->b_state &= ~(1UL << BH_New); in affs_extent_file_ofs()
605 mark_buffer_dirty_inode(bh, inode); in affs_extent_file_ofs()
613 AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr); in affs_extent_file_ofs()
614 affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp_next); in affs_extent_file_ofs()
621 affs_brelse(bh); in affs_extent_file_ofs()
627 return PTR_ERR(bh); in affs_extent_file_ofs()
695 struct buffer_head *bh, *prev_bh; in affs_write_end_ofs() local
715 bh = NULL; in affs_write_end_ofs()
721 bh = affs_bread_ino(inode, bidx, 0); in affs_write_end_ofs()
722 if (IS_ERR(bh)) { in affs_write_end_ofs()
723 written = PTR_ERR(bh); in affs_write_end_ofs()
728 memcpy(AFFS_DATA(bh) + boff, data + from, tmp); in affs_write_end_ofs()
729 be32_add_cpu(&AFFS_DATA_HEAD(bh)->size, tmp); in affs_write_end_ofs()
730 affs_fix_checksum(sb, bh); in affs_write_end_ofs()
731 mark_buffer_dirty_inode(bh, inode); in affs_write_end_ofs()
736 bh = affs_bread_ino(inode, bidx - 1, 0); in affs_write_end_ofs()
737 if (IS_ERR(bh)) { in affs_write_end_ofs()
738 written = PTR_ERR(bh); in affs_write_end_ofs()
743 prev_bh = bh; in affs_write_end_ofs()
744 bh = affs_getemptyblk_ino(inode, bidx); in affs_write_end_ofs()
745 if (IS_ERR(bh)) in affs_write_end_ofs()
747 memcpy(AFFS_DATA(bh), data + from, bsize); in affs_write_end_ofs()
748 if (buffer_new(bh)) { in affs_write_end_ofs()
749 AFFS_DATA_HEAD(bh)->ptype = cpu_to_be32(T_DATA); in affs_write_end_ofs()
750 AFFS_DATA_HEAD(bh)->key = cpu_to_be32(inode->i_ino); in affs_write_end_ofs()
751 AFFS_DATA_HEAD(bh)->sequence = cpu_to_be32(bidx); in affs_write_end_ofs()
752 AFFS_DATA_HEAD(bh)->size = cpu_to_be32(bsize); in affs_write_end_ofs()
753 AFFS_DATA_HEAD(bh)->next = 0; in affs_write_end_ofs()
754 bh->b_state &= ~(1UL << BH_New); in affs_write_end_ofs()
762 AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr); in affs_write_end_ofs()
763 affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp_next); in affs_write_end_ofs()
768 affs_fix_checksum(sb, bh); in affs_write_end_ofs()
769 mark_buffer_dirty_inode(bh, inode); in affs_write_end_ofs()
775 prev_bh = bh; in affs_write_end_ofs()
776 bh = affs_bread_ino(inode, bidx, 1); in affs_write_end_ofs()
777 if (IS_ERR(bh)) in affs_write_end_ofs()
781 memcpy(AFFS_DATA(bh), data + from, tmp); in affs_write_end_ofs()
782 if (buffer_new(bh)) { in affs_write_end_ofs()
783 AFFS_DATA_HEAD(bh)->ptype = cpu_to_be32(T_DATA); in affs_write_end_ofs()
784 AFFS_DATA_HEAD(bh)->key = cpu_to_be32(inode->i_ino); in affs_write_end_ofs()
785 AFFS_DATA_HEAD(bh)->sequence = cpu_to_be32(bidx); in affs_write_end_ofs()
786 AFFS_DATA_HEAD(bh)->size = cpu_to_be32(tmp); in affs_write_end_ofs()
787 AFFS_DATA_HEAD(bh)->next = 0; in affs_write_end_ofs()
788 bh->b_state &= ~(1UL << BH_New); in affs_write_end_ofs()
796 AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr); in affs_write_end_ofs()
797 affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp_next); in affs_write_end_ofs()
800 } else if (be32_to_cpu(AFFS_DATA_HEAD(bh)->size) < tmp) in affs_write_end_ofs()
801 AFFS_DATA_HEAD(bh)->size = cpu_to_be32(tmp); in affs_write_end_ofs()
803 affs_fix_checksum(sb, bh); in affs_write_end_ofs()
804 mark_buffer_dirty_inode(bh, inode); in affs_write_end_ofs()
812 affs_brelse(bh); in affs_write_end_ofs()
830 bh = prev_bh; in affs_write_end_ofs()
832 written = PTR_ERR(bh); in affs_write_end_ofs()
946 struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0); in affs_truncate() local
948 if (IS_ERR(bh)) { in affs_truncate()
951 ext, PTR_ERR(bh)); in affs_truncate()
954 tmp = be32_to_cpu(AFFS_DATA_HEAD(bh)->next); in affs_truncate()
955 AFFS_DATA_HEAD(bh)->next = 0; in affs_truncate()
956 affs_adjust_checksum(bh, -tmp); in affs_truncate()
957 affs_brelse(bh); in affs_truncate()