Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 104b4e51 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by Tejun Heo
Browse files

percpu_counter: Rename __percpu_counter_add to percpu_counter_add_batch



Currently, percpu_counter_add is a wrapper around __percpu_counter_add
which is preempt safe due to explicit calls to preempt_disable.  Given
how __ prefix is used in percpu related interfaces, the naming
unfortunately creates the false sense that __percpu_counter_add is
less safe than percpu_counter_add.  In terms of context-safety,
they're equivalent.  The only difference is that the __ version takes
a batch parameter.

Make this a bit more explicit by just renaming __percpu_counter_add to
percpu_counter_add_batch.

This patch doesn't cause any functional changes.

tj: Minor updates to patch description for clarity.  Cosmetic
    indentation updates.

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: David Sterba <dsterba@suse.com>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Jan Kara <jack@suse.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: linux-mm@kvack.org
Cc: "David S. Miller" <davem@davemloft.net>
parent df95e795
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -1255,7 +1255,7 @@ void clean_tree_block(struct btrfs_fs_info *fs_info,
		btrfs_assert_tree_locked(buf);
		btrfs_assert_tree_locked(buf);


		if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &buf->bflags)) {
		if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &buf->bflags)) {
			__percpu_counter_add(&fs_info->dirty_metadata_bytes,
			percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
						 -buf->len,
						 -buf->len,
						 fs_info->dirty_metadata_batch);
						 fs_info->dirty_metadata_batch);
			/* ugh, clear_extent_buffer_dirty needs to lock the page */
			/* ugh, clear_extent_buffer_dirty needs to lock the page */
@@ -4046,7 +4046,7 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
			buf->start, transid, fs_info->generation);
			buf->start, transid, fs_info->generation);
	was_dirty = set_extent_buffer_dirty(buf);
	was_dirty = set_extent_buffer_dirty(buf);
	if (!was_dirty)
	if (!was_dirty)
		__percpu_counter_add(&fs_info->dirty_metadata_bytes,
		percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
					 buf->len,
					 buf->len,
					 fs_info->dirty_metadata_batch);
					 fs_info->dirty_metadata_batch);
#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
+3 −3
Original line number Original line Diff line number Diff line
@@ -3584,7 +3584,7 @@ lock_extent_buffer_for_io(struct extent_buffer *eb,
		set_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags);
		set_bit(EXTENT_BUFFER_WRITEBACK, &eb->bflags);
		spin_unlock(&eb->refs_lock);
		spin_unlock(&eb->refs_lock);
		btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
		btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
		__percpu_counter_add(&fs_info->dirty_metadata_bytes,
		percpu_counter_add_batch(&fs_info->dirty_metadata_bytes,
					 -eb->len,
					 -eb->len,
					 fs_info->dirty_metadata_batch);
					 fs_info->dirty_metadata_batch);
		ret = 1;
		ret = 1;
+4 −4
Original line number Original line Diff line number Diff line
@@ -1682,7 +1682,7 @@ static void btrfs_set_bit_hook(struct inode *inode,
		if (btrfs_is_testing(fs_info))
		if (btrfs_is_testing(fs_info))
			return;
			return;


		__percpu_counter_add(&fs_info->delalloc_bytes, len,
		percpu_counter_add_batch(&fs_info->delalloc_bytes, len,
					 fs_info->delalloc_batch);
					 fs_info->delalloc_batch);
		spin_lock(&BTRFS_I(inode)->lock);
		spin_lock(&BTRFS_I(inode)->lock);
		BTRFS_I(inode)->delalloc_bytes += len;
		BTRFS_I(inode)->delalloc_bytes += len;
@@ -1749,7 +1749,7 @@ static void btrfs_clear_bit_hook(struct btrfs_inode *inode,
					&inode->vfs_inode,
					&inode->vfs_inode,
					state->start, len);
					state->start, len);


		__percpu_counter_add(&fs_info->delalloc_bytes, -len,
		percpu_counter_add_batch(&fs_info->delalloc_bytes, -len,
					 fs_info->delalloc_batch);
					 fs_info->delalloc_batch);
		spin_lock(&inode->lock);
		spin_lock(&inode->lock);
		inode->delalloc_bytes -= len;
		inode->delalloc_bytes -= len;
+2 −2
Original line number Original line Diff line number Diff line
@@ -1209,7 +1209,7 @@ xfs_mod_icount(
	struct xfs_mount	*mp,
	struct xfs_mount	*mp,
	int64_t			delta)
	int64_t			delta)
{
{
	__percpu_counter_add(&mp->m_icount, delta, XFS_ICOUNT_BATCH);
	percpu_counter_add_batch(&mp->m_icount, delta, XFS_ICOUNT_BATCH);
	if (__percpu_counter_compare(&mp->m_icount, 0, XFS_ICOUNT_BATCH) < 0) {
	if (__percpu_counter_compare(&mp->m_icount, 0, XFS_ICOUNT_BATCH) < 0) {
		ASSERT(0);
		ASSERT(0);
		percpu_counter_add(&mp->m_icount, -delta);
		percpu_counter_add(&mp->m_icount, -delta);
@@ -1288,7 +1288,7 @@ xfs_mod_fdblocks(
	else
	else
		batch = XFS_FDBLOCKS_BATCH;
		batch = XFS_FDBLOCKS_BATCH;


	__percpu_counter_add(&mp->m_fdblocks, delta, batch);
	percpu_counter_add_batch(&mp->m_fdblocks, delta, batch);
	if (__percpu_counter_compare(&mp->m_fdblocks, mp->m_alloc_set_aside,
	if (__percpu_counter_compare(&mp->m_fdblocks, mp->m_alloc_set_aside,
				     XFS_FDBLOCKS_BATCH) >= 0) {
				     XFS_FDBLOCKS_BATCH) >= 0) {
		/* we had space! */
		/* we had space! */
+1 −1
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ static inline bool bdi_has_dirty_io(struct backing_dev_info *bdi)
static inline void __add_wb_stat(struct bdi_writeback *wb,
static inline void __add_wb_stat(struct bdi_writeback *wb,
				 enum wb_stat_item item, s64 amount)
				 enum wb_stat_item item, s64 amount)
{
{
	__percpu_counter_add(&wb->stat[item], amount, WB_STAT_BATCH);
	percpu_counter_add_batch(&wb->stat[item], amount, WB_STAT_BATCH);
}
}


static inline void __inc_wb_stat(struct bdi_writeback *wb,
static inline void __inc_wb_stat(struct bdi_writeback *wb,
Loading