diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2019-09-12 11:44:44 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2019-09-13 17:42:27 +0300 |
commit | 26d2ef0cd0f7c12aa331b502c1c1460b85ebd04f (patch) | |
tree | e25b635d574645d3ea754e931a8081fb7edc574e /drivers/md | |
parent | 7431b7835f554f8608b415a02cf3c3f086309e02 (diff) | |
download | linux-26d2ef0cd0f7c12aa331b502c1c1460b85ebd04f.tar.xz |
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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-bufio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 2a48ea3f1b30..d3c86bf00075 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -431,8 +431,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 b->stack_len = 0; #endif @@ -446,8 +444,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); } @@ -465,6 +461,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); } /* @@ -479,6 +477,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); } /* |