From: Ryo Onodera <ryoqun@gmail.com>
To: Nick Piggin <npiggin@kernel.dk>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@gmail.com>,
Jens Axboe <jaxboe@fusionio.com>
Subject: [PATCH] brd: enable diskstats
Date: Mon, 24 Dec 2012 06:41:08 +0900 [thread overview]
Message-ID: <1356298868.9057.3.camel@erika> (raw)
In-Reply-To: <CAOEQZHGe7_9xwvQK-O13WcU+9EdqMpi+VAD0ECq5ahUJ1-dnKg@mail.gmail.com>
Signed-off-by: Ryo Onodera <ryoqun@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
On Mon, 2012-11-19 at 16:26 +0900, Ryo Onodera wrote:
> 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
>
> On Mon, Nov 19, 2012 at 4:16 PM, Ryo Onodera <ryoqun@gmail.com> wrote:
> > Signed-off-by: Ryo Onodera <ryoqun@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
> >
> >
> >
next prev parent reply other threads:[~2012-12-23 21:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-19 7:16 [PATCH] Enable /proc/diskstats for /dev/ramX Ryo Onodera
2012-11-19 7:26 ` Ryo Onodera
2012-12-23 21:41 ` Ryo Onodera [this message]
2012-12-23 21:47 ` [PATCH] brd: enable diskstats Ryo Onodera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356298868.9057.3.camel@erika \
--to=ryoqun@gmail.com \
--cc=jaxboe@fusionio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@gmail.com \
--cc=npiggin@kernel.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.