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 2B6D48045D for ; Wed, 28 Oct 2026 14:52:14 +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 69SEosgB020843; Wed, 28 Oct 2026 17:50:55 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SEosgB020843 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1793199057; bh=0gWgE0y8+DqSN92p/iwcFEoflqZ28SGsdxrUBN7H3rE=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=bt5z3YAOPN5ZeMEFKDuhKruinxiNurJ3IfuObpPPypvbtPRmqx47X5VQOTT0RMrd1 PCtZcWEkrbraQVoAvhg0aL2dTjG0jkYtRif7cuHCfuwKhG4UKp5seGCZIlBAApv8Ow p9tbs9JTVUj8JRQtWMSuUlgEYF4avfiZE8J4sTr4FYbmMfApjLUR8AUgPw+VGQg6tf t4DRA09AI7oqdu19TSigFVd29pmw+bFrcjMo5+AZo/jO5qxRlkUed7qzWLhNh6vEEM LQAcU3M0SOm41+P9oQixuIP/wqdGGiqsq1LGbsJVnkPfBeKzU/0sfdnTfNufh4G86G ikGsF3VFRu3aA== Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69SEorxQ020839 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 28 Oct 2026 17:50:54 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SEorxQ020839 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="NxkhgUK2" Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-c40d92085ceso99759966b.0 for ; Wed, 28 Oct 2026 07:50:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwQIcnkZ4zz8CRK5hwX0w6UdzQxu9ToQ10KzQx7X3Nj3yaojTIJQSa5FdAsBlzDie+U6yOFuw==@openvz.org X-Gm-Message-State: AFq9FYIt5ZJ+8neIuFb2ZE9fh5O6ttAehYvYRMXyciInX/xexd6JQL+K UwRcAtNm/lprS+6zzUI1wLbUbRaBNpTR1r3l2OzsVOM+aucwE04sMUOXL0JnpsKj92LvWB+nJkn eFPncNd03CFtLboXX7lZUE5K6a3FG9ZVi2E+A8TRuTJLwnRKN7gBcYw== X-Gm-Gg: AYBFou3UAvzLGeSQJtYKj0Qa74ivVHJh85DsFowYv0xBqWFO1UgRaBv91DOmmyMRyB+ DymOTmc4oLQEVuj7Nc17RzaShq07PUdNe918ceQxdPa48R+nAiTE5IhZT8IgOe3wVWQqVFVmGuF /Ggao4X8U4yMyB0kL7fFSh/42Y+QFotMwIaEgZ/Lqyt+q5wLb3T0a4HoA6LJbP4XnO5dxcJ6THG 6dnsXpaya0HwBq2WQJs2mctZ9K/vlp3NdF//AA09l7NIK6YapiyG+HtWo9J8v5x5jABsXx8afxL 5QN76gk1mw== X-Received: by 2002:a05:600c:621a:b0:49f:c5aa:9ef4 with SMTP id 5b1f17b1804b1-4a996b9812emr45730645e9.8.1793198213481; Wed, 28 Oct 2026 07:36:53 -0700 (PDT) X-Received: by 2002:a05:600c:621a:b0:49f:c5aa:9ef4 with SMTP id 5b1f17b1804b1-4a996b9812emr45729845e9.8.1793198212830; Wed, 28 Oct 2026 07:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793198212; cv=none; d=google.com; s=arc-20260327; b=tCQk4o7STYunlEjEHhhSEkR5rYG1Rsdx7jiq6QsutZzapjkeqdt/ZU8mhFkdDVtN4C NY2IGhHsIXqSm/GRt7NZjMezoq0FSqJB34GoEqkVco/hDaMCUhLmU5oWlAciPGfc8Jgo Q1BN8InI1KEiTYwfbqk3DbyJ8Yqivkh4K6rMPbOyf5QM9A3kOf0FPeW4Ds1TQE3NF++E BjR9ruk6qp/78Sf2r3dN2h57nGcgYdCfSvMPgVyH8wIES5rwI3gzAXMpaXW7FlsAYezu 7FpRF3v1jy4l0M/9TEG24qNzMrGCInq6DqklWREx5lwfTfQ37bjWa3ZsnEIlScgTU57y es7A== 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=8jv44Qzf1O+NEYIgrmP9DFIQPjKX2mm7tCz4jjc1nOI=; fh=MuLGNl5hxApTYgXcqlFMWahjzy4b09A1AxLiuD5UD/o=; b=Dm1AsOGD7tdXdklY1sctzmuxc7NqZHxTMrD0X8QiJjuVPX9B2hMuToLCITlXH0ApXk ijyHAaBHeElySpztAGdgYUR20hVVp7R0sZw84y1TY874KNhOgsehmJhbE/arjs5N9zcy ZkXRtj+N4txdDEX1uGvVkgaKfXwmNTSFR58QWDtkq9ZCsUT20lXz0WKuMRR3M5i6tHRP RLXHV5BgmBabhqoUUrFXbq0oxWIW5HrQb5obmsdxoG1ozqyasZnaB2EIH2BWUENKF1DF Qvg0rufoKjtRcGO6R/6gFxW0yMWyhiUDTdhxlwSI/VmwVEil4qB9fJ1udVB+lIf3Jz2/ vk8Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=NxkhgUK2; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf 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 5b1f17b1804b1-4a35a571b90sor25455245e9.8.2026.10.28.07.36.52 for (Google Transport Security); Wed, 28 Oct 2026 07:36:52 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf as permitted sender) client-ip=2a06:5b06:b600:300:2c3:d099:6fb:56cf; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=NxkhgUK2; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:2c3:d099:6fb:56cf 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=1793198212; x=1793803012; 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=8jv44Qzf1O+NEYIgrmP9DFIQPjKX2mm7tCz4jjc1nOI=; b=NxkhgUK2EWXRqT3YP/t/k+mUfeVhDD1MJCq2CK57QZS43BT8En7QA5z4NU63ZGDP8t OW4IFY5i5deMEqRKBBxNSSXUv+QC/h/VS3QvPTHyUWPXsSHJFVIelOFvABrSRprRiCoP SwTm1fKdIMv0FB2kSTMjQbdE0achkmTcMfzrBzYqpO/Hq0DrKdTWLYlYJPMo9pl+9cG3 AC7SLwYB/vRu1vrB3QAdYOYmYv/9/oj2NKHFbIFCapbgWexrwSJMykHUWGqkOyQXVQA0 lssuohUQ4zh6gb860OYjDcbuV8ImG8ME5C8Igxdd5oFvH2kp6nnI8U8dwmARzmLzpSoW 7cPQ== X-Forwarded-Encrypted: i=1; AKwUvBw4InQkl6f7LJFTkScCWLZ9dXQ+8JmKh5mbzG1SL6Ug7I8YeVPfD1JUrl1m1GCMdTxFzvTlSg==@openvz.org X-Received: by 2002:a05:600c:540f:b0:49e:65f2:db64 with SMTP id 5b1f17b1804b1-4a9961f390dmr49490415e9.5.1793198212245; Wed, 28 Oct 2026 07:36:52 -0700 (PDT) Received: from athena.sw.ru ([2a06:5b06:b600:300:2c3:d099:6fb:56cf]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e3ebd4d8dsm30321335f8f.36.2026.10.28.07.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2026 07:36:51 -0700 (PDT) From: "Denis V. Lunev" To: andrey.zhadchenko@virtuozzo.com Date: Wed, 28 Oct 2026 15:36:45 +0100 Message-ID: <20261028143647.2972030-3-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261028143647.2972030-1-den@openvz.org> References: <20261028143647.2972030-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v2 2/4] dm-ploop: renumber BAT levels when the latest snapshot is merged 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 ploop_merge_latest_snapshot() drops the delta below the top one and moves the top delta down a level, but leaves bat_levels alone. Every cluster of the top delta then sits one level above the new top. Checks done with "< top" do not notice, but the flip of the upper deltas compares levels for equality and leaves these entries alone. After the flip they are still taken for the top delta, so their I/O goes to the delta that has just become the top one, at offsets that belong to the other file. An ALLOC or RELOC writeback resets the level of every entry it writes back, which hid this for the pages that happened to get one. Lower the levels above the dropped delta and clear the slot the top delta moved out of, as notify_delta_merged() does for a delta merged from userspace. Fixes: 6ddad5a4d226 ("dm-ploop: Add ploop target driver") https://virtuozzo.atlassian.net/browse/VSTOR-151979 Signed-off-by: Denis V. Lunev Reviewed-by: Andrey Zhadchenko Feature: dm-ploop: ploop target driver --- drivers/md/dm-ploop-cmd.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c index 5fa78e6cff9a..b3d96bb657ed 100644 --- a/drivers/md/dm-ploop-cmd.c +++ b/drivers/md/dm-ploop-cmd.c @@ -721,6 +721,27 @@ static int ploop_process_merge_latest_snapshot(struct ploop *ploop) } ALLOW_ERROR_INJECTION(ploop_process_merge_latest_snapshot, ERRNO); +static void ploop_renumber_levels_above(struct ploop *ploop, u8 level) +{ + u32 i, end, *bat_entries; + struct md_page *md; + struct rb_node *node; + unsigned long flags; + + ploop_for_each_md_page(ploop, md, node) { + ploop_init_be_iter(ploop, md->id, &i, &end); + bat_entries = md->kmpage; + + spin_lock_irqsave(&md->md_lock, flags); /* write */ + for (; i <= end; i++) { + if (READ_ONCE(bat_entries[i]) != BAT_ENTRY_NONE && + READ_ONCE(md->bat_levels[i]) > level) + md->bat_levels[i]--; + } + spin_unlock_irqrestore(&md->md_lock, flags); + } +} + static int ploop_merge_latest_snapshot(struct ploop *ploop) { u8 level; @@ -747,7 +768,9 @@ static int ploop_merge_latest_snapshot(struct ploop *ploop) ploop_put_delta(ploop, &ploop->deltas[level]); ploop->deltas[level] = ploop->deltas[level + 1]; - ploop->nr_deltas--; + memset(&ploop->deltas[--ploop->nr_deltas], 0, + sizeof(struct ploop_delta)); + ploop_renumber_levels_above(ploop, level); ploop_resume_submitting_pios(ploop); out: -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel