Compare commits
6
Commits
v2.9.0-rc4
...
v2.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
359c41abe3 | ||
|
|
ca55019dac | ||
|
|
d1263f8f18 | ||
|
|
91af091f92 | ||
|
|
178bd438af | ||
|
|
9c6b899f7a |
No files matched your search
+20
-3
@@ -158,7 +158,7 @@ bool bdrv_requests_pending(BlockDriverState *bs)
|
||||
|
||||
static bool bdrv_drain_recurse(BlockDriverState *bs)
|
||||
{
|
||||
BdrvChild *child;
|
||||
BdrvChild *child, *tmp;
|
||||
bool waited;
|
||||
|
||||
waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0);
|
||||
@@ -167,8 +167,25 @@ static bool bdrv_drain_recurse(BlockDriverState *bs)
|
||||
bs->drv->bdrv_drain(bs);
|
||||
}
|
||||
|
||||
QLIST_FOREACH(child, &bs->children, next) {
|
||||
waited |= bdrv_drain_recurse(child->bs);
|
||||
QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) {
|
||||
BlockDriverState *bs = child->bs;
|
||||
bool in_main_loop =
|
||||
qemu_get_current_aio_context() == qemu_get_aio_context();
|
||||
assert(bs->refcnt > 0);
|
||||
if (in_main_loop) {
|
||||
/* In case the recursive bdrv_drain_recurse processes a
|
||||
* block_job_defer_to_main_loop BH and modifies the graph,
|
||||
* let's hold a reference to bs until we are done.
|
||||
*
|
||||
* IOThread doesn't have such a BH, and it is not safe to call
|
||||
* bdrv_unref without BQL, so skip doing it there.
|
||||
*/
|
||||
bdrv_ref(bs);
|
||||
}
|
||||
waited |= bdrv_drain_recurse(bs);
|
||||
if (in_main_loop) {
|
||||
bdrv_unref(bs);
|
||||
}
|
||||
}
|
||||
|
||||
return waited;
|
||||
|
||||
+6
-1
@@ -1098,8 +1098,13 @@ static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path,
|
||||
{
|
||||
if (dir_path) {
|
||||
v9fs_path_sprintf(target, "%s/%s", dir_path->data, name);
|
||||
} else {
|
||||
} else if (strcmp(name, "/")) {
|
||||
v9fs_path_sprintf(target, "%s", name);
|
||||
} else {
|
||||
/* We want the path of the export root to be relative, otherwise
|
||||
* "*at()" syscalls would treat it as "/" in the host.
|
||||
*/
|
||||
v9fs_path_sprintf(target, "%s", ".");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+14
-8
@@ -381,12 +381,13 @@ void bdrv_drain_all(void);
|
||||
|
||||
#define BDRV_POLL_WHILE(bs, cond) ({ \
|
||||
bool waited_ = false; \
|
||||
bool busy_ = true; \
|
||||
BlockDriverState *bs_ = (bs); \
|
||||
AioContext *ctx_ = bdrv_get_aio_context(bs_); \
|
||||
if (aio_context_in_iothread(ctx_)) { \
|
||||
while ((cond)) { \
|
||||
aio_poll(ctx_, true); \
|
||||
waited_ = true; \
|
||||
while ((cond) || busy_) { \
|
||||
busy_ = aio_poll(ctx_, (cond)); \
|
||||
waited_ |= !!(cond) | busy_; \
|
||||
} \
|
||||
} else { \
|
||||
assert(qemu_get_current_aio_context() == \
|
||||
@@ -398,11 +399,16 @@ void bdrv_drain_all(void);
|
||||
*/ \
|
||||
assert(!bs_->wakeup); \
|
||||
bs_->wakeup = true; \
|
||||
while ((cond)) { \
|
||||
aio_context_release(ctx_); \
|
||||
aio_poll(qemu_get_aio_context(), true); \
|
||||
aio_context_acquire(ctx_); \
|
||||
waited_ = true; \
|
||||
while (busy_) { \
|
||||
if ((cond)) { \
|
||||
waited_ = busy_ = true; \
|
||||
aio_context_release(ctx_); \
|
||||
aio_poll(qemu_get_aio_context(), true); \
|
||||
aio_context_acquire(ctx_); \
|
||||
} else { \
|
||||
busy_ = aio_poll(ctx_, false); \
|
||||
waited_ |= busy_; \
|
||||
} \
|
||||
} \
|
||||
bs_->wakeup = false; \
|
||||
} \
|
||||
|
||||
Reference in new issue
Block a user