* Re: [PATCH 3/6] md/bcache: use generic io stats accounting functions to simplify io stat accounting
[not found] ` <1416798327-12817-4-git-send-email-guz.fnst@cn.fujitsu.com>
@ 2014-11-24 4:48 ` Kent Overstreet
0 siblings, 0 replies; 3+ messages in thread
From: Kent Overstreet @ 2014-11-24 4:48 UTC (permalink / raw)
To: Gu Zheng; +Cc: axboe, akpm, dm-devel, linux-kernel, linux-nvme, drbd-user
On Mon, Nov 24, 2014 at 11:05:24AM +0800, Gu Zheng wrote:
> Use generic io stats accounting help functions (generic_{start,end}_io_acct)
> to simplify io stat accounting.
>
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cool!
Acked-by: Kent Overstreet <kmo@datera.io>
> ---
> drivers/md/bcache/request.c | 23 ++++++-----------------
> 1 files changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 62e6e98..ab43fad 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -601,13 +601,8 @@ static void request_endio(struct bio *bio, int error)
> static void bio_complete(struct search *s)
> {
> if (s->orig_bio) {
> - int cpu, rw = bio_data_dir(s->orig_bio);
> - unsigned long duration = jiffies - s->start_time;
> -
> - cpu = part_stat_lock();
> - part_round_stats(cpu, &s->d->disk->part0);
> - part_stat_add(cpu, &s->d->disk->part0, ticks[rw], duration);
> - part_stat_unlock();
> + generic_end_io_acct(bio_data_dir(s->orig_bio),
> + &s->d->disk->part0, s->start_time);
>
> trace_bcache_request_end(s->d, s->orig_bio);
> bio_endio(s->orig_bio, s->iop.error);
> @@ -959,12 +954,9 @@ static void cached_dev_make_request(struct request_queue *q, struct bio *bio)
> struct search *s;
> struct bcache_device *d = bio->bi_bdev->bd_disk->private_data;
> struct cached_dev *dc = container_of(d, struct cached_dev, disk);
> - int cpu, rw = bio_data_dir(bio);
> + int rw = bio_data_dir(bio);
>
> - cpu = part_stat_lock();
> - part_stat_inc(cpu, &d->disk->part0, ios[rw]);
> - part_stat_add(cpu, &d->disk->part0, sectors[rw], bio_sectors(bio));
> - part_stat_unlock();
> + generic_start_io_acct(rw, bio_sectors(bio), &d->disk->part0);
>
> bio->bi_bdev = dc->bdev;
> bio->bi_iter.bi_sector += dc->sb.data_offset;
> @@ -1074,12 +1066,9 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio)
> struct search *s;
> struct closure *cl;
> struct bcache_device *d = bio->bi_bdev->bd_disk->private_data;
> - int cpu, rw = bio_data_dir(bio);
> + int rw = bio_data_dir(bio);
>
> - cpu = part_stat_lock();
> - part_stat_inc(cpu, &d->disk->part0, ios[rw]);
> - part_stat_add(cpu, &d->disk->part0, sectors[rw], bio_sectors(bio));
> - part_stat_unlock();
> + generic_start_io_acct(rw, bio_sectors(bio), &d->disk->part0);
>
> s = search_alloc(bio, d);
> cl = &s->cl;
> --
> 1.7.7
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 0/6] blk: introduce generic io stat accounting help function
[not found] <1416798327-12817-1-git-send-email-guz.fnst@cn.fujitsu.com>
[not found] ` <1416798327-12817-4-git-send-email-guz.fnst@cn.fujitsu.com>
@ 2014-11-24 15:03 ` Jens Axboe
2014-11-25 4:48 ` Gu Zheng
1 sibling, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2014-11-24 15:03 UTC (permalink / raw)
To: Gu Zheng; +Cc: kmo, akpm, dm-devel, linux-kernel, linux-nvme, drbd-user
On 11/23/2014 08:05 PM, Gu Zheng wrote:
> Many block drivers accounting io stat based on bio (e.g. NVMe...),
> the blk_account_io_start/end() which is based on request
> does not make sense to them, so here we introduce the similar help
> function named generic_start/end_io_acct base on raw sectors, and it can
> simplify some driver's open io accounting code.
>
> Gu Zheng (6):
> blk: introduce generic io stat accounting help function
> NVMe: use generic io stat accounting functions to simplify
> nvme_start/end_io_acct
> md/bcache: use generic io stats accounting functions to simplify io
> stat accounting
> drbd: use generic io stats accounting functions to simplify io stat
> accounting
> md: use generic io stats accounting functions to simplify io stat
> accounting
> block/rsxx: use generic io stats accounting functions to simplify io
> stat accounting
Thanks, this looks good. I'll apply it, except 2/6, since nvme no longer
uses them.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 0/6] blk: introduce generic io stat accounting help function
2014-11-24 15:03 ` [PATCH 0/6] blk: introduce generic io stat accounting help function Jens Axboe
@ 2014-11-25 4:48 ` Gu Zheng
0 siblings, 0 replies; 3+ messages in thread
From: Gu Zheng @ 2014-11-25 4:48 UTC (permalink / raw)
To: Jens Axboe; +Cc: kmo, akpm, dm-devel, linux-kernel, linux-nvme, drbd-user
On 11/24/2014 11:03 PM, Jens Axboe wrote:
> On 11/23/2014 08:05 PM, Gu Zheng wrote:
>> Many block drivers accounting io stat based on bio (e.g. NVMe...),
>> the blk_account_io_start/end() which is based on request
>> does not make sense to them, so here we introduce the similar help
>> function named generic_start/end_io_acct base on raw sectors, and it can
>> simplify some driver's open io accounting code.
>>
>> Gu Zheng (6):
>> blk: introduce generic io stat accounting help function
>> NVMe: use generic io stat accounting functions to simplify
>> nvme_start/end_io_acct
>> md/bcache: use generic io stats accounting functions to simplify io
>> stat accounting
>> drbd: use generic io stats accounting functions to simplify io stat
>> accounting
>> md: use generic io stats accounting functions to simplify io stat
>> accounting
>> block/rsxx: use generic io stats accounting functions to simplify io
>> stat accounting
>
> Thanks, this looks good. I'll apply it, except 2/6, since nvme no longer uses them.
OK.
Thanks,
Gu
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-25 6:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1416798327-12817-1-git-send-email-guz.fnst@cn.fujitsu.com>
[not found] ` <1416798327-12817-4-git-send-email-guz.fnst@cn.fujitsu.com>
2014-11-24 4:48 ` [PATCH 3/6] md/bcache: use generic io stats accounting functions to simplify io stat accounting Kent Overstreet
2014-11-24 15:03 ` [PATCH 0/6] blk: introduce generic io stat accounting help function Jens Axboe
2014-11-25 4:48 ` Gu Zheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox