From patchwork Wed May 3 18:38:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13230498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3926AC7EE2A for ; Wed, 3 May 2023 18:45:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbjECSp2 (ORCPT ); Wed, 3 May 2023 14:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230015AbjECSpG (ORCPT ); Wed, 3 May 2023 14:45:06 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B77518A4F; Wed, 3 May 2023 11:44:02 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 343HpiBh015206; Wed, 3 May 2023 18:39:35 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-03-30; bh=fu8QPAY0g7iFXP4WhzCoh6qJJsySH/11LcV54M/u8sE=; b=1eGxo0WLSoeg3+C29obV/6jxXbh2qpyWtgV5xo1I7zAO8q5SzQdnjVGKywb8lZBplyb5 R0zXDJAWrldmSR/HupVA7ZakQaJE2VAWvzAE65i5FHy8HH8TH9RXaSJQq6iEzM/cBx2R +aVLsQSvAoTbJ7WK8BnNAD258Cc16N28kp7fzlq0ZWowxN4JP3FWziP0Zy3JAIphwR/4 YYR5ld2Y7hY9ZaF/n97vaNwrNplfWpmIFKfpc1/VZS0CBOex0baUPMKlOCkhxLVQW0HL c+P2NsLp2MWQS/MyAZtWqH8n227gtLUEqTzrj8r+G+yzXkYCBaSmfSdWatqa9KkqE1Dm Mw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8t14063k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 May 2023 18:39:35 +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 343HXUgq027022; Wed, 3 May 2023 18:39:34 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q8spdscfj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 03 May 2023 18:39:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8H3v/RMX1M4iQ4T29YbgJsOHfiNNIcBx91dU3hV0+aYAOkfLT6+b8Ph64O2k9EgLX0VyHblAGaQ9IpkVKPNxiIPeYzn8QDFlW/HEnsd/QV5FSvSPpyFXAYe/eq154iiKH2f70zJhaqLLo6oxXAtR5gveMXSbd45FqxEgj5nxKU3th8LhKIcmc0s8M+AdWp0+qi9ttef2gaLLcMLE3wCZyXyXbqgEyCmt5n+JKUkPaIiNJ9plCtJXCiiQ/OsF4gwoudwlx/bxbmBdZkuHT31PbFg2mGkjtaudxy3u0haKnk4D5e0inDoYkFPzx/PV62NMwe0z9m5TECucxe0tt0zUA== 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=fu8QPAY0g7iFXP4WhzCoh6qJJsySH/11LcV54M/u8sE=; b=inIDFHW4COolU1wQAKBW5QWZJifWJNb0j/wdORRcCyFvtnQ87glgkzalfH7f6jtdyrIIVDhZeXdTbar7oFD2Wv4MFTe9+AVyeMETIA/92fe499YGBzOBIj7om1uwo3HFY0DW9FG+raR+lzGgrycfQaW9ruR8YrMF/4WOifqHu+KgKgJYpKoUxspEa+5RulIZDPn2wyFnubueEwu4W7Eb3xA/FVPvKmNrxICLo412tH1CTsVpQx0Zaf9CpgNogWJ1kYe2QfJIMFDBLBTH/q2j+UYFe08rdRjkhh/Pj7CAP9isgj1K1/sV6GDPIt36hpYLIytjmQ9shmzU8fQ6OSIjng== 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=fu8QPAY0g7iFXP4WhzCoh6qJJsySH/11LcV54M/u8sE=; b=nUuvf4x0BdT4XW8x67BS3X57+nZhVdKvlNi5dvFrQMs0PFwNsMHRQibqzUYMl4avKVR2zrLNTlHfn62C0hk+XSdERKN8g61sTMohgLpIMrgHlLKBCk5tXMmiinzyFjkOS+/uHiaHXG922DR+oyeGLLVJK9yFBbvkm+614Y65PtM= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by IA1PR10MB6171.namprd10.prod.outlook.com (2603:10b6:208:3a5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.22; Wed, 3 May 2023 18:39:32 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::8456:ba59:80ec:d804]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::8456:ba59:80ec:d804%7]) with mapi id 15.20.6340.031; Wed, 3 May 2023 18:39:32 +0000 From: John Garry To: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, djwong@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, dchinner@redhat.com, jejb@linux.ibm.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, John Garry Subject: [PATCH RFC 03/16] xfs: Support atomic write for statx Date: Wed, 3 May 2023 18:38:08 +0000 Message-Id: <20230503183821.1473305-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230503183821.1473305-1-john.g.garry@oracle.com> References: <20230503183821.1473305-1-john.g.garry@oracle.com> X-ClientProxiedBy: DS7PR05CA0096.namprd05.prod.outlook.com (2603:10b6:8:56::28) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|IA1PR10MB6171:EE_ X-MS-Office365-Filtering-Correlation-Id: 0402ffc9-e9d1-489e-0f70-08db4c05bc35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jOUXNbw74GqLiIMZ16a58pJ3tzG2QBOxEjGQFgnSJVdyQFfL+QmjoYXHg8G7nWklX6WT1PbfpLHRp8/l/g7J6Pqk3aW/78RNrPrWoJvLWWhtAkk6q9ZTCdz2x/MAjov8vo6Q8Aj/QmghrYeBUdW7CBf8HiD1TwqpFa0iLg6us+8YdpigzOiI8oN1kJb0ix7TjUkZ1v8EfT9AZsGTzqkWU0+92gCk36vhXM+bDQuir1tuo0m5rF2T9VejXDyPQ6IbV5vKkyO5H9tUbdnuqQEFIlsBEicT3byKOUYH2IHvaQm4spffhr9AyNGyZprG8hVdzyvLXKf8NoVZoxmEK4+fUVpcZweUsj5Z47jICH/QrSfBqwJzX5gBXiSRuEQa1lewHFcwaYZSHaHTEq/TaQSfVqjvMT6b4jUQbU7qUoCj+zozCKErTacCN/E1AVvstPykY2cH1OczZkrmNQ7zv4sfOqMDPN1DxnJylG7YwYkvtxIma1qI/t77ntDF4snbMoC1GyVKXbthyucaDihEJKX/cb3kmhUP7Z0GE4K3OBH3aiBVe9WIMmkGaNgy5ZwzSV5HilMh7W3d/AKcItnwRkguQhUqap5TyUcCzMGfdb1XAbk= 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:(13230028)(346002)(136003)(376002)(396003)(39860400002)(366004)(451199021)(2616005)(186003)(4326008)(103116003)(921005)(36756003)(38100700002)(83380400001)(66556008)(7416002)(66476007)(86362001)(41300700001)(8676002)(2906002)(107886003)(5660300002)(6666004)(478600001)(8936002)(6486002)(6506007)(316002)(26005)(6512007)(1076003)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X2eCAWFYAIQ6DyFPfOltN8kWZZ1aE4DNxybztIy7Sr2E2cXy/GwiIreTr55dHJEI8TVSYcCnVfuDoLEPyCdTR8xBQD3mboH9VehYUrjovL5VsR03OnVTkB3p/r5nUEWn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Ps5MhUmA2g5u3plhY+F2TtGitP5Yp+1yvhsnOK4+ijzLX6L9qU/a8jb8mGAjJ5y3CxFJYsO0lbHKJwc9tRwR6407DDnz73KSEjGoQc26lodg1TYBdt2Od9ZaCcgTH66mZebbq9nNaeovz+o5eigiaW103xkHXv8WXiQB0EjLKevGxFcPU934mj0cSP36yj2nqJImnDwgX1ZybW0PImfa/F1fQKNmBkTw6lPzLwo+I65TyujCjsdHPqpmDavzOtVhr+dALHVITyIpuUWh0h+hE9sfRR131LbVCYdZVLiSnSyFsiaYT2tRVB+zRDHgjxHBKpjHN6Z7jMm/5lKIqgqWv2txneHFwGzYcx7GUeUD2tAhPSzo9uSuP0USlIkT4ZDqyh7/3V3B1o780YanXSbmnjJGx13l0uGg65DsD3NxAVUXGri3GwJXsEMIopalLyWHNCoIYL2XV/3xDJLRGjMIJfiSW+GEif4AHd0HIeAK4ptGbX4VMhIm1ulhr1+te1wKtusRgXIHBpULCkKpAXcDT7tw5orUVT5sdzeFXeKBFebDA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0402ffc9-e9d1-489e-0f70-08db4c05bc35 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2023 18:39:32.0432 (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: MqvcAysLVjjI9nC1zAtSqtpYAfL26fxRNNYjBBDb9NueV7UuPfXzF1UioUk08HboMLMLOqXfaoMzMLggB2HUkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6171 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-03_13,2023-05-03_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305030160 X-Proofpoint-GUID: XS2DdTNHYUWUBlfQk_oz1cvgpYwuSfNO X-Proofpoint-ORIG-GUID: XS2DdTNHYUWUBlfQk_oz1cvgpYwuSfNO Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Support providing info on atomic write unit min and max. Darrick Wong originally authored this change. Signed-off-by: John Garry --- fs/xfs/xfs_iops.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 24718adb3c16..e542077704aa 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -614,6 +614,16 @@ 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) { + struct xfs_buftarg *target = xfs_inode_buftarg(ip); + struct block_device *bdev = target->bt_bdev; + + stat->atomic_write_unit_min = queue_atomic_write_unit_min(bdev->bd_queue); + stat->atomic_write_unit_max = queue_atomic_write_unit_max(bdev->bd_queue); + stat->attributes |= STATX_ATTR_WRITE_ATOMIC; + stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC; + stat->result_mask |= STATX_WRITE_ATOMIC; + } fallthrough; default: stat->blksize = xfs_stat_blksize(ip);