From patchwork Sun Jun 2 14:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13682843 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 9D6243FB2C; Sun, 2 Jun 2024 14:10:16 +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=1717337418; cv=fail; b=ZkEUds2feC7cLnEPbkHKhF116jiOAPtb9glWqrDHJeFHw4EZPmroMNc8S379TTS6mJEILjFHBrttVRZkhVCYt4AbFrfuowz0J6PhNv9iv0gyqkRQi4jkE6kkDRPaXx4jtrXXSgWdL2xZoSSEoQnpMZ8LEToq3jKwdjQNcTiRFXA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717337418; c=relaxed/simple; bh=CFBO+VT18ojxHlDEWoFWs3ElF1fAtRAorBJQkub2TFQ=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=d94pJj0zOWZQ9gscVg87FMJvZD2EffmX5VVnKOCMeiIqb+ztEJCWLvv/YRUxtM6b8FU0Btrh6ckY5JYQ22T7iFKYP+LpX2ZUQqsr+0/sRy9uRcytGUzqZiSi8OOu+NTYIRsOPZ600Zg7HrEkkkVeSjuP7ckbIr7wkfpIEhCbbMo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4526jwCm031309; Sun, 2 Jun 2024 14:09:45 GMT DKIM-Signature: =?utf-8?q?v=3D1=3B_a=3Drsa-sha256=3B_c=3Drelaxed/relaxed=3B_?= =?utf-8?q?d=3Doracle=2Ecom=3B_h=3Dcc=3Acontent-transfer-encoding=3Acontent-?= =?utf-8?q?type=3Adate=3Afrom=3Amessage-id=3Amime-version=3Asubject=3Ato=3B_?= =?utf-8?q?s=3Dcorp-2023-11-20=3B_bh=3DKpcVfxMo6yonKCrC6qgtcSvs3vNfWS2EuCIjk?= =?utf-8?q?p2PNwo=3D=3B_b=3DUUuxOyOTXm9zJ3eNsP9ICZRMUJM5r1xa94TNl0blSsIUa7x+?= =?utf-8?q?V7b3AEkAji6uo+R8dSh7_GXog3sZpEVsNbH6pctE84B9oR7bxF3oF5nWxS00KpWfW?= =?utf-8?q?6G/XphK7TA4qXcvandNQbmDK_89dBrh10w+BBQs6Bune24xIrImEmWU7pS1+kEjxK?= =?utf-8?q?pjQvQTIs6t2SuItGGJGHXjhGdFJu_6xk05e2ZkJJzCtL1ZAnTRRKHqo8qeXhV2Ky+?= =?utf-8?q?B7s5KaAcQFh6tkJf09C6L193SuEZs2CL_py3Ea3fmQ6S4x0K7X70fJaFW/6p908Aq?= =?utf-8?q?vJp4dJmGImIrpzU6BvH+d9OBsH0+HufoXh4f_kg=3D=3D_?= Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yfv589ck7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Jun 2024 14:09:44 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 452CUmeM021076; Sun, 2 Jun 2024 14:09:43 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ygrt699g4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Jun 2024 14:09:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e32oLYwnH1DpXniARh4WdvPf8u6zcyzYxuBcPZhxBiM3dTYCSin6yHTcQph/dtSenFC0DQwyssywujwvVkB9uOHpkWZjksz0uG20RJsIseXWY1q+U1scTg12Wk9mG+EpQn6rbnqlsulQdORB6PNVw3/iN3K/6OEneLidYbopGGjV5v62qydmm1RodcirHiKeP1+Wpu+Ff6Gmho2qjciiAuBNdaC/pq9NSeJE+rlH/nni/g9qJuGTf4ucdhVJS0ySgH/t8x5r2TNryfNy0bctqT5Ru8vczG/w7Pj/xk1Kvi5ZFGP6In/izuCp4l+5qbnr/9aXevGN+ETGWuzp7YwiNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=KpcVfxMo6yonKCrC6qgtcSvs3vNfWS2EuCIjkp2PNwo=; b=Qa71veBu3/c8y+wk7UP6SwEv/GzK1UyR8C7Fw+dXidrtyq4BT4mjTMWRn964u4zOxaOGcYQFHEGAcCjVHrEJw+SNwNpopmsMiOqIUt5nsW4pHpFFfq1cSWbvFM6B6SWIhsFbRjhwHeLYkKnrA8K0w6FmvXFbtZSw6xEgI8SJk/p6O1IGupSnA6zeI3rWhPIiWTmm+gjRoE+cr0X+b1QbyHm0OyTyfDdgtQ5gg2a6xerLreNcvHYmNhEbH6lw8hJWUZSN4EzTj5NYxYHZs0OnB0ndMc3z8fNbV6xpLVqkj7nN5PRwIGQWP4cC70IO32CGj5ZcQe4eFO+kIK+cMbUpTg== 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=KpcVfxMo6yonKCrC6qgtcSvs3vNfWS2EuCIjkp2PNwo=; b=ucxVO5fKN4h+Z9bpfPFIQEO+28Qg4GN2LNeDhlSEuSZU1JrnbR8Ee0fyb8mVz3UNdGp68ND6ubJo8GOMWTl9fGSWNIlVC+lFvSonx1iX31X2+sgHiMF4toVKQtxZtIMoeavw75Ksx/zKuf1DX2UoViom3FHy8HjgjK5ifCt0Dhw= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS0PR10MB8078.namprd10.prod.outlook.com (2603:10b6:8:1fd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Sun, 2 Jun 2024 14:09: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%5]) with mapi id 15.20.7633.018; Sun, 2 Jun 2024 14:09:40 +0000 From: John Garry To: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, jejb@linux.ibm.com, martin.petersen@oracle.com, djwong@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, dchinner@redhat.com, jack@suse.cz Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, linux-scsi@vger.kernel.org, ojaswin@linux.ibm.com, linux-aio@kvack.org, linux-btrfs@vger.kernel.org, io-uring@vger.kernel.org, nilay@linux.ibm.com, ritesh.list@gmail.com, willy@infradead.org, John Garry Subject: [PATCH v7 0/9] block atomic writes Date: Sun, 2 Jun 2024 14:09:03 +0000 Message-Id: <20240602140912.970947-1-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: BL1P221CA0013.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::11) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS0PR10MB8078:EE_ X-MS-Office365-Filtering-Correlation-Id: 67dbca53-e7d9-422b-cbef-08dc830da4a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|7416005|1800799015|376005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?FKKrHJb9ZfqBIdY7wAhdT7JaLfncb6r?= =?utf-8?q?yZYYh2V2c2TqvYJ6wS3qvQr2oPlWBQDMhywrqiF2wz4U89ylNTDygNZ26eCayxcPm?= =?utf-8?q?eAJt/owf3/28sUO2lg6mSRXVJVsrkZW9/+2lV9uZyIj5HfWTpXjyp82perHcKxV8p?= =?utf-8?q?dqXtTeJzERMKZARNVrQ1qHhcSjyxXuc9TkAfL+zL1/grgYaOMXoQih7Fn4MzFPDam?= =?utf-8?q?Gd/eKQmSfOkzEi2wKtSqwWOjdTqVw3yc7VYgqL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PRlEbGaOyIWUKe2Z?= =?utf-8?q?nWxQ3L76MSClpATUJc3DP5sQfJuP1N/1kr8S4fNVT71oG8ww5AjKWHTZoLltnKbsD?= =?utf-8?q?t6Mc3odMCSbDPbBb7NIIrZL+s08uoPKzj34w=3D=3D?= 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:(13230031)(366007)(7416005)(1800799015)(376005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YAjXPlj33GpmaSvbv1lMQB+nrFV5?= =?utf-8?q?BhZGyMvV90kB7Hi0dtIDQI8V7ZH6TsTKUJfVjzdq1kZ6IvuggKKrOV8ghz1oHLWFr?= =?utf-8?q?6xi+Entkw15AQB+G3ZRgkE+skLoWBe5MRdu4XvoRvV7FcPqWWHuWF2h6OWk4djNbT?= =?utf-8?q?N67c3xBX3soWmFIIku0OkYEfNH4ODLwO0rW5ZUsSaJ32tz7gMHIjAZwQpKv0qhR51?= =?utf-8?q?mqEuhCYjs8qW+IoK16qIO7seQmtFdMZuOd0b8SkjVoQpLJv+re6dkn8ume2iQ1Unx?= =?utf-8?q?IueQdS2qxzifiuTLyk6enizgURF3xmeA/O1WEFZEJ71nk9wJbkp8JZDyE6L7B3hGp?= =?utf-8?q?0eobOZm1+A+xDCImsuT68ky0p6C8P0Qfld8lq+1aseF7IlsoIcnR+MmL7+sJu0+KY?= =?utf-8?q?MsTirq3mNnDrPfkxmy+IsJUM+gIJWYXChhDJxBtSyKXKucD/zCK7irJ8t4F/HT83L?= =?utf-8?q?Elers6Ir0TFhx/Hp7SYGbL9SG6FbAG05eqxP7PZtdXeiGThw27ejymUXBiyx/YAKz?= =?utf-8?q?9qV/e6JP4X5dMcBDl2HJXcc0S2nyxmHZkujk0kn0C5u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=?utf-8?q?HrcPXEmSzsSY0iTeJccJvRtFzNIdp/okF9/UddYCm/r8psHsviiYsf64ypUd/l9Ym?= =?utf-8?q?8jpTQVUQ5S0Zb6fIMY3Ozav6AlPs3/t0/g=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: RZC5WT+bnD33T8xpn5K+U2hyTyKzVQHyTTcr1umAjCpXPD/qc3AM8n0CSUtGUabt7AYRGXgJNyaR8Ix8g2VVZhl/cUa3/OmuCJz/lGeNcr+R2Bn+hAO2+wfZE2gXDt2eeCOud39NMJg6HiPSnAWWY/vqhMsrMhmuhmBljQ3SbCXS0z5E17Yw1acRnl7C+CA84jwSeOKUqMVbXBGT3O3hdJCQKgKyvtCPnxRpF1ohxche4KkIvOsR5bcUKV0cIh6NnpHyu+zwIjca/BQQgHTw9nAtdREwboFBfX4/b/WKcRlMVsCp+lmKAGZTMMe8+1jflL5UXqqyPJ5qzUdUTY/STukWS3viwTBQ/hF+O6+5o+YPKuPD9kLS1a1qhlpPoB+oG8za6arLqqhXSxe5cVgrQDsYB9RW/3C42btS/rcSsvhSuLjx7WfDbUKuIXbxxrjXVuZisocHy13UBLN2VvSokYTL20S8pgUqeJ2sQVgHw5WEieMCLDMDPFxxkIe4tIZ9vnsWzAtyF8x33lSgvida/RJGZv88FQWz7WE+iIU38zTKg0M7QtiE95569tFpWUo+IBIWBrHYhivXDQsklfqtU98Dap/sj/zbw2yKS8k0fnE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67dbca53-e7d9-422b-cbef-08dc830da4a4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2024 14:09:40.0900 (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: TSv8OiuG5lvvUq1ccBX2beOS3Rl5LsrO0BxMaa7CHPAHvIPn4g6QFkRr7uLEX/nCmjiXnyiCZs3stP5cQhz/Eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8078 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-06-02_08,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 suspectscore=0 malwarescore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406020122 X-Proofpoint-ORIG-GUID: oQUAhif7htos7MtWbkdrGYjITqJEulL0 X-Proofpoint-GUID: oQUAhif7htos7MtWbkdrGYjITqJEulL0 This series introduces a proposal to implementing atomic writes in the kernel for torn-write protection. This series takes the approach of adding a new "atomic" flag to each of pwritev2() and iocb->ki_flags - RWF_ATOMIC and IOCB_ATOMIC, respectively. When set, these indicate that we want the write issued "atomically". Only direct IO is supported and for block devices here. For this, atomic write HW is required, like SCSI ATOMIC WRITE (16). XFS FS support has previously been posted at: https://lore.kernel.org/linux-xfs/20240429174746.2132161-1-john.g.garry@oracle.com/ I am working on a new version of that series, which I hope to post soon. Updated man pages have been posted at: https://lore.kernel.org/lkml/20240124112731.28579-1-john.g.garry@oracle.com/T/#m520dca97a9748de352b5a723d3155a4bb1e46456 The goal here is to provide an interface that allows applications use application-specific block sizes larger than logical block size reported by the storage device or larger than filesystem block size as reported by stat(). With this new interface, application blocks will never be torn or fractured when written. For a power fail, for each individual application block, all or none of the data to be written. A racing atomic write and read will mean that the read sees all the old data or all the new data, but never a mix of old and new. Three new fields are added to struct statx - atomic_write_unit_min, atomic_write_unit_max, and atomic_write_segments_max. For each atomic individual write, the total length of a write must be a between atomic_write_unit_min and atomic_write_unit_max, inclusive, and a power-of-2. The write must also be at a natural offset in the file wrt the write length. For pwritev2, iovcnt is limited by atomic_write_segments_max. There has been some discussion on untorn buffered writes support at: https://lore.kernel.org/linux-fsdevel/20240601093325.GC247052@mit.edu/T/#t That conversation continues. SCSI sd.c and scsi_debug and NVMe kernel support is added. This series is based on Jens' block-6.10 + [0] + [1] [0] https://lore.kernel.org/linux-fsdevel/20240529081725.3769290-1-john.g.garry@oracle.com/ [1] https://lore.kernel.org/linux-scsi/20240531122356.GA24343@lst.de/T/#m34e797fa96df5ad7d1781fca38e14b6132d0aabe Patches can be found at: https://github.com/johnpgarry/linux/commits/atomic-writes-v6.10-v7 Changes since v6: - Rebase - Fix bdev_can_atomic_write() sector calculation - Update block sysfs comment on atomic write boundary (Randy) - Add Luis' RB tag for patch #1 (thanks) Changes since v5: - Rebase and update NVMe support for new request_queue limits API - Keith, please check since I still have your RB tag - Change request_queue limits to byte-based sizes to suit new queue limits API - Pass rw_type to io_uring io_rw_init_file() (Jens) - Add BLK_STS_INVAL - Don't check size in generic_atomic_write_valid() Alan Adamson (1): nvme: Atomic write support John Garry (6): block: Pass blk_queue_get_max_sectors() a request pointer fs: Add initial atomic write support info to statx block: Add core atomic write support block: Add fops atomic write support scsi: sd: Atomic write support scsi: scsi_debug: Atomic write support Prasad Singamsetty (2): fs: Initial atomic write support block: Add atomic write support for statx Documentation/ABI/stable/sysfs-block | 53 +++ block/bdev.c | 36 +- block/blk-core.c | 19 + block/blk-merge.c | 98 ++++- block/blk-mq.c | 2 +- block/blk-settings.c | 52 +++ block/blk-sysfs.c | 33 ++ block/blk.h | 9 +- block/fops.c | 20 +- drivers/nvme/host/core.c | 49 +++ drivers/scsi/scsi_debug.c | 588 +++++++++++++++++++++------ drivers/scsi/scsi_trace.c | 22 + drivers/scsi/sd.c | 93 ++++- drivers/scsi/sd.h | 8 + fs/aio.c | 8 +- fs/btrfs/ioctl.c | 2 +- fs/read_write.c | 2 +- fs/stat.c | 50 ++- include/linux/blk_types.h | 8 +- include/linux/blkdev.h | 60 ++- include/linux/fs.h | 36 +- include/linux/stat.h | 3 + include/scsi/scsi_proto.h | 1 + include/trace/events/scsi.h | 1 + include/uapi/linux/fs.h | 5 +- include/uapi/linux/stat.h | 10 +- io_uring/rw.c | 9 +- 27 files changed, 1099 insertions(+), 178 deletions(-)