mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
UPSTREAM: dm bufio: call adjust_total_allocated from __link_buffer and __unlink_buffer
Move the call to adjust_total_allocated() to __link_buffer() and
__unlink_buffer() so that only used buffers are counted. Reserved
buffers are not.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit 26d2ef0cd0)
Bug: 136247322
Change-Id: Ia47e99082a4c1a2acf5f5b5aab1a21fd8b6300df
Signed-off-by: Martijn Coenen <maco@android.com>
This commit is contained in:
committed by
Martijn Coenen
parent
c8532f7af6
commit
4ab67e0f0e
@@ -435,8 +435,6 @@ static struct dm_buffer *alloc_buffer(struct dm_bufio_client *c, gfp_t gfp_mask)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
adjust_total_allocated(b->data_mode, (long)c->block_size);
|
||||
|
||||
#ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
|
||||
memset(&b->stack_trace, 0, sizeof(b->stack_trace));
|
||||
#endif
|
||||
@@ -450,8 +448,6 @@ static void free_buffer(struct dm_buffer *b)
|
||||
{
|
||||
struct dm_bufio_client *c = b->c;
|
||||
|
||||
adjust_total_allocated(b->data_mode, -(long)c->block_size);
|
||||
|
||||
free_buffer_data(c, b->data, b->data_mode);
|
||||
kmem_cache_free(c->slab_buffer, b);
|
||||
}
|
||||
@@ -469,6 +465,8 @@ static void __link_buffer(struct dm_buffer *b, sector_t block, int dirty)
|
||||
list_add(&b->lru_list, &c->lru[dirty]);
|
||||
__insert(b->c, b);
|
||||
b->last_accessed = jiffies;
|
||||
|
||||
adjust_total_allocated(b->data_mode, (long)c->block_size);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -483,6 +481,8 @@ static void __unlink_buffer(struct dm_buffer *b)
|
||||
c->n_buffers[b->list_mode]--;
|
||||
__remove(b->c, b);
|
||||
list_del(&b->lru_list);
|
||||
|
||||
adjust_total_allocated(b->data_mode, -(long)c->block_size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user