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 0DD5280474 for ; Tue, 27 Oct 2026 16:50:29 +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 69RGnHpA030957; Tue, 27 Oct 2026 19:49:17 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69RGnHpA030957 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="fJt5yM91" Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69RGmvRL030898 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 27 Oct 2026 19:48:58 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69RGmvRL030898 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-8b18c67095dso36796087b3.2 for ; Tue, 27 Oct 2026 09:48:58 -0700 (PDT) X-Gm-Message-State: AFq9FYKEpPAQFLDYDGU5b1OC6kdJkrVRuFzV4AR5VLmAhfojrgQmzsUQ mxFAB2Pq+QQc1iNi6YBucZEew32R4daAhlbC6PnIa3wxm9jPhKdx/Hf5m99HqkaJv6helmzhPC+ 0cSuy1vnwrU1EBPgqybCnFak//+kpqNvu778m7LGrKrYTPtduqNv9Ig== X-Gm-Gg: AYBFou21xIeld2ID1ybS8fXFXjx9ToJbxSkPKSBE+M2s4Y5obhicmYPSdtkbYtx3vVr JyBryrY/TjdCUuDosb7NLWiKuDG1RvdbSNS1wdcX39mow4B5fOtTRFqUjmtRqxeWS/WNmRAKOeh Dod0PW8lXSaE+TbsZ0wANSrVQ54WmZUlhQumoBzhMeYK5RMDAU1wgQEHJNjyAKWlCtU1h4M1HU6 +P1eBtd9yqpNjgYO4QB+tD2wM9dDr7o3MVklHkmEwqqytCfMJKMg9LyDrz95I+ms3h5+HKNtVM3 K5nun102ukhQ1SCo1CAcpayhcfCG2Y2+f0n81IFxsHUI4g13305bOaREbGUbGtWYC4dTBLPnLpU ZlozkzL9quFfj4OIXK5y/AvE7YTobbKt20eJX6qaqQXjkgK8AH5abpJwuXw6LGmoqj/aoJmcAeB bIcM8qy4mu5RgUUSNBe4vNwc4ph8R6 X-Received: by 2002:a05:690c:9201:b0:8b1:215b:9895 with SMTP id 00721157ae682-8b166c5739dmr75819187b3.51.1793119737268; Tue, 27 Oct 2026 09:48:57 -0700 (PDT) X-Received: by 2002:a05:690c:9201:b0:8b1:215b:9895 with SMTP id 00721157ae682-8b166c5739dmr75818977b3.51.1793119736710; Tue, 27 Oct 2026 09:48:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1793119736; cv=pass; d=google.com; s=arc-20260327; b=qJSJVM+D5VmoEj2Pl7amW0Iyqk952aWlEaawLZQUUUp2LT5XCJbEGwVvYZ3EusnFrT Q08NhP7hySjk5qnMWCFogZt/sNTB46yVJOtCU2s/nL0ouV76gDLAHd1ZVsbV6ZJJDfMR bgvP69wv9BszaYvTyIoG2UfvauFNNDnC1UV9yQViVQ1snXXL4Ih+QtGCG2gH/aMxyjMG k9mheiXeaZ1CmLwKqZCD+5wFb0gpi5OMGpyoTBcEahZ1l0KLpV3Fq9t8IQhJd2frqDtB kOdLL1AtShO94SFVNQJSs+78yGVFk53UMdkxNd+uug5I7SBOayQC+bZ19GK464fd6xjw o7JA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=mime-version:cc:to:in-reply-to:references:message-id :content-transfer-encoding:subject:date:from:dkim-signature; bh=JZR+ZdKnkke9RFL1hbKTPiiAYAC4w11qt4CaIpSsuLs=; fh=y3TfVeQA9QYtIzD5Inxiyys5ebBfyOgjQPZaP/+mSiI=; b=sh2dvgs8rhcV5q2hhDekeEliq4w5fEoRr3J5m0JzVrqbqx0KE4KYhmbRjEz4Ax+bMH vY1nhYtwQO6wkGi2wUC3DDC/cKEpL3ouKsqpfHBKSVe12euLpGWBPIEtTGCzfQWYIr+4 ysrvyOgoBYDcRLwqmZ0hEvkFKJeRFVii+aeIxBAdRVor6bVTCiGaEQ9deEFphLUjr2pb CiMd6wHvBhlXm9hXzNLYPwE1jkEbWAmYcP2cl2c0sD4mNwyFsL9aHbH1ozcYSbmAHC2P CVJpqJzI/vXbV+ax/+7kMbdbOg93TVecK/kpEsUp8l+6TQOukSrqxdQt/QWT6ch8+Koi PY0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=fJt5yM91; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of ptikhomirov@virtuozzo.com designates 2a01:111:f403:c200::1 as permitted sender) smtp.mailfrom=ptikhomirov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazlp170100001.outbound.protection.outlook.com. [2a01:111:f403:c200::1]) by mx.google.com with ESMTPS id 00721157ae682-8b19e5ecb08si19356377b3.92.2026.10.27.09.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 09:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ptikhomirov@virtuozzo.com designates 2a01:111:f403:c200::1 as permitted sender) client-ip=2a01:111:f403:c200::1; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=fJt5yM91; arc=pass (i=1 spf=pass spfdomain=virtuozzo.com dkim=pass dkdomain=virtuozzo.com dmarc=pass fromdomain=virtuozzo.com); spf=pass (google.com: domain of ptikhomirov@virtuozzo.com designates 2a01:111:f403:c200::1 as permitted sender) smtp.mailfrom=ptikhomirov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YLSxDP/cMffDLqMdEWlQIsaOBr2wbZ2PbNS3Ukv1T3cmWUrxJ5OjrIUsL7CFtD369Th8xmp8zFoFGLkuLjNuW0iy5uI4OktLA7r4+nid7SllVFzbcqBjtpvp6gmifgkRdqj5j937zAJ2+gU8vQk2cOcgryqar2MHI2Zx2PpcoOjK8g4LfL0kGrbO1P8gOMVc7rSO40kRw8Y5ETSsooRfExBdmrr9DC957jYSbVrMaoH8OxitEQiMYGdRRjyG04RDGHca8vMp0cb6yGekxo42GgpSFLAZ8hBJU7xZctwI+mQJKjWFZq/2qDq9rymzD96RpPNEoSjvbz7AtGaJNwmoLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JZR+ZdKnkke9RFL1hbKTPiiAYAC4w11qt4CaIpSsuLs=; b=XsrsH/N66J0Zb3HRT6p529zei7k1llQ/Z6M4mDDOCxeAesSmf2422CE3KSwkf9mIpitLNKHd54xU0m5rx2Vja79ShMqhoPM2XMeR1G8eC/pHNljjLE/Pep1fQEikHqyCCVkL27ZS63SQoR6l9D57vRw2jIY3URF6Dzu+hJBJQ5I9qNU9FTeRvL8z2+uNxU0E4s7gNHvQfepokshJ6htaJdatr0llt4wnfGb9FZddsa8OXx0HNGLQ3lYJRmR0tsGLlfeabIZpLceebwaYqo1a8PPHwJNivdkMS0LfJ1LZW3K54PP6X4BNvxWWRXVT5GwDcocmoMI9na8QeDvCQk8DCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JZR+ZdKnkke9RFL1hbKTPiiAYAC4w11qt4CaIpSsuLs=; b=fJt5yM91ri65ooCFSBx6SAtqbRUM0G74e084Z9qU0X7yJweArRgTCY3it6T55T/FmrFeGqs7t0HHGZtuuMFmdglq0XkNY5I7eA1G7v9JYDLON2JPzAQcJH4h1KlZ567lT8WIXa06F+0RqVO+jG+L5XvtrCfekof9qMxvGwvk5yRezCjBFi++MdcJMGEk47LdcRu1fXQyH+urxdNn6B22EC372OBQ9tJoRly0LNa9oDgrSRDlrBar+CSldlPT0BWi6zew2c0C0IZYBYMklFko7XiZedLPw6vaYp0C6VkQjENYimQ0NgbZw4E0XMDi3fwnRSmEDqsVrhQdd8jBAB2Y8Q== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM0PR08MB11804.eurprd08.prod.outlook.com (2603:10a6:20b:747::14) by BR0PR08MB513224.eurprd08.prod.outlook.com (2603:10a6:2c8:67::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.546.22; Tue, 27 Oct 2026 16:48:55 +0000 Received: from AM0PR08MB11804.eurprd08.prod.outlook.com ([fe80::bf46:f137:f6d2:5b3a]) by AM0PR08MB11804.eurprd08.prod.outlook.com ([fe80::bf46:f137:f6d2:5b3a%7]) with mapi id 15.21.0546.021; Tue, 27 Oct 2026 16:48:55 +0000 From: Pavel Tikhomirov Date: Tue, 27 Oct 2026 17:48:52 +0100 Message-Id: <20261027-ptikhomirov-vstor-149268-cbt-account-at-rq-start-v6-7-f9870cf5c7eb@virtuozzo.com> References: <20261027-ptikhomirov-vstor-149268-cbt-account-at-rq-start-v6-0-f9870cf5c7eb@virtuozzo.com> In-Reply-To: <20261027-ptikhomirov-vstor-149268-cbt-account-at-rq-start-v6-0-f9870cf5c7eb@virtuozzo.com> To: Konstantin Khorenko X-Mailer: b4 0.16.0 X-ClientProxiedBy: BE1P281CA0178.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:66::13) To AM0PR08MB11804.eurprd08.prod.outlook.com (2603:10a6:20b:747::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR08MB11804:EE_|BR0PR08MB513224:EE_ X-MS-Office365-Filtering-Correlation-Id: 721a6208-90c9-4b78-d63e-08df344a2ddb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|10070799003|1800799024|366016|23010399003|22082099003|261026121527099003|18002099003|261022075727099003|56012099006|261009223027099003|10067099003|261021121427099003|261022105027099003|261026140227099003; X-Microsoft-Antispam-Message-Info: J3ECxwGK93cslBY/nZs4OqNWzMGMGhPde7nMjR7u/sgut+IRiaKL3/49W3v+8fhTP6diZBibvcwCbLtjEK2XPpQWi7AEBdNkvOtgFsGSIRVS1EmhBUiOMgOLdPvB/EQJy3pu227g0zFcA30vqq2NN563R4KhOzbWB4hpiWrNoleGRJ8k9FPrsvBX/8aMplLYCsOzH14z99VCNwc/AH7O/rGBL1vXuslxy9Y17XlPxajy2Jck13M/8OEwN4wbAYyStXWT7wKWKeCHIRltwBJdVnf1twOlWAV+9Xv60w0LcsQgRBV1uYvX7tgQ3b6eUFIrKNYovbzcQCvm1S8ajTmJc1WMh92oWNJW9jXakNtVt06BWlmfyGXBUpbTP6579AHhP2raTIJz4WR6PwYXdT6Ouc6LFYpTlAlE7znwzY4WX1VNF7gKQU+ovBtFyl51oDSeAGDulAhsTyJDnpCfD+eP6x53lb6zX1jOAQItaIQ4aHYNjRSYsjQvePMzgqM2bb7Cr8ahbKQRp4Mz2Nlo9u7XlhBQkXiUS0HdXnZPYQhovrFSfzAZzNPxlgvnJDkHqWnfhPCpz8qTxcxLWIAHy+xo1l3FvoRltBvKrogBQM8krd5JjcQS0xINoiorWSrHRHXC X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR08MB11804.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(10070799003)(1800799024)(366016)(23010399003)(22082099003)(261026121527099003)(18002099003)(261022075727099003)(56012099006)(261009223027099003)(10067099003)(261021121427099003)(261022105027099003)(261026140227099003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aTlFVHRUMVF2am1CMVlIazl2M1JzV3JxckkwOXZESHI0K0c0SEJrdUxBOFUx?= =?utf-8?B?V0xVcktIbDQxcFNQOFJOdE03Zklmdlh2UE9zOEpnMjZPdXZrVWQ1VXR4REFa?= =?utf-8?B?K05hMFpGYVpLd0Y5cnhreG1mMlpNcXE2a0J6U0t5M2RHaGhyMGRJM1RPRzJl?= =?utf-8?B?ZTVHd3FkQ0tpc3IwQUh4TzM3bG5Nek04dUd3SUEwOCtBLzllTmdCbFYrZ2Rk?= =?utf-8?B?Nm9ZcTQvZGVNYnlIZTFsdmZxZS9UZEpSOFZObnJLOXN4alRFc1I4VStxbHVy?= =?utf-8?B?MFRic1BhLzZHU2xNM0l2OVRGTGVLdHplRzJnVWlrUEo2WjRSMVRBRXBJcDVF?= =?utf-8?B?dnRHUHFVd0QwQllJdlArb2lzRjhTbUhkTWFwUnpqRHgweTQ5WjRuZ2N1TkJu?= =?utf-8?B?OUxmaFJiMHQwd212cXMxd0s5aDYrMC92UWpGdE93dEJMaGpwa0c4Ym1BUGww?= =?utf-8?B?UFM2QWtBS3dUTjVoY0twTmRKNDg3Mj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cGxjcVd5YWgvakZlLzUvSlEzYkV4OFpZc25ucHNyY2hLNFdLOWx3QlV0cVZE?= =?utf-8?Q?1UZ2wpmhS0pPJVXy0hnsyhY2G4f6/Mvg423RAN/8bgpZs?= X-MS-Exchange-AntiSpam-MessageData-1: zlZiajMkDowQBsmC3SvTUoHnauqjuJ8h9Eo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 721a6208-90c9-4b78-d63e-08df344a2ddb X-MS-Exchange-CrossTenant-AuthSource: AM0PR08MB11804.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2026 16:48:51.2232 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DVU7iM5bjfZnGFFLsUq6Jclry1TDV4rIqGuR37E47fFzhgkGWg3J9szbREE2bWT0aiWo1X6xHyTGozQR4m7LWPgX+mDOV9DrewEQl080/Gg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BR0PR08MB513224 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v6 7/7] block/blk-cbt: account a write request also when dm starts it 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 CBT accounts a write at bio submission. dm suspend of request based dm waits only for started requests, so a request submitted before the suspend but dispatched after resume is accounted before a backup point taken under the suspend (BLKCBTSTART, CBT_SNAP_CREATE) while its data lands after it. push_backup then saves the old data, and no incremental backup copies the new one. Account a write again when dm starts it. This runs under the dispatch rcu_read_lock(), so it can't allocate: it sets the bits directly in the bitmap pages, and the allocation of missing pages is now queued to the kblockd workqueue already at submission. If a page is still missing when dm starts the request (the work did not run yet, or the write was submitted before BLKCBTSTART), dm returns BLK_STS_RESOURCE, so that blk-mq dispatches the request again later. https://virtuozzo.atlassian.net/browse/VSTOR-149268 Feature: cbt: changed block tracking (for backup) Signed-off-by: Pavel Tikhomirov --- block/blk-cbt.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++ drivers/md/dm-rq.c | 3 + include/linux/blkdev.h | 5 ++ 3 files changed, 183 insertions(+) diff --git a/block/blk-cbt.c b/block/blk-cbt.c index 5535480847405..c114fb63cc134 100644 --- a/block/blk-cbt.c +++ b/block/blk-cbt.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,10 @@ struct cbt_info { struct page **snp_map; blkcnt_t snp_block_max; + /* Map pages to allocate, see cbt_alloc_work_fn() */ + unsigned long *missing; + struct work_struct alloc_work; + spinlock_t lock; struct list_head list; }; @@ -231,6 +236,85 @@ static int __blk_cbt_set(struct cbt_info *cbt, blkcnt_t block, return (pages_missed && *pages_missed) ? -EAGAIN : 0; } +/* Drop a cbt->count reference, release the cbt if it is dead */ +static void cbt_put(struct cbt_info *cbt) +{ + unsigned long flags; + bool release; + + spin_lock_irqsave(&cbt->lock, flags); + release = !--cbt->count && test_bit(CBT_DEAD, &cbt->flags); + spin_unlock_irqrestore(&cbt->lock, flags); + if (release) + call_srcu(&cbt_srcu, &cbt->rcu, &cbt_release_callback); +} + +/* Allocate the map pages queued in cbt->missing */ +static void cbt_alloc_work_fn(struct work_struct *work) +{ + struct cbt_info *cbt = container_of(work, struct cbt_info, alloc_work); + unsigned long idx; + + for_each_set_bit(idx, cbt->missing, NR_PAGES(cbt->block_max)) { + struct page *page; + + clear_bit(idx, cbt->missing); + if (CBT_PAGE(cbt, idx)) + continue; + + page = alloc_page(GFP_NOIO | __GFP_ZERO); + spin_lock_irq(&cbt->lock); + if (!CBT_PAGE(cbt, idx) && !test_bit(CBT_DEAD, &cbt->flags)) { + if (page) { + /* Release: lockless readers use the page */ + smp_store_release(&cbt->map[idx], page); + page = NULL; + } else { + set_bit(CBT_ERROR, &cbt->flags); + } + } + spin_unlock_irq(&cbt->lock); + if (page) + __free_page(page); + } + cbt_put(cbt); +} + +static void cbt_queue_alloc(struct cbt_info *cbt, unsigned long idx) +{ + unsigned long flags; + + /* Already queued: the work allocates it */ + if (test_and_set_bit(idx, cbt->missing)) + return; + spin_lock_irqsave(&cbt->lock, flags); + if (test_bit(CBT_DEAD, &cbt->flags)) { + spin_unlock_irqrestore(&cbt->lock, flags); + return; + } + cbt->count++; + spin_unlock_irqrestore(&cbt->lock, flags); + + /* The queued work drops the reference, or drop it if already queued */ + if (!kblockd_schedule_work(&cbt->alloc_work)) + cbt_put(cbt); +} + +/* Queue the allocation of the missing map pages for [block, block + count) */ +static void cbt_queue_alloc_pages(struct cbt_info *cbt, blkcnt_t block, + blkcnt_t count) +{ + unsigned long idx, last; + + if (unlikely(!count || block + count > cbt->block_max)) + return; + + last = (block + count - 1) / BITS_PER_PAGE; + for (idx = block / BITS_PER_PAGE; idx <= last; idx++) + if (!CBT_PAGE(cbt, idx)) + cbt_queue_alloc(cbt, idx); +} + /* Return true if all the map pages for [block, block + count) are there */ static bool cbt_pages_present(struct cbt_info *cbt, blkcnt_t block, blkcnt_t count) @@ -272,6 +356,8 @@ static bool blk_cbt_add(struct cbt_info *cbt, blkcnt_t start, blkcnt_t len, __blk_cbt_set(cbt, start, len, 1, NULL, NULL); return false; } + /* Queue the allocation early, so blk_cbt_rq_start() finds the pages */ + cbt_queue_alloc_pages(cbt, start, len); ex = get_cpu_ptr(cbt->cache); if (ex->start + ex->len == start) { ex->len += len; @@ -316,6 +402,86 @@ bool blk_cbt_bio_queue(struct request_queue *q, struct bio *bio, bool nowait) return wouldblock; } +/* + * Set the bits of [start, start + len) in the present pages, without + * allocating. Return true if a page is missing, its allocation is queued. + */ +static bool cbt_set_present(struct cbt_info *cbt, blkcnt_t start, blkcnt_t len) +{ + blkcnt_t block, end; + unsigned long flags; + bool missing = false; + + end = DIV_ROUND_UP(start + len, 1UL << cbt->block_bits); + block = start >> cbt->block_bits; + if (unlikely(end > cbt->block_max)) { + set_bit(CBT_ERROR, &cbt->flags); + return false; + } + + while (block < end) { + unsigned long idx = block / BITS_PER_PAGE; + unsigned long off = block & (BITS_PER_PAGE - 1); + unsigned long n = min_t(unsigned long, BITS_PER_PAGE - off, + end - block); + struct page *page = CBT_PAGE(cbt, idx); + + if (page) { + local_irq_save(flags); + spin_lock_page(page); + set_bits(page_address(page), off, n, 1); + unlock_page(page); + local_irq_restore(flags); + } else { + cbt_queue_alloc(cbt, idx); + missing = true; + } + block += n; + } + + return missing; +} + +/* + * Account a write again when request based dm starts it: dm suspend waits + * only for started requests, so one accounted at submission before a + * backup point taken under suspend may still reach the disk after it. + * + * Runs under the dispatch rcu_read_lock() (blk_mq_run_dispatch_ops()), so + * it must not sleep: if a bitmap page is missing, its allocation is queued + * and true is returned, for dm to retry the request later. + */ +bool blk_cbt_rq_start(struct request *rq) +{ + struct request_queue *q = rq->q; + struct cbt_info *cbt; + struct bio *bio; + bool retry = false; + int idx; + + if (likely(list_empty(&q->cbt_list))) + return false; + if (rq_data_dir(rq) == READ || blk_rq_is_passthrough(rq)) + return false; + + idx = srcu_read_lock(&cbt_srcu); + list_for_each_entry_srcu(cbt, &q->cbt_list, list, + srcu_read_lock_held(&cbt_srcu)) { + if (unlikely(test_bit(CBT_ERROR, &cbt->flags))) + continue; + __rq_for_each_bio(bio, rq) { + if (bio->bi_iter.bi_size && + cbt_set_present(cbt, bio->bi_iter.bi_sector << 9, + bio->bi_iter.bi_size)) + retry = true; + } + } + srcu_read_unlock(&cbt_srcu, idx); + + return retry; +} +EXPORT_SYMBOL_GPL(blk_cbt_rq_start); + static struct cbt_info *do_cbt_alloc(struct request_queue *q, __u8 *name, loff_t size, loff_t blocksize) { @@ -338,8 +504,16 @@ static struct cbt_info *do_cbt_alloc(struct request_queue *q, __u8 *name, goto err_pcpu; memset(cbt->map, 0, NR_PAGES(cbt->block_max) * sizeof(void*)); + + cbt->missing = bitmap_zalloc(NR_PAGES(cbt->block_max), GFP_KERNEL); + if (!cbt->missing) + goto err_map; + INIT_WORK(&cbt->alloc_work, cbt_alloc_work_fn); + cbt->queue = q; return cbt; +err_map: + vfree(cbt->map); err_pcpu: free_percpu(cbt->cache); err_cbt: @@ -721,6 +895,7 @@ static void cbt_release_callback(struct rcu_head *head) free_map(cbt->snp_map, nr_pages); } + bitmap_free(cbt->missing); free_percpu(cbt->cache); kfree(cbt); } diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 20f495bf5399d..5a8cd59ec257f 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -522,6 +522,9 @@ static blk_status_t dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx, if (ti->type->busy && ti->type->busy(ti)) return BLK_STS_RESOURCE; + if (blk_cbt_rq_start(rq)) + return BLK_STS_RESOURCE; + dm_start_request(md, rq); /* Init tio using md established in .init_request */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 885555f480462..9698a582356a9 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1628,6 +1628,7 @@ extern void blk_cbt_update_size(struct block_device *bdev); extern void blk_cbt_release(struct request_queue *q); extern bool blk_cbt_bio_queue(struct request_queue *q, struct bio *bio, bool nowait); +extern bool blk_cbt_rq_start(struct request *rq); extern int blk_cbt_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg); #else /* CONFIG_BLK_DEV_CBT */ static inline void blk_cbt_update_size(struct block_device *bdev) @@ -1641,6 +1642,10 @@ static inline bool blk_cbt_bio_queue(struct request_queue *q, struct bio *bio, { return false; } +static inline bool blk_cbt_rq_start(struct request *rq) +{ + return false; +} static inline int blk_cbt_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) { -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel