Skip to content

Commit aa0dff2

Browse files
Peter ZijlstraLinus Torvalds
authored andcommitted
lib: percpu_counter_add
s/percpu_counter_mod/percpu_counter_add/ Because its a better name, _mod implies modulo. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c4dc4be commit aa0dff2

8 files changed

Lines changed: 17 additions & 17 deletions

File tree

‎fs/ext2/balloc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static int reserve_blocks(struct super_block *sb, int count)
124124
return 0;
125125
}
126126

127-
percpu_counter_mod(&sbi->s_freeblocks_counter, -count);
127+
percpu_counter_add(&sbi->s_freeblocks_counter, -count);
128128
sb->s_dirt = 1;
129129
return count;
130130
}
@@ -134,7 +134,7 @@ static void release_blocks(struct super_block *sb, int count)
134134
if (count) {
135135
struct ext2_sb_info *sbi = EXT2_SB(sb);
136136

137-
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
137+
percpu_counter_add(&sbi->s_freeblocks_counter, count);
138138
sb->s_dirt = 1;
139139
}
140140
}

‎fs/ext2/ialloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ struct inode *ext2_new_inode(struct inode *dir, int mode)
542542
goto fail;
543543
}
544544

545-
percpu_counter_mod(&sbi->s_freeinodes_counter, -1);
545+
percpu_counter_add(&sbi->s_freeinodes_counter, -1);
546546
if (S_ISDIR(mode))
547547
percpu_counter_inc(&sbi->s_dirs_counter);
548548

‎fs/ext3/balloc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ void ext3_free_blocks_sb(handle_t *handle, struct super_block *sb,
570570
cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
571571
group_freed);
572572
spin_unlock(sb_bgl_lock(sbi, block_group));
573-
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
573+
percpu_counter_add(&sbi->s_freeblocks_counter, count);
574574

575575
/* We dirtied the bitmap block */
576576
BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
@@ -1633,7 +1633,7 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
16331633
gdp->bg_free_blocks_count =
16341634
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
16351635
spin_unlock(sb_bgl_lock(sbi, group_no));
1636-
percpu_counter_mod(&sbi->s_freeblocks_counter, -num);
1636+
percpu_counter_add(&sbi->s_freeblocks_counter, -num);
16371637

16381638
BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
16391639
err = ext3_journal_dirty_metadata(handle, gdp_bh);

‎fs/ext3/resize.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,9 +884,9 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
884884
input->reserved_blocks);
885885

886886
/* Update the free space counts */
887-
percpu_counter_mod(&sbi->s_freeblocks_counter,
887+
percpu_counter_add(&sbi->s_freeblocks_counter,
888888
input->free_blocks_count);
889-
percpu_counter_mod(&sbi->s_freeinodes_counter,
889+
percpu_counter_add(&sbi->s_freeinodes_counter,
890890
EXT3_INODES_PER_GROUP(sb));
891891

892892
ext3_journal_dirty_metadata(handle, sbi->s_sbh);

‎fs/ext4/balloc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
587587
cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
588588
group_freed);
589589
spin_unlock(sb_bgl_lock(sbi, block_group));
590-
percpu_counter_mod(&sbi->s_freeblocks_counter, count);
590+
percpu_counter_add(&sbi->s_freeblocks_counter, count);
591591

592592
/* We dirtied the bitmap block */
593593
BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
@@ -1647,7 +1647,7 @@ ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode,
16471647
gdp->bg_free_blocks_count =
16481648
cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
16491649
spin_unlock(sb_bgl_lock(sbi, group_no));
1650-
percpu_counter_mod(&sbi->s_freeblocks_counter, -num);
1650+
percpu_counter_add(&sbi->s_freeblocks_counter, -num);
16511651

16521652
BUFFER_TRACE(gdp_bh, "journal_dirty_metadata for group descriptor");
16531653
err = ext4_journal_dirty_metadata(handle, gdp_bh);

‎fs/ext4/resize.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,9 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
893893
input->reserved_blocks);
894894

895895
/* Update the free space counts */
896-
percpu_counter_mod(&sbi->s_freeblocks_counter,
896+
percpu_counter_add(&sbi->s_freeblocks_counter,
897897
input->free_blocks_count);
898-
percpu_counter_mod(&sbi->s_freeinodes_counter,
898+
percpu_counter_add(&sbi->s_freeinodes_counter,
899899
EXT4_INODES_PER_GROUP(sb));
900900

901901
ext4_journal_dirty_metadata(handle, sbi->s_sbh);

‎include/linux/percpu_counter.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct percpu_counter {
3232

3333
void percpu_counter_init(struct percpu_counter *fbc, s64 amount);
3434
void percpu_counter_destroy(struct percpu_counter *fbc);
35-
void percpu_counter_mod(struct percpu_counter *fbc, s32 amount);
35+
void percpu_counter_add(struct percpu_counter *fbc, s32 amount);
3636
s64 percpu_counter_sum(struct percpu_counter *fbc);
3737

3838
static inline s64 percpu_counter_read(struct percpu_counter *fbc)
@@ -71,7 +71,7 @@ static inline void percpu_counter_destroy(struct percpu_counter *fbc)
7171
}
7272

7373
static inline void
74-
percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
74+
percpu_counter_add(struct percpu_counter *fbc, s32 amount)
7575
{
7676
preempt_disable();
7777
fbc->count += amount;
@@ -97,12 +97,12 @@ static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
9797

9898
static inline void percpu_counter_inc(struct percpu_counter *fbc)
9999
{
100-
percpu_counter_mod(fbc, 1);
100+
percpu_counter_add(fbc, 1);
101101
}
102102

103103
static inline void percpu_counter_dec(struct percpu_counter *fbc)
104104
{
105-
percpu_counter_mod(fbc, -1);
105+
percpu_counter_add(fbc, -1);
106106
}
107107

108108
#endif /* _LINUX_PERCPU_COUNTER_H */

‎lib/percpu_counter.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static LIST_HEAD(percpu_counters);
1414
static DEFINE_MUTEX(percpu_counters_lock);
1515
#endif
1616

17-
void percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
17+
void percpu_counter_add(struct percpu_counter *fbc, s32 amount)
1818
{
1919
long count;
2020
s32 *pcount;
@@ -32,7 +32,7 @@ void percpu_counter_mod(struct percpu_counter *fbc, s32 amount)
3232
}
3333
put_cpu();
3434
}
35-
EXPORT_SYMBOL(percpu_counter_mod);
35+
EXPORT_SYMBOL(percpu_counter_add);
3636

3737
/*
3838
* Add up all the per-cpu counts, return the result. This is a more accurate

0 commit comments

Comments
 (0)