Re: [PATCH 3/6] zram: use generic start/end io accounting

2015-03-11 Thread Minchan Kim
On Wed, Mar 11, 2015 at 12:08:31AM +0900, Sergey Senozhatsky wrote:
> Use bio generic_start_io_acct() and generic_end_io_acct() to account
> device's block layer statistics. This will let users to monitor zram
> activities using sysstat and similar packages/tools.

Yay, Thanks!

> 
> Apart from the usual per-stat sysfs attr, zram IO stats are now also
> available in '/sys/block/zram/stat' and '/proc/diskstats' files.
> 
> We will slowly get rid of per-stat sysfs files.
> 
> Signed-off-by: Sergey Senozhatsky 
Acked-by: Minchan Kim 

-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/6] zram: use generic start/end io accounting

2015-03-11 Thread Minchan Kim
On Wed, Mar 11, 2015 at 12:08:31AM +0900, Sergey Senozhatsky wrote:
 Use bio generic_start_io_acct() and generic_end_io_acct() to account
 device's block layer statistics. This will let users to monitor zram
 activities using sysstat and similar packages/tools.

Yay, Thanks!

 
 Apart from the usual per-stat sysfs attr, zram IO stats are now also
 available in '/sys/block/zramid/stat' and '/proc/diskstats' files.
 
 We will slowly get rid of per-stat sysfs files.
 
 Signed-off-by: Sergey Senozhatsky sergey.senozhat...@gmail.com
Acked-by: Minchan Kim minc...@kernel.org

-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] zram: use generic start/end io accounting

2015-03-10 Thread Sergey Senozhatsky
Use bio generic_start_io_acct() and generic_end_io_acct() to account
device's block layer statistics. This will let users to monitor zram
activities using sysstat and similar packages/tools.

Apart from the usual per-stat sysfs attr, zram IO stats are now also
available in '/sys/block/zram/stat' and '/proc/diskstats' files.

We will slowly get rid of per-stat sysfs files.

Signed-off-by: Sergey Senozhatsky 
---
 drivers/block/zram/zram_drv.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 472c40c..45319eb9 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -743,8 +743,12 @@ static void zram_bio_discard(struct zram *zram, u32 index,
 static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
int offset, int rw)
 {
+   unsigned long start_time = jiffies;
int ret;
 
+   generic_start_io_acct(rw, bvec->bv_len >> SECTOR_SHIFT,
+   >disk->part0);
+
if (rw == READ) {
atomic64_inc(>stats.num_reads);
ret = zram_bvec_read(zram, bvec, index, offset);
@@ -753,6 +757,8 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec 
*bvec, u32 index,
ret = zram_bvec_write(zram, bvec, index, offset);
}
 
+   generic_end_io_acct(rw, >disk->part0, start_time);
+
if (unlikely(ret)) {
if (rw == READ)
atomic64_inc(>stats.failed_reads);
-- 
2.3.2.209.gd67f9d5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] zram: use generic start/end io accounting

2015-03-10 Thread Sergey Senozhatsky
Use bio generic_start_io_acct() and generic_end_io_acct() to account
device's block layer statistics. This will let users to monitor zram
activities using sysstat and similar packages/tools.

Apart from the usual per-stat sysfs attr, zram IO stats are now also
available in '/sys/block/zramid/stat' and '/proc/diskstats' files.

We will slowly get rid of per-stat sysfs files.

Signed-off-by: Sergey Senozhatsky sergey.senozhat...@gmail.com
---
 drivers/block/zram/zram_drv.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 472c40c..45319eb9 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -743,8 +743,12 @@ static void zram_bio_discard(struct zram *zram, u32 index,
 static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
int offset, int rw)
 {
+   unsigned long start_time = jiffies;
int ret;
 
+   generic_start_io_acct(rw, bvec-bv_len  SECTOR_SHIFT,
+   zram-disk-part0);
+
if (rw == READ) {
atomic64_inc(zram-stats.num_reads);
ret = zram_bvec_read(zram, bvec, index, offset);
@@ -753,6 +757,8 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec 
*bvec, u32 index,
ret = zram_bvec_write(zram, bvec, index, offset);
}
 
+   generic_end_io_acct(rw, zram-disk-part0, start_time);
+
if (unlikely(ret)) {
if (rw == READ)
atomic64_inc(zram-stats.failed_reads);
-- 
2.3.2.209.gd67f9d5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/