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 B38FE8017D for ; Wed, 28 Oct 2026 10:13:15 +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 69SAC4dE018404; Wed, 28 Oct 2026 13:12:04 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SAC4dE018404 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="khJSyGdV" Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 69SABarb018331 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 28 Oct 2026 13:11:37 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 69SABarb018331 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-88322409239so13173557b3.1 for ; Wed, 28 Oct 2026 03:11:37 -0700 (PDT) X-Gm-Message-State: AFq9FYLxdAPbsBXanYUXkSqe1G/jSshkEo69jq3GjYNaVBG60mzo8qmv BJWEH5Hb73dUKztvGpbGDTx+UywvO5FereOYSS1AiZFZnlB7SVTY+ty9mjMIVDZ7PfzegFdgtJf a+Pa7sXR2V5forpyc6JomZp6J/ZE8icTZ6ur25Rz6MuDkNR/ehQ/c1w== X-Gm-Gg: AYBFou0Oi/Wdnq5jiww+xJjTSiAurDyfIGsTK5hp/Rf7pNf6szlRdjxqYSvMwtvkW8J LThrwONeDUKZTEdbSErbC7G38tWkmVR58QPMMlOeWB3N05HE4H41Gt39lTwqursJKMXwAulftVO MWJLjiIjYQPl9Gcf92itPs7dclXnKXHPkiyssqu6TYumwqXgwS1ZEUsgHN6Ie/yWCGfJFwMGCtu Pv6l2TImgciBGVCP9RtJXWfJ4EM5Vw+yYVToQpmCRW8W+Lowjr2V+suPrlRUCKMH7d+265369fZ RtiuvZhmwwTIrgsxfsJiTJGBLdZONet3vl2krLuKIlfDZCqMKio7AGiLT1uUyxsiIgPK1BsF5pO h4F1kAnnjwtu2SPz55DsX3CZkiPYJRfSLnJcf58TY9cf8K0w25agi3XdnEmwhbpSHhTQwA/DXcl MCivRTgx9W5nymOrJKiXtkEgLeXFAs X-Received: by 2002:a53:bb10:0:b0:679:abf5:148b with SMTP id 956f58d0204a3-67a7bd4f542mr1439632d50.52.1793182296251; Wed, 28 Oct 2026 03:11:36 -0700 (PDT) X-Received: by 2002:a53:bb10:0:b0:679:abf5:148b with SMTP id 956f58d0204a3-67a7bd4f542mr1439620d50.52.1793182295638; Wed, 28 Oct 2026 03:11:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1793182295; cv=pass; d=google.com; s=arc-20260327; b=CYJcV9bA7GCJr8V8CP7AWU6BHmlvWEE0QxCZbHX70/1iEyLZD56P0Xek//OBE5M81h IAEEr02TQJTxHWNMiH5JKL2PZdoCVrTHvUln9owQsbg38xEvByQOdc5ESZRA4KxkQwyy 5eS4oL1NsJ8uv0PdkIHNGQ15glwCgMObR6R+6nLVun+PQUAfspkh59GE/4rHp3UZosL3 NmYgZmQWvQlBLWXvAfo6rAcwEmmKAe181p4jlz5V7lWhIymd02XeaDzxJJjCfFwMEoNl FS3l+mny1dbj4Xx7m6qLHY9wkOmUdHEhwgKEsl+em/Y7J0LxOQA7sJhRgMRSJWuZg6vu Pq9w== 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=O6hqEk5KW6tJsqmFBRqjyQXbsEWUQkdgfOlsKveENGc=; fh=y3TfVeQA9QYtIzD5Inxiyys5ebBfyOgjQPZaP/+mSiI=; b=QYMtxb8eaZxKxrrC+7+sNZ8KpNPW4R11ZkO2YhaICOXGGdrD0S9jnQ3Cw0GD7aLP/i Oz2hCJAfDlNc6Y+4Tsc8yMexITGfAuX9B9QNVnXe6kHruhqZIqM3qO6EH/pqQyUfuand XDXG1rqJkNAXCUdS50DbPitFiksuwMr06H58U61xEcCtsEyqtcHf614RKdqXO4vVvHLT /SMzFx5ytT7z4TAtrM+UvJkWrMrVxtqFAqxKYKQwNtA29wYLuFZVE9KlFmNEY4AWzmCJ P/ynUmeVHNdQZ/GwMZr+DF31Q2laENeFN0qiwLQg2vh8/1DT8uUDxrBEMChp/Iqe8aGo Gtnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector2 header.b=khJSyGdV; 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 956f58d0204a3-67a7a14dce9si2160047d50.242.2026.10.28.03.11.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2026 03:11:35 -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=khJSyGdV; 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=caK10qXfF+EXiLpGv/Eodiy5m+YicpWtvmHueqGIBOTzLZuD53ynkKDPAynHi20mUQ6CYzeidyUL1WeVIi4K0IhxHZ/vtkKn/iff44qEm+3VsTosyiA0ofEiK9NHJwRYgHiiRd1b7aTLm4i2IIREYkDiqEvM+9EcKM8xJGKRWnFOnf7z2OOiDBFm2nBwdqXnoBKoVEeQugvk9T380IuajqOck1zmI8ICnqBxqjpF5pu0pxXEBbBEB21R3VE7w7+a2aSQ9vauUmQt/q3QsUgILyBzunKLDZL0sP8uslOVzzMFOzY7v9zWa/BV8HYD1nWYDG+m5bh8KimOKpds78Vkog== 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=O6hqEk5KW6tJsqmFBRqjyQXbsEWUQkdgfOlsKveENGc=; b=Pb/spbq+bi2JvzKbMd7G8RDfR0Ji9mh+BopkTsGdqQKzRsBAKQUPjcU7pGBTqMtoW6kKSH+sWa7ulS1YtSa4z8WDeugO5fxIRq4CWGwekR1dQoMYQe8PcxJmNqnkUA27Kl0S2+x9kkuDpfNFDkw3KJyQw4GXukZDi6GcI8LMZcTAEdXsOeKYBFsmqxxVoCLIVeq2zYK+M8i66NQ1bVyw+qY2SIe9h7Wm1AVygXUJYjtwBTPn8gxPwX1mE7avU2g3aJ4XVYWabr2wawF4p0Ye1i+XcmaZOHkT3Gc0MH1oq95ABlT0XC6TrZnW0yR6nkkPdy2vrb+DVs8cO58MPlnYcA== 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=O6hqEk5KW6tJsqmFBRqjyQXbsEWUQkdgfOlsKveENGc=; b=khJSyGdVCSSU4aNhQ1l/2Stsvly8qhNgQG1Kbdt+UA+F2ukIHYrcjJ7BlI1qL4UwQrLAkcJJIOox786914kXRmDu/FAwyXj4nvJC60OouJ83TuBWJwD5ZFfsFrcyqZBJBOZ45bdBMFHzlXi3D1BgjJlR53cay0uGwFFBjqvogjLeR5qPF2FpbMOnyi70k2lN6L0nqUF3V5X8oCbMAlM6Vz39nSbMB41wtGtyJu206/R58gW6WBpJq8mYoem5bsh1NfgqoGaU0ChvfI4nO66wNjcg92piE9j4C8fylWLkcYzmitqTxBX27NETUCCfu0tup1I4M7Zy8cAArbTWORiBgw== 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 AS8PR08MB8802.eurprd08.prod.outlook.com (2603:10a6:20b:5bc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.569.8; Wed, 28 Oct 2026 10:11:28 +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.0569.007; Wed, 28 Oct 2026 10:11:28 +0000 From: Pavel Tikhomirov Date: Wed, 28 Oct 2026 11:11:29 +0100 Message-Id: <20261028-ptikhomirov-vstor-149268-cbt-account-at-rq-start-v7-8-5c48672191c2@virtuozzo.com> References: <20261028-ptikhomirov-vstor-149268-cbt-account-at-rq-start-v7-0-5c48672191c2@virtuozzo.com> In-Reply-To: <20261028-ptikhomirov-vstor-149268-cbt-account-at-rq-start-v7-0-5c48672191c2@virtuozzo.com> To: Konstantin Khorenko X-Mailer: b4 0.16.0 X-ClientProxiedBy: BE1P281CA0336.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7d::15) To AM0PR08MB11804.eurprd08.prod.outlook.com (2603:10a6:20b:747::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR08MB11804:EE_|AS8PR08MB8802:EE_ X-MS-Office365-Filtering-Correlation-Id: 97c35018-34a6-4fb3-dc4a-08df34dbd4f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|23010399003|366016|376014|52116014|10070799003|1800799024|18002099003|22082099003|56012099006|261026121527099003|261026140227099003|10067099003|261021121427099003|261022075727099003|261009223027099003|261022105027099003; X-Microsoft-Antispam-Message-Info: JKpw1y1qcgYfhUp4+stG/mgUAMlI3aZ7Hu5VQPsgs/Hsepik1N0TigrFJ0FfY5wot4owPxSLBEUP69ZBfVwu1Stbak4qbqUzsUb+lLpMhXftUsId1pVkoNcA6oUpk+fkxqCijtsQuOhAvj55f6K11NEmdiwbYhEVNIDSrQ6vMypLhM4917OWjjVairfTMOOF/4Onz0hlx3B2ARqy337VB1QZrp+cpP+Kr97anpOUNv9buGWngkm9jk4yU+V001CtDU2Ua6X2TvZRactorCEOsQUyT0Okz2bQH54JwzBM7FhYc9lPagJ4+yHSxRiXanrjqRfS1tAnwSdylrLhw1yelqJ+V58np+JP26xc5Dolo/E/c3gVtnJJVIceaXtQZli0HdOWWtBknkZqxBg35rGOzHbhfSK2arFSEMW2waw1oBsalzQLkCOyPOD0sqacjhSzoyHmXOc3gpHFKO9t6WqSO+6dCdqqyp07uSe5FpxbUhI5LlO93gz8EL9GrMpO5YwdF2c6JQz7Aln+zIb2Ts+BRTH0sfSPQZLfwkjKUSSfwcC9euEj6BJPLfbooxctb7YPI1Asa26IUekbM1CMU+vhzC5zJJ8+yadTwMcrgtLTWWq0bc+jbdV/BkpYfmO28jCo 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)(23010399003)(366016)(376014)(52116014)(10070799003)(1800799024)(18002099003)(22082099003)(56012099006)(261026121527099003)(261026140227099003)(10067099003)(261021121427099003)(261022075727099003)(261009223027099003)(261022105027099003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cEkwcFdWK2ordlQyVDBBd0R2Mnp4MFBWVXZOK1hGaEt2eTNMeXBZS29TS1Za?= =?utf-8?B?aTRuemhaQUprcmliYWhhYlVKWnZBUm0yWU9UWFlkZUlDclBTL2M1bjN0SWJh?= =?utf-8?B?YWpkZ3h6NGN6QklaVWxiZmpheXNzVVdockpzSldocXIvTDM0d3hRc20rTkhC?= =?utf-8?B?N1BwbFp6bHVmZGFabFdoTklIZ2dTMFN1QXZWTTZUbHIrSlo3M21qbWFQVXhD?= =?utf-8?B?eHVkQ1FURnV4L2d1amVuWWlEZDRRalJubGJOUy9ETit0bkxVMW1RbTVTdmZZ?= =?utf-8?B?alRYV0hINDM5ckt6REZDWUpXN242OU1kWTRNdTlQdVVIQmtlMmt4ZEVnQ3Vy?= =?utf-8?B?eTlxRWh1R1BSYXFxNGxiemhGZGVuOXZJTjR3UEZVZU9hcVlEeHYvc2pvOWx1?= =?utf-8?B?cUNmVkh3dURCS0ZBYWlWd2hMa0RpVFlUQVFGaTVoblRENk8vU2oxRmpndkdl?= =?utf-8?B?L2pHQWUwTEI2UFg1ZEZJazhudWg0cmlodGhMSy96Z0pLbW5sbi9ZQ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WRUg5MXpaU2VKQ0FUL2RkUUZSbDQ1cFlDNmdZNDRQ?= =?utf-8?Q?SThPZjvu1OhYkemBKOlufx4OPg3WXrH3r9AQ4lmB/czVb?= X-MS-Exchange-AntiSpam-MessageData-1: n+19gjZsVEWM6NrXc+l5aJ5hCGkYPgZ1LnQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97c35018-34a6-4fb3-dc4a-08df34dbd4f4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR08MB11804.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2026 10:11:28.5734 (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: JaKBohlgybkmdQrIKkh7WLlD2gIKVRV0Se3ElqnNST+GVVYoo44MQcjABacUEx3LzYS2XV754F4xYZTih2BO6kENhpGb862drHLNbxlVeNs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8802 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v7 8/8] 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 7b6441fad08f9..fb947200a0cdd 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, * or for an empty or out of range request, which needs no page. @@ -275,6 +359,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; @@ -317,6 +403,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) { @@ -339,8 +505,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: @@ -722,6 +896,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