aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2014-04-07 18:38:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 19:35:59 -0400
commitb7cccf8b4009bf74df61f3c9d86b95fabd807c11 (patch)
treeabf371c2142897309d8c292f1d87422422c612f1 /drivers/block
parentbe257c61306750d11c20d2ac567bf63304c696a3 (diff)
zram: remove good and bad compress stats
Remove `good' and `bad' compressed sub-requests stats. RW request may cause a number of RW sub-requests. zram used to account `good' compressed sub-queries (with compressed size less than 50% of original size), `bad' compressed sub-queries (with compressed size greater that 75% of original size), leaving sub-requests with compression size between 50% and 75% of original size not accounted and not reported. zram already accounts each sub-request's compression size so we can calculate real device compression ratio. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Acked-by: Jerome Marchand <jmarchan@redhat.com> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/zram/zram_drv.c11
-rw-r--r--drivers/block/zram/zram_drv.h2
2 files changed, 0 insertions, 13 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 3f0d6de36f74..995304ef40bb 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -293,7 +293,6 @@ static void zram_free_page(struct zram *zram, size_t index)
293{ 293{
294 struct zram_meta *meta = zram->meta; 294 struct zram_meta *meta = zram->meta;
295 unsigned long handle = meta->table[index].handle; 295 unsigned long handle = meta->table[index].handle;
296 u16 size = meta->table[index].size;
297 296
298 if (unlikely(!handle)) { 297 if (unlikely(!handle)) {
299 /* 298 /*
@@ -307,14 +306,8 @@ static void zram_free_page(struct zram *zram, size_t index)
307 return; 306 return;
308 } 307 }
309 308
310 if (unlikely(size > max_zpage_size))
311 atomic_dec(&zram->stats.bad_compress);
312
313 zs_free(meta->mem_pool, handle); 309 zs_free(meta->mem_pool, handle);
314 310
315 if (size <= PAGE_SIZE / 2)
316 atomic_dec(&zram->stats.good_compress);
317
318 atomic64_sub(meta->table[index].size, &zram->stats.compr_size); 311 atomic64_sub(meta->table[index].size, &zram->stats.compr_size);
319 atomic_dec(&zram->stats.pages_stored); 312 atomic_dec(&zram->stats.pages_stored);
320 313
@@ -478,7 +471,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
478 } 471 }
479 472
480 if (unlikely(clen > max_zpage_size)) { 473 if (unlikely(clen > max_zpage_size)) {
481 atomic_inc(&zram->stats.bad_compress);
482 clen = PAGE_SIZE; 474 clen = PAGE_SIZE;
483 src = NULL; 475 src = NULL;
484 if (is_partial_io(bvec)) 476 if (is_partial_io(bvec))
@@ -518,9 +510,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
518 /* Update stats */ 510 /* Update stats */
519 atomic64_add(clen, &zram->stats.compr_size); 511 atomic64_add(clen, &zram->stats.compr_size);
520 atomic_inc(&zram->stats.pages_stored); 512 atomic_inc(&zram->stats.pages_stored);
521 if (clen <= PAGE_SIZE / 2)
522 atomic_inc(&zram->stats.good_compress);
523
524out: 513out:
525 if (locked) 514 if (locked)
526 mutex_unlock(&meta->buffer_lock); 515 mutex_unlock(&meta->buffer_lock);
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index e81e9cdf4147..2f173cb1fd0a 100644
--- a/drivers/block/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
@@ -78,8 +78,6 @@ struct zram_stats {
78 atomic64_t notify_free; /* no. of swap slot free notifications */ 78 atomic64_t notify_free; /* no. of swap slot free notifications */
79 atomic_t pages_zero; /* no. of zero filled pages */ 79 atomic_t pages_zero; /* no. of zero filled pages */
80 atomic_t pages_stored; /* no. of pages currently stored */ 80 atomic_t pages_stored; /* no. of pages currently stored */
81 atomic_t good_compress; /* % of pages with compression ratio<=50% */
82 atomic_t bad_compress; /* % of pages with compression ratio>=75% */
83}; 81};
84 82
85struct zram_meta { 83struct zram_meta {