From patchwork Wed Dec 4 15:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13893965 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 A64E51E25FF; Wed, 4 Dec 2024 15:44:06 +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=1733327048; cv=fail; b=gDgSWYKEB3aiS/nPT4N9i91Duj9Ctf/SBMjLghZbr/nRwYYM5Grni5AKcQ7xfBj5gUvHTfOf5GXoSTjGmdKh67iYovgxfLWHgD/CwP1QtPS1Bi97rWLyFI7dLKWSLQ1IxLugq6B3i6QrOea3/xb2QHmx5CUlwSuc5j4IH3Nezh8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733327048; c=relaxed/simple; bh=HykQhYGJwbT2J02UtCfc6HYalxBak+4F9s4phYdwW8s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=TgIhfde1ZzZFSg8n5kbeKSLHCq/ffho+vrwdD3Kn3a1ZMjb5HKEgLQ4fFrbSpoG/+tOlbajHTVoo51iv7Hoqyh1BOdIO3MoDT27n4ZcDAY6XPP/Xn0LF3B/GC2w+gjR1rVbOhYkyqoBE3R4I4UCx2VXnV1ERk0y07RKnuSEc5Ts= 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=bJayo1v/; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=pAqya0c3; 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="bJayo1v/"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="pAqya0c3" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4B4D0xt9027470; Wed, 4 Dec 2024 15:43:57 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=2txTTNxaY+F8dFPfFqSNaB6iRtLZ5mIW4lWycbJcQOo=; b= bJayo1v/dC71g1pIblZdWmqOmzL7W2XPAVNF5vtHWDowXVQOt7v9BQUdUnWrdsJ7 19UTwNBbCZ4ledEWXkfUabDSyxiH3/R+GP+XgC1YRD346xcIRg+bG4/h0/0wSq/A D4oNT00EdIHIP0vj2STaBb9KSETFiRRyEGR3T6jEL1mY9pBwxzkfLsI5Ii6V+2Vt JyuUBCSxs3Z8jJhoF1t48YLFD6lM2d/iwVPVApZAO1mUClGzh/RPTrGWOtPAEtrz GE4U1SZeWXEy9JMYOOb1MNmYS0+eUHcdd84/B+3bOqIaOUXrfpzJ+EzVn2eG+RST yp4L0AIcBZnWQZXktHjGRw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 437sg28sgb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Dec 2024 15:43:57 +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 4B4EgW71001736; Wed, 4 Dec 2024 15:43:56 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2042.outbound.protection.outlook.com [104.47.55.42]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 437s59md87-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Dec 2024 15:43:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FsJZQOpoB3hPaNxfvg9ssopJL0SoCBhdbxu2UtAE0yEaqUqKscT7LEsmmnF2kb+RC8Hrg2KKGjE9Phr+vHikDESvjC12lVGQOy9Xt9aWtD+oL9ldAjTqrglE2VgbHcPUeDBlXJ0j+rtqarWSRzqxOcEoMqH+LzQU3ACgj0SZ4yW/7845WSoPCoVekIqT54pSCWD3c+grt43UXEn/cPNrpOsX3oCl74zAHPISKhM9P6ekiGa+DaXusf1NBKIRvO1eg3FB7CgTUWt236vtrl5C9Ie8r1tE6VpYEO1dKLZotE6g/MhNK+tvckC9mP34rLM2KuY8KW5bljQlEiSPQn9KFA== 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=2txTTNxaY+F8dFPfFqSNaB6iRtLZ5mIW4lWycbJcQOo=; b=DnubQlasTR5LePaFFLt6Bm1JezTWd55sR2HkmHMAAGG0kgveYHHBTiwYoUnqXv1TUHwnwB3hztH9YLIwhPFp0mS1YMjWoHSHsS7Nyy2iCPByI0JnD2CV0ItzwJdGaVAkUpHeLtbpDBUWFhWN4usrFCmj5Y8v0gDhl9Q7A72v27lVUaFAHCShXQs/x9Zw16JhlUSFxdNClbgzsBURjPmzsRP3l7aHLqm146aqnhiAy8n8L6Ucg53iJuaxOBX5ezAztgknd9uk2Rth1yux6zCuhcEiLP8+SBB4ZF7Thk6GY4gegqg+qswFpeakr7DvTvIMl8k1VpgvLcPIkqaO4hVuiA== 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=2txTTNxaY+F8dFPfFqSNaB6iRtLZ5mIW4lWycbJcQOo=; b=pAqya0c3Xl760MPaejCi5I3S11LofVtxpTdefAqxydwMsd48+F/fsHvpklXii+tJXqZetR1sMCKDepdAIQZRDAisesUrHkclts1N3cLghYuJ6Yvzh0l0Us5ocP4bH6IVvtaV4phlXlj9cr2IAowjTICypI2cNPuTcpReK6qckfw= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by IA3PR10MB7995.namprd10.prod.outlook.com (2603:10b6:208:50d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Wed, 4 Dec 2024 15:43:54 +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.8207.017; Wed, 4 Dec 2024 15:43:54 +0000 From: John Garry To: brauner@kernel.org, djwong@kernel.org, cem@kernel.org, dchinner@redhat.com, hch@lst.de, ritesh.list@gmail.com Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH 1/4] iomap: Lift blocksize restriction on atomic writes Date: Wed, 4 Dec 2024 15:43:41 +0000 Message-Id: <20241204154344.3034362-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241204154344.3034362-1-john.g.garry@oracle.com> References: <20241204154344.3034362-1-john.g.garry@oracle.com> X-ClientProxiedBy: BLAPR05CA0048.namprd05.prod.outlook.com (2603:10b6:208:335::29) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|IA3PR10MB7995:EE_ X-MS-Office365-Filtering-Correlation-Id: fca6d1c8-d49b-46f8-ff1e-08dd147a754f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: I0RDm95oxyw489MwQtapIk3jyY/7DVKUM7iCaWCnv/A7Zxgl0xaWXw6URXzQL60ncomZH7mLMmIZHaXhmlP+Rng/vezUCw5zBDfqyL1YznGmeVfdLPj6pxeCC+j0gtt4WUrn8hoAJOsLiwv7KY47jUPFOdDFqJ7xGn+uwRGQczUwu+rbfa0pCoCqRSA2OtXjSpyrFD9IKcvhtrfhLKGtf56Buk5ankaWCvQZWo7MgcsQknn++6hRcneghe/y4v/iCXGU8MjNHbtxOUk5dnNZjHFhLG2mzmAqU/rmdjQ3u8V4TNKYm7dnaaumywulc0zAL0fAY/cVfXhxWPTcD5KbMGeHWW2m3vTFTqQrCseTRWTizavgfjIF1I/1MruhJoXkpc/LAjG3xnYLobB2dMvbW/gb3G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YTcCiwpyQfoWg/BaqzN5ZhLR84zjjCZz7lxoPJZ+xWMUJnEyrvYmmwRruQjqYmzq8fA4lzEB/xp+1tc6E2O9cZjsh0KZA1Xmo5saXvEZJKj7kieZUi2Ti2M8xjOJ0SBiB7ouEy+k2PMBPKZF1lCIwStrDb50NGOmRE0DbhfO7QrPytGZeVkop3vrkXThmkCZi6w7NCjxvzq/wFEkevilkFsyrEl6zl4vgQTxb68jrws5CX7wVazaFU0BeZTULFoIRYoXK3DQEoLWLLRllINmuG/U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fca6d1c8-d49b-46f8-ff1e-08dd147a754f X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 15:43:54.4832 (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: 8zgUo2Q80sIbKAl839RB5GJaFY/au3M6tsj1DetvTZQQinFvR4iFhYGRymgveYEqnhhwOxiYEcA2rFTglwtIQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR10MB7995 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=2024-12-04_12,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2412040120 X-Proofpoint-ORIG-GUID: 2AZC6FBtpN3R0Yoh7diqny_-sJykBDAf X-Proofpoint-GUID: 2AZC6FBtpN3R0Yoh7diqny_-sJykBDAf From: "Ritesh Harjani (IBM)" Filesystems like ext4 can submit writes in multiples of blocksizes. But we still can't allow the writes to be split into multiple BIOs. Hence let's check if the iomap_length() is same as iter->len or not. It is the responsibility of userspace to ensure that a write does not span mixed unwritten and mapped extents (which would lead to multiple BIOs). Signed-off-by: Ritesh Harjani (IBM) jpg: tweak commit message Signed-off-by: John Garry --- fs/iomap/direct-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index b521eb15759e..3dd883dd77d2 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -306,7 +306,7 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter, size_t copied = 0; size_t orig_count; - if (atomic && length != fs_block_size) + if (atomic && length != iter->len) return -EINVAL; if ((pos | length) & (bdev_logical_block_size(iomap->bdev) - 1) ||