From patchwork Mon Jan 6 12:41:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13927368 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0FC41D88AC for ; Mon, 6 Jan 2025 12:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167311; cv=fail; b=RFyREN/idH0medG6ZnQuYvMXrbk2JomMmCU5LMbGt2/Wl6qr07737+sRDSURrGp8iL0MHMkkhdLLLnYb1FFC2cSVLepwWdOweq5QdlACxl/aXnVRMySRe4mX93MllSsgcptjGAeH9fDt3b5KEL9TaHSghCTSJJLt9htXKf6wjVQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167311; c=relaxed/simple; bh=kpm+0yaneby7Pkvj8vISBjN6zDTcCMmEKKQW0LjMunU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=I/nXfVzERWHJAS5Hra/deZDri+lDJJSy0eVAyJ44XEePD+6Fd05gACSaJnzofGY5oM8QinOerqCn08G7a8NPJ+A7m2NgrCuhNUgw6/YmFPUsfJzI/BNXOqFfHIBYvKnICF6kMqnyYVgCXOAeaBdcKQTVkdR9BepQJgNB/3azANA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=nhKmGCnO; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=QaipT5RI; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="nhKmGCnO"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="QaipT5RI" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5068u0kq014773; Mon, 6 Jan 2025 12:41:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=n96Tr9jpEclkwh1xhflTCQcfa6XoDMbR0CkzKsum5c4=; b= nhKmGCnOgCm/4AH5CbCWYdi99X0G4oLGOdMcAOsGr+KfpJJreW76AjTki853dMQM 33XyJm9fZGR5xaaNhqMj3ddH22zr0Ji6aDcY/tTfFyeEeCqwhB567LD99NefCKpM BONIzTTJBpeMRdP2BMgdee4Z7euxx0hKWCpabUjcDhYBsx47ESvyKwEa3eZ5k8zT 9Q7yYnjU+luYlbq1fyl33DFDBc66qua2rch6n/E0GcA7iAanJ/6KlEG4LudjIYW3 PIkNNM+gEvBk7a/axKdw6FLOmjvrrsU23dAuezLR/OcHrAqCJMVOLSZxHxzKVSRW 8KeE3+oLOtKT5AbTCRWzGw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43xwhsj7au-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:43 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 506C7JbQ022649; Mon, 6 Jan 2025 12:41:42 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43xue77s42-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tfvUGvInLKPRrSoihgVmcq0xvEDKGq9mAkpRwqXQnMhbhYlIARXY26TkV3R3DFqscwlxVHN8vB0yugW6PcUHC83E7rhYrdMVwH+UhyqWudgZm454JUMrlWicM0QQye5HlvzsGjZJrwzNuBjM4ZcZw6Rf92wF2H3hIBIxiLM+u/CeigSAuiKMScaTIQfPT4slyDFb0fklB8i+GB4Scj117uNIzKyum/DJstlEZXm0qBnDmWUgB92KYS6CubJhzt/qJEhjpyZZEORFL4CQ8uyW/HdojOi6UUfCQYswvVhKrfpQkjnaCDnFmLjkunOHbapZLHiCAV+p4xQlf0AU/ZbH0A== 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=n96Tr9jpEclkwh1xhflTCQcfa6XoDMbR0CkzKsum5c4=; b=D2V+CcAKc/q4o7/Zt8y6TjPoJEV51fc7KjtWo8BNvw9oVS+kHdU7/CGHAgAWoW4mFsF4+w57n0lKpqPBWJ5IX7MNqRpr+GSVHS//YJENdYYevslhkmyTEUHUmqFcysLDf4ygd+CnBNbR/PFoyXNlq349WSgpi7Ze0y8jgKOVWo4C4+LBMTepRsMkHTPWf/Eq2MSMh2yBlt+4gGVbcVUGQTI2jtZwINuvlgUDgIP5RSCWurnRrPDJvVKfx1GJhHiA3IHfLqMW9J5YLYurV84WrX40+XDxUY3Vtyu7ok89GtLhE1WxL5a8mJrz+20mZweioaGakhygE0yaAh0MlOJ6hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n96Tr9jpEclkwh1xhflTCQcfa6XoDMbR0CkzKsum5c4=; b=QaipT5RIx/3VXxH21lau36wKWJTnPuQIpo/VYZqTrkCyCK7AFysaG19mJosei28JkUA6QrhL95HsSi3RWSNfcPK7VI8lMGZKZ5+FqMvhzrmckmyvDPXqB/+Nq3GcnAEUm+T94s+6GOeDU+wzR5+XDRv3Xprqk1ktF63RU6jystU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA1PR10MB7662.namprd10.prod.outlook.com (2603:10b6:806:386::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Mon, 6 Jan 2025 12:41:36 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8314.012; Mon, 6 Jan 2025 12:41:35 +0000 From: John Garry To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, hch@lst.de Cc: mpatocka@redhat.com, martin.petersen@oracle.com, linux-block@vger.kernel.org, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, John Garry Subject: [PATCH 1/5] block: Ensure start sector is aligned for stacking atomic writes Date: Mon, 6 Jan 2025 12:41:15 +0000 Message-Id: <20250106124119.1318428-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20250106124119.1318428-1-john.g.garry@oracle.com> References: <20250106124119.1318428-1-john.g.garry@oracle.com> X-ClientProxiedBy: BN9P223CA0007.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::12) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA1PR10MB7662:EE_ X-MS-Office365-Filtering-Correlation-Id: a0df74a9-1ba8-4a37-c3cf-08dd2e4f7506 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: yiN400dj515WNVHJEukZRlXnqCU9JWD3e0dmlJeULNCY1cOSEQU4PeXDPUMZNQ491lTlww4QXsrPNQq5RXBIevEiWQRxFQAFlmNd8aY8gKDhsUQOb1T9el1wJW+KAV3t45SKgP1pr8Gmb7F+k7Ztf9GUOLn79XKm8fvB8e1r6bp9qUMnI4STjJNv9dncskKOBn05bTuQZ6SFvcUYnCoIyGQ4ItP1z1oIxdMkRd3cFCWqBRwpfLz8CMu24xLBfuwhXbCdDQ9NlQK1Lb5j+gRrEgQd33hQrljyjx3CTpwk2dTnGxbMcwnvbpfGd51mU6FM9QN9lP421PxUeWJkTxMVVmyUIqj5NCCEvgI57NIcC0WOFn56yNCiE3hjCGCjpzjyB3BAobC/g8oG460HtK3o7UdnLGV8qqzxHAbYNQmU7HZWsZsJK3RU+i+75j3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040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JAadAYX6ZzrT47w1ZFhSMEC6UupD/HVreHTmGZnQaaIrVi44p8O3O6HNJQ8X3GVkrGAgrwDX95ip6GzfKBcVqajo5myuB4r0tctDPC3rmptDJmukbbtrSMB0U8qLSqs+Uqo3j4Ciud5dJ8PXZXlmygOhcB5Wo233khzlS3P2O02JfvJP5bT5aqIPOa4qdLeKMSay64c5K0qQRDHvei9vCeYypeCVNAWzc4lj0IWYioCazih4hzczIiOECFlUY7QXA+KfahNf7CNcwKLJ5ZZf4uuWiajNc8bIY8o7EEG5Ayxmk2WrSsSX9YijG8Krq6j9PWg32ZFg4FCg0ESJuwpxRFn6ElGFzIs92KaB1xmM5LvpJcicMGBLLyvibTR4W2kGFHFZmyWKXPdGJrRg7hDx913qTTd5xejQIcaSYD+Tjv8eHhxIiXNfEHBakdR7OFdkl6MjnijU1VFkOwVOlXA+ic/AUkld7NkgSCU0T55DXM/R6LZJzGtEqUx4xdXDu/acpRVVsyZd7i9ZG5y/1XOR0L662OJe0QOTUZdSn3xQ619g4EL+Q+XGfwu9UDacahkDmLfLRB8uWgomjAD7ysvE4mhSk106xZDKrkGaY9xcIzcJUngSO8Bp6USCRBrdox77PejAKcxmoOVIUekyW395225AkGUd2SZx4Vy1Q+s7Ku/2JIZPzWoXhBm6gKjlbSuWPue+DPPKviAgMb4qKoSnlqYq0lbv1woeT5JsdpIKyTDV9piWHSZGoDGIgjaRy53yN7tt+RV19V4szTL027ikh6InuB5sBJw3u2PxCudYk6q6x39TXF6EOiwib1clEO4dWpeiSU3HBcrpcfdP6Ex/qnL137oSPR8w5JJNqJ6YeffQ3kG6iFb0OEuLFbkW4gHwqGWeJPOL7jDpmWmYbIvWoPwCYTPOHrv8EErHQ9QlbuW2+yXxl6pgGA/DzapO4ZUKjktmiQwv1ZUMoOzd7aVvpnqjvWwZfgJ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L0RdAOjkFffR8ocnUicXG/jnvLTazv2sHyLPZDnuuvJjlSd/6TfM7xgw/bUSUflmeyTdaD6dZqF4zMcl1RKNNcJ9fCkqj3NuCIpjNaB3VbJG1HME5XdG1NDEMxUXY4nYKFJXBaBrDiMB5t92ZvuCI4/8pqA6shxL4rTI86Nm8XVZugX0TsiOq5mW8JN+ONnx3lIs9w+YGjlPoULNWZRoM8W1wOVZnTe8K1Nqc0RW0zwq8mce5T4kujCkPvmMxU1ADft44= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0df74a9-1ba8-4a37-c3cf-08dd2e4f7506 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 12:41:35.8953 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4Z3zlv78jmDRC0NDFpJ//ah40FAKpmTo2rEuF2qxUo/dUdbtDMMT6oSDWxUFOZK5icHdAAbpzg/FcInsiGMFpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7662 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-02_03,2025-01-06_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501060112 X-Proofpoint-GUID: Je7NmrqyRS2TDeMnpMtUrUwD27Dmm-gB X-Proofpoint-ORIG-GUID: Je7NmrqyRS2TDeMnpMtUrUwD27Dmm-gB For stacking atomic writes, ensure that the start sector is aligned with the device atomic write unit min and any boundary. Otherwise, we may permit misaligned atomic writes. Rework bdev_can_atomic_write() into a common helper to resuse the alignment check. There also use atomic_write_hw_unit_min, which is more proper (than atomic_write_unit_min). Fixes: d7f36dc446e89 ("block: Support atomic writes limits for stacked devices") Signed-off-by: John Garry Reviewed-by: Christoph Hellwig --- block/blk-settings.c | 7 +++++-- include/linux/blkdev.h | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index 8f09e33f41f6..a8dd5c097b8a 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -584,7 +584,7 @@ static bool blk_stack_atomic_writes_head(struct queue_limits *t, } static void blk_stack_atomic_writes_limits(struct queue_limits *t, - struct queue_limits *b) + struct queue_limits *b, sector_t start) { if (!(t->features & BLK_FEAT_ATOMIC_WRITES_STACKED)) goto unsupported; @@ -592,6 +592,9 @@ static void blk_stack_atomic_writes_limits(struct queue_limits *t, if (!b->atomic_write_unit_min) goto unsupported; + if (!blk_atomic_write_start_sect_aligned(start, b)) + goto unsupported; + /* * If atomic_write_hw_max is set, we have already stacked 1x bottom * device, so check for compliance. @@ -774,7 +777,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->zone_write_granularity = 0; t->max_zone_append_sectors = 0; } - blk_stack_atomic_writes_limits(t, b); + blk_stack_atomic_writes_limits(t, b, start); return ret; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 378d3a1a22fc..b9776d469781 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1699,6 +1699,15 @@ struct io_comp_batch { void (*complete)(struct io_comp_batch *); }; +static inline bool blk_atomic_write_start_sect_aligned(sector_t sector, + struct queue_limits *limits) +{ + unsigned int alignment = max(limits->atomic_write_hw_unit_min, + limits->atomic_write_hw_boundary); + + return IS_ALIGNED(sector, alignment >> SECTOR_SHIFT); +} + static inline bool bdev_can_atomic_write(struct block_device *bdev) { struct request_queue *bd_queue = bdev->bd_queue; @@ -1707,15 +1716,9 @@ static inline bool bdev_can_atomic_write(struct block_device *bdev) if (!limits->atomic_write_unit_min) return false; - if (bdev_is_partition(bdev)) { - sector_t bd_start_sect = bdev->bd_start_sect; - unsigned int alignment = - max(limits->atomic_write_unit_min, - limits->atomic_write_hw_boundary); - - if (!IS_ALIGNED(bd_start_sect, alignment >> SECTOR_SHIFT)) - return false; - } + if (bdev_is_partition(bdev)) + return blk_atomic_write_start_sect_aligned(bdev->bd_start_sect, + limits); return true; } From patchwork Mon Jan 6 12:41:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13927372 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02BEB1DD871 for ; Mon, 6 Jan 2025 12:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167314; cv=fail; b=ouo6qnqMGKoYtBuVmS+OTLD3tdd74JTe7MEztU2OVQIWyIwc14KxreWxVMh8vZbOdWc9ga+WeGzgwdWw0gVFFW/y3Q3q45otAOu83DXM+5gn73hUo+OIinuW6V72N1u+T04uU4kKcb7vO15fi4gmA1RWq8FPgV3v9q8n4GcAI+U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167314; c=relaxed/simple; bh=mjTBV0NvoYASbDzEOfAgJ9USzJJSlHYH4IzKVILrZ3k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=IiwNuXML5RhdMPsaPSgX0h7HkRDdGh0hHXy1JYNzJVIZIEDdDSC776npIxlV1Zyug9WQ8F6frPZE4wwWAA7Q8MP4ukAgKol2qweqDQoXaZjAv1DNxVs/5/OiN/SGq7f+IaVIXIDPXU35XDczxCxhAPmpEeQEC/69LLWUnfxK3XE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=jKTYQPHD; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=WALSxV9l; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="jKTYQPHD"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="WALSxV9l" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5068tnm4019244; Mon, 6 Jan 2025 12:41:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=5dzqNWVwztqjK5VjNo1kKu3j8emTw6TD8G0pkZ+lPEc=; b= jKTYQPHDLLfQgR5Ib5DNNzmcGww5TUXdsmqdsfM7/uXVW65czQiEGJbkFByV7o4K WpW8vB8nU7WIXKB4BpNxWKadww6ZDJJENhhWW3o5ujEd4jewySIqwBh1H1Iu5/lI Qq+mFL9zsZ2Hm1eX9fRDq2bIOHQHp/hDKNHcS9GLOGTjA/UN6tyvJoaOduaqZRjY xcNrdsAXFmqBv9Zj3YTXoV8wNlQYLDGKwF7vk6Mb3Zu42HfuLJY6DpuNhpXNFJrT Tv/P+B+nVMN85rAAu7oPZIKbOx+8ppUaMymJVlcJn5qW3AZ32Dsbx85MVkMT6EpY IdY7UARV3SopQvwovAxHOQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43xw1bt89f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:46 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 506CRHYC022790; Mon, 6 Jan 2025 12:41:45 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43xue77s52-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XKGpH+7KxkOIxD/fZQzDKTvTzMA+u60tkewEA03GLENEg+2fRtmQzflvlyHFgrLz4HddUoEMKK2Sr1Duh42BjTuyJIaT0USkCfItaqTcbA8OjXXSIj57/eNSHHvu7TVl6lXMbGKgAyX7Grd4kvF1JiR2EUm7t3aOdGAVzvZ16nBq0UMD3aPHHzXcKO87L1/63UDbNNVvN/0JVdzWMZmoL6nt7J1FqOweVBS2Ms86HHa2Li77peFOBX4FtvzyNPVJvjCN6l00UNYAWlOVVn7yKaeVfA9NoLsFFTDbsJWpSKP0MMWvmTTjWEgJu6aZmKNjj/tQj66s6XqABSh76FTlbw== 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=5dzqNWVwztqjK5VjNo1kKu3j8emTw6TD8G0pkZ+lPEc=; b=O1qq7MgoH2ZBLUu8iCnuhPeoTnLfZt+/tAmmpLp9YOdkrwDWu5NJKbjQhEae9qaS5sdBEH6ERlAAQcGiuJO46BA39rjv83/VyZrDqJE4r9YMZ9D2pIWC50Uk3hfbXCWSUktLV6PPzQR7Zk6L8yyLhCDMuVJ+LAQHl4G6PS55Q4Qm7LVhMoumf+pVXG90VwswDSh0Spzxmx3efEmngy2DvcI4D1MFCwcEd1azVjcGo3SrTMCw+cgq2QQGJX1WhU+zPbiB1JtuPneApYvmZZkk4UzCbip22Tyl3Jqy61pUDCjRwRtAElvnh3HfNwNf6/gW2iqY8cSeAve8as9WLpmZFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5dzqNWVwztqjK5VjNo1kKu3j8emTw6TD8G0pkZ+lPEc=; b=WALSxV9lNbbY5luP3Q7VhtWYB6YD0657WhZ80IdWtXPHmMWZP3CWCImuraDEryqn1Ya6tAx8QTWtx6Lq5hKQYwxpgYrkM7KljgdX0l4ByHDMtT2Yb5Kvw8jyfxOshsBmiJoUjT3FkpePRREMsemijDb8hHzfMUkHOuPw1ul0u6U= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA1PR10MB7662.namprd10.prod.outlook.com (2603:10b6:806:386::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Mon, 6 Jan 2025 12:41:37 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8314.012; Mon, 6 Jan 2025 12:41:37 +0000 From: John Garry To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, hch@lst.de Cc: mpatocka@redhat.com, martin.petersen@oracle.com, linux-block@vger.kernel.org, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, John Garry Subject: [PATCH RFC 2/5] block: Change blk_stack_atomic_writes_limits() unit_min check Date: Mon, 6 Jan 2025 12:41:16 +0000 Message-Id: <20250106124119.1318428-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20250106124119.1318428-1-john.g.garry@oracle.com> References: <20250106124119.1318428-1-john.g.garry@oracle.com> X-ClientProxiedBy: BN9PR03CA0537.namprd03.prod.outlook.com (2603:10b6:408:131::32) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA1PR10MB7662:EE_ X-MS-Office365-Filtering-Correlation-Id: bb78f2c8-aada-417f-e2ad-08dd2e4f75de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: OLiNNg8xivXjR6Ho32+yF1nGlUWzwTBir8Kxm3oNkftUZl7lO9VY5FZ+bNyE5FfQBA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iXpwtg/L3eWEUXJpCtcCBl1S1jYvl+NLB0B5sBAfkIs1OQuCXZ7XKIgjdxgzBqd35Uddm+Iz9MZ6CkortLI5vxGGLEjyYQtFAtM75yJnBV4ozBOFU1mhOSq/SeM0HUB5W1/DDPtAvubNHu0Pms2kEmbV7MUe0iL+1fnHikhqircyw5HvYiDWskRvfyQuE+Al4BkWS69C98micwoyfOlifDzNy1wlvxdjJ4aZZ/y68g/DScsnXImX8zl8KK812wpNN2tY9tWSZQKD8dmW0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yjhsvaJpdEK+H89vmMDLI8JcPkdUoakz0CT7iCIMaVpAIH2hy6w0QQe7rxM8gcA82TtCzRGWLULOVJPZ99TxAgnYqbvFyxnajvom7wymj4Z8hCG4M3IH70KDVxD1rbSUnHWs01R4tBwYOd6F/4d6U8nvfSMbRbaQc4BcTwSAabMmg8xFR6KwvsmrjCF7wBAkyE0QWWf9AsKEjO7qIolP5aJ3sYUMpMMTQbA2sZdG2uQ3mymjY1Y36TrfK7bant824wNbpfuS/KTFeQtqpKm7tc4mdTMlVwsm/ZPccWGzFFWRfJl03S3JQETWK0OEUsn3zWMlZ/F82sSrisapTY/SEiSV/ynaazk06cO5qzS/W0dAbEGWafN8qT+sa6Ymeo1cxspJ5HyDfd5egdh1J8AXeuAnork0VZFQkYAccAZ2RttsAKZD8wTHladaLteekOcrBMPzkRm7/sPA0v/9azdStYTDQjh/mDMqKa1MgsXG2a6RmNin1BVrpIeXyOKSS3Icy3ESI1TSZfznlQnhPlPkouqyvZFmp4abO/uFkf8ji3KwoH2T917Xa/7HxtH0JK2D0BjMqSxEwV5TSzxA1eD4U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X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VdYyyb/SDGfcN/kaYMR+b8dgYYGE4QmDG5kyF8JZvwjVY/LBOfPz52hfJOHNpiYZnrzQ7/OFTt5JKSHo8z16S0jjS4GkH98uKuvXNytenNrk6JLxs+EBtqEN/QNmvFEVK06wB6r1yM6gogA/dhzWC/A6uxvi8isY9pcmSqFZhGT6Xv8LaToyX7dhszU4XvAktFuyCZeJU/1/UVUO0hxhdcEzvBtHCkHLcKbY+ttoCZ95MS6C+GQInejilAtlEhTysP+rkmmlf7ORnGk2RdKTovEBWI9yRMtSLnNTCdicsrfRShcjYp5CmnGuy+81ZVk8g1SXJ/i2Iodf55GKdzG2OK9R1Y8uQ7ADlddRmYOfc68LLCwoDeB2xl+kuP3rRLVtTHkaTt+4nDYylFU2EtEbqTWixVy+G62+A19nr2WwbCsdcVGoGlBlmgd9k2zeeW4X9KFYe46keoahfdc6WHHwoQHWoKLo20d0omm4bs5OPVSXv5ca0VSpfBjYPb1aceum3SO7/Fdm5MSRq0rKYveDrt3iwiSXHAfBUw/HUAHsvi+w6PVo1gVhISdOcjvro0cOyOezM10W3Wxzf/bYZ/Ej6fYhgpDN6fB30HPcGvLtnbw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb78f2c8-aada-417f-e2ad-08dd2e4f75de X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 12:41:37.2765 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v1jz3eYH/A/dlJldRA4u4u9DdZwI3imncBrowHcgg08GQDPmONq8cfp3MwMAw+3EgIv7m3V/+lpakTZ3+w4ogQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7662 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-02_03,2025-01-06_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501060112 X-Proofpoint-ORIG-GUID: ZDEDZ7pKQcUeA9TfBX1sYBBq6Exsn_1d X-Proofpoint-GUID: ZDEDZ7pKQcUeA9TfBX1sYBBq6Exsn_1d The current check in blk_stack_atomic_writes_limits() for a bottom device supporting atomic writes is to verify that limit atomic_write_unit_min is non-zero. This would cause a problem for device mapper queue limits calculation. This is because it uses a temporary queue_limits structure to stack the limits, before finally commiting the limits update. The value of atomic_write_unit_min for the temporary queue_limits structure is never evaluated and so cannot be used, so use limit atomic_write_hw_unit_min. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig --- block/blk-settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-settings.c b/block/blk-settings.c index a8dd5c097b8a..d4fccd09e237 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -589,7 +589,7 @@ static void blk_stack_atomic_writes_limits(struct queue_limits *t, if (!(t->features & BLK_FEAT_ATOMIC_WRITES_STACKED)) goto unsupported; - if (!b->atomic_write_unit_min) + if (!b->atomic_write_hw_unit_min) goto unsupported; if (!blk_atomic_write_start_sect_aligned(start, b)) From patchwork Mon Jan 6 12:41:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13927369 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C00261DD520 for ; Mon, 6 Jan 2025 12:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167312; cv=fail; b=cZPkiZTIJ+/YUDeKV7PbLFLpH6BGGxtvBdSueoQxDOGlJedhHIl1X4SbedOkVEYPjAjG3+SrA5fUok1kPNyrf8MLms10JQ39fUCSEmFaB9ygL3G1gw1O4wPQshv9jLkoSIcN9XrtYcUUrw9qK+IAugg4LcLEETCH7MbJlBtaNBM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167312; c=relaxed/simple; bh=Jo4Uy+G5aNWhOE2ig8YZcDzEWNXOXl5ktbxFvOF5vZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ejQCkIgjAO3RxEwLxZI9xahbYkkf0uxC+yd5fWGE0culUWFLkJK5RP3oR27vQbGIVgeKEeMBe2zYfA4wk1vTm4OuFyJ9XUFMz3s+Deo+wO9IrxAyJhps6vsF+DRNlY2TCAGcBPVsiEqNB3zkJQpxuEIVEGEDFZ95cfbgT+gnjJw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=lfrfuZ5y; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Y23zLuPC; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lfrfuZ5y"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Y23zLuPC" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5068tu8b011383; Mon, 6 Jan 2025 12:41:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=aadR7L0RRcg0fufZn+7824fps32TTXxFkguhgexSiQs=; b= lfrfuZ5yT2qof4GfDXTHJtp1+4q9wySdsbqCTVvkIOPAcmqbjTut0JJCY8mc2b/P aTY6Hzr3FbQZmstZfbISKfs0gRRh8sfNbChlFuSJqBKlkBCz4MTF8WJgu+JEeuWq Rkj6cSKUqCGCXa++UWOp+2JYxvEqU7hnwDb8JrANS2wzzuD77qsOr7jG9eGt8Vhx jl/cazp5LJeFFbZB7M+rAHvKIz20B2kMjJbPlID2LWHFbRTdmVMJiO+ZgfbVl+3l kPouj8GAFCpVOJuK9hRTrmgWfLyEuGD5ssEe4pNaZmvJ4md5Ib3M9u1w0w1mcKnd 1SBz4+vB7TNYfJznn7LRtQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43xudc2nma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:46 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 506CRHYD022790; Mon, 6 Jan 2025 12:41:45 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43xue77s52-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n4QhAhnRTPDL984OM+9xc/XYQf2y8y4N2Sj43vD1yTwovos+fNm6n+MYqYbBniMbXmK4vbpodap4vDGDmS3TMakRklHgfWvlifGkSt3O93sfW+xaQ3p2Z3FFEjGUamiHnvyJ88Njb1riMCLH/Os698c3Hg3d3ya4f8UhSew9dCxq3vP1d04j8VRNYqBlAM5E5CNdygNNr50fni6K4CB9VA/IaiI/wj7dwYQh4iBVNCI0hxgPUgmv9CRD9WDUy5RenANttMHi19QLZ20SrblXiTzPhDgabHY0zEjtMb4YmFQJa56is3FUmAopc4G3XPzYX4EtQP7eO8agZLU5NmU36A== 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=aadR7L0RRcg0fufZn+7824fps32TTXxFkguhgexSiQs=; b=yPDlEMHNY0G3IrqpwcjFsiGzK+qbv482koDPAXcZtSw1W6ZhyKFMrRXIskwDpYPaRnEfilC0XrIHRJKyP+A5KpYKNz/Znl6VhRTZYLYbHKK21kKA0kmw3VEk4bPsSvqjTwQKxwBhwkiJzKcnFrPgZ/DkbrX1r3W7Bvv7WCEwlXXVUMXLjf7hYBg+fJ9qmxb1IYnhVvX5iDPhP3DO7azeR/zgicVvsMn+73w+wo+QAd0UyrXdWqXK8ALNJf0hv469KC/uaVtvRBMO0NqIJ6QDYRHNjJ0heHjLO3ZBBa0HYxBLfxunE+2TmrPaXYqpEfxI8x7ZiBz5ZpEidXTRUJAOhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aadR7L0RRcg0fufZn+7824fps32TTXxFkguhgexSiQs=; b=Y23zLuPCLNmPYS/7YD800R8Hk1MG7N3YC10XoXvv5EIaqZOF2UxGK+Mdp4BoMVr34Tijt+vtKNXFwH8KRvVMOr9XR7WkVQy4zITViUp3XWXeib7XM8Sk9dPZGLLOBZbQ6YmPgC4RIMUn1ti1dBtclbTO2cqX3GeKI+AxSm3NjPQ= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA1PR10MB7662.namprd10.prod.outlook.com (2603:10b6:806:386::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Mon, 6 Jan 2025 12:41:39 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8314.012; Mon, 6 Jan 2025 12:41:38 +0000 From: John Garry To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, hch@lst.de Cc: mpatocka@redhat.com, martin.petersen@oracle.com, linux-block@vger.kernel.org, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, John Garry Subject: [PATCH RFC 3/5] dm-table: Atomic writes support Date: Mon, 6 Jan 2025 12:41:17 +0000 Message-Id: <20250106124119.1318428-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20250106124119.1318428-1-john.g.garry@oracle.com> References: <20250106124119.1318428-1-john.g.garry@oracle.com> X-ClientProxiedBy: BN9P223CA0028.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::33) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA1PR10MB7662:EE_ X-MS-Office365-Filtering-Correlation-Id: 28781f0b-f035-4f2d-de75-08dd2e4f7699 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: Ycv88d3xjkRI35YRtTUGYMwUu8A15JakzhOZC9K6AOOb29160KXATiAyZwJ/ZWeAKuUkEhbMxuK7fCZWuuMrABywYmEU7fRaKzk8hvVKlhshE8JGzJiO6Q/iNL6o1dlIKjg7OhWeaHlZaj7PPn3WKEh/cA7Tje8lvoMEgKijGHbF5eQONkmn7t1QvQwMvq/Cetrk272RQU+355SzJGq30+GkT1xcmTbU0hXZnMNTSnPHAFV1gxEtIa8MxzfpYCWcx0e31sHcIkwjr+MVprPio4qiTiIXe0skUtZCkWgfWPEszp7DfyaXJeFf+7GzuVd1kWvO7510M5SFCOk2mjQpAB/2ccKXnr9TWsCmH9MCZpd0nVLfDypHVb0Ju5P9Sn+h9wY52psqRRdQP8UR1fROdrr+ZW6ywbJ3v4fiPuUZCqfmSf3bYgxq0GNcqoG8KaCdtFjdP9AIDweqiuaEAEg1uDZBwmJALZXWmmbUpsl1zaRq7PI1fsR/7lc4dGnsgwfEfRpPE+Ys4mhd85JIo3jhHFj5PArKflKU//Vct/jEBEOccqYm/HKVa0UOIUhW4D1F6v0XL79xb6d2cBDkw0tNTijySkP4tCSdUC6m7VkitP/HwBeOKdKy4zl9hEs5jVD95eU79dymdIz+PA5iiNlOm7WPFDmlg35h8zkd/0CazyEUZ+814aOnLmbgdHj/0sCYzcQ0nBFSvjPSe+L4pb7NdC3bROkxSabIU63XURpIjXHLhfn8Ybong44FoiRqV9K/8oz0OQS0ERQ4uyC2p/SqrKhLo1OQVIWIdrvTZq62Zyb+G1Hbe69HkGUFJJDcM2JUHHIn9ogsqWRM3XC9OvAeFFGnXRZQ1h+ZKr8QbE2KDatfhL5EdzaVpK/fJv2wO2uJCtxKnRV21QKXp4Pt0pmW1b+FRWHot8EW4mR5ChDnznpdWqepZsKaF7weLM/jkX5U7spGbADBDapF6M+2AAd+nI8cumCizQ7lHtXl+RqXeOyzcbqAqIrF75TzHw8JN2lxxbxQ3qUqd+wne2WDHk9b6y/sK+lzTjb3VuVpJVXSgTwNFKZXcUlWCffPYctBl2g1cneWgGRi2vusW6yj8+kPgKYVX2DSwHJHPwm3DxssAQNmlijQUG2cH4kKS8H19AvSpfrQ6Fve7toz5jMzgIqbHEa5zIm9TWv3dwKShMhjLIyjlTf16dZBLG7+49Q4FZfHFK5tCReRTHmKnErS+MzdfijZRRg4Zzwz8U77wUcCBe3mUtPTBEdEDoVXEtABIFPFquw7dUEWl1vezSHDsdVDQVA9ojXgfhax7YWh9CyS8rw4dOgeAEPvI7yXqM8wOMV16jfCsq7mWPB8jArUu+X7qryHwoIyt6jQrs2T4zdCsqnb/Oj8aNVG8G1VFjmKea4v X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yMIhMKWidE6IuJse0nE6basO0AQhYEEE4GetRkyeDw6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jgRfWyvRieIZcPOua4lA0BcuQJ0VOsxD6N0WzhVE2iOmtoywnrMdEAEwrJKbdTGlUROp097qp0X5ScD5TstFUeFy96c+VcAZUTzQRsPt/mCioYI2YNLMg3lg6/mGN1k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28781f0b-f035-4f2d-de75-08dd2e4f7699 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 12:41:38.4570 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QCa7f83lLDEa9nJzb40PsBNiRD6z2ztUc1dgqi7QcSN6GnOE5uW3qLZZpRULcffi1mIrT/RRdB6T2kDlMM0kfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7662 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-02_03,2025-01-06_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501060112 X-Proofpoint-ORIG-GUID: LLQ_ODkX3ibUA-hVa1U5-4R4psDLlcb7 X-Proofpoint-GUID: LLQ_ODkX3ibUA-hVa1U5-4R4psDLlcb7 Support stacking atomic write limits for DM devices. All the pre-existing code in blk_stack_atomic_writes_limits() already takes care of finding the aggregate limits from the bottom devices. Feature flag DM_TARGET_ATOMIC_WRITES is introduced so that atomic writes can be enabled on personalities selectively. This is to ensure that atomic writes are only enabled when verified to be working properly (for a specific personality). In addition, it just may not make sense to enable atomic writes on some personalities (so this flag also helps there). When testing for bottom device atomic writes support, only the bdev queue limits are tested. There is no need to test the bottom bdev start sector (like which bdev_can_atomic_write() does), as this would already be checked in the dm_calculate_queue_limits() -> .. iterate_devices() -> dm_set_device_limits() -> blk_stack_limits() callchain. Signed-off-by: John Garry --- drivers/md/dm-table.c | 12 ++++++++++++ include/linux/device-mapper.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index bd8b796ae683..1e0b7e364546 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1593,6 +1593,7 @@ int dm_calculate_queue_limits(struct dm_table *t, struct queue_limits ti_limits; unsigned int zone_sectors = 0; bool zoned = false; + bool atomic_writes = true; dm_set_stacking_limits(limits); @@ -1602,8 +1603,12 @@ int dm_calculate_queue_limits(struct dm_table *t, if (!dm_target_passes_integrity(ti->type)) t->integrity_supported = false; + if (!dm_target_supports_atomic_writes(ti->type)) + atomic_writes = false; } + if (atomic_writes) + limits->features |= BLK_FEAT_ATOMIC_WRITES_STACKED; for (unsigned int i = 0; i < t->num_targets; i++) { struct dm_target *ti = dm_table_get_target(t, i); @@ -1616,6 +1621,13 @@ int dm_calculate_queue_limits(struct dm_table *t, goto combine_limits; } + /* + * dm_set_device_limits() -> blk_stack_limits() considers + * ti_limits as 'top', so set BLK_FEAT_ATOMIC_WRITES_STACKED + * here also. + */ + if (atomic_writes) + ti_limits.features |= BLK_FEAT_ATOMIC_WRITES_STACKED; /* * Combine queue limits of all the devices this target uses. */ diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 8321f65897f3..bcc6d7b69470 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -299,6 +299,9 @@ struct target_type { #define dm_target_supports_mixed_zoned_model(type) (false) #endif +#define DM_TARGET_ATOMIC_WRITES 0x00000400 +#define dm_target_supports_atomic_writes(type) ((type)->features & DM_TARGET_ATOMIC_WRITES) + struct dm_target { struct dm_table *table; struct target_type *type; From patchwork Mon Jan 6 12:41:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13927370 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 168C91D88AC for ; Mon, 6 Jan 2025 12:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167313; cv=fail; b=a1Pbh/A4XC9ZqJcoShg2IWVUp8ZIacv3AP6Hd3OswMIgZj3jMOy6X696vAOSLbVTR3U+d3zDrijSkweCCmc/716AozU72St3SX/6a9djkgzhdwp9tcSTNlksJlD+pDiWWpgcTT1ZjBTkh8Hka1h1+EWTbmH0OL/wGOP/KECR3BM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167313; c=relaxed/simple; bh=3tIVXBvYHF2KN6KrooOTm+8Jl+o1P+9DTRtr4f3ltS0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=sYWOp/riklBx2U4C1ee37VeWkNCTdkNNnRS5InqAiib9gWk0UdIX3bU3tEvEKCMLhRDizywMx6sTaj+eKeQmjugWmnOlYsb8fGMqU3OpttP29CTrZ84i6Lnmvi72XD2SH+XqKAclrzqH3HhcSwfuXrSiMFu7OgawoikfvHXnIhE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ITCcvBbs; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Vas0zJEl; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ITCcvBbs"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Vas0zJEl" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5068u4cH011449; Mon, 6 Jan 2025 12:41:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=p+ysVsiT4AHWozSRa28JuSgRYXzYpExZevoIbCMiOZ0=; b= ITCcvBbskkQxLzW+M5td0E1A/yJKpgb4ZiYstYu2pAWG4PnFV+MUPIxuT8eviaB9 h7xCJ2s6SOn0WOPSUQ07xaQicsGhcWbB7WWvaIRoEOjDvjYljJ6uwZ2SgPC8Nr01 ZS8ypTXF6n7FUR2gZsTMDJN/vF0aMh4qWzJhmj+DSvFiQOjIEWC5LMkf5YvRUeR0 RO/TuFaPwF0s9liHeulJLBVpbhkzXJTtnzyGxmU1DGQfhOZ884mCOSCU3M5Md5/H gVvjRWkuY9nVlfunyv9NbWsx3wZV7h0V174BOvHzywbiV3mbH8tb9JH+rC84t/Kw +mll/cr8wnqV0JYh9AXJIg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43xuk02r3y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:48 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 506CDvtg025483; Mon, 6 Jan 2025 12:41:48 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43xue7fqsm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v4q9fqgj2OIa5EnvrO3hJKwsBM2WNfblRSHmfQRRVOzVNbeJEhD0ej5s+LXs48H3HZTuhu1O/+0In9YE507STCAqSM0MndBFTNjDJBqUYD6yZhhf6WRCNc7LZlohCVjrjHJyzq6UPyjwCrqZeF2OjQu66+rkI7HYYAxZcNyRtsaLEL8MQeyIEi3SR9zmF8TFKVBMoz3cFVoqK1y+Os3LqKy5Lt8WzZ2iOTGIdYOsXFb5qY1KDoxJIHDm58D3lcTj5QydgxzPwOeZcNfw0sbijy45ROU1qPxirziRx5fCt17OboCdpQPJ6C4DxjoRn1V6yAmt9nkJW/Ghl0tsMPvACw== 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=p+ysVsiT4AHWozSRa28JuSgRYXzYpExZevoIbCMiOZ0=; b=ae09gy2kbBsXdfBSDd/X0hi9GFuTO9Y3MDXMNesoObZvdiht/Wz3qtvcoIByKY80qGk8em0mZjRQhPWLfLUmjbCOIdNcugMwUfE1mRGz4M1KB4cjo+OBTTZuXawq5pWKmRoTnDGrvMINymO10muG3Kvwm7IodZrGAIOtWHJi5KRJzbzqsJjwiXsJrH0YhwILcM+ygbl+f01Tu1/JHkT6LIGw8nHjJmXbMNxjKFrzESgMvxLHicyaSOkR2Ojc8mpch6Bc9a6yKMMPtRuMlxr+gfXqstLdxaDW86SwDaoSR3Tl92khgyOLGtCvnB82usrNclSbN0ZIs3WiUoWFb8ZuAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p+ysVsiT4AHWozSRa28JuSgRYXzYpExZevoIbCMiOZ0=; b=Vas0zJElFpeO9ESIXYCLMjZ244u2B/xIDb90lK+Qmjqx11m1zUNV2HBfK7haGM1S1irdUU9tfR1QUflHNCr7v8ja8ELJiyeIIlQVObCsjdLaWXms2tYW4vfib3PQeVQo6kkstWE+1pK7DJ+gMlfgudcNYY/eMjC0dolEtUskeWU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA1PR10MB7662.namprd10.prod.outlook.com (2603:10b6:806:386::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Mon, 6 Jan 2025 12:41:40 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8314.012; Mon, 6 Jan 2025 12:41:40 +0000 From: John Garry To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, hch@lst.de Cc: mpatocka@redhat.com, martin.petersen@oracle.com, linux-block@vger.kernel.org, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, John Garry Subject: [PATCH RFC 4/5] dm: Ensure cloned bio is same length for atomic write Date: Mon, 6 Jan 2025 12:41:18 +0000 Message-Id: <20250106124119.1318428-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20250106124119.1318428-1-john.g.garry@oracle.com> References: <20250106124119.1318428-1-john.g.garry@oracle.com> X-ClientProxiedBy: BN9P223CA0012.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::17) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA1PR10MB7662:EE_ X-MS-Office365-Filtering-Correlation-Id: 12ac51ae-b121-4a7b-66de-08dd2e4f773f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: L1JeVL96rC2Ej2SixaoxJo7IWHrpfF2HzCvd489UIgnUcuAHImdebh4ar07VCm/8X3GCCvyY2toqamVwR4LsM3ICqyQ7E+f9gpKc+Eu9tCBXVkpWYM0mQ4mxy2zLx4Qb5GX8HXolkZtug/JUQPOYD4lQzYocpEjrXp6ajmseiP/YO1BSykzqFJ8cG7JJolSFJAQHH8E/OrHjcREwnLQHinBTrQS7u00vAc0Ri1WIAn/BZzN0Itaz5ECBQysMT1raOig3eUwL/Y7jcADyWTdrI3bc1sy6Us5NhZi6eNx+j2hvlaePj6QfsEz3BRNL53SUEImwddLgBhCB0RKz/OU2czf6NW8YW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forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TCS93JIxCwVFpjLtB6TXIbK7DZMLY+1T3Cofj30sGh2rtLqvp3TnbN4M3J5nKwqeDGkHda6vmi/cUV4RAqCovhVMRyQ5kEks4rdPOZB0VGhdMkRp8BrivWmrHggf0qxbKUUxAQsCHTq67MbePjeeKF8I9Lo/OJJQ4d8LqtywLkO1SrnxuRTGYnTV8GimC/3CHcmOGILVJyY1axxCsKp40Hh2AxhG3dArIKVX8Gkg314gNc1enWbDQOcnu57aVzBddZuavvN+UCft13CXhZdzCa6pPm/Oid4illyTi9DiYYWuPHowDMikd67vpuvtFP8TB0oR/50qB6pIdrETu1AUl4OmRkwtJAh4Xx88J4iiLuM1Y/35H1YeADTAw7oZGsaR12mr5Ms2I8ABtKmTu4lvzwPgF4kHD07XvmfXy4GSK3gzE1YLhp+8rfip4AT2fHbTUZ+p5v2bn014VC2VGDQVxQrcuVMFVSPYj2cgwEi8y/iwmReeNWyaiCF0q4o8yn4mbysWnCzmCImTNfsId5kigz8IKZEiG5DNbm8elJTSxjEpAN1l0T8wOfHX3pJ9zIbWim7k5RwNk+g0WSkeLFbAU4kKk3gO7BJBgk9p64fXT6JHtWrIi1IdlHiUbrlYjn+DW/73OpgSPGH6NF2UphTFiPXJYukt992qk3rbG65RNe9Dyyg5wwQ9at1le/yFQuqWdCaeA9jlOkOH0Qud51Ri9X+GmLtVryppQ+NPeeVM9RNXnb0VWU4XYgUQvO0mhjsCQ4MNG4bFZqyoRmBz4LPeBZ9KzEszU2NovT9olVKoDiJAH45uMNjNok9pyT4MTRZbCD9P74DLvq0KE0aUXb+X4R1VjKV56ZbOKUcoCFcitS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0gv8Y1C6Hwm9/WZ7GJC1IZiIWV32sqMQpX9ZWFS/HFI/sKbtX9evvigXY2NKoy1iKtCPiMNZQQ8gmKoJtuePzGf5zTecVNB9DPX9L9qPseAwibYarrVTMNESJ6SWYeofAh+CEPuH5493hdMIL0rEvxN8Op0Z5fFLvitT4+QEXMLD69aQVTjVB5J9WOAnI+6W9eXsqZ/RLOfXJgxtkNTLRSVBxGu7XhsPQj7Q340Vo2LkijpQEP2L/RmlezaTqZAMR0kQAlPr0i8mHm9QP0zOaFMX9BG7BuvIFQFrO4EcA7HQCIIh4phd4w/sUgvktDTWMiN+X7sUsXYhcYVatN3hbDToLubq/3xHON2xCuR+CwyZHNmaamk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12ac51ae-b121-4a7b-66de-08dd2e4f773f X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 12:41:39.5867 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5j2h5GOZNVFu6cspR+3DK032b7mvr7j/mHWDF9NNsyHvZDLKo7+g9SpRRXTW/kR/MDacMsEBclqMbYOuk8zyGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7662 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-02_03,2025-01-06_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501060112 X-Proofpoint-ORIG-GUID: oyQAk59Et2XL2w7yL6s1VR3p3uvgZ-L5 X-Proofpoint-GUID: oyQAk59Et2XL2w7yL6s1VR3p3uvgZ-L5 For an atomic writes, a cloned bio must be same length as the original bio, i.e. no splitting. Error in case it is not. Per-dm device queue limits should be setup to ensure that this does not happen, but error this case as an insurance policy. Signed-off-by: John Garry --- drivers/md/dm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 12ecf07a3841..e26c73fb365a 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1746,6 +1746,9 @@ static blk_status_t __split_and_process_bio(struct clone_info *ci) ci->submit_as_polled = !!(ci->bio->bi_opf & REQ_POLLED); len = min_t(sector_t, max_io_len(ti, ci->sector), ci->sector_count); + if (ci->bio->bi_opf & REQ_ATOMIC && len != ci->sector_count) + return BLK_STS_IOERR; + setup_split_accounting(ci, len); if (unlikely(ci->bio->bi_opf & REQ_NOWAIT)) { From patchwork Mon Jan 6 12:41:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13927371 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 328411DDA2E for ; Mon, 6 Jan 2025 12:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167313; cv=fail; b=erquc/Hf8XYJuhXICSrag1b7rWrDBWpaei+NnjaHRgB9pypk7CK/0eR4eBOGugLP3xXpAP7EawmhvyD7YAJALENsqL0pFdF4kq8mfj7Ki0ldS/6jEV52zzLeEQenhFP/z5G3MT1k+LNpYTmQ/U3Y4sFhXE1OoYTeiIqx3wcEyD8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736167313; c=relaxed/simple; bh=F+RP7B5Bw991OHHY+NwYg1gQU/8Z6WhhMC/WV0c1dmw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=AgGr94FkSjaN3MqofcWnagRv0InkVHRNY53Dkfr+cq8gZehtwNonwc/OGcazt8hXRqRcrWyqS6Ffv093Wqe2QKdP1MOqwwGvOFwF7a9ButJ0UMrgMIBt4tRfCQVMgY4/0tyyVjx00rB8ndM9UEEaC/odJGkpz7D+cYbpNHeS8mM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=cI9k3LS1; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=VfD4V+7l; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="cI9k3LS1"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="VfD4V+7l" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5068tnm6019244; Mon, 6 Jan 2025 12:41:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=9RvRaCj1qXoc71O+4ar8RblUY1mnlIDr1xYBjAFSGms=; b= cI9k3LS1MeMP1qaAgw5okmQsyu5zk2pHFUbBT4VytYp8BTXiuu31obRSbXtwdAxv 56LVfrfXlGBa9CjY8eqLDYNn4CEuESWSv++Y7m5eKQTTTvPov5uBDo1XeDURS7SI jyMOmsIJV3OVeizTD5yDSPFJ+l+ZIfixNYFIfTPdCto2nNgcok8NqYAdPAnYSTfr RwGK/ceaA8/myuf6PbJ4GpDwBRra17/1K7HubB3Gm6mf1IBT3uVtGtTv+sTq0dkJ reTiGgnBYaJfTAERsLyk2pFXJhMpDwgEsK8iYqUAOdId0CADeOL8EFJ0kSHMJdOI XsTBYBXx1SEEeLjatpxzRA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 43xw1bt89h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:48 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 506CDvtf025483; Mon, 6 Jan 2025 12:41:47 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 43xue7fqsm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2025 12:41:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ufZC+hUoG39sX5t1/bWPPDUsqgAXaelohQq1nuw/UD01LFzXjZdGEhEEOlJGbau7uoYxkfM4n34ZoSEQYBxVEFIIlR9yrS6H2fxhUdWwfAgaiMzjTLsT4dm+K35RQ8dSutAkd7u0pUBPm6roEjbZaYwbYDTK9fc6jbluZKw+/XvHAT7POYtCzooqf1TuYCz9NUNgJ9TaKN4ZSmSwwUZB5V4cMu26bgDonEO0OUEN0f1X+Npy3eX1BtlEpmIgl25wMYpjQYqwQTtFHZpj8Z/IX0Jpgq71ycjyD7n8KT52Fstc82NRhaGGaLlTXAYmAlV9Is9vX4sg07AGNITXCSkCMQ== 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=9RvRaCj1qXoc71O+4ar8RblUY1mnlIDr1xYBjAFSGms=; b=x8fAHmf341hy+ig4SJxAKxR27MeYu1sAo3XwUfHLARyGwi9X4J0h8yx06PQmQWOxZdMLwS68kyoIpG6KaPD4OS0v8nDIFLdzkh/GrCbEbXgiCMUiG6fFPN+fYLOz11yMs4K+ZfsgRAqxwi9h/o+R8U81hdfz3vjRwQknjnKVOdmeX6CvW20I8xQMCQJsKa4YU3mFQFW/VRG+ge+Q5zn49A9gQbDdK1W6cUmHuyoxshxSgPrrY5wKTQMLIssbpuf8FKWeifh+D5kyQQqPoECRWwxuVstBhBdhFYkvzuzeq1nplo8N2yzVJzMbQ6NJ9y8OMxYlK7Q6KF9q+aLGbwJxbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9RvRaCj1qXoc71O+4ar8RblUY1mnlIDr1xYBjAFSGms=; b=VfD4V+7ln9C+g6nQJ63BiCS6oROemfo9A2dTubSuA9ZOcaGHDxw+TKlNPPVIZ3expTwl1r1sPXo/ILJcqo8HqmXh/ZFKlSBURcKXFj/MjZ6vLz2f7C4FyptDd+J6hxtK84UAURsjt+U5uzAd32tHAuaY5R0ctu8K9b9dVW0wom0= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA1PR10MB7662.namprd10.prod.outlook.com (2603:10b6:806:386::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Mon, 6 Jan 2025 12:41:40 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%4]) with mapi id 15.20.8314.012; Mon, 6 Jan 2025 12:41:40 +0000 From: John Garry To: axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, hch@lst.de Cc: mpatocka@redhat.com, martin.petersen@oracle.com, linux-block@vger.kernel.org, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, John Garry Subject: [PATCH RFC 5/5] dm-linear: Enable atomic writes Date: Mon, 6 Jan 2025 12:41:19 +0000 Message-Id: <20250106124119.1318428-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20250106124119.1318428-1-john.g.garry@oracle.com> References: <20250106124119.1318428-1-john.g.garry@oracle.com> X-ClientProxiedBy: IA1P220CA0022.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:464::11) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA1PR10MB7662:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f1fe892-a1f8-4bc2-a1cb-08dd2e4f77f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: uNkpxNNZ+eV8t06ypyvV4/K0atKIvFpNNpU0zEulRceK2EMenCV6Ii2aG8mQYXrqEb5wDLZaouxT+55m96lrDALrsNPaSowrD3KnpD3SBvyI3W4oMO9Ukne6uwW8YaXveCMvGF+1d6MreBQ+rrbaVp1X9EwvIdJPgd17zUFLjLVaL/Ulqb6EPP6ehFUz27BBlPScoLySCR/hoRWFRbMWNMwV0ZCeTvYxfuoUO8oNkzzLXPIbB+rTgGeQZgLrPlJLxFbzc1rIFXYFR7jfiOSdaNCRY4HThFXSIjv8D9DGRQiqNQQvIIMArZmwrXrBQJHdVBiPphrXQlDHhF7SKl4pE/Xvyb4XBzcTu1X+BQA++LaPhYMu6ZWaBBcizDd8fyVilbXOTN3rtcT4VTWXNskrvNqOP/2/6MZZn3/6L/1IoXacYjYQ42VP/fJLIUrZjQb6YtdSi7J5jQ9oEs0Z8eRJBM4iR0dkaJ6mYNxAgN4qvmcKSVz6565Wa1DGZNHUW2Vtv+LL8IdiHbktZQAIKoBn6ZfbgnqORuLbBj0V+XVxoLZNbnHgFhFrKzc0+/UAamnSvLJcTAryd5AoIALavRTd/2CUkg80At6Og4bc9pzOSKLtHo0eUnjUzl55MZbu9C5OVJclUVmWKE0kddpQTVtCH1HVfEON0GRKT3GK9LlhgJRQrQoYzAQh4Bkx0skFM7rM7BtD7ky13vSviRSsoVMuIdwudRdWCXF/rkFh4a1iMci3Zi37TdEfE+8FHFyVxZkoGsSiOPd4zwIyAgRfwtfTID8wWsWNKwGLy6W1SMb8aKbdztBei9Lhot0nLzzz54Ds0XarBRMjp8MU1aV1KRSEc+oO78Xsdbt9N57chg4va17Wes6xKSiXyYnVhtIbzZrYQzCLRVgkgmaELuHbNAt1+nR+z7FBo60QvN/fOfg+Cu/gfgytp+YuH0TSRAdtig8uPorKjKguL4YOFVRcHWq1eL+riNxoJ1qnHZLtw559KP8pqnjmAXgLKHSqhkJZ8wbJ57XhZMJsnnk4rBMC0DIfptX3cc+v/x6GBjtR2Cg/GWZwnuy+GSyjIHT3JXvL1484phqQKpxNA3d/lNT6KAtFJ02Tq0XcRBcaUStTdTVOgsDfJ5DAd1Xcn8g7VdE6iBpeMvqOhp/uK1os8QPmmzQUmsdbJp40aZ8Tj0t8HwJ3ebfxB5EX7p0RkBcjWRIWNKxxxIqNuj1YjARGAcHJ2jWXReX/oy8jT2q3RyVbeGrDDoErLeEpkGatnyAB0sf8BqBK6D9Y5CeHqKO2lH2rTbwhEhzmm+ye9SgoNIzuZAodUy4a7wOBl0Y+bi4NaPEYfrAnl1E1EdMvk9Ts0Cr5Pk7ZFU7wLryY3qlUOKxEATdSjisKQQpgQgQ1JK6/Mv4a1CY3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5UG3qfoRMXAyuW8jBttVj59TejxThXvRQ3K0R5mTKRGrS78CfJn1ifXiS7EVlVjV3oOi3ZfPOX3fnqyhvLIG1LWQblR0W0MORANdv5reeAPNkDZzOy5chOp6jb/qkZeAaVDNkxk5/k+K5DpVPZZiiMLKnfDQV/FBq86lCAY0VG2LgTeayvk2USEIdv5+F+Pn1daAaReiTMtI2QDgeEg4o2YuQlJYANF5DNbNxKIzYj3tVxa/fFqhPuJHIrGeUW1QhyCM2FUm1xHRsVPx6/MK1ZuzeNiwzV/nxmavAL4nswjdhV4gM4zEBNca9nTBpPdL80i3fvOq0j96A4MRX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5/0LZ6MnX4vGx0Exdh8052DrNYGyaizS0HMbi9vn6qZJT9BSQkOcOD4UDfiMH9eyrIxQgi3gHFfGUo/7mCyAlZgijNc4S77UvDuD21cuuPU7BKLw7Sa1ystQ+5tcuSBWKFOGSbw8UiMCP1R1tV6P+11KoroBrsHxYq9uTG+yEjaj4Ih/GDFeLSOEcT3oFs4mgavFB0PVksRsw/RQChKpWw2zCcWAPBrW2Rudg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: eonB3a2tOGF2y/8hF5aHvfcnLD/W4+POjIYgaunimYQuPfcepHJtOFHeBlL+ZQoHOqMBBsUk/4i+DSMgg9fbGTA+GS7+SnGhxdW1q8aK5PmNHl+w0G5cSwyNJsDcbdGoJzrN7LU5xkSpgLdQdbFTAEHiDm7EIXKMTHjet3qOy+M0vG54DCCUOiKYW2hEDjtec84w9Y1bWvo99wBlj3wqbdqv4eU7BRRkzYvHmnBwrQCnWAjVf3fiKe5Xby07ETbuPevbZ5Agn01/m5hMBvexh7jb6e5vrLnVMGPAy175RGGdQvmePXmNtRWRdnWQOThgWNxRB3VKGSGoFi8GuMYIrZhCTKPxEgdQBk2JRwcWK2xZLMaKjomYwpJP0+uG8VvsnyzRzrJlyDIwFXbOQxZYqySas/IPVBdNc6z9QN+mLOhUz0YlUN5XO8o4mZJ/vyqpHissZgOPX5ipTOKvTLw1S1cl5v++dPeOeMnzvtFC4eYOTu6Gr/066gHl4EGk+Rq/PnTfSP0PwBAvEX1sO6L5FDY0oGEe6bwfpWvnx8+OtKpEkQthTt+RtmOLM162RRLThyNfGpjVc9bsXIdF6w+3L+bYfziLYwouf48AS41t4lg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f1fe892-a1f8-4bc2-a1cb-08dd2e4f77f4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2025 12:41:40.7248 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3DzjySxSPu1Ylwqfo02SMY0hWUhQkqQ3VYl4WIvOmrnvmOiLLsbbvpyfgYAm9+TXvPe8gowcRcVRguIn+XTEeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7662 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-02_03,2025-01-06_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501060112 X-Proofpoint-ORIG-GUID: EAr-9VNoip4aDbQz7MWb1GIyy3mcokGy X-Proofpoint-GUID: EAr-9VNoip4aDbQz7MWb1GIyy3mcokGy Set feature flag DM_TARGET_ATOMIC_WRITES. Signed-off-by: John Garry --- drivers/md/dm-linear.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 49fb0f684193..351f4ee83997 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c @@ -201,7 +201,8 @@ static struct target_type linear_target = { .name = "linear", .version = {1, 4, 0}, .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_NOWAIT | - DM_TARGET_ZONED_HM | DM_TARGET_PASSES_CRYPTO, + DM_TARGET_ZONED_HM | DM_TARGET_PASSES_CRYPTO | + DM_TARGET_ATOMIC_WRITES, .report_zones = linear_report_zones, .module = THIS_MODULE, .ctr = linear_ctr,