lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1502413832-13560-1-git-send-email-xieyisheng1@huawei.com>
Date:   Fri, 11 Aug 2017 09:10:32 +0800
From:   Yisheng Xie <xieyisheng1@...wei.com>
To:     <akpm@...ux-foundation.org>
CC:     <minchan@...nel.org>, <ngupta@...are.org>,
        <sergey.senozhatsky.work@...il.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH -next] zram: fix compr_data_size stat

The compr_data_size is a stat for compressed size of pages stored, which
should add comp_len when we compresse a page.

Meanwhile fix typos in comment:
* ZRAM_SAME means page consists the same element not the entirely zero page
* read_from_bdev_async() return 1 to avoid call page_endio() in zram_rw_page()

Signed-off-by: Yisheng Xie <xieyisheng1@...wei.com>
---
 drivers/block/zram/zram_drv.c | 3 ++-
 drivers/block/zram/zram_drv.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index e27daca..b2b75b1 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -455,7 +455,7 @@ void zram_page_end_io(struct bio *bio)
 }
 
 /*
- * Returns 0 if the submission is successful.
+ * Returns 1 if the submission is successful.
  */
 static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
 			unsigned long entry, struct bio *parent)
@@ -1073,6 +1073,7 @@ static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
 	}  else {
 		zram_set_handle(zram, index, handle);
 		zram_set_obj_size(zram, index, comp_len);
+		atomic64_add(comp_len, &zram->stats.compr_data_size);
 	}
 	zram_slot_unlock(zram, index);
 
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index 5573dc2..31762db 100644
--- a/drivers/block/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
@@ -60,7 +60,7 @@
 
 /* Flags for zram pages (table[page_no].value) */
 enum zram_pageflags {
-	/* Page consists entirely of zeros */
+	/* Page consists the same element */
 	ZRAM_SAME = ZRAM_FLAG_SHIFT,
 	ZRAM_ACCESS,	/* page is now accessed */
 	ZRAM_WB,	/* page is stored on backing_device */
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ