提交 06e7ab53 编写于 作者: P Peter Osterlund 提交者: Linus Torvalds

[PATCH] pktcdvd: more accurate I/O accounting

In the /proc statistics, only count writes that upper layers have requested.
Don't count additional writes created inside the packet driver to satisfy the
requirement to only write full packets.
Signed-off-by: NPeter Osterlund <petero2@telia.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a676f8d0
...@@ -736,12 +736,6 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) ...@@ -736,12 +736,6 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt)
atomic_set(&pkt->io_wait, 0); atomic_set(&pkt->io_wait, 0);
atomic_set(&pkt->io_errors, 0); atomic_set(&pkt->io_errors, 0);
if (pkt->cache_valid) {
VPRINTK("pkt_gather_data: zone %llx cached\n",
(unsigned long long)pkt->sector);
goto out_account;
}
/* /*
* Figure out which frames we need to read before we can write. * Figure out which frames we need to read before we can write.
*/ */
...@@ -750,6 +744,7 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) ...@@ -750,6 +744,7 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt)
for (bio = pkt->orig_bios; bio; bio = bio->bi_next) { for (bio = pkt->orig_bios; bio; bio = bio->bi_next) {
int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9);
int num_frames = bio->bi_size / CD_FRAMESIZE; int num_frames = bio->bi_size / CD_FRAMESIZE;
pd->stats.secs_w += num_frames * (CD_FRAMESIZE >> 9);
BUG_ON(first_frame < 0); BUG_ON(first_frame < 0);
BUG_ON(first_frame + num_frames > pkt->frames); BUG_ON(first_frame + num_frames > pkt->frames);
for (f = first_frame; f < first_frame + num_frames; f++) for (f = first_frame; f < first_frame + num_frames; f++)
...@@ -757,6 +752,12 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) ...@@ -757,6 +752,12 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt)
} }
spin_unlock(&pkt->lock); spin_unlock(&pkt->lock);
if (pkt->cache_valid) {
VPRINTK("pkt_gather_data: zone %llx cached\n",
(unsigned long long)pkt->sector);
goto out_account;
}
/* /*
* Schedule reads for missing parts of the packet. * Schedule reads for missing parts of the packet.
*/ */
...@@ -790,7 +791,6 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) ...@@ -790,7 +791,6 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt)
frames_read, (unsigned long long)pkt->sector); frames_read, (unsigned long long)pkt->sector);
pd->stats.pkt_started++; pd->stats.pkt_started++;
pd->stats.secs_rg += frames_read * (CD_FRAMESIZE >> 9); pd->stats.secs_rg += frames_read * (CD_FRAMESIZE >> 9);
pd->stats.secs_w += pd->settings.size;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册