From a92b1b065eed385d9077be735eb8e92f5a6e150a Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 27 Oct 2020 00:05:53 -0500 Subject: block: Return depth level during bdrv_is_allocated_above When checking for allocation across a chain, it's already easy to count the depth within the chain at which the allocation is found. Instead of throwing that information away, return it to the caller. Existing callers only cared about allocated/non-allocated, but having a depth available will be used by NBD in the next patch. Signed-off-by: Eric Blake Message-Id: <20201027050556.269064-9-eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy [eblake: rebase to master] Signed-off-by: Eric Blake --- block/commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block/commit.c') diff --git a/block/commit.c b/block/commit.c index 1e85c306cc..71db7ba747 100644 --- a/block/commit.c +++ b/block/commit.c @@ -156,7 +156,7 @@ static int coroutine_fn commit_run(Job *job, Error **errp) /* Copy if allocated above the base */ ret = bdrv_is_allocated_above(blk_bs(s->top), s->base_overlay, true, offset, COMMIT_BUFFER_SIZE, &n); - copy = (ret == 1); + copy = (ret > 0); trace_commit_one_iteration(s, offset, n, ret); if (copy) { assert(n < SIZE_MAX); -- cgit 1.4.1