aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/xattr.c')
-rw-r--r--fs/ext2/xattr.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index a99d46f3b26e..987a5261cc2e 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -646,8 +646,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
646 unlock_buffer(new_bh); 646 unlock_buffer(new_bh);
647 goto cleanup; 647 goto cleanup;
648 } 648 }
649 HDR(new_bh)->h_refcount = cpu_to_le32(1 + 649 le32_add_cpu(&HDR(new_bh)->h_refcount, 1);
650 le32_to_cpu(HDR(new_bh)->h_refcount));
651 ea_bdebug(new_bh, "refcount now=%d", 650 ea_bdebug(new_bh, "refcount now=%d",
652 le32_to_cpu(HDR(new_bh)->h_refcount)); 651 le32_to_cpu(HDR(new_bh)->h_refcount));
653 } 652 }
@@ -660,10 +659,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
660 ext2_xattr_cache_insert(new_bh); 659 ext2_xattr_cache_insert(new_bh);
661 } else { 660 } else {
662 /* We need to allocate a new block */ 661 /* We need to allocate a new block */
663 int goal = le32_to_cpu(EXT2_SB(sb)->s_es-> 662 ext2_fsblk_t goal = ext2_group_first_block_no(sb,
664 s_first_data_block) + 663 EXT2_I(inode)->i_block_group);
665 EXT2_I(inode)->i_block_group *
666 EXT2_BLOCKS_PER_GROUP(sb);
667 int block = ext2_new_block(inode, goal, &error); 664 int block = ext2_new_block(inode, goal, &error);
668 if (error) 665 if (error)
669 goto cleanup; 666 goto cleanup;
@@ -731,8 +728,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
731 bforget(old_bh); 728 bforget(old_bh);
732 } else { 729 } else {
733 /* Decrement the refcount only. */ 730 /* Decrement the refcount only. */
734 HDR(old_bh)->h_refcount = cpu_to_le32( 731 le32_add_cpu(&HDR(old_bh)->h_refcount, -1);
735 le32_to_cpu(HDR(old_bh)->h_refcount) - 1);
736 if (ce) 732 if (ce)
737 mb_cache_entry_release(ce); 733 mb_cache_entry_release(ce);
738 DQUOT_FREE_BLOCK(inode, 1); 734 DQUOT_FREE_BLOCK(inode, 1);
@@ -789,8 +785,7 @@ ext2_xattr_delete_inode(struct inode *inode)
789 bforget(bh); 785 bforget(bh);
790 unlock_buffer(bh); 786 unlock_buffer(bh);
791 } else { 787 } else {
792 HDR(bh)->h_refcount = cpu_to_le32( 788 le32_add_cpu(&HDR(bh)->h_refcount, -1);
793 le32_to_cpu(HDR(bh)->h_refcount) - 1);
794 if (ce) 789 if (ce)
795 mb_cache_entry_release(ce); 790 mb_cache_entry_release(ce);
796 ea_bdebug(bh, "refcount now=%d", 791 ea_bdebug(bh, "refcount now=%d",