diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/balloc.c | 7 | ||||
-rw-r--r-- | fs/ext3/ialloc.c | 12 | ||||
-rw-r--r-- | fs/ext3/resize.c | 12 | ||||
-rw-r--r-- | fs/ext3/super.c | 2 | ||||
-rw-r--r-- | fs/ext3/xattr.c | 6 |
5 files changed, 13 insertions, 26 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index a75713031105..da0cb2c0e437 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -630,9 +630,7 @@ do_more: | |||
630 | jbd_unlock_bh_state(bitmap_bh); | 630 | jbd_unlock_bh_state(bitmap_bh); |
631 | 631 | ||
632 | spin_lock(sb_bgl_lock(sbi, block_group)); | 632 | spin_lock(sb_bgl_lock(sbi, block_group)); |
633 | desc->bg_free_blocks_count = | 633 | le16_add_cpu(&desc->bg_free_blocks_count, group_freed); |
634 | cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) + | ||
635 | group_freed); | ||
636 | spin_unlock(sb_bgl_lock(sbi, block_group)); | 634 | spin_unlock(sb_bgl_lock(sbi, block_group)); |
637 | percpu_counter_add(&sbi->s_freeblocks_counter, count); | 635 | percpu_counter_add(&sbi->s_freeblocks_counter, count); |
638 | 636 | ||
@@ -1696,8 +1694,7 @@ allocated: | |||
1696 | ret_block, goal_hits, goal_attempts); | 1694 | ret_block, goal_hits, goal_attempts); |
1697 | 1695 | ||
1698 | spin_lock(sb_bgl_lock(sbi, group_no)); | 1696 | spin_lock(sb_bgl_lock(sbi, group_no)); |
1699 | gdp->bg_free_blocks_count = | 1697 | le16_add_cpu(&gdp->bg_free_blocks_count, -num); |
1700 | cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num); | ||
1701 | spin_unlock(sb_bgl_lock(sbi, group_no)); | 1698 | spin_unlock(sb_bgl_lock(sbi, group_no)); |
1702 | percpu_counter_sub(&sbi->s_freeblocks_counter, num); | 1699 | percpu_counter_sub(&sbi->s_freeblocks_counter, num); |
1703 | 1700 | ||
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 58ae2f943f12..4f4020c54683 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -164,11 +164,9 @@ void ext3_free_inode (handle_t *handle, struct inode * inode) | |||
164 | 164 | ||
165 | if (gdp) { | 165 | if (gdp) { |
166 | spin_lock(sb_bgl_lock(sbi, block_group)); | 166 | spin_lock(sb_bgl_lock(sbi, block_group)); |
167 | gdp->bg_free_inodes_count = cpu_to_le16( | 167 | le16_add_cpu(&gdp->bg_free_inodes_count, 1); |
168 | le16_to_cpu(gdp->bg_free_inodes_count) + 1); | ||
169 | if (is_directory) | 168 | if (is_directory) |
170 | gdp->bg_used_dirs_count = cpu_to_le16( | 169 | le16_add_cpu(&gdp->bg_used_dirs_count, -1); |
171 | le16_to_cpu(gdp->bg_used_dirs_count) - 1); | ||
172 | spin_unlock(sb_bgl_lock(sbi, block_group)); | 170 | spin_unlock(sb_bgl_lock(sbi, block_group)); |
173 | percpu_counter_inc(&sbi->s_freeinodes_counter); | 171 | percpu_counter_inc(&sbi->s_freeinodes_counter); |
174 | if (is_directory) | 172 | if (is_directory) |
@@ -527,11 +525,9 @@ got: | |||
527 | err = ext3_journal_get_write_access(handle, bh2); | 525 | err = ext3_journal_get_write_access(handle, bh2); |
528 | if (err) goto fail; | 526 | if (err) goto fail; |
529 | spin_lock(sb_bgl_lock(sbi, group)); | 527 | spin_lock(sb_bgl_lock(sbi, group)); |
530 | gdp->bg_free_inodes_count = | 528 | le16_add_cpu(&gdp->bg_free_inodes_count, -1); |
531 | cpu_to_le16(le16_to_cpu(gdp->bg_free_inodes_count) - 1); | ||
532 | if (S_ISDIR(mode)) { | 529 | if (S_ISDIR(mode)) { |
533 | gdp->bg_used_dirs_count = | 530 | le16_add_cpu(&gdp->bg_used_dirs_count, 1); |
534 | cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1); | ||
535 | } | 531 | } |
536 | spin_unlock(sb_bgl_lock(sbi, group)); | 532 | spin_unlock(sb_bgl_lock(sbi, group)); |
537 | BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata"); | 533 | BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata"); |
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index ebc05af7343a..9397d779c43d 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -518,8 +518,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
518 | EXT3_SB(sb)->s_gdb_count++; | 518 | EXT3_SB(sb)->s_gdb_count++; |
519 | kfree(o_group_desc); | 519 | kfree(o_group_desc); |
520 | 520 | ||
521 | es->s_reserved_gdt_blocks = | 521 | le16_add_cpu(&es->s_reserved_gdt_blocks, -1); |
522 | cpu_to_le16(le16_to_cpu(es->s_reserved_gdt_blocks) - 1); | ||
523 | ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); | 522 | ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); |
524 | 523 | ||
525 | return 0; | 524 | return 0; |
@@ -890,10 +889,8 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input) | |||
890 | * blocks/inodes before the group is live won't actually let us | 889 | * blocks/inodes before the group is live won't actually let us |
891 | * allocate the new space yet. | 890 | * allocate the new space yet. |
892 | */ | 891 | */ |
893 | es->s_blocks_count = cpu_to_le32(le32_to_cpu(es->s_blocks_count) + | 892 | le32_add_cpu(&es->s_blocks_count, input->blocks_count); |
894 | input->blocks_count); | 893 | le32_add_cpu(&es->s_inodes_count, EXT3_INODES_PER_GROUP(sb)); |
895 | es->s_inodes_count = cpu_to_le32(le32_to_cpu(es->s_inodes_count) + | ||
896 | EXT3_INODES_PER_GROUP(sb)); | ||
897 | 894 | ||
898 | /* | 895 | /* |
899 | * We need to protect s_groups_count against other CPUs seeing | 896 | * We need to protect s_groups_count against other CPUs seeing |
@@ -926,8 +923,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input) | |||
926 | 923 | ||
927 | /* Update the reserved block counts only once the new group is | 924 | /* Update the reserved block counts only once the new group is |
928 | * active. */ | 925 | * active. */ |
929 | es->s_r_blocks_count = cpu_to_le32(le32_to_cpu(es->s_r_blocks_count) + | 926 | le32_add_cpu(&es->s_r_blocks_count, input->reserved_blocks); |
930 | input->reserved_blocks); | ||
931 | 927 | ||
932 | /* Update the free space counts */ | 928 | /* Update the free space counts */ |
933 | percpu_counter_add(&sbi->s_freeblocks_counter, | 929 | percpu_counter_add(&sbi->s_freeblocks_counter, |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index cf2a2c3660ec..8e02cbfb1123 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -1222,7 +1222,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1222 | #endif | 1222 | #endif |
1223 | if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) | 1223 | if (!(__s16) le16_to_cpu(es->s_max_mnt_count)) |
1224 | es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); | 1224 | es->s_max_mnt_count = cpu_to_le16(EXT3_DFL_MAX_MNT_COUNT); |
1225 | es->s_mnt_count=cpu_to_le16(le16_to_cpu(es->s_mnt_count) + 1); | 1225 | le16_add_cpu(&es->s_mnt_count, 1); |
1226 | es->s_mtime = cpu_to_le32(get_seconds()); | 1226 | es->s_mtime = cpu_to_le32(get_seconds()); |
1227 | ext3_update_dynamic_rev(sb); | 1227 | ext3_update_dynamic_rev(sb); |
1228 | EXT3_SET_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); | 1228 | EXT3_SET_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 408373819e34..fb89c299bece 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -492,8 +492,7 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode, | |||
492 | get_bh(bh); | 492 | get_bh(bh); |
493 | ext3_forget(handle, 1, inode, bh, bh->b_blocknr); | 493 | ext3_forget(handle, 1, inode, bh, bh->b_blocknr); |
494 | } else { | 494 | } else { |
495 | BHDR(bh)->h_refcount = cpu_to_le32( | 495 | le32_add_cpu(&BHDR(bh)->h_refcount, -1); |
496 | le32_to_cpu(BHDR(bh)->h_refcount) - 1); | ||
497 | error = ext3_journal_dirty_metadata(handle, bh); | 496 | error = ext3_journal_dirty_metadata(handle, bh); |
498 | if (IS_SYNC(inode)) | 497 | if (IS_SYNC(inode)) |
499 | handle->h_sync = 1; | 498 | handle->h_sync = 1; |
@@ -780,8 +779,7 @@ inserted: | |||
780 | if (error) | 779 | if (error) |
781 | goto cleanup_dquot; | 780 | goto cleanup_dquot; |
782 | lock_buffer(new_bh); | 781 | lock_buffer(new_bh); |
783 | BHDR(new_bh)->h_refcount = cpu_to_le32(1 + | 782 | le32_add_cpu(&BHDR(new_bh)->h_refcount, 1); |
784 | le32_to_cpu(BHDR(new_bh)->h_refcount)); | ||
785 | ea_bdebug(new_bh, "reusing; refcount now=%d", | 783 | ea_bdebug(new_bh, "reusing; refcount now=%d", |
786 | le32_to_cpu(BHDR(new_bh)->h_refcount)); | 784 | le32_to_cpu(BHDR(new_bh)->h_refcount)); |
787 | unlock_buffer(new_bh); | 785 | unlock_buffer(new_bh); |