From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: jaxboe@fusionio.com, vgoyal@redhat.com, jmarchan@redhat.com,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] Change a argument of disk_map_sector_rcu() to hd_part->start_sect from req->__sector
Date: Mon, 06 Dec 2010 18:45:18 +0900 [thread overview]
Message-ID: <4CFCB0AE.8050804@jp.fujitsu.com> (raw)
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
PROBLEM:
The previous patch does not fix the problem completely, since the problem occurs
on following case.
When sdX region is between sdX1 partition and sdX2 partition, a sdX region's
I/O is merged sdX1 partition's I/O or sdX2 partition's I/O.
1. sdX region is between sdX1 partition and sdX2 partition
sdX1 partition sdX region sdX1 partition
|----------------|------------|----------------|
2. issue a sdX region's I/O and increment a in_flight of sdX
sdX1 partition sdX region sdX1 partition
|----------------|------------|----------------|
<- I/O ->
3. issue a sdX1 partition's I/O
sdX1 partition sdX region sdX1 partition
|----------------|------------|----------------|
<- I/O -> <- I/O ->
4. merge a sdX1 partition's I/O and a sdX region's I/O, since the previous patch
cannot care this case.
sdX1 partition sdX region sdX1 partition
|----------------|------------|----------------|
<- I/O ->
5. finish a I/O and decrement a in_flight of sdX1 even though it was not
incremented
HOW TO FIX:
The patch fixes avobe case by changing a argument of disk_map_sector_rcu().
The problem also is caused by merging different partition's I/Os. But, it is not easy
to fix, when I/O is sdX region. So the patch allows step 4, when I/O is only sdX
region. But, it does not change a result of disk_map_sector_rcu() by using partition's
start sector ot original I/O , even if the I/O is merged.
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
block/blk-core.c | 10 ++++++----
block/blk-merge.c | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
Index: linux-2.6.37-rc3/block/blk-core.c
===================================================================
--- linux-2.6.37-rc3.orig/block/blk-core.c 2010-12-03 17:15:50.000000000 +0900
+++ linux-2.6.37-rc3/block/blk-core.c 2010-12-03 17:15:54.000000000 +0900
@@ -64,11 +64,13 @@ static void drive_stat_acct(struct reque
return;
cpu = part_stat_lock();
- part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
- if (!new_io)
+ if (!new_io) {
+ part = disk_map_sector_rcu(rq->rq_disk, blk_rq_part_sector(rq));
part_stat_inc(cpu, part, merges[rw]);
+ }
else {
+ part = disk_map_sector_rcu(rq->rq_disk, blk_rq_pos(rq));
part_round_stats(cpu, part);
part_inc_in_flight(part, rw);
rq->__part_start_sect = part->start_sect;
@@ -1778,7 +1780,7 @@ static void blk_account_io_completion(st
int cpu;
cpu = part_stat_lock();
- part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));
+ part = disk_map_sector_rcu(req->rq_disk, blk_rq_part_sector(req));
part_stat_add(cpu, part, sectors[rw], bytes >> 9);
part_stat_unlock();
}
@@ -1798,7 +1800,7 @@ static void blk_account_io_done(struct r
int cpu;
cpu = part_stat_lock();
- part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));
+ part = disk_map_sector_rcu(req->rq_disk, blk_rq_part_sector(req));
part_stat_inc(cpu, part, ios[rw]);
part_stat_add(cpu, part, ticks[rw], duration);
Index: linux-2.6.37-rc3/block/blk-merge.c
===================================================================
--- linux-2.6.37-rc3.orig/block/blk-merge.c 2010-12-03 17:15:50.000000000 +0900
+++ linux-2.6.37-rc3/block/blk-merge.c 2010-12-03 17:15:54.000000000 +0900
@@ -356,7 +356,7 @@ static void blk_account_io_merge(struct
int cpu;
cpu = part_stat_lock();
- part = disk_map_sector_rcu(req->rq_disk, blk_rq_pos(req));
+ part = disk_map_sector_rcu(req->rq_disk, blk_rq_part_sector(req));
part_round_stats(cpu, part);
part_dec_in_flight(part, rq_data_dir(req));
reply other threads:[~2010-12-06 9:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4CFCB0AE.8050804@jp.fujitsu.com \
--to=isimatu.yasuaki@jp.fujitsu.com \
--cc=jaxboe@fusionio.com \
--cc=jmarchan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vgoyal@redhat.com \
/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.