From patchwork Mon Apr 22 14:39:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13638591 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 C0AEB1474B9; Mon, 22 Apr 2024 14:40:57 +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=1713796859; cv=fail; b=ZO/fcR01U+yaw2xkSgCCdCw4yFPY/DdYBoUmWsmJ9pKdmAouj2BJEtg1oegIjiTh8NMAHw7sF/x0Gz6WnGurrxmmCTZ8Mo5d/jPYIOmOAeRBwGSqzDGuzJf7W/0n9F1d0yFf7/IjIs8TuQPBtRw4ocr6lAJxNXqQNttHQROQk0A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713796859; c=relaxed/simple; bh=NeC6oIlwZkd5qeu+j1ngCwlzznJXASClxnEcLCnOJbc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=h+GCltkjTnkU9ZvGwduSXUq3IOqQlNch8nhx5jMSafOGlp1FZji4wxX7WvRV3GpkZt1RUVsItHj7TxJc5IRifb8bMng1bzz4ZMqQDMwfoCUsSCkZ2wffkRghbtGIwFtH04OCjtQzbdMmdaEWJFoaVP2rYj3M60pllpvKfc+/vb4= 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; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=eGcniPEm; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=rC6KMbxs; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="eGcniPEm"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="rC6KMbxs" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDZCX0020753; Mon, 22 Apr 2024 14:40:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=xNFprL13lOZTXnDP0AM2Aa+pOjBkZj67b+iK0XfxumQ=; b=eGcniPEm9F1GRA09F+qEEz6CrLftwf5P4u4IWsj1CShtF65nQZ94YFwYi0hI0b2LOQez h170v8yTd7fqim3ME2kyxrlOWotD3Q24R1apQ0Zw4GGiavyicqCUQkVuyoXAtnaru2QE RXKF2lh1RsGrFf+DhlRzl0TykkpfOO7VPeIO0X1cg6T39Egas/bozBZ6BAgD7fGkLJVw dQeuUHctUYvX2aNrBan96OfBjwkRHblDO0bvyUaDGNtFysaJdqilshqIOt6Xd9q+O7Lo eNWLxKpmvGPi/p0hxI2kuMFkIB1dz2k0Pg89BFp+gtQ8nQBpmdMY0jvJ71jMmpSBaheL Ig== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm4md2vs6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:21 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDtjFv006759; Mon, 22 Apr 2024 14:40:20 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xm455qkvn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nkOThC+I/vMPhlC6N13fA7KG/8V3cvXGpyI7WUf+oXa/9GdRIHsRON1w9Cd/q1em9onAdobeYPTuaIFEhCfgmvjyLHYGXUAimVV4euMVI87OnRwm1xeP7t4TWjm2pQZvHG3y2gHwaYPhJclT0ytKy3u1KsRiikXovnGjBRVlUiADrMsoH+KIoXHIklNpuSvcSfKA+ht5foVsWaFxwLqwBhxJImiX92z9Owy9EQ3IQsSm2K3pi38dPtZrVohkAeMh0tRvXTJ892yFYymxOzUFwAtmjRzyLvm1t/vtqOrF8psI8EfhI3uAiIPCV5pOZEvLB0bl6fPxbRShZuQ5vlK6FQ== 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=xNFprL13lOZTXnDP0AM2Aa+pOjBkZj67b+iK0XfxumQ=; b=A/fMe0zu6dRvZ56bwPwdULw9pvDg4cCehSbCoMpRbZ1ZQYn9CIHIkzSTvCeV30VB96SrHecntFZh372RQoaAK42gQVv9oNQ1vismb1o2e70SzeUm4KCFAoepTkccHqLuElRSI9esloQ8YOyqGQldc2NnnJ9v/3E7M75anx19IGa++xW2Mec78yHXTj8gHyxRnuAhpOW0q6WbWSifRht5F9a+B6CIsayZTDOz5vWvvgTRkrIRiRLzx0iDQQFmt6d3l3HdwYUtuzTcq9M2Fy1GBUwn/gXQ35Cv6mJECOUITLyGJeXDu0GisJ3kRXrLhdXuJozJHCTLIqwlsWLrIE001Q== 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=xNFprL13lOZTXnDP0AM2Aa+pOjBkZj67b+iK0XfxumQ=; b=rC6KMbxsEm9LuwWulUJIJR5MtSJjAr4KwROHOV/YFC9j7yqV0HqxMHij3UQXSYOtl1YK72sPdLx6w/QLeStXsmizg4IycyOVae2LuaIZLr2JTBWhZEaAnwsR2PKJQdB4ANLQJk21pG1hh9EnOqjQI7/pXCIpQEPfziUkd5wVvPQ= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS7PR10MB5039.namprd10.prod.outlook.com (2603:10b6:5:3a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 14:40:16 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324%4]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 14:40:16 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, akpm@linux-foundation.org, willy@infradead.org, dchinner@redhat.com, tytso@mit.edu, hch@lst.de, martin.petersen@oracle.com, nilay@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ojaswin@linux.ibm.com, p.raghav@samsung.com, jbongio@google.com, okiselev@amazon.com, John Garry Subject: [PATCH RFC 1/7] fs: Rename STATX{_ATTR}_WRITE_ATOMIC -> STATX{_ATTR}_WRITE_ATOMIC_DIO Date: Mon, 22 Apr 2024 14:39:17 +0000 Message-Id: <20240422143923.3927601-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240422143923.3927601-1-john.g.garry@oracle.com> References: <20240422143923.3927601-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR03CA0032.namprd03.prod.outlook.com (2603:10b6:a02:a8::45) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS7PR10MB5039:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f7088e1-f7e3-4096-f35e-08dc62da1fd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6YOMl31mRJY4UCzc2E0wYQU42up3jRn1Fhj7zN/P3pd+OkwNduaOSe9Cu4+UAglGWhC0f7aIBEjAzfmC9/qhmrsSu187am+rlVPWVMu085Qqhs3W7d/KXsL/rMSDjTbh+fQENup9oImAkB2MxaH9oMhSgKswd4bmQLVPBR9JnXyHMzev7xxMz2+8O9KPJ9RnMEgPWgXcWuTpEjW9QlozR1mZcnUntErTaun55fC0GFH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FqlKz6BVBfdoxUqszSDpazLbtc 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)(376005)(7416005)(1800799015)(366007)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: shYMtFj6+4OpV/TeoMKTQCkwxeobY9+nMYs8HhCtMpU7DkKEKqg5SqTx5ASXc+8bbq6qobHbFmPrQdKRr3D7eiznXubcAIeUX7W99rb/ZENbwlXJteLImawkwtnt1XDFr0n1HdwvNOj+WIrLjw6xyKMeq/khgkNp4gbdTj+EC/5t9bc4XS1AyBIaPWxLH7wdCPskXX21uRaBalRD9rVFfKvd8oUpGhuTXpfJX6mARo8wpynIVuGjgqlR5iLZVKmSk2fN8ksNFvqP/z5ilz6corBpAtl11jbAktIn8VFqYDrjUelqbP4K9UvH9EWuMknQpfEVCsezrDOm/cZE9XrNMHJneLz7RbjzzweTNz8hfeh3gHAoBRwCaCSQy5UbvYxPzq2Ot3y2shIrpyWvOSvEQm3xLO41Y8Fwe7FXWkMc3dOZJWO93sTVCOXCnUEf0YQtQTfxopWvSjXPzg780wiUwY0MLzJCyT5FZ5Ql6X7xpm8S4TmgZsGLO0LiP5To7/X10NVecRCgayJEtyRdmGkIsMWmBVU43eAgbyG+FFAwTvqGCkOvg87hmFbaHPjOFSQGva7WPeNNYCW/yNBV+o8GKj1Hd/AwG6ci0hUGc5F8RZeDcOfgQ5dPKxwR8wF5Bs6BqY0CjDpTIze7s14JwlycjPWyO3uXJ8eL0xUhKKOE0rRahyWhA4mV77bfpheBhjSo+U6k/unY2+uwM4Frjlv/6EmJo/erNat0L1ulWY0/CGoXhKck+X6TnFKe68ev2r+GK2U90fHfKxEy2mVFPo+WoOwAnq1+vWDqD+D+iGwMHrGwrWbsPIHMSy6keJRVcGr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100CMbS/3lKwoeccGed6fKcCKsFyt0mJnAWH779S/pLfOgG4bI7v0ZfxhbMj1jQOfYajeEBbyKz4Od9GcwY8UfgViVdf+8PfoUZRU8h4LILdixvE7RTwFIpaqbeAPfMp5WZ4iXVhZmKxYRl2tkSLxSfiLirJhyKZdySmzY5dnxWMTto4jI+CiLOK/VmKc0ddwpgsC4/LEfL0pZBxVFeRfZ9NGH7dx8r02ZYLzJ7/DaN0tY74Htt6LEArf4oLlo432RU9oWe0MVpp3STFHLofUBmlxcmy0U9HUqjTc+YU4CqCYcH75POKk2eOdtPQWxZYYaDHQ1jPmtoaTRPf2vnXMq55X9I+MegguWLAsEXRuCsLqArAWA0mPsRr4+aZd3nSZWMHwedpcos7Kgqkn5OMvHqV3C9WMzlg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f7088e1-f7e3-4096-f35e-08dc62da1fd5 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 14:40:15.7105 (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: N8T4Hfjs5VO+8fewgVNbjtji2KSYRs2cpwZ89XTTa+WEo/gWBLz/N5gxjEXN+6gqrEkmrO7pp89JGCc6UgGAew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404220063 X-Proofpoint-ORIG-GUID: Wsa-kJHzDeyLUWYA7S6uCHAvcxph-GEN X-Proofpoint-GUID: Wsa-kJHzDeyLUWYA7S6uCHAvcxph-GEN Rename STATX_WRITE_ATOMIC -> STATX_WRITE_ATOMIC_DIO and STATX_ATTR_WRITE_ATOMIC -> STATX_ATTR_WRITE_ATOMIC_DIO, to make it clear that they are only relevant to direct IO. Signed-off-by: John Garry --- block/bdev.c | 6 +++--- fs/stat.c | 10 +++++----- fs/xfs/xfs_iops.c | 2 +- include/uapi/linux/stat.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/block/bdev.c b/block/bdev.c index f3dd9f3c8838..e2a9951bd2e9 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -1182,14 +1182,14 @@ void sync_bdevs(bool wait) } /* - * Handle STATX_{DIOALIGN, WRITE_ATOMIC} for block devices. + * Handle STATX_{DIOALIGN, WRITE_ATOMIC_DIO} for block devices. */ void bdev_statx(struct inode *backing_inode, struct kstat *stat, u32 request_mask) { struct block_device *bdev; - if (!(request_mask & (STATX_DIOALIGN | STATX_WRITE_ATOMIC))) + if (!(request_mask & (STATX_DIOALIGN | STATX_WRITE_ATOMIC_DIO))) return; /* @@ -1208,7 +1208,7 @@ void bdev_statx(struct inode *backing_inode, struct kstat *stat, stat->result_mask |= STATX_DIOALIGN; } - if (request_mask & STATX_WRITE_ATOMIC && bdev_can_atomic_write(bdev)) { + if (request_mask & STATX_WRITE_ATOMIC_DIO && bdev_can_atomic_write(bdev)) { struct request_queue *bd_queue = bdev->bd_queue; generic_fill_statx_atomic_writes(stat, diff --git a/fs/stat.c b/fs/stat.c index 0e296925a56b..0c0c4c22c563 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -95,18 +95,18 @@ EXPORT_SYMBOL(generic_fill_statx_attr); * @unit_min: Minimum supported atomic write length in bytes * @unit_max: Maximum supported atomic write length in bytes * - * Fill in the STATX{_ATTR}_WRITE_ATOMIC flags in the kstat structure from - * atomic write unit_min and unit_max values. + * Fill in the STATX{_ATTR}_WRITE_ATOMIC_DIO flags in the kstat structure + * from atomic write unit_min and unit_max values. */ void generic_fill_statx_atomic_writes(struct kstat *stat, unsigned int unit_min, unsigned int unit_max) { /* Confirm that the request type is known */ - stat->result_mask |= STATX_WRITE_ATOMIC; + stat->result_mask |= STATX_WRITE_ATOMIC_DIO; /* Confirm that the file attribute type is known */ - stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC; + stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC_DIO; if (unit_min) { stat->atomic_write_unit_min = unit_min; @@ -115,7 +115,7 @@ void generic_fill_statx_atomic_writes(struct kstat *stat, stat->atomic_write_segments_max = 1; /* Confirm atomic writes are actually supported */ - stat->attributes |= STATX_ATTR_WRITE_ATOMIC; + stat->attributes |= STATX_ATTR_WRITE_ATOMIC_DIO; } } EXPORT_SYMBOL_GPL(generic_fill_statx_atomic_writes); diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 2de0a9c4e6e0..37076176db67 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -650,7 +650,7 @@ xfs_vn_getattr( stat->dio_mem_align = bdev_dma_alignment(bdev) + 1; stat->dio_offset_align = bdev_logical_block_size(bdev); } - if (request_mask & STATX_WRITE_ATOMIC) { + if (request_mask & STATX_WRITE_ATOMIC_DIO) { unsigned int unit_min, unit_max; xfs_get_atomic_write_attr(ip, &unit_min, &unit_max); diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 319ef4afb89e..05f9720d4030 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -160,7 +160,7 @@ struct statx { #define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */ #define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */ #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */ -#define STATX_WRITE_ATOMIC 0x00008000U /* Want/got atomic_write_* fields */ +#define STATX_WRITE_ATOMIC_DIO 0x00008000U /* Want/got atomic_write_* fields for dio */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ @@ -196,7 +196,7 @@ struct statx { #define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */ #define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */ #define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */ -#define STATX_ATTR_WRITE_ATOMIC 0x00400000 /* File supports atomic write operations */ +#define STATX_ATTR_WRITE_ATOMIC_DIO 0x00400000 /* File supports atomic write dio operations */ #endif /* _UAPI_LINUX_STAT_H */ From patchwork Mon Apr 22 14:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13638594 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 0069A1534EF; Mon, 22 Apr 2024 14:41:01 +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=1713796863; cv=fail; b=EKpdhEJIFhzf43rW8V9UuJgr+8Xq/ylCFYDfPGs/LnAGQ/pb/rImb/yeiNY++EJ5PugrJyerBLR/YVLsJ/TWDP6JEAeSzfOjB0bV/5YgkBo0OsyOCgdB9U3lUwkaUEdjw3fhKnp39Aksr7DnsCuRy5naG1MVwkouP1CskUYoM6g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713796863; c=relaxed/simple; bh=gLm+aCnWKYQqK3OVtfmDOXLbWTdsl2Opx6fu1BGPPD0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jCh1cMBm0mw7DDREFPiGE8qlpnFMnSINwlDiqIWDDjy5URSAwL+SvcaBLLytMrALB9UZD7MiHHsVmMCEBJOJmmBatee+boNVW1MC5sQkmHMo+1jEt4eIn+g1DeZkLmEaLADT/IEx8APmEElno8wgAaWilUm7ocs7cTDJUvQYaLQ= 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; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=dx7yCvD9; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ZEC6eVfA; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dx7yCvD9"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ZEC6eVfA" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDYqq7018272; Mon, 22 Apr 2024 14:40:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=w9bvgYzAPBe7SVrTS1knS/niWNGXh5GFN5/xdO05/qA=; b=dx7yCvD90+9rfIRboIFEJGyqMgmrd2nJVqw3d9Vi4FLE8vpqH9+S6pzHzFXtPq2eKiSM ilPvdPJnV0pbUlZcR5uy75XLbPMxh4j5yG/r+xQUn4bPKTgkcfIv1cuV9ekGmHwSo3bS 2oGcNAn/Cfvwnr6IZjeTnL9nLq2Boekey7cRQ9ctbjwzk04oyA0ima04xlcrRlNcRHfP eyZN9yR/71nrm7+Dq+mlZpxnpQdWCohm8dGCrYBmfvwv8acDDxKjHr4FjxqsSBrFYIfn FrXuaqfedFQ0xHTGQfogReLQiXGWWDtFckWCp3jvTI1vV5Ki8ObVEulZNgwSy5+TBVoG lA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm68vassm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:23 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDtjG2006759; Mon, 22 Apr 2024 14:40:22 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xm455qkvn-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mPGEOwSpxcWt593Yx4vJxrGFlAp4aJr3Zk6YGRWXjDTzrnoxfDF3FEfeX1EmE3tsZItMjm+P4xmFfmRD7D9rB0F0eOh4H0XEzzuA0fukNH5hQH2ICm/gZcjhMTuY81X8nes6wtveFw4BLSTYqY1hkHLWLvlKyEHbOVLbaheSOeFl04fZW50OiYno/yP1lkRnehcei4tb36UWH1bRU25Hh690l5VHHN3KQTarMofRy/Sn3HM2+EHAGTwrcHzBqU5RXT1qOFgKRbknoVBSPF6cWsKE+FoDumHyQgJMTbCviyw3PqkZEmd+b+2srhobFw9QEQWCYgpQXvrkL3X9CSH9nw== 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=w9bvgYzAPBe7SVrTS1knS/niWNGXh5GFN5/xdO05/qA=; b=YwRHGjKbKVOdeU5HgLAxu4lSfwNHo1tAEKT6xIsSw29C/kgAQfz6eLqIQwuHbOFz78Shb+BKVmZtf9XsgkVdaBsdrDp25Pl5oFs73Xb8LBPMiXMGtkSLLnu1NWqfsO4jLgWIrYPC/VaMmnbI2w5lHJgJKs4yxEdqWzJK4y28+UZMvtrEo7MYz6MbmEK7G7hDSwPDQ7+J0Sr1ZZ/0uagB3ZVCo+26VaDmVV93YzFTewMkCL2+1ZjFYYeWTAfY0KQj3BbSU6xTPNDirCBvCBuPDNqlHziF1Pdj+nf8FS9YWdQ+N4auIHMU9wRntcWHNwtBnqnaciD5hVPJKk6hXWMSVg== 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=w9bvgYzAPBe7SVrTS1knS/niWNGXh5GFN5/xdO05/qA=; b=ZEC6eVfAHmQVqpU7lud1E8n2mZtVmkCxzPuVWZgQ1wC1x7XTtLJpPPEQazS0rdqW1/N76OBRhhgg+kAwat26UpLA+MCovGXHANyC53uZmL6CAJVjCDbI8bpEsQ8tzzHB+M5wi9950gCrSaEQ20oek2Qt/RgRAcj4Xy9M7IaxH1s= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS7PR10MB5039.namprd10.prod.outlook.com (2603:10b6:5:3a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 14:40:18 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324%4]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 14:40:18 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, akpm@linux-foundation.org, willy@infradead.org, dchinner@redhat.com, tytso@mit.edu, hch@lst.de, martin.petersen@oracle.com, nilay@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ojaswin@linux.ibm.com, p.raghav@samsung.com, jbongio@google.com, okiselev@amazon.com, John Garry Subject: [PATCH RFC 2/7] filemap: Change mapping_set_folio_min_order() -> mapping_set_folio_orders() Date: Mon, 22 Apr 2024 14:39:18 +0000 Message-Id: <20240422143923.3927601-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240422143923.3927601-1-john.g.garry@oracle.com> References: <20240422143923.3927601-1-john.g.garry@oracle.com> X-ClientProxiedBy: BY5PR16CA0035.namprd16.prod.outlook.com (2603:10b6:a03:1a0::48) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS7PR10MB5039:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e76b849-5a74-4017-07f1-08dc62da2121 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JMF0w3QTBlSM8PWYRst+2rcu/ChTfygJO/t/LRxs8/sP8rgfF3DfULv1zKAR51gJ7ufqyws7pnSBkcutwKMQbym2Ac4Qav6KmfTQtsd4VhxF6KTKFuCKBj7j5tKHvJJM36xn+0QGdFWUwejDidBIL/Oz1e6Q5xx0ALZmAA00sDJe4irU9bgwPGanjMC/ESq5oCqSg3/1i9CTnqleDIzO/1qKp9GERnhBX9DSd6F/aRNJft98es56ZcNTzTIhJylsD3BKFtrk/aW3qg3tTUeIhvX5BI0FtR8Rf434Lm67kOeyWHX6JiCcDnd4dhTQ8ysg7cXOjDk+i2MbQ/H1NCj4ITiHbjpbb+z5k5K2/S6bgbSFG0/j1AfVDpEITKE226zBoifoTDiq/0u28IyV74YOYrMgihDPmTARj60cY61zw8LbZgZ08FZhHlhauRyH9RzP9mJqvU7sHzfbrWAd0YCJELuv9xFI883WOmtyjfveEN8Y0wpopggT3cRiyOWwxdN9KMJDyHZHtvzhQE8ES3/2Qti22AxX8RuERVppjrqAxxmf388SiJhRPIhBnKpi6vT8+xGwuqTweRf7/hQWg4nET2JzyGzwzHk1tKkK6+W6Ar/XFmFj43l2fBGfrDStq7aUbPLlbPJlXBFc7C+5fFBFTsqHDk/xrnQDieU8+kN/h9X1XYVSPxfuJTXCyhUqErms7m5fZyhaD24AINVbio6CNt85u0VBqJXw6QJZoVt/MfksCREKCTef2V1Q/TjTuwDrW5WsRAbiHsFcjurzUlfzQ+bR0O+5Afyr/8Fs76yrdhj0ofhBKh4GQ/r59edz1U0tA4BRojkwcXD21oxrPn3uVrGqWvC0RZwufDEEYZWjJm3RAfXNp9/gM3Xh+gMgheF/vMywkaVYQTOYGt8AiD1uwyo7uvPfpGWTFMwRgqJeWy/NoCtLpaqCKBdHEJrOWi3cFQjVdBFNWvASq3bz9LhmUO4pyZsDlQaJQSXxhhK4hROa/QBE25+T2wTeKQp98vjfksil3HS4LLkkZ7qrQj42xxPkgGIbcoAEKDo1d48BW1983dbNp+A7HAFRnUBy7bU9LjmuB/08CxNjxvKezf8kJ2OMeuaRH+6dtXAkecJQ8aqL0SrzGW6jCBcK0YzUa2KRxm2K4//q8XMv1aqTxFDZj/SyxjU7M6X8Shmevy1BUy4333rvbvUFE3L57ebOZXP6bEbWc83ma8/qfliZNSXoB062FB8twhjc3Q781iDTHvX14lc0veu5qWQOmvEAC/M5rnqHk+LYXeaKqH+u7qMhiJ7BgMBQ83dZ9YVVuOeVdInY9ZO3CCZWsgYqlk1TDGXD 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)(376005)(7416005)(1800799015)(366007)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PyLHnOJ6D8Fq+4GiQZRAmZTEc8KeLLYMnevYl9z13ck2eidLMQKW2dqW4Og1AqkO7Wkl59vNG4u7k3c35Yjs0YTihb3skka5IIwUKjCb3qtOEo4uEDly1dBAvZF4PuXN7xlWIcQiHBM+Y6rWzN/wW2kcnss7CriEm0QVwX1QR56etD/KYx5Wv0HYZU8q5gLYvL3gqg88mIUQ+pZkm+3mG21SgEZn/1mxFpAiG5DSwRUr1bd/Xy3AEZxreEWGSEtVspS46vKmLSyxTW8rxj1Ozo86KJoawZ9EXeXD60GTnWiA4OS/6lg7A3/A3jYSLQGXgOzctn45KK8AoNpmKjQav4qiyzmT1HnkR+59VVCvIpfLycNhS+snavIOAsUxoH7O7/5tY8F/bygd4q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E1w5ie5t8IzH/L5xa1AIcCP2MqVQBD2mehSOXXIchly5toekjM/0rFs2bL5tebhyLHq441Almw9U04kKxeZbwGDCy9Dzh7HFi10nyPs+Ke6njL6BmSSQx84L08zjWwEQDaUzdOMwir39c6IponjFKN8GSSP36MQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: pXJby91Cr/XZ1zSVpDgbxDPU7hOig02/ZEAI6CZ1wTthpbZK6EvsqXygsFIN5LSOnJaV32UzFPcY83EUzRLU9YN18GXPVx3/BPMi5OXH39y0it9nm6gIEal6z+5xEkJzEosGTJx3wThT6Ji9bk38vOMh8ellnj7ECuGy4eJlCTCLhCEsltNTAr+fhgH1mNVwlalZwOtBloCGvxNSuRmMVhhjHh1XC/wO2kOOVL7W5T4b9W/rqa8ilTnwdZ36OUSaFvUJ83GAL6cmdwLvNPyphHf1scH5ibUHiXPuO7E1tzpEr/87QpjkviT66dOfTTfGZkxA9dRByKN8JQaRXyIhJdbB0UfAbFE9EL/jF4OxZkyR8QMAaqI1pkPX2ujRqx/ok/VL/ZwZ+zzgYh/iR80WX8S1ln5ZGhzMBx8v8N6s8t6yCjeYDMgbO6MV8xIe298Goa6ehgIZSqAPCerzXubqFCZ8oVf2m/yNur6CgM2kT0hPGaU0Dtblm8iznRHw0bSuiK7HBYv1AKq3QjU3RDylsdhxBuq+2Z8UBACovVZozghORQA3XpZUwwGSwblPYK8MlJqpGU7pLZXoen5MI7HdV2SNxQl3dAxe/4G/02WEOeI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e76b849-5a74-4017-07f1-08dc62da2121 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 14:40:17.9314 (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: ML4EbKXfKp4HiekFkBo2oJzs1royAEBnQSPMJqDeHqaOLeinDfgfOgy2qhyyOLiH/45jXX+K0+q9/vUdO5muYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404220063 X-Proofpoint-GUID: kzUEw02_L7fTn2fN7F-S2VY4mSS_MU6l X-Proofpoint-ORIG-GUID: kzUEw02_L7fTn2fN7F-S2VY4mSS_MU6l Borrowed from: https://lore.kernel.org/linux-fsdevel/20240213093713.1753368-2-kernel@pankajraghav.com/ (credit given in due course) We will need to be able to only use a single folio order for buffered atomic writes, so allow the mapping folio order min and max be set. We still have the restriction of not being able to support order-1 folios - it will be required to lift this limit at some stage. Signed-off-by: John Garry --- fs/xfs/xfs_icache.c | 10 ++++++---- include/linux/pagemap.h | 20 +++++++++++++------- mm/filemap.c | 8 +++++++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 8fb5cf0f5a09..6186887bd6ff 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -89,8 +89,9 @@ xfs_inode_alloc( /* VFS doesn't initialise i_mode or i_state! */ VFS_I(ip)->i_mode = 0; VFS_I(ip)->i_state = 0; - mapping_set_folio_min_order(VFS_I(ip)->i_mapping, - M_IGEO(mp)->min_folio_order); + mapping_set_folio_orders(VFS_I(ip)->i_mapping, + M_IGEO(mp)->min_folio_order, + MAX_PAGECACHE_ORDER); XFS_STATS_INC(mp, vn_active); ASSERT(atomic_read(&ip->i_pincount) == 0); @@ -325,8 +326,9 @@ xfs_reinit_inode( inode->i_rdev = dev; inode->i_uid = uid; inode->i_gid = gid; - mapping_set_folio_min_order(inode->i_mapping, - M_IGEO(mp)->min_folio_order); + mapping_set_folio_orders(inode->i_mapping, + M_IGEO(mp)->min_folio_order, + MAX_PAGECACHE_ORDER); return error; } diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index fc8eb9c94e9c..c22455fa28a1 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -363,9 +363,10 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) #endif /* - * mapping_set_folio_min_order() - Set the minimum folio order + * mapping_set_folio_orders() - Set the minimum and max folio order * @mapping: The address_space. * @min: Minimum folio order (between 0-MAX_PAGECACHE_ORDER inclusive). + * @max: Maximum folio order (between 0-MAX_PAGECACHE_ORDER inclusive). * * The filesystem should call this function in its inode constructor to * indicate which base size of folio the VFS can use to cache the contents @@ -376,15 +377,20 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask) * Context: This should not be called while the inode is active as it * is non-atomic. */ -static inline void mapping_set_folio_min_order(struct address_space *mapping, - unsigned int min) + +static inline void mapping_set_folio_orders(struct address_space *mapping, + unsigned int min, unsigned int max) { - if (min > MAX_PAGECACHE_ORDER) - min = MAX_PAGECACHE_ORDER; + if (min == 1) + min = 2; + if (max < min) + max = min; + if (max > MAX_PAGECACHE_ORDER) + max = MAX_PAGECACHE_ORDER; mapping->flags = (mapping->flags & ~AS_FOLIO_ORDER_MASK) | (min << AS_FOLIO_ORDER_MIN) | - (MAX_PAGECACHE_ORDER << AS_FOLIO_ORDER_MAX); + (max << AS_FOLIO_ORDER_MAX); } /** @@ -400,7 +406,7 @@ static inline void mapping_set_folio_min_order(struct address_space *mapping, */ static inline void mapping_set_large_folios(struct address_space *mapping) { - mapping_set_folio_min_order(mapping, 0); + mapping_set_folio_orders(mapping, 0, MAX_PAGECACHE_ORDER); } static inline unsigned int mapping_max_folio_order(struct address_space *mapping) diff --git a/mm/filemap.c b/mm/filemap.c index d81530b0aac0..d5effe50ddcb 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1898,9 +1898,15 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, no_page: if (!folio && (fgp_flags & FGP_CREAT)) { unsigned int min_order = mapping_min_folio_order(mapping); - unsigned int order = max(min_order, FGF_GET_ORDER(fgp_flags)); + unsigned int max_order = mapping_max_folio_order(mapping); + unsigned int order = FGF_GET_ORDER(fgp_flags); int err; + if (order > max_order) + order = max_order; + else if (order < min_order) + order = max_order; + index = mapping_align_start_index(mapping, index); if ((fgp_flags & FGP_WRITE) && mapping_can_writeback(mapping)) From patchwork Mon Apr 22 14:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13638590 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 C0AA0136988; Mon, 22 Apr 2024 14:40:57 +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=1713796859; cv=fail; b=rcokqZJnvRKY/B2692CDrRk+Ce9QlnLvZPwo3Vmzg/RTJPuiKAluSBUo3K3kkyuJp1cgQMx4Zbq7ZX0y8bN3v/Wzz88ovv/Jx3X51wq9ARRRtT58+bnCFTHs2ot2H6OibwqXmXjPo9iumUgcAjyYXVMv7VBPa6Z/Xx2xGdMMd2Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713796859; c=relaxed/simple; bh=yXg7sp4hk1jqIHnV1Mc7hv2S3RUsHXAi68bmDFkkrEE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ExRkfEoDOfKdiMS9ICgOp7Jx2xLdRAzDaGwApfzk7s1LbOn+59/mxc6mqWX3fRGPEwT4LCydGGJ1ENAFbJ9b0g1M2PWqcESTJT4ppOt5w9c9KIrsDgEbG6pGu+D535LqIHkZzIFABuNiFts/IwdEsABYswONxQut8C4NuiA+XIo= 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; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=ZUi1MXUm; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=mcTCa1SB; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ZUi1MXUm"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="mcTCa1SB" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDZCwK020759; Mon, 22 Apr 2024 14:40:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=U019sOBA7Tr3hBdd6zCAzE9UG7fqx/aDZtB3xmfwiDA=; b=ZUi1MXUmW+XHiUWdaYjQ20f/ab/y/RhRAPdbQ+irnnN09HyaIsPLIEH1GerGIr3qMpan 8pNV51QnvW75h82EIzkI1sAHzPlzoc44JgG83P5jbVybWT1KAqC+5cpuDZ8xMoRz+l9W BWeWpnvJt0nRmAYgU+11c3mlIUVQV2aFI3H0T+FxPkrqwhcwlzB4ARljLRmJAEwKQqMa ZknNfPf0XZ+icqt2A51Ec4V/4W/n/ZR5vIeIbI4ZLqatSO7Qarl7zNj+rQhzUVFJGJ99 HYh/o7Zg2tUmvEWuWXRgCTaDzsZBJY0pE1Y8+dFERr+mvVBhF67wkCfRfCFjjT3KWEtK /g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm4md2vsa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:25 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDtjG4006759; Mon, 22 Apr 2024 14:40:23 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xm455qkvn-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FZN2IsXA1lyXRMt3Be/ekdtuT2x9sn18xXC/kI3ZnQiEFUGAccccrvbUG8YLWJduy2mpu7ItJW48s8QNHZdXyEPNENNOA1S4nbDtvYBhoBDfBdM98zE2+Rtcu+Tf0vhY2k6yuCz2naS4Th8ddXF1vObMxoRELft+Zv4SeT77zBxTEUtTlpAXM8kEhPJ7+GDuwxWGmy8P4XCL/F1iTKjctrz6mHm33l/WIKY9c5qvMZsZopA1b/gQabKbxwL1itMbcv1svs1zA7FQyctLVIgMtsK46iJVu+HLHHa3GroB+5XHorfOuSFEgxFKjPh2waE/Nqc+T5wgQMbnwEZg27GUmw== 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=U019sOBA7Tr3hBdd6zCAzE9UG7fqx/aDZtB3xmfwiDA=; b=GTMRfIkpPdDbv/773VyjO/IsdM9bZ9yzCnIbvOAGQYjPSRJT5789oelYAJl6Yu+POPHbutMwULkZDzK5G0FDPNPllJ9lkS4HjNVH0XUPuqlj4kcfgui8AETFF51NBaHKJX6nKbO6fdSLQp+I2fquuMR8uy1Vy+VlZU/WckysrH6UJLP1fKIPvTN5JUJy/ANcdw2rpna2cMUsrT74mnF32Vn+mDM3yfP6tb/d2+/jkq6XEsm8XumJUO+KKUo0u80R2vPa5b+ZtEIluGnJMz6iosrCIBFZGnt7TG8SkCd9aS13gvEimykhIrcJOY8SgdAyd+LCFSk0vj7Q+wRGaPQCng== 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=U019sOBA7Tr3hBdd6zCAzE9UG7fqx/aDZtB3xmfwiDA=; b=mcTCa1SBa6DN2Cf1bzRhhYJr8m1GAqfBjEOiHa+1kVbEJvxsjArZnloEDZEoG4iEazvXigClp04NR9wLs5l7pdImzRyU2XZlxqETcGjJqEKN2THVUAfmIkAI6v4C4rUtvsxtxZhoXwyCZiRrPEleLmjQxHzM2ShDlZJR0MKkVfg= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS7PR10MB5039.namprd10.prod.outlook.com (2603:10b6:5:3a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 14:40:20 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324%4]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 14:40:20 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, akpm@linux-foundation.org, willy@infradead.org, dchinner@redhat.com, tytso@mit.edu, hch@lst.de, martin.petersen@oracle.com, nilay@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ojaswin@linux.ibm.com, p.raghav@samsung.com, jbongio@google.com, okiselev@amazon.com, John Garry Subject: [PATCH RFC 3/7] mm: Add PG_atomic Date: Mon, 22 Apr 2024 14:39:19 +0000 Message-Id: <20240422143923.3927601-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240422143923.3927601-1-john.g.garry@oracle.com> References: <20240422143923.3927601-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR03CA0031.namprd03.prod.outlook.com (2603:10b6:a02:a8::44) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS7PR10MB5039:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ea15031-45a0-4566-b7b1-08dc62da2263 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mcguabszj3MJDFuMdkJ5jJ6YEHSQPMLGjq9QFURznBUBLlxCLJyatz6oLzaV8ANif6nXVqr4MaBtTSpvrBs0xhm1Grdw7NRl55ycEILDjomhDjrsrDFjd6vzrQUtO4+d8y+D2C86UVDMQj7B44HKPnyAx9J22IVV6hCoer8TNGXYe8pL8qOPiUrRZRnUs/JTnlF6fjj5tmdLnx7AZeFLtm1P5TR+BbV0t8uK2jwrdagoefJj/H1c1Rp3Un4RUcyisXL5U9YVXjXQhnmnYG50usTnO2lYp0kN+GdvWtRREi4nKmALtFTLMCfyAMX2YX3kqjxLENvjdiRqgSibWX6WRwHjJWur0kqCqdxEwyc9heRyKAdwnTfJo79DfK/eFdvHrNrTY/aEhDhkgKnD5XBbNmC2W9je3JRfQlkDrTMcLRQ4g/7xuuGrS8bqDsyUlaTCz1xEQk+cHbjk1z9xm7fm+d1HA2Snwp73LbX2QTUvRrO+fZ9Rl5Xw2HHGP3hchMt2iHHjlsYjGYbFPOgx/4YF37ZE5o81JXJ+y3RksNWsj7f3bLT0ZTls1UjmdO36csz/XVd7IJ8dGVSJ+2jmFn2k5bZQ/umR+UKtJQC+fzVISAhjZYNqvVAzOB6IfJDqzo7VoKRjcIIrK4+/bGqwi5klB3oqyBcHw6ohhtT+RySogkQWwaeLX8t9twst91paLcBnpzClCFedc9laS4J0EYB+teMXhYbcmYsggOqgvUpmyypGCSAXPzS5vBMq5kI91b9RBKSbjhpUjZ2q+e1d2f3E9xFvNBfmz0hi2GMlnEyTBTpb/XEBtpPHiO9/5zEMhtIxNWsvsNaQx16vGxNI1QHoK4KUW7QH7CuWQq+P47rwWM4jWSXl94Qn757EWXRV1yN3V8DVzgmUEwGox6zdDCO3nSLVN9wKv0E5EpNyHNCricjKHld9Kp5UdsM5vTz/hfGDctYjOiIbX35yJXczCdIjKuKSxJccM4pEMTKLnYFhoOHjieydVUA4vxeFxtvyvhuGbZCGkkPf9fflToO4GNIEUJCDYUIjSO6Y5N03wJOpgnJvkfBzXqsysxpy4PQjdyHZuf2sEJo224XceOYUp7d3Bka2XjZBowQ1e9NGFcDZDuaHPSgUaAyOhHc/g5/n0mBR1qnE4jrLMXBoNKfGNrohlj1/rcsm00uOcioJ7QXBgy4B7s6YV24lOkWOD07NCQSAHBjFaz98G6p6860kX74/rSR2ExymovK2zrCpcBcp5Od/iX7bS2YhgAf8cHykA8qPbfz1zS595R0FNE5DD1z3rb3VKZs7Z5rTMzbDc0dh4SZuSX/KggIHyLrfULbdgLpZ 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)(376005)(7416005)(1800799015)(366007)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jCOzNgL/l+cQG3vPm8CE+Uadf+u2m6X58RG58dvcX2/BPlIcV1QaAXUGk9+8snFUEw5INaKnmtkvjFjBm/WPjsePmjqjbcLkokcxbVDZk697nv1cjEzcZpqxjyidpwIQKkR3cgW0K4s2eoQoOuJVbcm3ERa7cV2N2eB2GAoN2sPQbiQbVREcsmTUK+bOjcRMjeAd03nOUg1jubkQ8MOKV1HpQehvDX4J1P0fWynZOXhs60Z960/bZNYqtpr3TbxT2L+1FG89tyeojr3FYmxEb9fFR8BxgnBb4aJ5XJYWoenxCg8JeEa6vmUdYanjrD+VYR6jrAn2Ps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A5zDlaFsxbUxbT5P/hwXzytxu0J6I7Kv++vhNKbJC9bvh00o2aTStgLbNafhkf6TUmBgS3nciiJ94HTI0Dj66+EoZQ1xgn2mQf5rVGDkgBY8Ix7UeuJYgS82WqDX/atwXrR3Hh2CWtqnNj9qCG6+/FboSNjXaGWbhjNYRr0lxhdQsHOFewhjUNTU+LDgrpWNyUCthA2aXRaIz93a6cEglgZgLkXLqzeA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: omMSYl1mVrp5Jdk02TpoY4Pbap9ziCb1YFeIr/Tq9zgwrB8J52Afmu9rjQOMnroj+uuhKkvcDQ62DP+5I1OpUCPBtJpcVjEzIxwVtG4OYOMnBejUQA5WDKtqfLhzQbYS6dMnjnaKB3PJHeBdJdWKNlRGLmApF3LFHv5pTPnbJ+GEG0lszeVdGyX8CUfE9SJCUrvhjnHsVZcuFsCq1uoWAIk1tnv9nVRBWus5c313edIsfGoCB9pjrZJDyBzn9MU30+ssszA1TO4OFP4wovPYFH/m2oW5OCm73Ejt9UcXi6Ra7a5JTc/25EdMAgonZmEIetiBL0GhdvxlwrowMyu4t8Fy6dfb646vpDVQqYNomqxrPTOLI1R0+fxwJD5Wbp2PUQSIPE12KrGDUca2UbXpMG85WhEuudNxqwQpVTEYyOKhUBmZg4UAeTtk27Zdu/Zlhs0b5f2rdlkRsxFmLgpOzxsdTxb1GF8Od5U/uqtbCfSqRTh3JNUJ2JfhSB6I2WEq3AkRXoonBPiCepdR2asJf6D9yen4d1LzIK9JYwSguu00qpiPk1SZWTeUIyLjaMI4LMa1GdtVWNM1BCvvTZ6l2cjD3w8CQqLdGyOqb/0OT2s= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ea15031-45a0-4566-b7b1-08dc62da2263 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 14:40:20.0586 (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: MqHnCLDSVcqtiwTfWkzMxj9kvoiLlATzjbf4Ff9ud9UNUEmhAu6MQcdakpQlUC9qYJCM3Nt+WI4xl3shVl+Dug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404220063 X-Proofpoint-ORIG-GUID: TiVG24EcCOMRGxlQURS2tmXuWrAhvNU0 X-Proofpoint-GUID: TiVG24EcCOMRGxlQURS2tmXuWrAhvNU0 Add page flag PG_atomic, meaning that a folio needs to be written back atomically. Signed-off-by: John Garry --- include/linux/page-flags.h | 5 +++++ include/trace/events/mmflags.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 652d77805e99..e777b2e7daaf 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -119,6 +119,7 @@ enum pageflags { PG_reclaim, /* To be reclaimed asap */ PG_swapbacked, /* Page is backed by RAM/swap */ PG_unevictable, /* Page is "unevictable" */ + PG_atomic, #ifdef CONFIG_MMU PG_mlocked, /* Page is vma mlocked */ #endif @@ -579,6 +580,10 @@ PAGEFLAG(Unevictable, unevictable, PF_HEAD) __CLEARPAGEFLAG(Unevictable, unevictable, PF_HEAD) TESTCLEARFLAG(Unevictable, unevictable, PF_HEAD) +PAGEFLAG(Atomic, atomic, PF_HEAD) + __CLEARPAGEFLAG(Atomic, atomic, PF_HEAD) + TESTCLEARFLAG(Atomic, atomic, PF_HEAD) + #ifdef CONFIG_MMU PAGEFLAG(Mlocked, mlocked, PF_NO_TAIL) __CLEARPAGEFLAG(Mlocked, mlocked, PF_NO_TAIL) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index d801409b33cf..3c83e7b93898 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -118,7 +118,8 @@ DEF_PAGEFLAG_NAME(mappedtodisk), \ DEF_PAGEFLAG_NAME(reclaim), \ DEF_PAGEFLAG_NAME(swapbacked), \ - DEF_PAGEFLAG_NAME(unevictable) \ + DEF_PAGEFLAG_NAME(unevictable), \ + DEF_PAGEFLAG_NAME(atomic) \ IF_HAVE_PG_MLOCK(mlocked) \ IF_HAVE_PG_UNCACHED(uncached) \ IF_HAVE_PG_HWPOISON(hwpoison) \ From patchwork Mon Apr 22 14:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13638588 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 0D46F1514F2; Mon, 22 Apr 2024 14:40:56 +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=1713796858; cv=fail; b=frXahRyIPr2lCplR6et/H1+jtIxFMy0ovXSLVIgeAkOn+zzd6WeHNyiLo2L11CpMqXRUDpdgoY+zSJrvrIZSdMXx4M/upGtVzxCnzz4yvjp5vT6CCcWf/Cf3mT7czwjn5PT5AJ8Ogr9Pum3Fj7hd6qQN5OkpHoblZZrgU4Nz5+0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713796858; c=relaxed/simple; bh=eR5GF6zkNHtRoTGcBz4fQyZQGOXKmq0dO+a+s/0pQX8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Xv0ycLQCMELYb0ivEXbp80CCw/unumSJDkSKZLl2wpRmgmy6bXecL/Z/oL/5yCXDYBLKNcVLQk3w9coYpkBG7Ma5Md9J0b6kZnl1TxrBBinBE6B8H7nqNcN4Cto5Lf0h42wIV+8dPFyaA1ODfETmrOSqbvo8gOW/K/D+N3/TfhU= 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; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=JKNx7Css; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=bMnDHCBI; arc=fail smtp.client-ip=205.220.177.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="JKNx7Css"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="bMnDHCBI" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDYCVD028754; Mon, 22 Apr 2024 14:40:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=2Xn5Oquli+l4IsJVekV6nhgZjHWFufS+Ek7zvaqQCU4=; b=JKNx7CssMorgnQUZmuCkJoAVMCuow0teeKlxedHi7FWKRFz/w2HWlaBG0VVsn3AFKVpq KrNP3+7rDRK5/V3n8kWWUqdizyJrUzdkCNP/97YUsKW2Wowo3J27LfM+flqxptfeAKMi IqW39rC6kSKzSEHD/OJJsZfVaBT1earVoKrBgKrzBRqJeiI+I+zBLvnV8osZHgvzV6cX mfJY8KhED26EcEB/Iw/H5lJBExy/VFCNG8Fux/lEFPa9WiKHkXkbqsX7SMsDIeD26fQS GIeS7SYr6doMlKLtcTgtUMI+IDaWZhvgAjokoB5dhjWMPX2dPSWu8U+JADpqUCsR6Vcr Ug== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm5aujsyc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:26 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43ME3wk7034978; Mon, 22 Apr 2024 14:40:25 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xm455qv7e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CBOixMceyXTbiX3f3BVna0tDjF5ue0lShPvXs1t8SU18kqsgNNCHVcYm4Wp/RU6mOi6egJazwpFWau70mbVMPgIAM0mvwuxvrBC5ZJ8aoeOKjEpqztyd0PVEBg2j3AtmCcn4EeuKUTcVDOGHXgkXoDncugTrjTHT0vYyDQdQ/6cC/KaONtawUhsCTAWTXK542EwhV9GSmMFsdEBgXPu0Pn3qW5gqWgMenVwq6avcGv8/m+VjhnLOSCHLeqonig2sdBlvJKvl7mbYKVy65xs3SleoHLkHDNH0RRHxY64zf/cQgeMrWtuXuFthOGtDO5SX9GdBIrCmxoXQSpXnB3sV8A== 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=2Xn5Oquli+l4IsJVekV6nhgZjHWFufS+Ek7zvaqQCU4=; b=RT9xW18nB9grxwzebzh2xDBML3meO1kv6hHwne13cLTzLjzmK3ILf6X2L5/d5i0B9QNuLn1okThyuLBqbRRRSyz7myhBwcUVahBLrBRx/Vb3wTw+OwCkHra8skpZGAS34SOSD/Untc7vkRofXB6TQE4ym4ePpA5QxxF+HVuigL4m4GQxUDKERY2ZhPASH2l2gBhsr2PW7C9oIGAUu7DKvmjSdglCLexG11oRLSOXk37tQ1KqmhiA6DnCIYQl/R0AOkk08qvrvLOM1o+0iGDUjHU/ueGGhpLCQncr0vyU1rDE3veaXq+auWD+pJXkxkTfJLzspc4hHloN2ZagW3CsBg== 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=2Xn5Oquli+l4IsJVekV6nhgZjHWFufS+Ek7zvaqQCU4=; b=bMnDHCBIfpOslhj9Lx5LkS5gP6bncTIcFaw6MnXzUBTZ016scisP3bDfXovS9jjZw58MqmAefSOr2j+5LJ+VXXluFhnSRu+EeTgM1APTgOekO4qQ9QFRUEbG2R91/oyXS9im6FGi0VMsfzC3EWtpeQRxAPSO/8hC+nWCTDrKolw= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS7PR10MB5039.namprd10.prod.outlook.com (2603:10b6:5:3a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 14:40:22 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324%4]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 14:40:22 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, akpm@linux-foundation.org, willy@infradead.org, dchinner@redhat.com, tytso@mit.edu, hch@lst.de, martin.petersen@oracle.com, nilay@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ojaswin@linux.ibm.com, p.raghav@samsung.com, jbongio@google.com, okiselev@amazon.com, John Garry Subject: [PATCH RFC 4/7] fs: Add initial buffered atomic write support info to statx Date: Mon, 22 Apr 2024 14:39:20 +0000 Message-Id: <20240422143923.3927601-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240422143923.3927601-1-john.g.garry@oracle.com> References: <20240422143923.3927601-1-john.g.garry@oracle.com> X-ClientProxiedBy: BY3PR03CA0019.namprd03.prod.outlook.com (2603:10b6:a03:39a::24) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS7PR10MB5039:EE_ X-MS-Office365-Filtering-Correlation-Id: ee42feae-6dcc-4c83-28d1-08dc62da23f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XX0Gxw0SIgb9ELWkJjZyFkOImxruU9LeX65ziGK6XasRsUHirWMUsMhT3wzrOcckw4ZawpIcYOnW0zELpZuTAwdyUC903rGXp9J5Jw7qBSiefGtrdcWAKD5mDn/rnBlO9GP3jf3T+YdaISl7BmfRLa8i5ulWYh8khggg21eqrjE3V29UYROIrQq4HmJMyX+HGYafE7Vr9YzBujA5jzhOwrUJ2timuvRJhN3T47SS8yQfUsMYjk0OEx5M7Vl7vPH3GJol4YlFzZbJqstxW0XbL81g1t8O3a0iMxcyFsxqHhvQHHpeZjFgDlV9xAhObV8SEnkkSkTE0tPBt7A+TNY1gIpr9VBYUO3wmR88uHJr3o0O8YvBBw06UAhXm3dTx5ui/Hi5oPIceqIGg6ksvOtVWIvNAb7nsQRyMVxlDybZ/osl8/h9OK4EakQyqOsioAPTnvI5Pv2jB8HlZuIETxWyywrG2J9BKNT6igkO52flBkYs4l5uTyvWsO1wMRYQYUBbWlo12KehbQC6somr2vO0/IV9J3LuwoSp7+3XqCpfZMG6Oe8wvHu2dhAGfzn6T11UI30OYnAjNt3jHOKdLMFJPsVA7axJ+6Ju4swDwv7lCGpauTEH4ILtYMXJvJhWGR8q7L+X5Z1+0G+kR4iwPM2EEbeQFROrjJyr1RkendjaxCtlry9u6wRhd4sNHddtuafuUW6UQljhz2OCTfIAXOU8hqUncbmHrRaHk2o0r6KOppRErWB6c4ZM5Dpum8/sWwoY1vvBmCYHrTCHO/8AVWQH55X7GrzpPmeOZwq5m+wrsH/prSVXElnOOA0JZiFK/VGxmCNtj2Uv9kG63g2m0RxEyVL3ZC4nVPyPJUarQYvBazPAM5pHg4hu8EKdZ2gTSYPI6K1Q8zjy7gdTvDngRY4Zifpb/PG/wIvHj9maNWVrSB+nmpQf5WNBorzfzRGAcb1kPPKx80KfqNmPTokfmd6+oTjuCtiyyrfZKVQQz/XhNeV9/WU9HMjT7aeaNn8hI5xDkRQSIs7Q6D8fw6vrpADLrO33U2VDWVc4bu0Lq5j/wtwnc/W2Q17kdMsSx9MQsdPyCLOEebGbI7kNNJXtjnnx+TlW0khHaSVyet87IcINyOFnVD5kY6LSPXIhfXhHrJUngKki7zNQALVfRR3aFWfGIVGQii1AhfA8wA3KYQI8DKBRpbZvMjqywogg+hTgM34WAGipZ0wzur0oP7WkXzpu8WGYRyDCDfqDjEi0Kv/2KMgjITJb7Ef99563CVRIFF2e6JsH6aaQtV2KVvYMe4B4NF9dC8CJUDcG7hBKgYUgysW4OrilEwZ42386eZALeE+m 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)(376005)(7416005)(1800799015)(366007)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Iwe/tex1X1AwjdbSJTrRiEM/DNDLbRX4K7C3r69/SIQFmfz4dwCWfABpyZ8A/dKKzdbm/njAS98l3RLSIsbBhGvLBKzzmWvLND6W1dpqDzgh3GN+9zzTZzFFlFyr5DNxbcKuMteqP4Unvvq/HOucaV3OWzaNxe7RXmWtegTDKMcRCqMAtVtryMLWf52GK6R7LmtxqEaBW4ashTM3EPQwA8VZSJ3a3zVq0FM4Y2FYaumHZhIvY0YhSuOpbTPq7Rat6oak51mAV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Nk3myHegVTudoMaVczamp5SYWV2THJXZyCGQf5UyBRijVsWeyXoRYGJm+t5cFphDKZbxlwdqoLGCQpLJTsuejoAK9/qx8MLRDxkVm+y455074CQ5G8ltXklI51MrniOD8F3aLW/avlGOcxJ7CcOEFAZwYd3o16cMWg1Tb5lM6uIk/u59VyqViTb7r0cydX/RpqCwyKze/RJ42yR+FVkUtEoZ5Zly6pv+37Bf+M6XwMCjw59Kk3N4V8oIowjLUmmqBg9VWEX41I1/9pkyiw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: puhXGsFzldkJHKqXdSsn35ncaI4A7IaTjc4fsGo1K1kTyi29SNY86EWE1WwXCkm3fDIJwSuRwvpqZH1yG8sCYFS6ab8vCfpCNw6p9EU7V5B30rD36h/rnZ5PhSgF65d6lQl0rPWwcmuLOIf06oP10RVYosHS1mglKkFa+Alrcw15mKQcwXh2jmbMjYi+iI/hCu0t84I3H0B08iW7k2J5oHInFZCo69GSCXgFIfL39s/kOJo+rgf1hiQSmNqRQ1NutZxF8eQ+74Qz9MXuL8YAp85LAG+HQMmRKMJ6NWaZmq6HF4GLqvl8oHVQkJ08q7Xdgm1IJ8Ura4GZS4gFDzgzWjZEcQsG22ykAQbYEhJUQkBtaDWeleLDqvYvSfw/s4ss+9YWeHX9SK8HJK2vNIpIl3QgaHc6LxUFgMZBXjTIrYc1siNEw0HQYHXSJUN2NCETeUmesYI8U+NzQ+nDOnd8zOIbZxHWDBb983fxu5etyvikiF1cetcEtW8WbgzfHsB+F+c1+3yRgvBtxN6DJquhvZ5XhoEWmth/PkGhD5OE6Aoo/nkGyuoCoKA45HkGV27kA6+kiF5HskeREnbWCZGvfoLCwoDr74KqSjSEy1v6xSI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee42feae-6dcc-4c83-28d1-08dc62da23f6 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 14:40:22.6363 (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: sD5oj7108LaVvLvDXF0i2efhkFZYYaN4I6ZHW/RhsAzhaeOAjfA2qnQgZgVSz1dntUnL7ybXbcKpsytZSxpsIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404220063 X-Proofpoint-ORIG-GUID: _02o-5q_qYeMjcHU_hlFTTylJf5Tk_QH X-Proofpoint-GUID: _02o-5q_qYeMjcHU_hlFTTylJf5Tk_QH Extend statx system call to return additional info for buffered atomic write support for a file. Currently only direct IO is supported. New flags STATX_WRITE_ATOMIC_BUF and STATX_ATTR_WRITE_ATOMIC_BUF are for indicating whether the file knows and supports buffered atomic writes. Structure statx members stx_atomic_write_unit_{min, max, segments_max} will be reused for bufferd atomic writes. Flags STATX_WRITE_ATOMIC_DIO and STATX_WRITE_ATOMIC_BUF are mutually exclusive. With both flags set, neither fields in statx.result_mask will be set. For buffered atomic writes, stx_atomic_write_unit_{min, max} must hold the same value. Signed-off-by: John Garry --- block/bdev.c | 3 ++- fs/stat.c | 26 ++++++++++++++++++-------- fs/xfs/xfs_iops.c | 2 +- include/linux/fs.h | 3 ++- include/uapi/linux/stat.h | 2 ++ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/block/bdev.c b/block/bdev.c index e2a9951bd2e9..b80c78aed9f6 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -1213,7 +1213,8 @@ void bdev_statx(struct inode *backing_inode, struct kstat *stat, generic_fill_statx_atomic_writes(stat, queue_atomic_write_unit_min_bytes(bd_queue), - queue_atomic_write_unit_max_bytes(bd_queue)); + queue_atomic_write_unit_max_bytes(bd_queue), + true); } blkdev_put_no_open(bdev); diff --git a/fs/stat.c b/fs/stat.c index 0c0c4c22c563..cb8283534616 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -94,19 +94,26 @@ EXPORT_SYMBOL(generic_fill_statx_attr); * @stat: Where to fill in the attribute flags * @unit_min: Minimum supported atomic write length in bytes * @unit_max: Maximum supported atomic write length in bytes + * @dio: Whether filling in the fields for direct-IO * - * Fill in the STATX{_ATTR}_WRITE_ATOMIC_DIO flags in the kstat structure - * from atomic write unit_min and unit_max values. + * Fill in the STATX{_ATTR}_WRITE_ATOMIC_{DIO, BUF} flags in the kstat + * structure from atomic write unit_min and unit_max values. */ void generic_fill_statx_atomic_writes(struct kstat *stat, unsigned int unit_min, - unsigned int unit_max) + unsigned int unit_max, + bool dio) { /* Confirm that the request type is known */ - stat->result_mask |= STATX_WRITE_ATOMIC_DIO; - - /* Confirm that the file attribute type is known */ - stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC_DIO; + if (dio) { + /* Confirm that the request type is known */ + stat->result_mask |= STATX_WRITE_ATOMIC_DIO; + /* Confirm that the file attribute type is known */ + stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC_DIO; + } else { + stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC_BUF; + stat->result_mask |= STATX_WRITE_ATOMIC_BUF; + } if (unit_min) { stat->atomic_write_unit_min = unit_min; @@ -115,7 +122,10 @@ void generic_fill_statx_atomic_writes(struct kstat *stat, stat->atomic_write_segments_max = 1; /* Confirm atomic writes are actually supported */ - stat->attributes |= STATX_ATTR_WRITE_ATOMIC_DIO; + if (dio) + stat->attributes |= STATX_ATTR_WRITE_ATOMIC_DIO; + else + stat->attributes |= STATX_ATTR_WRITE_ATOMIC_BUF; } } EXPORT_SYMBOL_GPL(generic_fill_statx_atomic_writes); diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 37076176db67..05b20c88ff77 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -655,7 +655,7 @@ xfs_vn_getattr( xfs_get_atomic_write_attr(ip, &unit_min, &unit_max); generic_fill_statx_atomic_writes(stat, - unit_min, unit_max); + unit_min, unit_max, true); } fallthrough; default: diff --git a/include/linux/fs.h b/include/linux/fs.h index 08a0b9a4da93..1147d031d5bd 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3243,7 +3243,8 @@ void generic_fillattr(struct mnt_idmap *, u32, struct inode *, struct kstat *); void generic_fill_statx_attr(struct inode *inode, struct kstat *stat); void generic_fill_statx_atomic_writes(struct kstat *stat, unsigned int unit_min, - unsigned int unit_max); + unsigned int unit_max, + bool dio); extern int vfs_getattr_nosec(const struct path *, struct kstat *, u32, unsigned int); extern int vfs_getattr(const struct path *, struct kstat *, u32, unsigned int); void __inode_add_bytes(struct inode *inode, loff_t bytes); diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 05f9720d4030..9eef921b3942 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -161,6 +161,7 @@ struct statx { #define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */ #define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */ #define STATX_WRITE_ATOMIC_DIO 0x00008000U /* Want/got atomic_write_* fields for dio */ +#define STATX_WRITE_ATOMIC_BUF 0x00010000U /* Want/got atomic_write_* fields for non-dio */ #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */ @@ -197,6 +198,7 @@ struct statx { #define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */ #define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */ #define STATX_ATTR_WRITE_ATOMIC_DIO 0x00400000 /* File supports atomic write dio operations */ +#define STATX_ATTR_WRITE_ATOMIC_BUF 0x00800000 /* File supports atomic write non-dio operations */ #endif /* _UAPI_LINUX_STAT_H */ From patchwork Mon Apr 22 14:39:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13638589 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 1F45D15216D; Mon, 22 Apr 2024 14:40:56 +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=1713796858; cv=fail; b=sosn2jCnbcAk7Y25JG4amCBxqF1L53i07ZCsDAC5WYnjp/l7ZQBlOwpvT/ujJZUs3AT1F62qtYrG9Tx7BGmt9+qILeyiLn7HvBg7m98fwLQu+KGbbSErW4xECc+mDc6+qBXcKPWM1qEWxt/yNMdu0jf5H1m6L4+cXlKPwKd5OdA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713796858; c=relaxed/simple; bh=LQNTJS2Dl9j8hWesCuTuvvFAVzuhESZ6PR7W0z7t758=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=uTEWqD6xq1MLIjJE9TtaC7SMuPZ9CS+Ign50dmCjiUMAp1+lZgjUBV4G3F6Fx1lOSLIWcHoyzjw2e8F6wKVJojknWqE4mNHRxuunE2hDk+lWFA4uNOsQXlUF0KnlGyN6NuqvGz+4KoFYuDLQhY8kQUuojc0ZRktfoDRs7RKZlEk= 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; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=BhwPhjuq; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=gwvtoXby; arc=fail smtp.client-ip=205.220.177.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="BhwPhjuq"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="gwvtoXby" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDY0xb005886; Mon, 22 Apr 2024 14:40:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=taroF7H7egrJK7Pw/kJDYZMg7eDmZ06EnDskm+PiDNQ=; b=BhwPhjuqA2w59yTi3pOKNql2zPHiMdb44iHJtEu/VGvDIkO7lFO3adSTjeavzWRKO3AT vl/TS2AqsuK0WerUVG8Wo3w2MRAN3MotD3gNSgZhCdkrp3Mzvg2u8oSFcsDQvAuO3oSN 4HtWOGDft3QlGb498jTn6ohj4l7lGunv0wbQAtv/IJQVz+Bwp4hpEg92JwA//+u2f+r3 DrEprtN8Mf1TS6qFYjmRiPQcMO50W5DcoAv+6a4xlmJliccrO+QAuvbGOYM5o3MJqGSg OTiUYXCZawx617OYoUbLPIJNTKxTC8KM4pypUW+8P2w496nuotEMoMvjd9qmq5z8EYAb pQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm44ettkn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:28 +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 43ME73O6009698; Mon, 22 Apr 2024 14:40:28 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xm45byksu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mwAtI3CEaGPPWnGHKziNieOCqMQbroxTDMRxBx/JUdOvb7noVfEWwUaocKztXUnx/3z7Snrr7RCjXE3MVRDSgjtI5Kpevi6JF2jo0tHhh8ouBiYrcmSXNO/DdoMJUfmof3c+WufKIuo40C06XqEA417QNKp+Lu4YXPXKB4Cx8xUsxP8YruF5n6GxNTL6gjnKPlc1BEWnQw4Qn1XuMGE1pI377XDvtDJUYaeMCvdQwbUV7VmVtlMyBqZfzuAbc6oglQ/TloHj5VJpA+LUli2t4RK73EFABk+kB5ub+8mlr6+0Qk43NaAfYXD/4ZU4/6+Hm4LLwzwOgQWyzhwr6CG2Wg== 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=taroF7H7egrJK7Pw/kJDYZMg7eDmZ06EnDskm+PiDNQ=; b=jlEevv2OWZMz2z6zBk+x5vRX0Ihw73Wx88kmQ7jeuOVVKSt0CTbYfUGaaDViBVE++IemGS79qss5lI23obwkXrVgzdjgATXdvChJT1yak7+rIh7XbRUbuxAolCsNKzBJN72Jr5Oz2s/q9e94zRManbO8isTD1wRf/3s7ZQYY4FRhTwa6gws3r0wjTIAXUeD0lvbf8XKCXE+iiIkUr9MYWfK3n2xaoOpKxC9fF8tJNRX4zND4zsBVGqeSRha0KdTCF0uhf3FlMuiAOA50TqZKcR1xf2rlYjA3zMyW5ctrMgPh7jdgATIvz6ronfA6tjuU+YsWUjQNoHIMsCV5pWZupg== 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=taroF7H7egrJK7Pw/kJDYZMg7eDmZ06EnDskm+PiDNQ=; b=gwvtoXbycNJ5Rsk+5JGG1KpyyiIZ+X70TYG4R7t5INa7Qp18jI1h/jFjKX1WU/rzPZlZgh22RjEGjU7uklLmz9dtPNnOx55kVRK05EVt2EqItXcjgxIZ/2aFl+5w40KOEWO8vcbpq3abre4O2EhdiSg84+3F802WD2RntGK67D8= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS7PR10MB5039.namprd10.prod.outlook.com (2603:10b6:5:3a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 14:40:25 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324%4]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 14:40:25 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, akpm@linux-foundation.org, willy@infradead.org, dchinner@redhat.com, tytso@mit.edu, hch@lst.de, martin.petersen@oracle.com, nilay@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ojaswin@linux.ibm.com, p.raghav@samsung.com, jbongio@google.com, okiselev@amazon.com, John Garry Subject: [PATCH RFC 5/7] fs: iomap: buffered atomic write support Date: Mon, 22 Apr 2024 14:39:21 +0000 Message-Id: <20240422143923.3927601-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240422143923.3927601-1-john.g.garry@oracle.com> References: <20240422143923.3927601-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR03CA0024.namprd03.prod.outlook.com (2603:10b6:a02:a8::37) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS7PR10MB5039:EE_ X-MS-Office365-Filtering-Correlation-Id: eb47ac47-80ae-4058-f4c4-08dc62da2548 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rB1eh7mcGR5wskUc5CTOWu8lvYeN1OtwR5jSSIhzmB4Ljyz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/Xs5ey6si9EbFwrMCoHAnL96Y8K2QHMFah/7xWw5/uys0YKuf3IO4wB4+2+9YckqnOSEZDymblTT1Zu62EvwyzyYmhy5rahTOBdA8WS+TvetpsnsYuGor71j9t9LXfu8nkNWUVIukh8AjF2Gzkm21KkZYQgvYC5RX7djDY5pg4lMw88+CtcSLhAH2tvYEARfYE/cQwGagikJT9C1ysDhP 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)(376005)(7416005)(1800799015)(366007)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w8gviT6NdX1aPPpzDJ+HJITzUAvCC5Vd7mzgfsmPlnBx2ZpeMhSbqaWsL8SQmKnUGpvgOFiIxhYVH8IopqDLLXnG3lrZ6H2pUAAMLUu5atujv/uYy8n88003DMJkXTX8MHvchtIzc+WqSI3LJWq8HslIOHYKuJB57GlRuayMXKD2VHwbkBACPOyjl6H/p5Qn6pOYsGRvDCYnGr5WZH0Ou+0eUnJtKQ52HYNyea8XAZYBGAiVpkhJR9x8uY+m84+9hNzv2+6k06fKBUETCyZmVmNcORBJicjUbK3hez6V+OXhHZUlI4iaQRgFAGapnDvpwIPXncjuK+ZPWhD1HMtRFUhQEfPkYY39M3rEBn5s0gx/QRRV8inIZXgGE0p0iL4aIOalxIsWiCS2lOVIwyd6Rw566N5UnGTdw3xpRvFndoXx9BMNuqWeKPbvpTpI++W9s3vnlLKpH5Z1+XG9VG8WWEuEPS4PlGyaTmyUqOVlEvzdvYqa+PcXJgqxmkdl8bkViPUxHYbV0ZjuGWTc/TPE3kpbTs9WvdiGOc1GlAPnJFdL3V1BegcjRYZHvzHX0q3xsdEby7TB6hO/uvpAbhJQILBTT8/muFLmeaj/v3IhhfMPJxLzdzL0bXutCF9WiYwHo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O+Tg8rkrUVaokUubVJfp6BvBCGHJAUcSJdggzUrpH69d1HTge/ZT2Y3zvxTm3rydZTtnTEsip83fkpYlGeiep+oecH4RK7PharPcQAf6gRT7rOyEZLg76t1VEADyR0RPTpq0r4JsMubT6kFtpS8sCLnPpDqfg9AKyUwlHbx+j1H8Y3V1xBlHfjJ9rI0Sv1iayPSuDgbMYGuVcG+0gjskz/N+2z1fva85a9Ici9uBjBpkanLb6f6NMPM5ycEzAL0HCOnvjfb8zd8CXk+7CNAqNFK/v2WbDvgOPhbTvkYr7sjK3s1IxGJMb4qAJMnIWq001L7sA+vUcerJDLHQRvJNrrmsZah6/hEMgH6IE6ICdvZW+mnvDGLMh/jkkJiG4B6xGtiEkf9AI5SgpswYxFk06HvN2YJ+Ae+m1oAxLfgC21aOMeLAEK479RKs5v3vOIGiu0Rdiwf4PnvaWFqeAocWaTLlB2zziRLlNoZrxgUNKZKYwlLe4cAf/KCYlFaKaqxlMbo3+1hwTudWUZpyRL1Opb6gCNVXIvSmnUOmKn60stzsX8cLzXtSa9M+wkygRStb2CN0xn1h9vtois= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb47ac47-80ae-4058-f4c4-08dc62da2548 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 14:40:24.9493 (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: EyU4QUJSaQShh/uz0X8SuIHChrzKdgWW4JnX4FDZqVPcC9M6VzKos8zWICuVqoH2/i1W16eHhi/cjgc6nppZKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404220063 X-Proofpoint-ORIG-GUID: de4RcoK0WpeaFunLdETakunvmUYU-xgk X-Proofpoint-GUID: de4RcoK0WpeaFunLdETakunvmUYU-xgk Add special handling of PG_atomic flag to iomap buffered write path. To flag an iomap iter for an atomic write, set IOMAP_ATOMIC. For a folio associated with a write which has IOMAP_ATOMIC set, set PG_atomic. Otherwise, when IOMAP_ATOMIC is unset, clear PG_atomic. This means that for an "atomic" folio which has not been written back, it loses it "atomicity". So if userspace issues a write with RWF_ATOMIC set and another write with RWF_ATOMIC unset and which fully or partially overwrites that same region as the first write, that folio is not written back atomically. For such a scenario to occur, it would be considered a userspace usage error. To ensure that a buffered atomic write is written back atomically when the write syscall returns, RWF_SYNC or similar needs to be used (in conjunction with RWF_ATOMIC). As a safety check, when getting a folio for an atomic write in iomap_get_folio(), ensure that the length matches the inode mapping folio order-limit. Only a single BIO should ever be submitted for an atomic write. So modify iomap_add_to_ioend() to ensure that we don't try to write back an atomic folio as part of a larger mixed-atomicity BIO. In iomap_alloc_ioend(), handle an atomic write by setting REQ_ATOMIC for the allocated BIO. When a folio is written back, again clear PG_atomic, as it is no longer required. I assume it will not be needlessly written back a second time... Signed-off-by: John Garry --- fs/iomap/buffered-io.c | 53 ++++++++++++++++++++++++++++++++++++------ fs/iomap/trace.h | 3 ++- include/linux/iomap.h | 1 + 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 4e8e41c8b3c0..ac2a014c91a9 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -586,13 +586,25 @@ EXPORT_SYMBOL_GPL(iomap_is_partially_uptodate); */ struct folio *iomap_get_folio(struct iomap_iter *iter, loff_t pos, size_t len) { + struct address_space *mapping = iter->inode->i_mapping; fgf_t fgp = FGP_WRITEBEGIN | FGP_NOFS; if (iter->flags & IOMAP_NOWAIT) fgp |= FGP_NOWAIT; fgp |= fgf_set_order(len); - return __filemap_get_folio(iter->inode->i_mapping, pos >> PAGE_SHIFT, + if (iter->flags & IOMAP_ATOMIC) { + unsigned int min_order = mapping_min_folio_order(mapping); + unsigned int max_order = mapping_max_folio_order(mapping); + unsigned int order = FGF_GET_ORDER(fgp); + + if (order != min_order) + return ERR_PTR(-EINVAL); + if (order != max_order) + return ERR_PTR(-EINVAL); + } + + return __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp, mapping_gfp_mask(iter->inode->i_mapping)); } EXPORT_SYMBOL_GPL(iomap_get_folio); @@ -769,6 +781,7 @@ static int iomap_write_begin(struct iomap_iter *iter, loff_t pos, { const struct iomap_folio_ops *folio_ops = iter->iomap.folio_ops; const struct iomap *srcmap = iomap_iter_srcmap(iter); + bool is_atomic = iter->flags & IOMAP_ATOMIC; struct folio *folio; int status = 0; @@ -786,6 +799,11 @@ static int iomap_write_begin(struct iomap_iter *iter, loff_t pos, if (IS_ERR(folio)) return PTR_ERR(folio); + if (is_atomic) + folio_set_atomic(folio); + else + folio_clear_atomic(folio); + /* * Now we have a locked folio, before we do anything with it we need to * check that the iomap we have cached is not stale. The inode extent @@ -1010,6 +1028,8 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, if (iocb->ki_flags & IOCB_NOWAIT) iter.flags |= IOMAP_NOWAIT; + if (iocb->ki_flags & IOCB_ATOMIC) + iter.flags |= IOMAP_ATOMIC; while ((ret = iomap_iter(&iter, ops)) > 0) iter.processed = iomap_write_iter(&iter, i); @@ -1499,8 +1519,10 @@ static void iomap_finish_folio_write(struct inode *inode, struct folio *folio, WARN_ON_ONCE(i_blocks_per_folio(inode, folio) > 1 && !ifs); WARN_ON_ONCE(ifs && atomic_read(&ifs->write_bytes_pending) <= 0); - if (!ifs || atomic_sub_and_test(len, &ifs->write_bytes_pending)) + if (!ifs || atomic_sub_and_test(len, &ifs->write_bytes_pending)) { + folio_clear_atomic(folio); folio_end_writeback(folio); + } } /* @@ -1679,14 +1701,18 @@ static int iomap_submit_ioend(struct iomap_writepage_ctx *wpc, int error) } static struct iomap_ioend *iomap_alloc_ioend(struct iomap_writepage_ctx *wpc, - struct writeback_control *wbc, struct inode *inode, loff_t pos) + struct writeback_control *wbc, struct inode *inode, loff_t pos, + bool atomic) { + blk_opf_t opf = REQ_OP_WRITE | wbc_to_write_flags(wbc); struct iomap_ioend *ioend; struct bio *bio; + if (atomic) + opf |= REQ_ATOMIC; + bio = bio_alloc_bioset(wpc->iomap.bdev, BIO_MAX_VECS, - REQ_OP_WRITE | wbc_to_write_flags(wbc), - GFP_NOFS, &iomap_ioend_bioset); + opf, GFP_NOFS, &iomap_ioend_bioset); bio->bi_iter.bi_sector = iomap_sector(&wpc->iomap, pos); bio->bi_end_io = iomap_writepage_end_bio; wbc_init_bio(wbc, bio); @@ -1744,14 +1770,27 @@ static int iomap_add_to_ioend(struct iomap_writepage_ctx *wpc, { struct iomap_folio_state *ifs = folio->private; size_t poff = offset_in_folio(folio, pos); + bool is_atomic = folio_test_atomic(folio); int error; - if (!wpc->ioend || !iomap_can_add_to_ioend(wpc, pos)) { + if (!wpc->ioend || is_atomic || !iomap_can_add_to_ioend(wpc, pos)) { new_ioend: error = iomap_submit_ioend(wpc, 0); if (error) return error; - wpc->ioend = iomap_alloc_ioend(wpc, wbc, inode, pos); + wpc->ioend = iomap_alloc_ioend(wpc, wbc, inode, pos, is_atomic); + } + + /* We must not append anything later if atomic, so submit now */ + if (is_atomic) { + if (!bio_add_folio(&wpc->ioend->io_bio, folio, len, poff)) + return -EINVAL; + wpc->ioend->io_size = len; + wbc_account_cgroup_owner(wbc, &folio->page, len); + if (ifs) + atomic_add(len, &ifs->write_bytes_pending); + + return iomap_submit_ioend(wpc, 0); } if (!bio_add_folio(&wpc->ioend->io_bio, folio, len, poff)) diff --git a/fs/iomap/trace.h b/fs/iomap/trace.h index 0a991c4ce87d..4118a42cdab0 100644 --- a/fs/iomap/trace.h +++ b/fs/iomap/trace.h @@ -98,7 +98,8 @@ DEFINE_RANGE_EVENT(iomap_dio_rw_queued); { IOMAP_REPORT, "REPORT" }, \ { IOMAP_FAULT, "FAULT" }, \ { IOMAP_DIRECT, "DIRECT" }, \ - { IOMAP_NOWAIT, "NOWAIT" } + { IOMAP_NOWAIT, "NOWAIT" }, \ + { IOMAP_ATOMIC, "ATOMIC" } #define IOMAP_F_FLAGS_STRINGS \ { IOMAP_F_NEW, "NEW" }, \ diff --git a/include/linux/iomap.h b/include/linux/iomap.h index f726f0058fd6..2f50abe06f27 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -179,6 +179,7 @@ struct iomap_folio_ops { #else #define IOMAP_DAX 0 #endif /* CONFIG_FS_DAX */ +#define IOMAP_ATOMIC (1 << 9) struct iomap_ops { /* From patchwork Mon Apr 22 14:39:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13638587 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 0D4BC152169; Mon, 22 Apr 2024 14:40:56 +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=1713796858; cv=fail; b=Vw1e9EY7rRwJuRlyKUw2vRkFczhRw1rr4raX4Zo1Xm/U+XgE0bPXmChLD0WgsdamduaNW6EyKwP1JMYFq1sZNn9/UY0Lpwmti0Ed8ntzXBv/ccrW/KWace7VN8OvL2yQOMewCe1miNM6Cf0C3LxyPeUyNpt85lKn3MxUrwedD+U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713796858; c=relaxed/simple; bh=d8jHRDYVIci8o1q6FyxHR0FDsFP3PY1DVBtiTlJfmwA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=W+QEBwUEzDCRMe3jSOeb70tMRPoPJnjGEjZCWKZ6XQjX0xWSLpduVbmF4dQNwmjNM5CCiXYleAWpXonrRGzjJfL4qF6ds/ds5XZ/x5KdTZLkE8M5ObIGOCE+HpcXGC6qJdQ2AEDOpfpBIst+Q9UXy6pODngK0J9aIbOrbDxinsY= 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; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=dUhIns7w; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=k0XH9+XP; arc=fail smtp.client-ip=205.220.177.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dUhIns7w"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="k0XH9+XP" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDXwDO005320; Mon, 22 Apr 2024 14:40:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=xefVs4tJk5WRWK7zeBsAkORSf9tgcB2s8eHLN7n+TXM=; b=dUhIns7wKTHEYDddnTYjBsOoC2O1fJqva18LflAITTgRMS8//JKQQqtlkYkMeUDXmUaj 812fccUEeMQu22MuOvHQBxTJvJ8+bgVQnZdDXwcQXwXYv9u2Rzba7jQuFkxNqu41Wcvj Lu/0+Z/R0mOFpH+fH2mxKtOFM5YrXRpvTtPR7sCAI/eQZeFOfuDQFzyVLEPsVdwyQcyV GF0OSFzaOZwCBAda7+uV2qI57vUiIi5y4Bzun61xIzJEpI6lJdJcWeqPlfZPXPp7S1Vv E0HB8y+oiC4uqqJ7UnOY7lhwtG9KGYmCbov79Iq9sUZl3MY49IFhUgpRVXsT7sZA+qXU Rg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm5rdttq6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:29 +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 43ME73O7009698; Mon, 22 Apr 2024 14:40:28 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xm45byksu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSaWZ0GsRznrrRlegO7GUo0GusdLNW6RZ4rxeES6RbDLM1ejzDLhuN3JljWYDGUHjAU5G/0zj+/tbZZgvCoslgi71VrRlt5psCWgXwsAuUWAJyQ6dbHa8P/JBb8gSoV5fBeeW+Zr5M/VCEfbazM9XXav+ElyffVVd02knvzglNEnqOBo3rznhlF/72hPqOFWL33uoh5jXJsuiXXeodFHdpI6xQ6wIBfBnvyumfN2FNfW0lU5FFmKiNHm/NLIW3IJcn9zteXhiIfqBWXZmzwz7p0w8CSf8C/KtVMivkUebwRMrCQCABoiTkN3H+gJQVkr7gIwIUmqkjJqVD+4ajFp0A== 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=xefVs4tJk5WRWK7zeBsAkORSf9tgcB2s8eHLN7n+TXM=; b=DruwAtGRZ8iIVO1dM6IwrEpcFZ1zAtKOFCPnpbEPBJYjRDMzc8ZVMGfk+vt7kQZ9WrI9PueWbaor2MJ84JuqsuSJdi8eAdqcSmqI1TZdLh3z1TKRgsyPfxAvi4Yy4Sj83aOpkj4Ek7wLXbPUDq3M3jyurAA/jpLhh/whW5x/lPUDcdSW30gXJCbPjjQD8ILp032dWPfa1kR3PG9mNxiCkMVeCmEgckzXcpnCAk9XSUBiZpM7otfDdPawNzdxoQJ18UFn0R8zWJceBlB8ltX67SkgtODg5L6JWr8NKIU2ppzxB3SOtBtEUBv4mQHzGHSR1d5d6eBJLOW6xyxckIw1eg== 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=xefVs4tJk5WRWK7zeBsAkORSf9tgcB2s8eHLN7n+TXM=; b=k0XH9+XPaft3FeCnUSB9Ye+sM/YXIia/BbG+ey8S1Wvy+sso6wIbMQ36If442g1FPPEnLy/amHZasnGSC17qCazDv+ewfbE1VRUaG55iGdsb2HVU77GI6mEQ/+E68zW5DJr8Ww2jshha4FVoOkgNno09i2ceUJW/6kT3A/iBygk= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS7PR10MB5039.namprd10.prod.outlook.com (2603:10b6:5:3a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 14:40:27 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324%4]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 14:40:27 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, akpm@linux-foundation.org, willy@infradead.org, dchinner@redhat.com, tytso@mit.edu, hch@lst.de, martin.petersen@oracle.com, nilay@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ojaswin@linux.ibm.com, p.raghav@samsung.com, jbongio@google.com, okiselev@amazon.com, John Garry Subject: [PATCH RFC 6/7] fs: xfs: buffered atomic writes statx support Date: Mon, 22 Apr 2024 14:39:22 +0000 Message-Id: <20240422143923.3927601-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240422143923.3927601-1-john.g.garry@oracle.com> References: <20240422143923.3927601-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR03CA0227.namprd03.prod.outlook.com (2603:10b6:a03:39f::22) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS7PR10MB5039:EE_ X-MS-Office365-Filtering-Correlation-Id: ac170589-52dd-4bfa-e223-08dc62da26a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LiI4/SO/aCHPjPGACdZ8wKOzSl7/EM4PstNrkx5mNzG2d9B20LxiFtFLf4Q4m7p14equDqxjctvSEbLyZ6x6dgI4RMrdOhr73OXMWe+ZabcUfZGCv+jKAwmE/8zrXa9tYxr/XadQNwnmzREeP6xzajQavCUCzHcsz4KTHoYOHkRwzcxSC8afErMq+Vk79DkIbLDNdXqBsmKdfk1d9yuOo5PInWF2OlcKEfgyQIJwWT82tUoVBMsvENBxQL/wpc/k7azesR5Mk1pesf0zogho4jtEdmUSGfm7li0ZtMzs8fQUP5+bx0KB4DuAH9cK/OGoezQRtwlXvJjua/RpISOUW6kOPdt416SebYiSoe17MbEgokGhY+ZRKHt5av4bZv9YSs72Ij5hbvQ79YWMjAeBhrw85SCTKkCP/AWEnl7U8ZC9v57+ZPYjLppoYsrPvvO3cU/fY0He4iIarQ/qBFJhZNmRDyZ71sYrXBFFB9C5WI0ZAUz+PbYIPkTPs7fjCq+n3JTsPzdE90S/QRy8wvRNjDT9MXyIAOWSHzkwxrcASxEuu6VSYId1GMwF98hHeDPNhqxU7oIOjafAaGr66IXuFiQhF5Plaqnd65jhZUPOD7PUdkPsuYNq+iSv6OGr5//TUw8NWQT17DlvqpTDf3Mo8zgAmczpB9sbFATk6s9V/ftuOBh2/D1R5yUWtE4RVxqd3sIEMBerkXDrwSH9u99Xu1qA2R2+jTGbMSSNT7soGujZJqyif3YHr9HuucbW4eEPTC9dxs8FXimubiRft2fIQdJhtMa8Iox/RprPgpAfE0DOITkN30yVULEAOeT/Vh0JmnY4NxM7zk88k8Afe1osRm//8AdnJn3dFw3y2LlvWuR1Xa31QoHmInSbfbmqUS6slfQyPLgn9YZ5BenzHIAaawVqsXY3Fo+rtUeVecynJXueaqzkkfQui7/fb/c3b1vGKdeTCCChD867F6UhEyeZcgz1R6o1h7n7/iU5uuo38OZxbjyNCd+uU2tzwGGVIJLu/bKneF0PfcfvMt6WFgoewzqzEhOTt2HoiY124WKaFmY25rqfNZDTOCzA0aGYWx2pKNeIN5X8885kCHFr8jkbHhj//6nov2QzEl0cIS6FDIBzsxsWE8jhmxDAqjfrxx5WaO5mHVTNQCxCyQaW7SYJc0Mo39o+gviWuby/TEPnzf5b2rEzCxXruoSM8gw/VRvk7G6m/Kl3hi9LG+s/VbJW0HgOyyukgqbgkp/MeuLGBNOJzOxlKVaLf6KcpHMV4sZgOTH3903/l+fF8Lrld+WE+omRs2/9YhN6L8aATZ+ZaWendJYMECu3FfhkIrpMJMyf 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)(376005)(7416005)(1800799015)(366007)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wPW9obOt5Ddm+/RFtoq8uBTXUStdVA5vKBH3QlS32XKfGeg2R7/GoKGeD9OveyhndDnPyWHaW5w6mqqoGR2y3Urw8ZrnjeDcvc4RDrsx4qFfwqyFicOY2QwAds99LMR02ENfJfDenEGu6gINU29Uy9SueoB+J5WowwExSNvGjIV0pGBgeSRUFBJAAr79xoPcuoaSudd+C6tyqQZcY0AeGgEP/ZhvC/ZZiUuwCqwLLe4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spgqbt/wpedlTLCpFxGSpEnoDYz0gtarwB8c24doOuw48rqtGvGmA4UP/HaIAFIg9JawyEZIofBE0QyPQa7dnmp2e5+qQssEUZ1aiLbE4PdigipzogEVQVzwmXTz2fFH9NQGH3eqC1aVJ0WlWvrsmQlFTwQbZ8CIMdP6/pe9RjAbCq2aBxaJ6N4kHwY8cjyzXXNEFu5UR/9KoV8ZVy6KRQt38Ns7NRL/8cBKZ4A4BJn07wkfWABBTUSZmespzD1CxheZWvUZc2yV2u8Ty8YukHXk6yFCucaEvath8Ikpie8PC7s594ZsB4es6Aubg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xoCdW8nECbOonv/YBN4EqjD5cTZ3lA+68/IKNn8V6rJIoCPmj/rZQ7yJUSUkKDj8/n4UNAT+akjWPBkXlbwPiCqW17hRFbnpdghgm5lzppquRW0G3rsVU/IshDAb/N9/uKvxy+vCESHp2iQhSWYwE+2B2rdU+M0XlxISKGHP/WYM8hJZXqz2XINVrCPbzq16bbjAF6ZCpsiusPn8iF3FcUA+8VZXJMU/5fNB8+7hc2VMxdz1+smnevtE/ET/+LOj36JqvZx4mz7fYOU2p7Hr3DNpss1AKrAYFLK+6apE7f3Nx2B+16Vf5B1fAuqQlunCv4UBqiQsY+LJziHXcRyVw4PMr7qXmd2E1/UZba7SJqXKv0a4a88E7iAyTaZKxBwf4EnztvH2UZCgavUbfXmx2pUPwBTJw8LVvkJLeFxb81gLPyUIbz6Q730gNRqyhwmAm3oc/YJnuGp3Zx1jdZ2Q+3WJF8MZ7G4X7xwq+XloBt46lOABHQLMXBVCnXOUuUR9QUj+rPpFgdctyX6cubLQA8wzmsvrrezodEAkQt1KFqzlRpC1SQ2uB1cJEh9B6v3znpGX8oc9ZJO1bwrAlVwkx/Jc94+fv1ltZs3Q6S4XBBc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac170589-52dd-4bfa-e223-08dc62da26a4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 14:40:27.1687 (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: jzmzxJlR+twt7I2VV11Sskfcz1PJ0Qem3OHz8lXSUNo/pCPnbcIrWauvgdfv2+ee+NRYwlKAyJL6xHDIIGeF1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404220063 X-Proofpoint-ORIG-GUID: qPHEibSr3geO_zjDXyDw2XwNDBdWlA2G X-Proofpoint-GUID: qPHEibSr3geO_zjDXyDw2XwNDBdWlA2G For filling in the statx fields, we use the extent alignment as the buffered atomic writes size. Only a single size is permitted. Signed-off-by: John Garry --- fs/xfs/xfs_iops.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 05b20c88ff77..d2226df567ca 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -650,12 +650,19 @@ xfs_vn_getattr( stat->dio_mem_align = bdev_dma_alignment(bdev) + 1; stat->dio_offset_align = bdev_logical_block_size(bdev); } - if (request_mask & STATX_WRITE_ATOMIC_DIO) { + if (request_mask & STATX_WRITE_ATOMIC_DIO && + !(request_mask & STATX_WRITE_ATOMIC_BUF)) { unsigned int unit_min, unit_max; xfs_get_atomic_write_attr(ip, &unit_min, &unit_max); generic_fill_statx_atomic_writes(stat, unit_min, unit_max, true); + } else if (request_mask & STATX_WRITE_ATOMIC_BUF) { + unsigned int unit_min, unit_max; + + xfs_get_atomic_write_attr(ip, &unit_min, &unit_max); + generic_fill_statx_atomic_writes(stat, + unit_max, unit_max, false); } fallthrough; default: From patchwork Mon Apr 22 14:39:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13638593 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 4027D152DFB; Mon, 22 Apr 2024 14:40:59 +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=1713796862; cv=fail; b=VeqGijNh+5aSXgaavtiNj4I6+YNeCtKB78tBfLyKFdiKuzVAey6BHxvfXEVkKrKSgdiRp59sbWW+HMqEEATZgO9/vcRibZKW/sabNFbHhu/veIlPBMzja234hcqmbjdPEWXSlu1e5lgA+K5nfaEXpxrVj+5fRGMPXRUKUMEhwtc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713796862; c=relaxed/simple; bh=C3S5CpYzbTFYSyscUzb5VFJmE83nZ7++8K27ay9153Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=H4AHr6QNtvxzl/eGLcOIp6cM8HwkFB+1Vtrj0ULSSbjbWHYYBdxZY57bDIZLTpnBXi9jZgn/esJ4rVoxRsx9mPADSqfykCTVB8VwXA+kZv0gLGrGPC3Fv+zyybAZhgiYsvcy+BOLCXWW/VSsDEOWSNj9R7LEwv1/j5NLQdoOIyg= 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; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=MFIdc6q2; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=WT1DGBga; arc=fail smtp.client-ip=205.220.177.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="MFIdc6q2"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="WT1DGBga" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDXxpD005865; Mon, 22 Apr 2024 14:40:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=49ljf2saGMeHE+yHQnzEON1DLcaRD15VYQp+BpxZ63M=; b=MFIdc6q2PHY5/sYhZdluCdul0D1yjzpoFil0+T8CSUaWDUtG8kbcaGivOpREPK6LTW8E iZNjAVAl4UjHmR4n/A4+7DMiF4DiG3+xqGvTvrwSeIY+FsyA5rk+6SXp6HxbG5z58T6+ 4FKaq3vo3MY2spx0A9MQqzCfvkxSUQIqwZdziavAY7Y7F24NpwGqRcWTr8yP0W60VNZe pSc8PaiHtOglyxNDpiyHvEXC10Ooj4rV0V2QrH4jfFbZ+1hxR6Mebah7fOydyl0gxYZ7 4tpJrg+mwcFHKf+A5EJVGl0EB3p4Xkai6N6g1pQRJ/SsALtuc/suayFWmH4KtYMIb1zd PA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm44ettkt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:32 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43MDtRdq020139; Mon, 22 Apr 2024 14:40:31 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xm45c7wtp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2024 14:40:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GJNymi9JuaHTNTbg+QCS4+J3gmHc+YFsQ56IC+BKtgT74EToW5o7QZA1OCoibBbhEqKFtq6n3coQmqk/2ZiayohemSsOGsrWBfNmVFYQbcbjEXa8faE4IYx0C/BOa392OYl0X0vqmv4RBbpoqNoJuM1mdT6Xl+WXWfzENoVSt6YbBLkji+nMfS/N2lYhgjPYSyL/Dh+3d4k/0WGL7lKOxUoz/rg2EnoRycD9bW4GQGxfjUGbL+GrXKMN7QfbuRjJtke0OzHmmZaArrxFikmIcWuQZkRVwamKpC2Be/4RgCaYJerrrUEkfblELeJskNgm38NAM7lp+k3+nFcrlYaVDA== 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=49ljf2saGMeHE+yHQnzEON1DLcaRD15VYQp+BpxZ63M=; b=Dg9jZSuUuLHOSbVBHP+TlwlNuZnJK6IR3NGvjHv9dSP8xc4PSKJHoIQ5dAEggyZcxeWB4lEjZPi08BttnOCaM2hbKQM5hdl8iEXu8Lid40HqKRuG8dvEXGAT1kPt9+DMRwOEnljsaS6D8W5At9VaubIoCdMwNcGhhI+fwBdXEHy3RVWcnJ/AMbCqZIW+gG5H7X+nyWuztjXpT9QPXi4Zvgor0s2GKmumha6AxP7ZFBVSG0g3BzAMvJ0QVhpgQR6FI06id1/M/49YlmyyMEFsKTNKUJkWCoTS8NUmvtOJleiEf2fjeeksxh0YywRjess8r11/X8Pzw+WJPwG48BLT/w== 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=49ljf2saGMeHE+yHQnzEON1DLcaRD15VYQp+BpxZ63M=; b=WT1DGBga20bmArTahxr18MAQyUzb/PMHIXc3mmznjWdZM95rp5kEKW0Z7uaaTXkDVjlJwRh3nDbNYs2tlOKtntkXE6V6nfTHabN3CY62OQXsgJ4nrmACXeWa3RLb/vQzPBb6ougqvrUwGEuQKsiFo9Pz/7odeHru7UEMHTGzGvY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS7PR10MB5039.namprd10.prod.outlook.com (2603:10b6:5:3a6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 14:40:28 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::ae68:7d51:133f:324%4]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 14:40:28 +0000 From: John Garry To: axboe@kernel.dk, brauner@kernel.org, djwong@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, akpm@linux-foundation.org, willy@infradead.org, dchinner@redhat.com, tytso@mit.edu, hch@lst.de, martin.petersen@oracle.com, nilay@linux.ibm.com, ritesh.list@gmail.com, mcgrof@kernel.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ojaswin@linux.ibm.com, p.raghav@samsung.com, jbongio@google.com, okiselev@amazon.com, John Garry Subject: [PATCH RFC 7/7] fs: xfs: Enable buffered atomic writes Date: Mon, 22 Apr 2024 14:39:23 +0000 Message-Id: <20240422143923.3927601-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240422143923.3927601-1-john.g.garry@oracle.com> References: <20240422143923.3927601-1-john.g.garry@oracle.com> X-ClientProxiedBy: BLAPR03CA0150.namprd03.prod.outlook.com (2603:10b6:208:32e::35) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS7PR10MB5039:EE_ X-MS-Office365-Filtering-Correlation-Id: 43d443e1-91eb-4c8e-c1f6-08dc62da2782 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: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HZo1SUv2oz97kVc8J/DyShQB2yy/cTC6YZqyr2dwhTyiDEeebsZABnshSghyY+H6ffjCzVLM+qWEstlyIkaWthRERbrsVqryI/0m5Z+vAoaMofMx24Sud0Wj9WhCYDZZju5zlblkVBubkepMUtD5hgn1Z2j/KJIdVrcpbaLivaPW67v/bkfI9nxCL9TUgKCOHHKqLo0CRsyYDd3GgyBH5K5w2z2n8xKjde1FUpVhm3IOyXDEAq5LcCebmiI9DpqyIhpz3zCV/ozxTyERWEmItZOV9 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)(376005)(7416005)(1800799015)(366007)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j8HHgEdiSA2uEdNWPYI7AzOiNe/HFJRgm4+2FmnKEFr1gHes7jCNAAh1ZgJQKXpCypjON8AkZBamQn4MXqeD5BU+JU5Zxv2V0jlJheVlwTvNHMF9u8z3GPj8jbTCctwfLZdz1pQUtBi8F3vB/Y2HN+oL3a5AVMJG88OUV+GtO0BkyWGABzdn21r6pT4QiCRwoRLOqw1K7nUS+TBQLepSTG4YyqYCT8MMQH8g5bffaqqDGFaZDb4J0/vNTv+cUIO6Z58kuuUH7jKO41yTRLE1RYIg99+kEgivQkBmwiJm+WZlM0Fs8NMymzOZECuh8xxgsof6cWSas6bROCQQndxku1xA3YGxAUjXu5BWiRUUf8qaODJ3Q/7gv9ftqjJs36teVucWjcygaVI1tcEnXJAHq01pzbPiyL9/rGPb6G0HjCXT/wNCA4pSYqhSpZepTju5iUuuqgKipiuYEz8uw/9O+DxvTzW1NWjw2gE6KcttFVLxhVcGL2Mqc1DjG1awAEtF+IpZpomeSzIyuol7+yEAUcbZ5DwygAP7PgvyDzpALGQRZgPJ1Cs0sC79ctVm7gaPigg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exchange-AntiSpam-ExternalHop-MessageData-0: Vq9UCMnHatsSovFh/02kR1sW3LEwM0TVCcjeS1ya+LO54JVVOCipjDDtwk7SKFlpwqatZa0UY4391uZW98OwIaCl0prCxubO1FwaF3zlRdrHal10xmrgbWOcXZ01lghBe2sj1pOI8gjXxoHhVLnjDFKsZR4n4nQY1tsJwvFXN5sGpa497uyPzWe5NpY1HSRLE+0CCwKn2/5raUJEug2sQWU2Q0Dzoimpc5egrS72yjMmKB4gzRGirtSyyKJFCYjeRRlpwRkPlTXdX2ni/qU/J0fw98/HpkDdsCRT5JdSM3IfsvlYVRTF7rRs484TVH/oxPgFQJZZswWkZeYTQI4EXCqFXnlHwU2Vgn5e2YkDZ3KMpbOQzjICDzneBHyPcIbDZkcOT/4F2nP7cWPJsjICmZ29Z3ko/mfyKEAVwww7gKMaSazzM2cJ9okpGmTDKhBCu4nWriD5GVinjS+VLZM8PaZaLeXSeUOIgHx1QacrONnxnYJ1w5nERanZq5OtDuAK1EAc111WCPVSQ+gOCgvQwtwB/ceONV8zoKpU/p+aONZBFih/WJ5dHL2ZOIeoO/sKjVzgZo03Zi3xo9TFAIXlj6jqmr5DHINP5MgGx/PbubA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43d443e1-91eb-4c8e-c1f6-08dc62da2782 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 14:40:28.6172 (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: a3jiSkxdK314/w4cZby3Ijx7FD0P/gFuT+xmfpc9aut0a3V9sx75UN2cOvvqJrNFTZ8UzJzhZNEyCA/smRpLVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5039 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-22_09,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404220063 X-Proofpoint-ORIG-GUID: Z_U_9O15snWMq5vMoQPfL_7A70juNBRI X-Proofpoint-GUID: Z_U_9O15snWMq5vMoQPfL_7A70juNBRI Enable support for buffered atomic writes, in addition to already supported direct IO atomic writes. The folio mapping order min and max is set to this same size for an inode with FS_XFLAG_ATOMICWRITES set. That size is the extent alignment size. Atomic writes support depends on forcealign. For forcealign, extent sizes need to be a power-of-2 and naturally aligned, and this matches folios nicely. Signed-off-by: John Garry --- fs/xfs/libxfs/xfs_inode_buf.c | 8 ++++++++ fs/xfs/xfs_file.c | 12 ++++++++++-- fs/xfs/xfs_ioctl.c | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index abaef1137b97..38e058756b1e 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c @@ -181,6 +181,7 @@ xfs_inode_from_disk( struct inode *inode = VFS_I(ip); int error; xfs_failaddr_t fa; + struct xfs_mount *mp = ip->i_mount; ASSERT(ip->i_cowfp == NULL); @@ -261,6 +262,13 @@ xfs_inode_from_disk( } if (xfs_is_reflink_inode(ip)) xfs_ifork_init_cow(ip); + + if (xfs_inode_atomicwrites(ip)) { + unsigned int folio_order = ffs(XFS_B_TO_FSB(mp, ip->i_extsize)) - 1; + + mapping_set_folio_orders(VFS_I(ip)->i_mapping, folio_order, folio_order); + } + return 0; out_destroy_data_fork: diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 2fbefd60d753..d35869b5e4ce 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -782,6 +782,16 @@ xfs_file_buffered_write( ssize_t ret; bool cleared_space = false; unsigned int iolock; + struct xfs_mount *mp = ip->i_mount; + + if (iocb->ki_flags & IOCB_ATOMIC) { + unsigned int extsz_bytes = XFS_FSB_TO_B(mp, ip->i_extsize); + + if (!generic_atomic_write_valid_size(iocb->ki_pos, from, + extsz_bytes, extsz_bytes)) { + return -EINVAL; + } + } write_retry: iolock = XFS_IOLOCK_EXCL; @@ -1241,8 +1251,6 @@ static bool xfs_file_open_can_atomicwrite( struct xfs_inode *ip = XFS_I(inode); struct xfs_buftarg *target = xfs_inode_buftarg(ip); - if (!(file->f_flags & O_DIRECT)) - return false; if (!xfs_inode_atomicwrites(ip)) return false; diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index d115f2601921..d6b146c999f6 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1169,10 +1169,13 @@ xfs_ioctl_setattr_xflags( } if (atomic_writes) { + unsigned int folio_order = ffs(XFS_B_TO_FSB(mp, fa->fsx_extsize)) - 1; + if (!xfs_has_atomicwrites(mp)) return -EINVAL; if (!(fa->fsx_xflags & FS_XFLAG_FORCEALIGN)) return -EINVAL; + mapping_set_folio_orders(VFS_I(ip)->i_mapping, folio_order, folio_order); } ip->i_diflags = xfs_flags2diflags(ip, fa->fsx_xflags);