From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] ide: kill ide_dma_submit_check
Date: Mon, 20 Dec 2010 13:46:09 +0100 [thread overview]
Message-ID: <20101220124609.GB6423@lst.de> (raw)
In-Reply-To: <20101220124548.GA6395@lst.de>
Merge ide_dma_submit_check into it's only caller. Also use tail recursion
using a goto instead of a real recursion - this avoid overflowing the
stack in the pathological situation of an recurring error that is ignored.
We'll still be busy looping in ide_dma_cb, but at least won't eat up
all stack space after this.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: qemu/hw/ide/core.c
===================================================================
--- qemu.orig/hw/ide/core.c 2010-12-20 13:16:11.379004054 +0100
+++ qemu/hw/ide/core.c 2010-12-20 13:16:11.000000000 +0100
@@ -321,14 +321,6 @@ static inline void ide_abort_command(IDE
s->error = ABRT_ERR;
}
-static inline void ide_dma_submit_check(IDEState *s,
- BlockDriverCompletionFunc *dma_cb)
-{
- if (s->bus->dma->aiocb)
- return;
- dma_cb(s, -1);
-}
-
/* prepare data transfer and tell what to do after */
static void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
EndTransferFunc *end_transfer_func)
@@ -493,6 +485,7 @@ void ide_dma_cb(void *opaque, int ret)
int n;
int64_t sector_num;
+handle_rw_error:
if (ret < 0) {
int op = BM_STATUS_DMA_RETRY;
@@ -538,7 +531,11 @@ void ide_dma_cb(void *opaque, int ret)
s->bus->dma->aiocb = dma_bdrv_write(s->bs, &s->sg, sector_num,
ide_dma_cb, s);
}
- ide_dma_submit_check(s, ide_dma_cb);
+
+ if (!s->bus->dma->aiocb) {
+ ret = -1;
+ goto handle_rw_error;
+ }
return;
eot:
next prev parent reply other threads:[~2010-12-20 12:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-20 12:45 [Qemu-devel] [PATCH 1/3] ide: factor dma handling helpers Christoph Hellwig
2010-12-20 12:45 ` [Qemu-devel] [PATCH 2/3] ide: also reset io_buffer_index for writes Christoph Hellwig
2010-12-20 12:46 ` Christoph Hellwig [this message]
2011-01-13 15:40 ` [Qemu-devel] [PATCH 1/3] ide: factor dma handling helpers Kevin Wolf
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=20101220124609.GB6423@lst.de \
--to=hch@lst.de \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).