Discussion:
[PATCH] Enable /proc/diskstats for /dev/ramX
(too old to reply)
Ryo Onodera
2012-11-19 07:20:02 UTC
Permalink
Signed-off-by: Ryo Onodera <***@gmail.com>
---
drivers/block/brd.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 531ceb3..181b2d7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
sector_t sector;
int i;
int err = -EIO;
+ int cpu;

sector = bio->bi_sector;
if (sector + (bio->bi_size >> SECTOR_SHIFT) >
@@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
if (rw == READA)
rw = READ;

+ cpu = part_stat_lock();
+ part_stat_inc(cpu, &brd->brd_disk->part0, ios[rw]);
+ part_stat_add(cpu, &brd->brd_disk->part0, sectors[rw],
+ bio_sectors(bio));
+ part_stat_unlock();
+
bio_for_each_segment(bvec, bio, i) {
unsigned int len = bvec->bv_len;
err = brd_do_bvec(brd, bvec->bv_page, len,
--
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Ryo Onodera
2012-11-19 07:30:02 UTC
Permalink
Hi,

I'm Ryo Onodera. I created this very tiny patch to enable /proc/diskstats for
/dev/ramX.

I'm contacting Nick Piggin as the maintainer of ramdisk ram block.

This is my first patch to the Linux kernel. Sorry if this is not the expected
way of submitting patches.

Regards

Ryo Onodera
Post by Ryo Onodera
---
drivers/block/brd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 531ceb3..181b2d7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
sector_t sector;
int i;
int err = -EIO;
+ int cpu;
sector = bio->bi_sector;
if (sector + (bio->bi_size >> SECTOR_SHIFT) >
@@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
if (rw == READA)
rw = READ;
+ cpu = part_stat_lock();
+ part_stat_inc(cpu, &brd->brd_disk->part0, ios[rw]);
+ part_stat_add(cpu, &brd->brd_disk->part0, sectors[rw],
+ bio_sectors(bio));
+ part_stat_unlock();
+
bio_for_each_segment(bvec, bio, i) {
unsigned int len = bvec->bv_len;
err = brd_do_bvec(brd, bvec->bv_page, len,
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Ryo Onodera
2012-12-23 21:50:01 UTC
Permalink
Signed-off-by: Ryo Onodera <***@gmail.com>
---
drivers/block/brd.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 531ceb3..181b2d7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
sector_t sector;
int i;
int err = -EIO;
+ int cpu;

sector = bio->bi_sector;
if (sector + (bio->bi_size >> SECTOR_SHIFT) >
@@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
if (rw == READA)
rw = READ;

+ cpu = part_stat_lock();
+ part_stat_inc(cpu, &brd->brd_disk->part0, ios[rw]);
+ part_stat_add(cpu, &brd->brd_disk->part0, sectors[rw],
+ bio_sectors(bio));
+ part_stat_unlock();
+
bio_for_each_segment(bvec, bio, i) {
unsigned int len = bvec->bv_len;
err = brd_do_bvec(brd, bvec->bv_page, len,
--
1.7.9.5
Post by Ryo Onodera
Hi,
I'm Ryo Onodera. I created this very tiny patch to enable /proc/diskstats for
/dev/ramX.
I'm contacting Nick Piggin as the maintainer of ramdisk ram block.
This is my first patch to the Linux kernel. Sorry if this is not the expected
way of submitting patches.
Regards
Ryo Onodera
Post by Ryo Onodera
---
drivers/block/brd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 531ceb3..181b2d7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
sector_t sector;
int i;
int err = -EIO;
+ int cpu;
sector = bio->bi_sector;
if (sector + (bio->bi_size >> SECTOR_SHIFT) >
@@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
if (rw == READA)
rw = READ;
+ cpu = part_stat_lock();
+ part_stat_inc(cpu, &brd->brd_disk->part0, ios[rw]);
+ part_stat_add(cpu, &brd->brd_disk->part0, sectors[rw],
+ bio_sectors(bio));
+ part_stat_unlock();
+
bio_for_each_segment(bvec, bio, i) {
unsigned int len = bvec->bv_len;
err = brd_do_bvec(brd, bvec->bv_page, len,
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Ryo Onodera
2012-12-23 21:50:01 UTC
Permalink
Hi,

I'm Ryo Onodera.

This is a resend for my earlier patch. Because I got no reply, I've
added other people as CC, picking from the commit history of the
relevant file.

I created this very tiny patch to enable /proc/diskstats for /dev/ramX.

I'm contacting Nick Piggin as the maintainer of ramdisk ram block. As
mentioned above, I'm also contacting some related people to get more
attention.

This is my first patch to the Linux kernel. Sorry if this is not the
expected way of submitting patches.

Regards
Post by Ryo Onodera
---
drivers/block/brd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 531ceb3..181b2d7 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -332,6 +332,7 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
sector_t sector;
int i;
int err = -EIO;
+ int cpu;
sector = bio->bi_sector;
if (sector + (bio->bi_size >> SECTOR_SHIFT) >
@@ -348,6 +349,12 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
if (rw == READA)
rw = READ;
+ cpu = part_stat_lock();
+ part_stat_inc(cpu, &brd->brd_disk->part0, ios[rw]);
+ part_stat_add(cpu, &brd->brd_disk->part0, sectors[rw],
+ bio_sectors(bio));
+ part_stat_unlock();
+
bio_for_each_segment(bvec, bio, i) {
unsigned int len = bvec->bv_len;
err = brd_do_bvec(brd, bvec->bv_page, len,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Loading...