From patchwork Thu Jun 1 15:14:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Nefedov X-Patchwork-Id: 9759873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3860860375 for ; Thu, 1 Jun 2017 15:25:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28868284F1 for ; Thu, 1 Jun 2017 15:25:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CCDA284F9; Thu, 1 Jun 2017 15:25:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5A0BA284F1 for ; Thu, 1 Jun 2017 15:24:59 +0000 (UTC) Received: from localhost ([::1]:45218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRy6-0007iG-4I for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Jun 2017 11:24:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRok-0000QY-5p for qemu-devel@nongnu.org; Thu, 01 Jun 2017 11:15:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGRog-0004me-VO for qemu-devel@nongnu.org; Thu, 01 Jun 2017 11:15:18 -0400 Received: from mail-db5eur01on0125.outbound.protection.outlook.com ([104.47.2.125]:27033 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dGRog-0004mG-JG for qemu-devel@nongnu.org; Thu, 01 Jun 2017 11:15:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CigHav1LueQGw6+ITFq5j7KMZkBfCLgPXzdhZgsMKqk=; b=ARM0YDLP3bnnzFwDKaxc2WuRVNbQ5Vrp8Z0qDHTM4Cli73tPE3bHkb8fN5IZks6zw1/uAmGQiuUc+ZrcceVlgF8JI+csbngGKudsOlsEjFIFUZLPVbctCR5/O3CXN7X8OAzbI+kXIT1Jy5GRqzkyTA8m0wThKcXprrQ34Gb7XD4= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none; nongnu.org; dmarc=none action=none header.from=virtuozzo.com; Received: from xantnef-ws.sw.ru (195.214.232.6) by VI1PR0801MB1999.eurprd08.prod.outlook.com (2603:10a6:800:8a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Thu, 1 Jun 2017 15:15:11 +0000 From: Anton Nefedov To: Date: Thu, 1 Jun 2017 18:14:30 +0300 Message-ID: <1496330073-51338-13-git-send-email-anton.nefedov@virtuozzo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496330073-51338-1-git-send-email-anton.nefedov@virtuozzo.com> References: <1496330073-51338-1-git-send-email-anton.nefedov@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR1001CA0005.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:b7::15) To VI1PR0801MB1999.eurprd08.prod.outlook.com (2603:10a6:800:8a::20) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR0801MB1999: X-MS-Office365-Filtering-Correlation-Id: cf6d2a23-fdda-4508-d138-08d4a900ffde X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:VI1PR0801MB1999; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 3:y0fgwaMJKT57c0GlnMriulMBIYb4f2L0jYB46ucp7DEJm3xR3gGzMLzOduAkwSUNFY2fR70aPLYUiwRYwywemARz9Zf6gogKmYKDyA+uxWHglwRo8Yf1eNKceERN6jidPgnbUADHp6LAcpkkiGuNm4R0SvgYxVIvhddHsMpaeWwYbi6PZhP2Wppd7l1hKwmZtl+wcUKYAzjsUV/uBO+CHIbXRE44DBsC6OSJqWsQkkFuqasgGP/+T7oHJQBZTQI8G4gGQeA1Iu27s5K11KeEnNlrfx6LbrE7IXxKffdOzdn5aIWGtnr1kiYNQ0jeGpSjTBZldjXl+Ul67gBEfvq7eQ==; 25:xaUZuZQLHz0pCEbzKhxfgNyjnyThoWfh5L9ZrxfVJ1g/YMMAqfeYP6pEihkX5k8NZTd/MTyRzd4siYnso9p/j6NIg6x631zfPl9e9wyuok/5a2JYyaxk1r+/2PtNYRn0AvoLwuXfDmfymD7H1riKv3mO9R/g77DG8sxAyZjspRh50Tz2Mx/0SzHaf+SlEXJmctYddMJxkJ3Fh+NAa2wvJPtLxXy+7WYEwOblWt10zs3DshUuSMmkNsEKi3aO6G6WwlYjTLWvVLPpiU0Wg4nIznpTlNS8Aw0dEPZQIbwQTuBb2L05N7xQyQmXIJYxIhfcEz0ggWQruNvfMnYxj8gzFd6vgi4T8SMbSDUuihA2nC5RJuesg8cCWwGzkusVoTUDsOLxylbzyRfZbugmcD1Qe+aWyZUYFz4cYszIUCWkA3QyAMNbzgjubPoEf2qR+4Cg9LnWwKFjCnT/HBXXasGiDeoLKBO6fucxMyHw25D2/OM= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 31:NFPqvRL68uHn8XuLpTnOs1s8ffDq08SVBgLi9Ln467bK4POAxhr/d6OMCc+nLSf7XLfkrdAnxtu7cImzUkTNoWLXcawNFHBv+bh95o+rD5m66Q5FAIo1gnKdS6OEB08AiEviEuOA/FHW+nHV+3dNnpge3lyQHssGbZvDIt50H2ptKx8tV+mfn0yucGOqiuuKaI0H+d3hBTCt2A5CedUl8rqTrFEed+xe8zf7NUSrJ7M=; 20:X+TyB5G3+/ND1ZGwv/AZWjGGhVWwiipI+2cdSLSC6QZdTEZsdK+smI66tu6vn4TI3AKIqsvYPJnvIjcQ2rCMm4RmuI+3A556LDqRvBfOg8Z6mVLLelD14MOAHDw5Bw2e+/ENgSb1RM2xwUVa6PTRyD3eNckP+/gl8yZLRVr8hO1j8BtBISGRTWa9HWn3I7Kn0CRfjrWLk2kIf33v4kXuYLV9yTUr1U7Rb6uqU60PubF5UvFXxSdG4Fow+FOGYVjPylmSIb8QAKT3JMDkHMh6fHNwuFfw2712JxXfV8JS9G4eoIQIkysjWpnbj7qwZ3KIs7Qs7I7d9INrt0gGl2EbGnNnpWRaT0qt+nrWZJcaN5JfOjhbyK+2IzZx/YThi61iW3X8xV/BozqmIJP0NjJelCAOlVGrlLwMAS5enUxluos= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(20161123560025)(20161123558100)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0801MB1999; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR0801MB1999; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1999; 4:r++bVomrnrNvtjlu12rhu0zrtAbVw0sYznJ7Z9Q2?= =?us-ascii?Q?sUmc/HBeDukNxlLE6ZTtKfnfWw/r9xP/9BRGAwNzWGjwweKqkSDZHKBS+XxJ?= =?us-ascii?Q?109U5MelsczDGrQn2Z3SNHABKR4YMQdD3R528G5ak18xFRjkI+y708iR42dF?= =?us-ascii?Q?lVu3UgrouY9oHcYGT1zg6QU/fjaeNlZmzGgsP2R1zBei8+5YFpMyxUCjwY48?= =?us-ascii?Q?7i5wGCdWrkJ48shKg2KGsBIeotY4KfyUxxAEChZJ7MlGryJuIjJt6HOFdP4O?= =?us-ascii?Q?wx/cFzi51uXoncFARCC4cQMV4XSu0UXJr5UuYQKTi/ykxXrVg9vE6drWDWss?= =?us-ascii?Q?Qf0t97mFar9y584craC1I3/g6bDyLo+73e66Fm3Qugc5ihdZNdl7KowpqI6H?= =?us-ascii?Q?WyA6Pq2/BiPmapjZ1h0C22uRoD/3pDvlFHH85gkHUEO7GXik15FVeBXkGitV?= =?us-ascii?Q?o/7XFHawk/Bn9ySYmZRnJ3hDQrw+/iorQ6oiwSfXnc2i1TyIUtv7DxIlKG4q?= =?us-ascii?Q?3bqgu+L+pikb7eHiUhjIpCk9rW31iXcOZSAWszpwumGzCPMPmL8qm36b0bRQ?= =?us-ascii?Q?MQBkhC7fb4caqbUvMLZPFmTHQF6m1uawIUvT4UJFCRef1QeYpmF8wxVdq5s6?= =?us-ascii?Q?McJ4riVjfQoyBWMBXR/exmNT54TtknEKWP4g5jx4SyyQLPYr3pUYRvIno8qs?= =?us-ascii?Q?P9nnW7A9zI6W4UWBR7EghV8PGmH+JiwnqhFXGstaWBm0hKpxSP4wJAZGo6te?= =?us-ascii?Q?5pYEWNx0Znnrx6qUCPuhS1erAl1UyOkkiAXU1Obs9F9fqGq6+WgUbFzJ/In5?= =?us-ascii?Q?0ahwaRYqQuy1K0qkAypt8qVjjPcA1GliCdnjvto9d69cDINIyYHrm5KIja5c?= =?us-ascii?Q?e2gLB5PKWmGuJDcdPztwDSXq0w74hLceHQSeTa+t0CHxklMlyUGfgUgXEIsw?= =?us-ascii?Q?r35L4Q9pyVJ/5OVUNmsivIUgXVTig07sNT0MUBNXO5PKDYzV4LfCdMSEUyFg?= =?us-ascii?Q?+bvcOj/IKoKqso15kfZPdf/pvT4KgiTFj5hq+SK0UQ9WDVgYV9MQTJyP7idY?= =?us-ascii?Q?hJmTh+ZGcn3wIxzuGDbCdXuwlthHoYQbFKSB9+CIRngrJvo9YPGGL3JxGx4c?= =?us-ascii?Q?S3qLxzU1Y1G5WGqAVXQ99w/Ai/h5jKM1?= X-Forefront-PRVS: 0325F6C77B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39830400002)(39450400003)(39400400002)(52314003)(6916009)(6666003)(6486002)(7736002)(478600001)(5660300001)(305945005)(54906002)(53936002)(4326008)(6512007)(6506006)(2950100002)(110136004)(107886003)(3846002)(50226002)(8676002)(66066001)(42186005)(81166006)(38730400002)(25786009)(6116002)(76176999)(50986999)(47776003)(86362001)(5003940100001)(2906002)(2351001)(36756003)(48376002)(50466002)(33646002)(53416004)(189998001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1999; H:xantnef-ws.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1999; 23:pqwwGe2md/Ggoh66aY88J0wCO84lu74FYDLJE5o?= =?us-ascii?Q?TWnK5tIJ4z6yXIFnkTvnNzQHGFXh6X8bDCsZvsXkEAeTy0A07KWF5DIUeOHt?= =?us-ascii?Q?O/7MD0SJGNyV34Cqt2xCxYNsZ64D5HAmGFz80lCr1h/PA1a6ZBwCG1vLN23e?= =?us-ascii?Q?AkeEyu+52152UTdUC+sFj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bTn8jVimzoVYNyyKncTicvTMHdMmf/Pk60+nwK8eRHXa0EJCwaYJpGTEB1bezYZrCQCIONyNBvRgG1N3BBJXWEZeWj4iyptqejUhG; 24:zGYbcbbOP4Un3FlHz5vVxsC9CmgZFd7lmhac0uXH2kmfrPOFY2tBp126N/UZz7Jnz2sKUd1/VugBiPeLZjQOWgvfwd5FXKNQP062RttYIoE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1999; 7:571KvqeB+41PdbgdvwRnxg+i364f+uNu4ymhxa0z810wjkIc8piTKZ9F3C+kn2ikx2pgQgswd4bx915zGGu5O9rMhTCEMj/ME6nzmJCuSX8dCkMW17u0JDNaWiw6Ra1Q/4HINkGhSB8dLzg6qag+v4s5RqdBioQ/KWJfC5tBPc8/+Hk07An/kxtwEAHPX449mWBMua5KQFba3OlB1SyPk8O6VyNPR+NTEfpPQvxh/9e8NiYU1pp0Cn5MD6H6PBQDwE+5FhIuGVXE2WbnX0IrCLj3UIea5JYdP6gH5UHjsae/3oOl9ehfxQROuXUODxp7aeVaa4CFKAy4Re40U7IX7w==; 20:GfKjLjy+YUuPHrRdDWij6kADWK4JqOyHjP242eBzq78MnPG+GKL6iOL0YdVgQ5dkSzyde7ztYlOYGh6CikVaXb6XgyxwLckspshJwNJzAlInqDnODnH7N9fXKPchxffoIx/ezCxdW4G6rp3OI2rY9CZonr68NCQEFo78ulfEZfU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2017 15:15:11.4437 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1999 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.2.125 Subject: [Qemu-devel] [PATCH v2 12/15] qcow2-cluster: slightly refactor handle_dependencies() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Anton Nefedov , den@virtuozzo.com, mreitz@redhat.com, "Denis V . Lunev" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP - assert the alignment on return if the allocation has to stop (at the start of a running allocation) - make use of const specifiers for local variables Signed-off-by: Anton Nefedov Signed-off-by: Denis V. Lunev --- block/qcow2-cluster.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 3dafd19..95e8862 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -900,15 +900,15 @@ out: * Check if there already is an AIO write request in flight which allocates * the same cluster. In this case we need to wait until the previous * request has completed and updated the L2 table accordingly. - * * Returns: * 0 if there was no dependency. *cur_bytes indicates the number of * bytes from guest_offset that can be read before the next - * dependency must be processed (or the request is complete) + * dependency must be processed (or the request is complete). + * *m is not modified * - * -EAGAIN if we had to wait for another request, previously gathered - * information on cluster allocation may be invalid now. The caller - * must start over anyway, so consider *cur_bytes undefined. + * -EAGAIN if we had to wait for another request. The caller + * must start over, so consider *cur_bytes undefined. + * *m is not modified */ static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset, uint64_t *cur_bytes, QCowL2Meta **m) @@ -919,10 +919,10 @@ static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset, QLIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) { - uint64_t start = guest_offset; - uint64_t end = start + bytes; - uint64_t old_start = l2meta_cow_start(old_alloc); - uint64_t old_end = l2meta_cow_end(old_alloc); + const uint64_t start = guest_offset; + const uint64_t end = start + bytes; + const uint64_t old_start = l2meta_cow_start(old_alloc); + const uint64_t old_end = l2meta_cow_end(old_alloc); if (end <= old_start || start >= old_end) { /* No intersection */ @@ -939,6 +939,8 @@ static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset, * and deal with requests depending on them before starting to * gather new ones. Not worth the trouble. */ if (bytes == 0 && *m) { + /* start must be cluster aligned at this point */ + assert(start == start_of_cluster(s, start)); *cur_bytes = 0; return 0; }