From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 6EA4480031 for ; Thu, 19 Nov 2026 01:11:37 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AJ19DnD031330; Thu, 19 Nov 2026 04:09:14 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJ19DnD031330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1795050556; bh=Hq/ebYv6Yv5OdjoJ4bR3fCH7vLPDqSOacdF1EkPG/Lc=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=Q/FFxr3fWM3yfdUW3DWoj80csTcL85I9891K+z1nrlKD65M6nMOAWRWtbvUd0pVVQ PNSqBFzeBT2Hdo9tTa5K39U4MQNSGt+x3GmPYNdGHEdy5UzYV9QRQugr6KtzNAntg7 kqq1PXLkFrtEu3TC0k8zqjXGYKwlA6QHY26EjOqVGZFezBmMjwgV7HuPMSFWHItVtm zNLzMbKsMN2lPnFTDYjpzsnomqAEkcQLAATtty+2Yy2smkGfYfo3fV8qgNr3t0vWjn zEJK7BQqjfGZ6EcVZsI9FinP13DfQIX+gnoyqUrmwwdA1Dcqkw97O9BCLvtvksaRgP LDuuXppMQfpiQ== Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AJ194gd031299 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 19 Nov 2026 04:09:04 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AJ194gd031299 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="E7ZoyW/p" Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4923b9fdd43so1254438f8f.3 for ; Wed, 18 Nov 2026 17:09:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHuOgG7eX4YAmo5b6y8JD6xhm2hNdAuXqEm6CigohLWZK2iD5w9109QbrBJqxiUBeHf2gmdKA==@openvz.org X-Gm-Message-State: APuU4Z/adjkqOjHjP2J2OsAekOQBcQkj9+p3qdsvL/Z27nuIbTgPLZ3Z 4r3mMazOPubAV6v65U7LVwbXuAu1b/4uzUggd6PPBECuQvFG5W8zrjeivLf0cba4p5JCEqGMiPP jA2cjAxMEiGpad3E5aVOfZ8cZtTe2ccp94E/5nnsWS//eJwv3Vq0jzg== X-Gm-Gg: AZFdTZf8aG1U9G6T28x6plCfqTSUNk5CCyokJhVh4kzMPlDzylYHn6IygjnlElHA203 DltysRHw7V4KhjxD1haD4PgECH+M/NsgdEVrm2WBoCynzOruc14pdT2ZIkXi6ps7iBXFIhR8OZ1 6uQMyQwV/719E7OLE+xjQ35fUEk/ji7f+XQh9MVmS2uEOHHOUy5Lti8+SExwabKZgv3/aaGGDB0 hmzvnrz5Tb+O+ZDJOYB8JV7VnKmCHiPy2XpMdkxW+NG8CblSPr22UgFPhwKNE+gLnxT9PjDcyrl WSoWZkvrPw== X-Received: by 2002:a05:6000:470b:b0:492:cd78:7137 with SMTP id ffacd0b85a97d-4a633785fb5mr9288773f8f.8.1795050543815; Wed, 18 Nov 2026 17:09:03 -0800 (PST) X-Received: by 2002:a05:6000:470b:b0:492:cd78:7137 with SMTP id ffacd0b85a97d-4a633785fb5mr9288749f8f.8.1795050543419; Wed, 18 Nov 2026 17:09:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795050543; cv=none; d=google.com; s=arc-20260327; b=Kp6I5UmyBvp03Q8fdNDP7lfdDyajyz+mqqk8Ax6o78+hqELiDAQHKQdiX+8eab8jCo OEMvq8QCxgFsgReRvGhCh3C/v/w8yPyxapBQ6dnIwdUCrloITSPT1lpDUA59WqqNurhL 4ZbyFaL3OSG0k4WQaRjmJ9IBpriSTuO8XDvvzd4Wg31hj3TVyvX0v7CqnPN/7625NAry 45p4Ugwuoc9NDAkFKKoELpltikwjS73xewa9+ldEnWH9hLgPSNW5uadHIYtsbr7mwQ1i h6gQ0FBBt16ixeDX4IUJ9Cn0y3yoi3tAQf3D14vR/hWAG7mMtUSWRdVsYblAFmprpjVR 7qJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=B3bWEDF8r70y4jDqO+f5DpW5PphNAtDsrNLv6LKbBFA=; fh=BjGOvPjPXXcG4FOEOAa06XSrSHRNVQK+GLk0VTQxk/8=; b=cOvQZ2p84qWPheSbwRQgw03MtOivtyFwSngPhqPU+AtYTjSRNR3Y5ri1zkvksN4Bl6 Mlp+CwsEkWXQA1nUqIsQ/kOEV8kket2zi36Gu01fHYRzlPIFQtotfOGQ7tauIaB98Oe0 9b0woMNQEA/Xqwcj25pQK1lzTfBuOlKsK4a0NyELF+4EvEptJNhG1yg5rxPvt5l7PwgX QxK6Vr03HSCbeTTWZRKpU+4by1tcmPmTAKnKPrOWHnaX82owGKHF4hx1TwuESjz7qaTc hNJw/PlS9G1AsiTEz+SBAVZdMN5rFyDRaRa880DLS9GPlSuJldKvc3q73i+SxJDYB0dg K+/g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b="E7ZoyW/p"; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-4a656d07fd7sor672417f8f.14.2026.11.18.17.09.03 for (Google Transport Security); Wed, 18 Nov 2026 17:09:03 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) client-ip=2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b="E7ZoyW/p"; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1795050543; x=1795655343; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=B3bWEDF8r70y4jDqO+f5DpW5PphNAtDsrNLv6LKbBFA=; b=E7ZoyW/prHIdn1r6ciA/MyifDyvQCmUvmbTPkL1bmVXLiC21h9dcWycXTCnJPN/ExZ N9rKgBgtRBnZgSAdXO3Wsi3J9TAeI5LX+73wUTdJYAXgVrmh4QFlaTy2trrLwUbMm5jw 1zcg+J/1HGU5igSd/Y8UkmcMl6lDa7uLFWoWCsRiJCyCljB8gVF6/1MjlBEQ5wkBKt8B i03+u6DpdhdEsVGvBcIj7s4ELSDLBkVLf5QVdDaK5U3J6Dcq0TXWhHZ2xAm8/i+far4w eOYWY8an/bre/oTIu5ykSrZVDDbk9JeEWDfcb+910iQmyt6Zbjg5WQvayahLHtRRN6WV jQNA== X-Forwarded-Encrypted: i=1; AL+hErGa/E6QX2vyJaf0Wg50FfFGFG+ZWmLQLuyl8Gh3yM5pTZLH1VF/Lq+KTPciPvnHYW2Ycb2pgQ==@openvz.org X-Received: by 2002:a05:6000:2303:b0:4a6:d298:8332 with SMTP id ffacd0b85a97d-4a6d2988570mr8813640f8f.57.1795050543048; Wed, 18 Nov 2026 17:09:03 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:8c09:3cc3:6efa:ac1f]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4a65560b2a1sm7266442f8f.32.2026.11.18.17.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2026 17:09:01 -0800 (PST) From: "Denis V. Lunev" To: alexander.ivanov@virtuozzo.com, vasileios.almpanis@virtuozzo.com Date: Thu, 19 Nov 2026 02:08:53 +0100 Message-ID: <20261119010854.4107497-4-den@openvz.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261119010854.4107497-1-den@openvz.org> References: <20261119010854.4107497-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 3/4] dm-qcow2: delay a backing-file COW while its L2 entry awaits writeback X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Denis V. Lunev On an ext_l2 image with a backing file, a write that covers part of an unallocated subcluster is a backing-file COW. Writes are not delayed on a dirty L2 entry, so such a write can follow, in the same worker pass, the write that allocated its cluster. It finds the cluster in memory, keeps it (only_set_ext_l2) and computes the new subcluster bitmap from the dirty entry, but does not join the writeback of that entry. If the writeback fails, the revert sets the entry back to offset 0, and the COW then installs its bitmap over it and completes. Its data went to a cluster that nothing maps, and later I/O to those subclusters goes to cluster 0, where the image header lives. Delay the COW while its L2 entry or the subcluster bitmap is dirty, as prepare_cluster_discard() does. Only a write that partly covers a subcluster of a cluster allocated in the same worker pass waits longer. https://virtuozzo.atlassian.net/browse/VSTOR-154310 Fixes: 222b6f1291c1 ("dm-qcow2: Introduce driver to create block devices over QCOW2 files") Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Denis V. Lunev --- drivers/md/dm-qcow2-map.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index d1ec79189f81..fedf9ac4e6e3 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -3703,6 +3703,21 @@ static int prepare_cluster_discard(struct qcow2 *qcow2, struct qio **qio, return 1; } +static bool delay_if_l2_dirty(struct qcow2 *qcow2, struct qcow2_map *map, + struct qio **qio) +{ + struct md_page *md = map->l2.md; + u32 index_in_page = map->l2.index_in_page; + bool ret; + + spin_lock_irq(&qcow2->md_pages_lock); + ret = delay_if_dirty(qcow2, md, index_in_page, qio) || + (qcow2->ext_l2 && + delay_if_dirty(qcow2, md, index_in_page + 1, qio)); + spin_unlock_irq(&qcow2->md_pages_lock); + return ret; +} + static int handle_metadata(struct qcow2 *qcow2, struct qio **qio, struct qcow2_map *map) { @@ -3748,7 +3763,10 @@ static int handle_metadata(struct qcow2 *qcow2, struct qio **qio, * snapshots). Here is data COW on L2_LEVEL. */ map->backing_file_cow = true; - ret = prepare_l1l2_replace(qcow2, *qio, map); + if (delay_if_l2_dirty(qcow2, map, qio)) + ret = 0; + else + ret = prepare_l1l2_replace(qcow2, *qio, map); } else { /* Wants L1 or L2 entry allocation */ ret = prepare_l1l2_allocation(qcow2, *qio, map); -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel