From patchwork Wed Feb 16 01:36:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747784 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 B8643C433F5 for ; Wed, 16 Feb 2022 01:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245501AbiBPBhi (ORCPT ); Tue, 15 Feb 2022 20:37:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245509AbiBPBhh (ORCPT ); Tue, 15 Feb 2022 20:37:37 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3855819C29 for ; Tue, 15 Feb 2022 17:37:25 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FN8hX1028765 for ; Wed, 16 Feb 2022 01:37:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=i5ZjRRX0+Ag3k3QMER+6A3+XIPRF5VcX3CVx2dHGqEs=; b=UE/2wFqtfItHI3QAqlVvaN0fRZbE2IM2eQcUBhZT/xI1Xi7n0g0L0oXsnSwwgdyzb97r c10FaWMXdGOglo1xoBg+wt5CyHXkbkV+ENNM5hBmnKnp3PyqdF2PYNxL/X841+ZGgD7Q I4gzApv+N86uCWE6/+5MByF982cxYOrOf0KeG0JJSy8tlhZ5YDxZIGcBQ8uIBms+1jdF gK6kP9sqeL4JbrdGNRiqYl2tiMtTLf2KExJZKfgHPqScmnq/oRtrhaqn+/L6RzZLEma5 y6AO578UX8/y53dY4/JI6O/niDuUFyki5FxDbLwzu4/Aw/lMl8qquxVlkB9idbz1VAmJ 4A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nkdg6kd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:24 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQCZ138909 for ; Wed, 16 Feb 2022 01:37:23 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2045.outbound.protection.outlook.com [104.47.73.45]) by userp3030.oracle.com with ESMTP id 3e8nkxj2rq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DVTdhbdx3/AvCiR2IsCKuMe5fOm6guk+lXuZOjqFlZp0+FGOJlDzE0IQ6qeQksiFqeFJUBInqidXuAmkC2Q0KN8ItxhXcnSX9XQGipkWAaGRmPUPwwgr+gXkewBaH9e/0dPdxnYceSfzg69SCcif9PYQmB02UXJaj9N78caZStaGuoJRqzfS3RuGDw9AbZzGwRvJFybOGf4A7Tn+kL9oEkrLs4g74xDyM04uekzlNi8JQxG3dR3ApoBeKj/jOPU7FLX+rBge65x2I/9CQ5PQhT5Ee9r5RP/WNOqjdqi/hJ38BBSqZbMAc8h+oJeJ9mgOE8zVG06Nq9b8dMjztSGUxg== 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=i5ZjRRX0+Ag3k3QMER+6A3+XIPRF5VcX3CVx2dHGqEs=; b=AQyQTkrSDIS4DhY51+1dpouqyDwmhLSaam0a2ueibMJ2TLgzD2XXsSt9D4OG3clYKJpZSx81LpFNCxoFpG5nTzylZ+2BsTmabIxUIrfNwC89PKTHmeWi3M6HzD8cW1Rz+MuO6d3qvmQUV7SI+2HI8UCr5JOzeMNLJpt10kuUEs0If7eE8JY3SL0LsHsfrsH/nzHKEmLLMLv6rmtsplV1iqnBhb7D+tuMTO9N6Llq3DzCb+ut+YGqs79mfff9lUcSg9p4VnxHUjjdJxIFGsgd4aqimkBqbHyZTbT9ULl44SZIejPlHE0SBErYBaiZjfKvMRGMh37JznRhZ92uWOeeAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=i5ZjRRX0+Ag3k3QMER+6A3+XIPRF5VcX3CVx2dHGqEs=; b=v3WsuWe6oZSVV7ub7fX4qZ1Ugcg5oBJUut/OofKA6itHG/U1ksJilzixcxLa5IJd3xZnsOja3sxY2bJgxOBBJUV3Xx9xKta9Up+NwYeOfBFzPN4hMSXbK31W3tOucyrIW28eZh7TKRdVVLysZzug7yMIiqPmjRU74RufbUgLvLU= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BN6PR10MB1283.namprd10.prod.outlook.com (2603:10b6:404:45::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Wed, 16 Feb 2022 01:37:21 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:20 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 01/15] xfs: Fix double unlock in defer capture code Date: Tue, 15 Feb 2022 18:36:59 -0700 Message-Id: <20220216013713.1191082-2-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00451f92-914d-4a4d-85ba-08d9f0ecdf85 X-MS-TrafficTypeDiagnostic: BN6PR10MB1283:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:221; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NMQzJVUroMi7z3/+BuX9AXVZEULXNiOxCrSBJykIEecvzsKIjY8/KyvoAdeTnVhCI4dzmuEeB11gRsJ7f5/PE48CwWFz8QepNbY+zfysrflQtlAZIX64hPmWSEeML2hKcVMsOQlxROEkp+XjIDXFwpo2l2elaLOTc7dBT4SSnnU/LDDDXrr2hisaIxj0tdvYiX/DKekHdX859oshih0xGAOecNTjcrsYckaN3tIrLxSmElqUye7CxJDnVi9d+XhaigTErTOo3mX6jMEUOGTupB5W3C3Y9K8KYc+t7f6jGCbWV+rU4Lp4diunP7DoVhecRVQsiKO+VSmRmdax9gM7VDhvrUlVfmfQJsAGodaqMRFfuzW2zTB2XRY7QRtW01JtbzrkQjMfpbhTbhcYyUPfpf1PUmgwQwjA2mA5F8NbBQ/QiY53eKf8Q/h16y2FEvKpkWE4n1s7KlM2ZKVxcNUefLmEA4k5DyuUW2210jrQEK/O+rf1w3005adKie4QTRhL53XdT52YVRoe64Ik0VCyp2IET3TdHxnEWczWrR5Y3cYFfWRrIn1umuH0a2GRUgTJqUbLXvHAe2z4SwuW9rJ6flBNbqrcSiz+/O+cWazeO8svpr9SW5a+BrsOWQC2Aix03iriQbcJMSTcBfDDvNpCNzVECN4SBC13NLhXgj8pIxRqzD6iGx70JGXnqiOe/fcMDEYGqVzkvMgEV8CTSY3g7g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(8936002)(8676002)(6506007)(66476007)(52116002)(83380400001)(86362001)(6666004)(66946007)(66556008)(6512007)(36756003)(38350700002)(38100700002)(2616005)(26005)(508600001)(6916009)(2906002)(5660300002)(316002)(1076003)(186003)(6486002)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YaoFuv6R6u4M1JrPxNi4KCYyikY2Vrk603Hs95aAs0KLXaiFq67hrMrXWR7BRHsm12VtjKI1DPf/Iw1XOd2t37EBp1SfUqmkFYPb8/7UKv8hsSemakNvPZ/KPk9ILTbupxFlTN/XBpb+cEcBlvV4c+JEw9gQyHRrvpRBEy1LdghtTHCCL12Y9OuOuiyV2JDYnfssNKGcvLKKjRCUwAmsGJ36EKFXcV/9U2IqkRF2m6sQkFn6tJ9CKAsHgbX7+CDsdTs4gEC726CaGMiHqgBjtI0bGmyVcWSbBiCIDdGuKV87HpG4Vivp4T5+xdw1tBMtnH5hpPP3GTfaAdBNvYaJM8MTQxTvPDe8lB0mECk3XfCSARFKMaYcDj+kK+5yq18ItZuL9nt4K+OPvxaYsG2sW4VPN2o93tW840Qi2aPUB3nlTx7SBH7PQjmG2T9PKJRWp9A+FI3zyjS4Q6lTRGRcKkBs2XcpkwbEiyFGLzJbg4c0aitoVZLjF7N71eJSjOtzgp7ojwZLMQz+vb2bOG+3FnKryb8Jve0gBXi+KPR7/j2Keei4NPgAI2KvgCQp42aLY0y9HwtmFzw1cMhK8lcuHHfosG05ldgMT86hY8Ysg78aQFNTRlJ4FO7u4DPOLE+/zPUTdBvaKCZpFMTfr6v9NXmimqNyLxQxkHvJnyEO0DptSOIvYhZvsLRnQtXtQfWiylTwu2P7sm2An7qncGJeR6SyOsyjv8Eljh+/FxIjLdL9m1m9dMyf6WM9O5BdXRS1tyf7JvpKWZ7bYlZBvuAOyXtpX9IgQ7I1QX1WwOW/QoT1DdmLsTXU/w54x0Geb8RekH/MAXOrzzPKYYwDkxdGX4cNQ9eWZnO9pU//ToNhGGHT1OuobeczMXCMDlgqIt213vDBkL3kx8W7aL9YqFZtdLQV2ec+BnFp4n2q41FqdpfyKjTYI4p5rWrC0USUmZTmiWFzxbGlzEg7wMzKVFcAv2vQhPhSX3nsUf++JPXNexPws/3ReuTmPf1BIZNuk1kQs3ToKGe1pYMssX3dkPNFVON+q0y8qyWXZiB8BxGU8I08dPfRooIxEiXICdeWPPpBCxG4hGY7Laz4Rm96tkYMawF6FUZGHClXTTGqaZMCMcfTdC9PKu28CcHxZSRx2JVjmjh2/GYH538lh8uOM/gz2jjY73EY3iUD9Dq42/W16f7z6iodAwGmv5hthy5b5vfUjG7lpRC9tPun9Y21TNP1eoyRr/kuIPD24L9nwLSynExVe5SySeXbKuPl//rhLcD6gQMo3hMrsI2CNqYKdqCH0ur2c/LVFuIvDT2vI0YBsMjT2kAReLaNIp4bk6wJhMjq6BmrS14l2OnVWtOV2E3HlK74cFbYe4zn5dBQkd/udsI7aERQ4xW8eKa0lwM44uqwA4E/XNcMyLDg8KtoZvTbWik8gNi4nJqe57NJX/XptqdNc5wRR73g7JklwMXCbyjDWvEcS1Q7860EgZTd8bxaRlbSs5c4RSDDBkA5jSAC1TMjcC/PaB6kHPJGIvEKLVOoYADxquPYDCX+unesAeDdrAeWtOialxtthAzlp1WTLM1ESgb0xKgTlDVhdu+wMWKyP0t984o4OrSgYQq2OJs44f6YpvObFqId830XE+uuqUmLBBuF33J+TY0sJGl+o0gWNLLbA9NQuQW46yVnjqynHg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00451f92-914d-4a4d-85ba-08d9f0ecdf85 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:20.3761 (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: j2mhLOd0YMBcZSdAkCF0anoUE8YB+zKKxZqh0j/zIDoZS7t0litBN2G3cgZrgtM9P4b6RiWpKarDkxls6oUdzu5wiUDgaODHDUBhAVwoSdE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1283 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: mMpoBuxma_2IcrKCLH-KYY3YKPZpCdG5 X-Proofpoint-GUID: mMpoBuxma_2IcrKCLH-KYY3YKPZpCdG5 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The new deferred attr patch set uncovered a double unlock in the recent port of the defer ops capture and continue code. During log recovery, we're allowed to hold buffers to a transaction that's being used to replay an intent item. When we capture the resources as part of scheduling a continuation of an intent chain, we call xfs_buf_hold to retain our reference to the buffer beyond the transaction commit, but we do /not/ call xfs_trans_bhold to maintain the buffer lock. This means that xfs_defer_ops_continue needs to relock the buffers before xfs_defer_restore_resources joins then tothe new transaction. Additionally, the buffers should not be passed back via the dres structure since they need to remain locked unlike the inodes. So simply set dr_bufs to zero after populating the dres structure. Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_defer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 0805ade2d300..6dac8d6b8c21 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -22,6 +22,7 @@ #include "xfs_refcount.h" #include "xfs_bmap.h" #include "xfs_alloc.h" +#include "xfs_buf.h" static struct kmem_cache *xfs_defer_pending_cache; @@ -774,17 +775,25 @@ xfs_defer_ops_continue( struct xfs_trans *tp, struct xfs_defer_resources *dres) { + unsigned int i; + ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); ASSERT(!(tp->t_flags & XFS_TRANS_DIRTY)); - /* Lock and join the captured inode to the new transaction. */ + /* Lock the captured resources to the new transaction. */ if (dfc->dfc_held.dr_inos == 2) xfs_lock_two_inodes(dfc->dfc_held.dr_ip[0], XFS_ILOCK_EXCL, dfc->dfc_held.dr_ip[1], XFS_ILOCK_EXCL); else if (dfc->dfc_held.dr_inos == 1) xfs_ilock(dfc->dfc_held.dr_ip[0], XFS_ILOCK_EXCL); + + for (i = 0; i < dfc->dfc_held.dr_bufs; i++) + xfs_buf_lock(dfc->dfc_held.dr_bp[i]); + + /* Join the captured resources to the new transaction. */ xfs_defer_restore_resources(tp, &dfc->dfc_held); memcpy(dres, &dfc->dfc_held, sizeof(struct xfs_defer_resources)); + dres->dr_bufs = 0; /* Move captured dfops chain and state to the transaction. */ list_splice_init(&dfc->dfc_dfops, &tp->t_dfops); From patchwork Wed Feb 16 01:37:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747783 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 EE700C433EF for ; Wed, 16 Feb 2022 01:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245510AbiBPBhi (ORCPT ); Tue, 15 Feb 2022 20:37:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245501AbiBPBhh (ORCPT ); Tue, 15 Feb 2022 20:37:37 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1FA119C2B for ; Tue, 15 Feb 2022 17:37:25 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMrfZU024709 for ; Wed, 16 Feb 2022 01:37:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=fJ5CaKNvw0pAT8Iux/k1gmCD4eTUAw/E68x7c31yUgA=; b=pQ4VQtGlzkurBSW/61UKrdg+jtnIVNfXx3hg9hHJTvB7ONeRf3sqBMDNQLtNmjfENT5B XqkSmrdIob/MSXwInSTzDtOLY4wQ9FtPY7GCh/HBems49EgsNpvTnTGnN9KZkd3zh5Ru XeRXzZF5tCdy7K2LfEDNMCNKTAMc6reHVMBHQjK/V3QJIn2mK2YIssq+CZ6JeMHNCDsZ 00qRnRNRQIxGKtm65mddmm1G6/wMkbbYlb0BHAW/dmzi4lq1T5RhHfiXtvEG59b0yBm5 uo9nl0QXwCV1XOnM/34alOg+FfkjZjBxWavU0vhwWyOihWkOQ+v5ij318q9HQksEZh6u dg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8ncar778-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:24 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQCa138909 for ; Wed, 16 Feb 2022 01:37:23 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2045.outbound.protection.outlook.com [104.47.73.45]) by userp3030.oracle.com with ESMTP id 3e8nkxj2rq-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ycpai+JaHTcvMNcsjSsbmEyHiqTiojEwtJT1EXC4Z4fOnAUl4rnSwLGaA+sMJBef+/wmqDrRIXHCRAPdEDgK6l3Sq+VHj9oFzMl7Rod2Mr84e3MLEbMslaNLocZ8ggEPq7cO6j4gOORYdmNjVgt4amrkTq8ncjkwVsaiPVx0J2KlJm9tS2Qg5I3Ru7/G62L+CacHqaH8O8xQAbzkdmlAOi5tF82hcVEBPqySdS7Nce8zLBQjv2X/EADsMqPKAj8OWjlIdXN3SQJHUszcdblWSmPV2xNl9GZAfne6qcGBiEVvCdAJHy8N9fYraghfdQ+uFeiHg8tDEc9Wxv43z2eSCg== 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=fJ5CaKNvw0pAT8Iux/k1gmCD4eTUAw/E68x7c31yUgA=; b=CBSd2Wl9ZXomUCMlnMXRMTzjzAHdkmCC0BSARdaNQomRLy7L7cLkWkkeiznR7SWGxOrK0RcaxoepsPU4pAHUAfYem2PMUHomDiYdtG4OOEifcd9elfAPSG9dfz3kG4koTlStnVwziJ3E1VuMDzVI2jn0Jrd7qzQ9Vxlet4ucBy7qfs0Ud8d5S8OZL1OV0x++PXWdskAMO1xtPytBhKa3uYXVUsQYj0za5talZ5vSgFs9uX0lBlNFUyioPpUfhRp+gkfid7+A5v9DnG3StLONhZ9PpzQncfffXMp7BsUghlNSwVVkETDAtwwxAdo1JrPOzC0JRaJKMi/SUAk940hiDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=fJ5CaKNvw0pAT8Iux/k1gmCD4eTUAw/E68x7c31yUgA=; b=mlNCc4MaY1npIysPvm8ijrShLlsQeVyo4O1JXmY1xyLi/iu7aDXmv64l4ohDYp/gbdM6MPPvZh0Y1xwVn2z8bNxoJ1FxaU/S0qnV330V6Zqaq6NhX1277jjy4oJhTTFfC/ytk+aGKPPcgBGL/bhRrMkwEdv3xd3EZoFBP837LS4= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BN6PR10MB1283.namprd10.prod.outlook.com (2603:10b6:404:45::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Wed, 16 Feb 2022 01:37:21 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:21 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 02/15] xfs: don't commit the first deferred transaction without intents Date: Tue, 15 Feb 2022 18:37:00 -0700 Message-Id: <20220216013713.1191082-3-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76c2554b-41e2-425f-cb66-08d9f0ecdfb7 X-MS-TrafficTypeDiagnostic: BN6PR10MB1283:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:331; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bsyWoCUky9xOo/bGBCkUyrhqW9lDfi+frCksbAKnU5TPOFh2hguNdDeXjOeThOE8qH1bAZQGLGBNPqPiwSrMOsqLlT8Z4NDbya50iHYDZJa3YhyXnTWDRZ0jYtUvxe01rsWcX6ZvEYQaesCgxjYE+qL7hk5LdVb6xYL0IuB48sjGqpKL9J4+F7/xfezvaMhajywWE/SiEpJy/+7yhXbFexeS94G8WGhgkF6jXVAcr7P9P4T5ojdoSedCp9221Cb9RdJUlCJ2jwrbH22BFyHDJ0nFro/CQAJs8oYL2XeF5sYsHxkImqnOzLH//GDEyGHZ3FL0cKvUQUwCcWzLtElO3c3BgEhkdWKqUxsARLeALCgBlT2dTkn5Wn12kHg0pofhQMxS4dHRiRDzrb5kNRKKLeVa08z6dLcddiq/klVOuG2tB1RYyJFSZhY7XsRKT7j/ThAKCmCFX+HSs7JakclWsJFHZ1LQB1i9eFCWM9n+Mj1qeNHfitQu+LTrQIrR5xkRmqnFNod+h8DoN/HgBsjND9DMHq398hJuXxG4pWgtINL9PdTvaLTm+7W0JLqIbCEUblrKk9KP0HTVPlBw9P8dxFGMOi2siLBoHpMa3CeqyLi3nl0vzhghxn6n2x4GxhyIItIqaYrjrTk895Dlgwzus1mcmnUoHFMCIPNbpk/jMelFljuIn5MtqqFiMA3ToGovlczdwgGGOvQ1UTBUjMT0gA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(8936002)(8676002)(6506007)(66476007)(52116002)(83380400001)(86362001)(6666004)(66946007)(66556008)(6512007)(36756003)(38350700002)(38100700002)(2616005)(26005)(508600001)(6916009)(2906002)(5660300002)(316002)(1076003)(186003)(6486002)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MupkBjInxni0eOjuXGn4rgIyrUU7Jf0w13ogJ1Nax5B93U6lDAL3DA9BwaDijb6unkMqlj57uR5mHU3pPoyrVIEhxpHU+xWVX5pWfIqZ2W5FE/beaf0hDaCeRqkssrO4rwgsth+Ou5wOpi43WKazLjYEYsJtuPXFH53aNEA7YCfF8Pp4OMQ0Ou5h5IOKuV7BIsO9JdWheSv8uIxLP1M+krWFxAbUTkP6n+wUvjXyMoEZJJwUScfH8Ftx2N2fnWRl7sRW4YHtNI21xTGb4fvmXPe/7x9ekTLzVWXzwy3ItMvHE3RhIkh04qSBUMtMa53QZIzNzMTshJnesf4oXjnXdxjVJbPBRQbJo+9o6dg/1us8VyCyVEcJ2HFL+1PaCC+QEN05kwyDc1F0UtEA2Dao3lMuGQsrUGw0DfbIinums+3e5tsKBbAsdsrGkRYFeBmLWMe7w5xRx5MZ/Ir+fbZLsW0td6osrLa2Yl6km7RsKaQ/4bndiIec62Xb533J8DQMHNF2Q7EPnShvaa5YcO+yjohgI/8KevweiZe6dcU0JdcvuLU+EbjyVkFXwIOSvVbaCQXoN9kmr0jtQGPY5DDOuLMwH6JrCr4f8VN5nkSZdjeCL5tMXb91a0tA3U5JQ5walWGw1u6EYEPtrU2yxm8FlI17kAKpC0np6j4HP2eraakGT8OqeO4HjmA0KHjG3HoJO+7Lhzq3To/S52hlWDFnE7MyqGr5ZgE4svDtn/TG+5UuSaX4YP7hQOTjIsIS83B857wzCb41U1//Ia4znfOoJo7lztsXi0Rh2lIWSneKt0jEx9WrhdLkNo/HTH5d/tCh0SosNS3w6QHSQaFWHGfaE/0ugqiYkYGUJc9a3BmrHY9JM3128Aa8UBMFjD9qWpyHfU4467bMwGCZn422pY0RQPHvTN90itHY5HRQnPUztATHjqes3a6YI4DcSzwYADSQuU87GDGNwJ1Erq9c1yTeoo0rK7Z6HUtmzw/biR+B483labyvpgB8WYrhN7y2Qo00N01btoMhc1X1g0cy9yuq7NvWxadGfbBMH9aIOqg9WLYQRKLiKdnwC4AhHBS+ww8TQreVT7J9KfTz28EOvnwsjFqPZmC/+xd9VfiFa3wfzpkAXMHT2RWNa2bq3d9MR80LDGGKt2YX439xbKRu+xNLlKnZIitvrYd8T9nQYZ2D7yg6zyqHwH5j6rb6wxukpgKAH+BY1BS1u26iwMGlPekJjD4SXoFHAXqbd2d8PdTZvtt2Xx4v4Zxt9Yqusx7L3XlC+dJm0YGfko1STF644Hc8kO9KZRUW30ZzjZ3rJOAsR3DNtFje9mc+RuKKf8a1XC8BW3qmF98GPAqYJJ6Lj0Yp2VffLRAmc/NvBHqKtpsmBUhX3ts7KULPkGJ0ZnHMmIM1U7z03aM796EfBDbg8HaOI7uMtFP7doqpXkp02uJ3wrnSJEAnQIlIbcHH2IzoDVqavKYZoZ/5V4h3a4rr69Rr3nKOUO2J1wKvJDuCeQVPtnPi6R9kfKiM5L5FZ2z9SPpOStWjkjsYZrKxLNfB0Ec/paWvXA3VnUpvp5xdavhJKEl27pbBj8sATAGtbWbE+LoHbQr5sPntKlOVAaUjq2DT5N1GGn4wyO/q63JauqDW7jnnlEmNkE9YI/e4HdqxvaQx1PMeYa15Se0d/p8wLFck4g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76c2554b-41e2-425f-cb66-08d9f0ecdfb7 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:20.6885 (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: iERWmuk0czKe15TpevRCEBZrdHtsy6JYYCr5urWP0zbMQCw9GOQXGmuNcn/xCP1p0elT20w9uEcLlJoUVZ7Zqp2YRjByKKLK2/Dhg2x6d1s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1283 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: IVtuzXd2AODyxZzMSIrWuk6pPYBFtQEN X-Proofpoint-GUID: IVtuzXd2AODyxZzMSIrWuk6pPYBFtQEN Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org If the first operation in a string of defer ops has no intents, then there is no reason to commit it before running the first call to xfs_defer_finish_one(). This allows the defer ops to be used effectively for non-intent based operations without requiring an unnecessary extra transaction commit when first called. This fixes a regression in per-attribute modification transaction count when delayed attributes are not being used. Signed-off-by: Dave Chinner Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_defer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 6dac8d6b8c21..26680e9f50f5 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -510,9 +510,16 @@ xfs_defer_finish_noroll( xfs_defer_create_intents(*tp); list_splice_init(&(*tp)->t_dfops, &dop_pending); - error = xfs_defer_trans_roll(tp); - if (error) - goto out_shutdown; + /* + * We must ensure the transaction is clean before we try to finish + * deferred work by committing logged intent items and anything + * else that dirtied the transaction. + */ + if ((*tp)->t_flags & XFS_TRANS_DIRTY) { + error = xfs_defer_trans_roll(tp); + if (error) + goto out_shutdown; + } /* Possibly relog intent items to keep the log moving. */ error = xfs_defer_relog(tp, &dop_pending); From patchwork Wed Feb 16 01:37:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747785 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 E9286C4332F for ; Wed, 16 Feb 2022 01:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245509AbiBPBhj (ORCPT ); Tue, 15 Feb 2022 20:37:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245497AbiBPBhh (ORCPT ); Tue, 15 Feb 2022 20:37:37 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6660119C30 for ; Tue, 15 Feb 2022 17:37:26 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMrfZV024709 for ; Wed, 16 Feb 2022 01:37:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=hLTFl3bdtlWGt6UMCQpgcnbNsiEqYCv7cGYKd50yvM4=; b=GEdyLq51yUIWLhjcxd2S96YwGcwH27cCrxkOwcqpPppnKUAW1lDS9P4fDiaaFAsc1Xbf 9G+0Gssqj5jqGtRdxvk6EkCgyOxuFx4M/GMFt9or9rrtJ5Ey3BMvKdwyxfd8ooDSu9kS v8/spBvCswZxoTZDKYxnuIgedYeiLHKJlENPreoK4nOlwlJBByZmxa+i01VXjEO9NUET mjp8OtTCRWR6o4JQxgaPo962c+gjXkFbnrUrrcqBRwuhtYElKNx+LrSsgN5gfrtNG1xO vsQINTBOnxta0CzvKlpxQJqRgtsBbZM6EIyOFNofzb90qAJGUw//ELNRE1VXJX4Y+Glw 1g== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8ncar779-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:25 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQCb138909 for ; Wed, 16 Feb 2022 01:37:24 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2045.outbound.protection.outlook.com [104.47.73.45]) by userp3030.oracle.com with ESMTP id 3e8nkxj2rq-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjxI67Bu6YvRlKqjYWSAlA77WPIyjsBN6R/euCbHiOPSsmvvhMbJIvXlwAYMsIqPqLTe16ijOobBd54uA3T77KrkXjYbg/JYTmypTDHcb47goXi6+uldyYuOGlUyKPQQbEUYEta7HCMbbtbLsCLn13wb8/RGppDRAl+Bk64xPgPN6RwbfNcVUC391RMB4Kv5P3A7q7ND/GdERIkqMKo/DK/Gasn3XSLaysIT/Sj82OkIbSpNQ0y1YnK0Sni/vi/FK4mLzYV4ov43QouL5z1l8ei3tiWeE+KguqvmTvK9nucHblViyGhTGYEA5gOx9/5PinKG6tiVh7NEtIRPV7B4VA== 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=hLTFl3bdtlWGt6UMCQpgcnbNsiEqYCv7cGYKd50yvM4=; b=m0WuxsoHRr+Ne74der1agH0U6gEoapTuvb6e2raHP4kOvaz5HY3vj6zbVKCyHNmXhCOBfKdg/DdsJZBbadfwGcewKtwFCXWpHLyuPeVFWOqm9Mc3VtUe/RnF9S/9U+SblK0LsgOQqxqqCA9Lv6NCSQy5uPN5SUIm4NMY/IyVzq60Qpg/e6MJYZa9CTpF/GA39JvncIk32wUWf6gJwISDf78socNKqx1mgcPOZyhjh7Hpdx1wL1gVohSbvqmRDIQFGjsrfquzO4T4dVqc6nbUsxA5zn4dJ3qmdCW7gfXM8v89gkRUYKQwUsQIQD2VTBDzOIjbsqAGPYlIscjDslVLHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=hLTFl3bdtlWGt6UMCQpgcnbNsiEqYCv7cGYKd50yvM4=; b=H5yo6mI7ohLGNw4VDvk73XAhDsYEkQdjGUteqP5N/RkSa9urbRJEf6pM5wMq20RIZiff0QZ1+dnwat0190CNbpxbKye7vsGEjpslowAaOLtftmNb3RzQgVUTk1p5nvFc2TzsDAR8fqx2W91exS7Nm3FQ3LgtbebphsqkvsBUpnc= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BN6PR10MB1283.namprd10.prod.outlook.com (2603:10b6:404:45::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Wed, 16 Feb 2022 01:37:22 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:22 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 03/15] xfs: Return from xfs_attr_set_iter if there are no more rmtblks to process Date: Tue, 15 Feb 2022 18:37:01 -0700 Message-Id: <20220216013713.1191082-4-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ebfca70b-cefe-41ca-4bf2-08d9f0ecdfee X-MS-TrafficTypeDiagnostic: BN6PR10MB1283:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +b+K3g3FRctBC3LI1+JpvwvLCDt44dMIxAYFuL1/UVGxuIdf0lzh5jzJKu2H0NORQm70VQmz5V6jpFALbqRKT/Br+oVVenR72XKdls6gekJ1+wjm7dxP+ZYQ15rSC6VXSCk5MOr7TSB3/0ABGEhVFBjda5vaPqv37K80bwrlW9Y/BC/qCHgCF1nVddt1HURRRJk7ZCmZLF+YK+Tbam3Qs8kAdXJ0h4/NcmEA0YsetzJ1gYG63IY4fT+gYa+78ceZR1Es9oeQfGR/vob+e9IsXySJ06+PvPYXVhpImPy7qDoOJk3VH4RNCi82iZZmKynNo6ZxrfmGphuWz1S1IXn9ur7vMFlqtEtBihNlB4FrHtnjXMOsTf8nR5itscu/1l+7s+IiF58Xwn7f0h8iednkLIrOXO7sMb7LTqSFXkiWm5z0E/pHVYb2rvi11PnW3Hooza5s7U9e+/F3GmmqibF8cQpsVc3mT95ZYpW4jJ9zqYboxD+0d8cy7tosPEhGFqdTkPgiZGHg/IP+hfmUENb1TWhpo6cIZhzxCx1iS8PdtnUdvx6CmTc2p5zx/z6G5PN+GtDk/QINCl2Myfl7CG528Lpc0K/rRP51rDPBDB9GSWu3aeM1b0WZESXU5NURMlhhWBk4z/4jVfgEvcdXdWf9xB+axrPJF9o+7j+jt0KZ1ifDXdThiLk1WTJy4UJboqAdt9PU+cAe3dGHSb8Kcfy3xxnwuRJMsUdqo8KJDK6jD4LewXtjQX738Xpl4MqU+M6E0hrFEh+rjGdGh2sZ6JyvgA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(8936002)(8676002)(6506007)(66476007)(52116002)(83380400001)(86362001)(6666004)(66946007)(66556008)(6512007)(36756003)(38350700002)(38100700002)(2616005)(26005)(508600001)(6916009)(2906002)(5660300002)(316002)(1076003)(186003)(6486002)(44832011)(29513003)(40753002)(133343001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4c7eksnINU1qQnNc0Oh8kmLjVjxytPHMZ/3TKEswtbh7c39HvpU98msm4Toj8r0rWU9kfxSL6W8s4HNFZJCN+owpTNZk3jttLFZf0nfrrE/d5kTrfZEtAhQD1zllxzV2Dm0UnmkYxMYlEv3fAl5aXYhFTrur8o3lQo/vzoB0KEUAPnd/KOgdK1O5IDeYCa9m2tKu6ywWXHvf6WKPlpC7ObYWHpNuoZi8/9MOce4HIcTqKqtexzueySu87sP5hNebd3wY3oHQg0T4t4FjkX4rKS9pIs6ve6UBwm0bt1jln9hgm4tqRjQdinyvz7dBnl+PqQFFgphK6gPMmdqEd/Dp8Q9rSDReq7LZz7kz9gnhy7oQGKVNauc8ITsEt435k4cesZNTFd0X9pSutw64tSclwvKCGUzqlDE6i2/SB664TeuCtEO6/Y68mafbk9AdoG0TAZR+bbhCS1G88C4u33ANmUWIXn4TAadmT9IrR3EgUXcWqzPiSKkpoOVmbNXHWL+FkH/fAuG7R3VRJmkClln9Fr7YQPVldtpp1n9OwYetIs90l1dICjSBQNy+4RqlagobTX6mHoHmzNkkNYrqkIEu/IldKzOQWEiwusMjOVrINCH4/qb2soAzAsP7gcUL/za/ro59MPpKPSXTcq2C293LiXesdhqcBfyAldzFzvJRa4hd+sRDh+omUxIaUoV1XiAYj5K+ff1YzvH8x0P8kY2xxIt4wc8ymQH62A9zEKMjCe/UT6A4admISNktYm91j/cL5nqOQwPcqVyqa5TdrdQzDL8cKoc3LlB+5dX9bigMEWQnVFI7vIb0y4s96di6Qm1io9qIgnh2zbariv0BJ4Wud47+17llELs06PhZSKUV97SHVoThAHl/5qhZE/XCHpVkOrZp7YMGA07prMmMadtcBXix3GucLfz5CxSYlYXwwWb35Mp2DU1HwvoKoGXUod3TNiOdvsX2gtxgERDlmdMwteKGP/oxjKE0Upx3HwffP52W9B5yo/qO41VMvQBGVJXWmkrXPjox+GQKO10SMC34szj2L+m83AYU4X9epyPVb8HNu7nn8db0jtVXt3pQ8DLgUHelwvOPfkzyD91xTL5fykV/R8w6O9STjO3otxe0QLAWkuy5Jvy8PljK8K9wuQDZ5aq9qZ6R2rfkr6ysZbDboAk2mjFvGgH+XiBE4a8Z2HeGzHMrIZegz6I/gTzyyI/dLpaMGgSjMnuwFtMROcs8LB4273SITrvzlpAh30DKIcwvQ/NHb4HD8XvakvxWH39llWbvZUXPaX0C1C0SW+phQh1Gbx30BPVHnKVz9C5uZJ6sr3jvCoFZKOCxDqnHnjnjJ4HPZIh5li7hNptU2W/BCGd2u/YbtM2+Z9bemC8XI0cmNdUgc+vCUShSRnC/FcD2iHjk5FfHpWX6tq0QoOQbTP6CCsVDN8B++QaYAopGnsI/wirBP/s6i3xl0um33LoThvRDkT46zZjfL9I5SPqQ4fBMaSMXl56NnTUNt9fg7RskOA0OdIIOeW8vj3qC3P6rjdFdyfDs72enBtjFH637TIeUKzn3dTAqLSrEWEN2mPcgff6OnLao1b42geka3+LqUyzmowcXcQq6H//MuR84n4QTG6OEgD1GD6vdooNqFk4i3jT4N4LzbvpMAag6GUhDEuLvCY/DgjUOhJS+XyGWcA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebfca70b-cefe-41ca-4bf2-08d9f0ecdfee X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:21.0144 (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: JCk3BgtCIPY/XS/YTb6AcriuiHIQ/zO+4plRl7+1KF35MFsRWToJ2lj6jafjNEil3/Pv5voIHoM4euIrJbM2nNtvJRNqoNGjuN42XPno4fM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1283 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: 6F8ZJbmDvThTNZmYgCTg2-wUF0kH7nsw X-Proofpoint-GUID: 6F8ZJbmDvThTNZmYgCTg2-wUF0kH7nsw Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org During an attr rename operation, blocks are saved for later removal as rmtblkno2. The rmtblkno is used in the case of needing to alloc more blocks if not enough were available. However, in the case that no further blocks need to be added or removed, we can return as soon as xfs_attr_node_addname completes, rather than rolling the transaction with an -EAGAIN return. This extra loop does not hurt anything right now, but it will be a problem later when we get into log items because we end up with an empty log transaction. So, add a simple check to cut out the unneeded iteration. Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 23523b802539..23502a24ce41 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -412,6 +412,14 @@ xfs_attr_set_iter( if (error) return error; + /* + * If addname was successful, and we dont need to alloc + * or remove anymore blks, we're done. + */ + if (!args->rmtblkno && + !(args->op_flags & XFS_DA_OP_RENAME)) + return 0; + dac->dela_state = XFS_DAS_FOUND_NBLK; } trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); From patchwork Wed Feb 16 01:37:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747789 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 00F79C433FE for ; Wed, 16 Feb 2022 01:37:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245515AbiBPBhm (ORCPT ); Tue, 15 Feb 2022 20:37:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243706AbiBPBhl (ORCPT ); Tue, 15 Feb 2022 20:37:41 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84C8819C28 for ; Tue, 15 Feb 2022 17:37:28 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FN8hX3028765 for ; Wed, 16 Feb 2022 01:37:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=QkSMFc1miyrePX8KHNLq1doe4Q4tAD90H/VN/XWJNX8=; b=Z7XGhWxJ8yoN5yat/JSBiSb2y12jgyM8qaFrNFtQd1KMOLkmrs6ewrCSYGyICB7zhLGE 9LNYKopyRxLZEqjYVXMK3OMQrKnISwpkhU44tvnMdPT160SdLbLZ1mPArYHArXZRhkPZ ue299loWbGIKqEejl25DlZwH0O+NRo5KQj43D+0UqBsmaDfrvGnccbNcCQDyFBps/8b2 +++1dxx1P3GTpZs3ImWTa4zduGBe02AyTaOdIRp0jYb/6mPrF5R+IFtUm0yVU+O3iPB5 SUpYrqKzu5s7ReNvHH2lt3lpwY6QvL5e+mgbRA49NAQ22jgY4IaxUrZ+/qZC+WykKmw8 Dw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nkdg6kh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:27 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1UZxI165528 for ; Wed, 16 Feb 2022 01:37:26 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by userp3020.oracle.com with ESMTP id 3e8n4tuxvp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AiPh2QrwxiBOTzi2PTP08OxWBGmOe2Lu6g8y2tmVPP7cLJr03AjRgVxQaOd1K31szH00J3Sd+oKfIB0bYiXlx5l82DAoi4qF7YF++GuriBPrbZCvxKMmdxNblJt+m2XBFPKHaiw2WGwNLq0Q0VlLtA3Dif81DmvoB7B7rFlN2b7KPGC79NVO49cj7hIgPF8U4Xv71IvBgg9In3XtaDvEwPaSfVEPulXA4ut2W2iVvi+a5if5VtlQ2fEURMF+gEbmNSnuGP/1E2Y+cWpIjjbVS/NrSOJFrCjQNtVCLPM+DI+YWwh503qH9EHC+q1s117eZC+KMX0LG5xVtvX65X7C3w== 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=QkSMFc1miyrePX8KHNLq1doe4Q4tAD90H/VN/XWJNX8=; b=I0kGiBrk3U0my9B3rYEE3uR6exZN2sVq2o+8PzIO4b+Nhi3oquUi+6ouhLx8iSR8iebpJVKbC9cD6rgPBH0ANL9jomcv5rC6VfIjQRoDdLLFVMtI/nF9NS6KT5ThqaWZUmhsxLIf0eaNs1ObU4bqUnczQUblhQg/D7SxIqSBV+phCRSZ0q0bN0Q/miMeyUEvujLRB+oQTnqBpodJRs68ExTtd7oGTuxd6k6IYpot6wqIDlXNGkM5U5LiliY2erGHwUfSdf7Iv2nrw0juGk7UdkZhhmY8h057qBFrKnsklPeQIzs9tIMXV9Oubnsr0dDlcvt9xxegARzunpqZioFjUg== 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=QkSMFc1miyrePX8KHNLq1doe4Q4tAD90H/VN/XWJNX8=; b=MVHS92CXl3J5dZHepL4MjbgpbQlXugJchyCsMiMKESKILdVtcSgOmwoXBg/Woo93SY1epJmxQE3YUPi0ZaOi/sT++zrhxYSBhiiZ8D5JLwJIEOlMiZopr7K6zR6d/D8BBdPkegckFoYjwZHNQ1ZVJJWD0mGmXFm7yPIDjDzjUYY= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:23 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:22 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 04/15] xfs: Set up infrastructure for log attribute replay Date: Tue, 15 Feb 2022 18:37:02 -0700 Message-Id: <20220216013713.1191082-5-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e5900ff-adba-4afa-9681-08d9f0ece01b X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ShBAccUKHXHf5ZWdsLgihkHUENmsziC3t+hOTsuEBU7NseuGiNEzQcZebZY6kd90/M5vdigMzWyxaa8/xFGCB2uEb3pAUu4rRatlMKjSw5pStrMBk130syZPMCmt3wf+eM7IFhVSda+fgIt6VNpvWmvr9dw5UyaZzD8N7PoyoR1WO8jPx0ioA7RMJC0rN2BSu08lm3s4moYOhX2WZC3yBMS37E8yCFe09OBfNEFUw2evTt/ZWfq3NbGsZjMa5iNa1MSr8tMrheH5Q3r6FKjkiXFZgoXWpMzxegNjmRHZUqcs+U2F1BMJKdD5VrpL5BVyZfUg7vXnAS2w0qxOYC+SDovp3wAttHilhJfBXr7OhgzNOYxvPML6gQSfAHzrsG+sPFLRidt3YaRsmP7C2e6GL3YnTdWKRDJV7qwgVoGpf9MG1U7Vhb0mCrqG/NWBgpssbmOwBFoYa7X172RVUbvm2z7snNvpWcJQgW+NruVfzTIRumBB4RzTfTDWZe6+flkRHXi+rf2d+ODvbdRPl2nqmc8dXu6VvfKS2QNoHzB7uzL9e8emqESurm8drOQpCdseLAdpecTQYF2d5PDB0zHffuNq3pkTE0JCOashT3IJHZOA9OhkMoiufcSDbK1zs3XSJZJkeRwXzzbG52Pn4wqZ0P5PCoKyLpYA9HdDTA7UHdoZZUCne0xQ5iwMAywnRnUsP+8S63TAn7lF9dRFq++Gng== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(30864003)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZhxWtN+HaQ/3n0tVoGK6+W/wI0cQB+PVdwYEaD6TThNGDib/ARAdqFGPcjMJOsznyp8CZpZWpH9a9N0TEauLBA//wTGc2sBeVarQv0x1GGP4yrygFN9RqMxKIebHOE9KzSUbC/OR55iPbkC66llXhxe0xO1cCe45VTT1UrWikza+a6Dj8GWSX5S3CDGMJt/pMB0oKgS/Y20rEOErLRaAPZQ/3h64G66bpE5lVqM17XPT8g+oEITd6zv8uACryGAKiJ/B31ZNsBMBE+qqXFdkv/2eByBQNwlgHTltYZb/Z9ui5hyl/sWj251+HyG4AxbKHEm0w1mK8BtD1VovpVmqT6Y/ME0rNjFeBdBQgLeiEPeQ0A96+ZxrRgsl2qXOxEtUEZ+MMbHB9Ujxr+mRQ0SA2YR4EUoEHtjO99xBhE+7E77tC9S3oyNutg+MbgC3awqVTslH7p8FuIktcVDyYOYYrgYp72rXZdkDwj50plXp4tuWkz7yI4aOjEV97OKi3SdbZvGvXthfJepRqD1JZ32B+69K5Y1dZkn8EJh9BcSqSpHacdZPonlb5h6bMI+mPRVDi5TByWHnLMOrK+NEf5yV+oLbK0xpYoUpw+IZsIYmHJFGnKJsvn3ybTDwirvMndRwHEpfcyE5Q3dZsSn2tuzrjXE4Hk+NjZcSRHHGvcp3RhKSb3Ifu83EB9bp0oXXlZBCIWu28eTXO54Sym2zwZ/oPMAeCewPjmyL43Rw+qgP4UiW/bjtb4SNDKxWndHWEkVawgAPqZTbQ8RM7mNa2AhuXOyumqO8W8pXrc9N0QSUjJxWW0tdIxzSVnCs45Iskq3K+75SwODqA/sWLdhBeKN4MjOMBvjqg+xIOUlvcb6N+eCijPRdvBhjwUetfg4egCZ7gZNt5TzPnAXlsg4FZU8Fbvj+W6V5Bu2TPpAcs/DRN52wSFHI1t9vjouDO0G51HYccxpq7HFUFFuiBoc8rkhHQI9oPDobcg4QUzQw+wCpTJfy9o1BBreAOTeq+mZkcvGw3DZzYBUq906IYRMPjKGwhFNSBg75OCcovSLdJF45OUkdRYa2Lyl3MxI24UgFResTfJxZLxw+97AXI3QJZOouJxvqZVLIOPz69oKXlfDDolPWyoArcij8TCfxVavg/NBS0HK8APJI/3gvIxRHHpjEAk2VZUFrzYtj3WMiylN7F347pFtkQHZkR3zSf9+7yjAdj6by6zPXlgKkJeZUB9Qs9Kn6t185yrpxzE9Jp8YE4scBcOu9bpte5iz9ACVoE5zoepX3UoqFq0TKN/E/A5PCN4HKf0r6KiZ+pj89qo1kaKqjaNZ7Uvts2GYyXOOqXEitYT8/L7zjwlDCTWcpl2zzyExr6+bRoh0zF+Le36S4SrloKfNtrceLoX4I3whwIuEAkeE2LYIcbWq/6IaoZZBtGV0qcdQKsFdp9a7kNpIV8njexRvhxahCrSgzSb0T7bjBtKgWrsrFhmRaDvfmLAkixcv1AGXmzfuydT6RmMXCOgKLaG1/2snvhZbs/HszKNoQnrplDqsO5fbNceKJd7e/gkh/09yD96ipiWpCB8Kjf36iED9G8eRG/97Fi+E7SIzkHiQihTGQvzHXNjFFEPLimFMrnW4OeIKin+MFSnn5IAWL7eiEJ+aBhmgkNavjOyBV+2RiuDnVwCMkoCpKSg3u2Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e5900ff-adba-4afa-9681-08d9f0ece01b X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:21.5144 (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: nH1+BCUQMEOR4cDPciuFLGkFDQyEcOZOLL4ead3KTNCMxBUxfVQbP+2HgRmsSOTfeBOXtuI1VOVdB4lLSVZwG79lIF92sdZUEixJiEDp3Hs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: dVBrj0kbXKL5AEJC7Vxlll4D_DNYzz7_ X-Proofpoint-GUID: dVBrj0kbXKL5AEJC7Vxlll4D_DNYzz7_ Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Currently attributes are modified directly across one or more transactions. But they are not logged or replayed in the event of an error. The goal of log attr replay is to enable logging and replaying of attribute operations using the existing delayed operations infrastructure. This will later enable the attributes to become part of larger multi part operations that also must first be recorded to the log. This is mostly of interest in the scheme of parent pointers which would need to maintain an attribute containing parent inode information any time an inode is moved, created, or removed. Parent pointers would then be of interest to any feature that would need to quickly derive an inode path from the mount point. Online scrub, nfs lookups and fs grow or shrink operations are all features that could take advantage of this. This patch adds two new log item types for setting or removing attributes as deferred operations. The xfs_attri_log_item will log an intent to set or remove an attribute. The corresponding xfs_attrd_log_item holds a reference to the xfs_attri_log_item and is freed once the transaction is done. Both log items use a generic xfs_attr_log_format structure that contains the attribute name, value, flags, inode, and an op_flag that indicates if the operations is a set or remove. Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R Reviewed-by: Darrick J. Wong --- fs/xfs/Makefile | 1 + fs/xfs/libxfs/xfs_attr.c | 42 ++- fs/xfs/libxfs/xfs_attr.h | 38 +++ fs/xfs/libxfs/xfs_defer.c | 10 +- fs/xfs/libxfs/xfs_defer.h | 2 + fs/xfs/libxfs/xfs_log_format.h | 44 +++- fs/xfs/libxfs/xfs_log_recover.h | 2 + fs/xfs/scrub/common.c | 2 + fs/xfs/xfs_attr_item.c | 441 ++++++++++++++++++++++++++++++++ fs/xfs/xfs_attr_item.h | 46 ++++ fs/xfs/xfs_attr_list.c | 1 + fs/xfs/xfs_ioctl32.c | 2 + fs/xfs/xfs_iops.c | 2 + fs/xfs/xfs_log.c | 4 + fs/xfs/xfs_log.h | 11 + fs/xfs/xfs_log_recover.c | 2 + fs/xfs/xfs_ondisk.h | 2 + 17 files changed, 646 insertions(+), 6 deletions(-) diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index 04611a1068b4..b056cfc6398e 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile @@ -102,6 +102,7 @@ xfs-y += xfs_log.o \ xfs_buf_item_recover.o \ xfs_dquot_item_recover.o \ xfs_extfree_item.o \ + xfs_attr_item.o \ xfs_icreate_item.o \ xfs_inode_item.o \ xfs_inode_item_recover.o \ diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 23502a24ce41..21594f814685 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -24,6 +24,10 @@ #include "xfs_quota.h" #include "xfs_trans_space.h" #include "xfs_trace.h" +#include "xfs_attr_item.h" + +struct kmem_cache *xfs_attri_cache; +struct kmem_cache *xfs_attrd_cache; /* * xfs_attr.c @@ -61,8 +65,6 @@ STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); STATIC int xfs_attr_refillstate(xfs_da_state_t *state); -STATIC int xfs_attr_set_iter(struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp); STATIC int xfs_attr_node_removename(struct xfs_da_args *args, struct xfs_da_state *state); @@ -166,7 +168,7 @@ xfs_attr_get( /* * Calculate how many blocks we need for the new attribute, */ -STATIC int +int xfs_attr_calc_size( struct xfs_da_args *args, int *local) @@ -837,6 +839,40 @@ xfs_attr_set( goto out_unlock; } +int __init +xfs_attri_init_cache(void) +{ + xfs_attri_cache = kmem_cache_create("xfs_attri", + sizeof(struct xfs_attri_log_item), + 0, 0, NULL); + + return xfs_attri_cache != NULL ? 0 : -ENOMEM; +} + +void +xfs_attri_destroy_cache(void) +{ + kmem_cache_destroy(xfs_attri_cache); + xfs_attri_cache = NULL; +} + +int __init +xfs_attrd_init_cache(void) +{ + xfs_attrd_cache = kmem_cache_create("xfs_attrd", + sizeof(struct xfs_attrd_log_item), + 0, 0, NULL); + + return xfs_attrd_cache != NULL ? 0 : -ENOMEM; +} + +void +xfs_attrd_destroy_cache(void) +{ + kmem_cache_destroy(xfs_attrd_cache); + xfs_attrd_cache = NULL; +} + /*======================================================================== * External routines when attribute list is inside the inode *========================================================================*/ diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 5e71f719bdd5..80b6f28b0d1a 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -28,6 +28,11 @@ struct xfs_attr_list_context; */ #define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */ +static inline bool xfs_has_larp(struct xfs_mount *mp) +{ + return false; +} + /* * Kernel-internal version of the attrlist cursor. */ @@ -461,6 +466,11 @@ enum xfs_delattr_state { struct xfs_delattr_context { struct xfs_da_args *da_args; + /* + * Used by xfs_attr_set to hold a leaf buffer across a transaction roll + */ + struct xfs_buf *leaf_bp; + /* Used in xfs_attr_rmtval_set_blk to roll through allocating blocks */ struct xfs_bmbt_irec map; xfs_dablk_t lblkno; @@ -474,6 +484,23 @@ struct xfs_delattr_context { enum xfs_delattr_state dela_state; }; +/* + * List of attrs to commit later. + */ +struct xfs_attr_item { + struct xfs_delattr_context xattri_dac; + + /* + * Indicates if the attr operation is a set or a remove + * XFS_ATTR_OP_FLAGS_{SET,REMOVE} + */ + unsigned int xattri_op_flags; + + /* used to log this item to an intent */ + struct list_head xattri_list; +}; + + /*======================================================================== * Function prototypes for the kernel. *========================================================================*/ @@ -490,10 +517,21 @@ int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_set(struct xfs_da_args *args); int xfs_attr_set_args(struct xfs_da_args *args); +int xfs_attr_set_iter(struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp); int xfs_attr_remove_args(struct xfs_da_args *args); int xfs_attr_remove_iter(struct xfs_delattr_context *dac); bool xfs_attr_namecheck(const void *name, size_t length); void xfs_delattr_context_init(struct xfs_delattr_context *dac, struct xfs_da_args *args); +int xfs_attr_calc_size(struct xfs_da_args *args, int *local); + +extern struct kmem_cache *xfs_attri_cache; +extern struct kmem_cache *xfs_attrd_cache; + +int __init xfs_attri_init_cache(void); +void xfs_attri_destroy_cache(void); +int __init xfs_attrd_init_cache(void); +void xfs_attrd_destroy_cache(void); #endif /* __XFS_ATTR_H__ */ diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 26680e9f50f5..030a865ed481 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -23,6 +23,7 @@ #include "xfs_bmap.h" #include "xfs_alloc.h" #include "xfs_buf.h" +#include "xfs_attr.h" static struct kmem_cache *xfs_defer_pending_cache; @@ -870,7 +871,12 @@ xfs_defer_init_item_caches(void) error = xfs_extfree_intent_init_cache(); if (error) goto err; - + error = xfs_attri_init_cache(); + if (error) + goto err; + error = xfs_attrd_init_cache(); + if (error) + goto err; return 0; err: xfs_defer_destroy_item_caches(); @@ -881,6 +887,8 @@ xfs_defer_init_item_caches(void) void xfs_defer_destroy_item_caches(void) { + xfs_attri_destroy_cache(); + xfs_attrd_destroy_cache(); xfs_extfree_intent_destroy_cache(); xfs_bmap_intent_destroy_cache(); xfs_refcount_intent_destroy_cache(); diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h index 7bb8a31ad65b..fcd23e5cf1ee 100644 --- a/fs/xfs/libxfs/xfs_defer.h +++ b/fs/xfs/libxfs/xfs_defer.h @@ -63,6 +63,8 @@ extern const struct xfs_defer_op_type xfs_refcount_update_defer_type; extern const struct xfs_defer_op_type xfs_rmap_update_defer_type; extern const struct xfs_defer_op_type xfs_extent_free_defer_type; extern const struct xfs_defer_op_type xfs_agfl_free_defer_type; +extern const struct xfs_defer_op_type xfs_attr_defer_type; + /* * Deferred operation item relogging limits. diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h index b322db523d65..3301c369e815 100644 --- a/fs/xfs/libxfs/xfs_log_format.h +++ b/fs/xfs/libxfs/xfs_log_format.h @@ -114,7 +114,12 @@ struct xfs_unmount_log_format { #define XLOG_REG_TYPE_CUD_FORMAT 24 #define XLOG_REG_TYPE_BUI_FORMAT 25 #define XLOG_REG_TYPE_BUD_FORMAT 26 -#define XLOG_REG_TYPE_MAX 26 +#define XLOG_REG_TYPE_ATTRI_FORMAT 27 +#define XLOG_REG_TYPE_ATTRD_FORMAT 28 +#define XLOG_REG_TYPE_ATTR_NAME 29 +#define XLOG_REG_TYPE_ATTR_VALUE 30 +#define XLOG_REG_TYPE_MAX 30 + /* * Flags to log operation header @@ -237,6 +242,8 @@ typedef struct xfs_trans_header { #define XFS_LI_CUD 0x1243 #define XFS_LI_BUI 0x1244 /* bmbt update intent */ #define XFS_LI_BUD 0x1245 +#define XFS_LI_ATTRI 0x1246 /* attr set/remove intent*/ +#define XFS_LI_ATTRD 0x1247 /* attr set/remove done */ #define XFS_LI_TYPE_DESC \ { XFS_LI_EFI, "XFS_LI_EFI" }, \ @@ -252,7 +259,9 @@ typedef struct xfs_trans_header { { XFS_LI_CUI, "XFS_LI_CUI" }, \ { XFS_LI_CUD, "XFS_LI_CUD" }, \ { XFS_LI_BUI, "XFS_LI_BUI" }, \ - { XFS_LI_BUD, "XFS_LI_BUD" } + { XFS_LI_BUD, "XFS_LI_BUD" }, \ + { XFS_LI_ATTRI, "XFS_LI_ATTRI" }, \ + { XFS_LI_ATTRD, "XFS_LI_ATTRD" } /* * Inode Log Item Format definitions. @@ -869,4 +878,35 @@ struct xfs_icreate_log { __be32 icl_gen; /* inode generation number to use */ }; +/* + * Flags for deferred attribute operations. + * Upper bits are flags, lower byte is type code + */ +#define XFS_ATTR_OP_FLAGS_SET 1 /* Set the attribute */ +#define XFS_ATTR_OP_FLAGS_REMOVE 2 /* Remove the attribute */ +#define XFS_ATTR_OP_FLAGS_TYPE_MASK 0xFF /* Flags type mask */ + +/* + * This is the structure used to lay out an attr log item in the + * log. + */ +struct xfs_attri_log_format { + uint16_t alfi_type; /* attri log item type */ + uint16_t alfi_size; /* size of this item */ + uint32_t __pad; /* pad to 64 bit aligned */ + uint64_t alfi_id; /* attri identifier */ + uint64_t alfi_ino; /* the inode for this attr operation */ + uint32_t alfi_op_flags; /* marks the op as a set or remove */ + uint32_t alfi_name_len; /* attr name length */ + uint32_t alfi_value_len; /* attr value length */ + uint32_t alfi_attr_flags;/* attr flags */ +}; + +struct xfs_attrd_log_format { + uint16_t alfd_type; /* attrd log item type */ + uint16_t alfd_size; /* size of this item */ + uint32_t __pad; /* pad to 64 bit aligned */ + uint64_t alfd_alf_id; /* id of corresponding attri */ +}; + #endif /* __XFS_LOG_FORMAT_H__ */ diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h index ff69a0000817..32e216255cb0 100644 --- a/fs/xfs/libxfs/xfs_log_recover.h +++ b/fs/xfs/libxfs/xfs_log_recover.h @@ -72,6 +72,8 @@ extern const struct xlog_recover_item_ops xlog_rui_item_ops; extern const struct xlog_recover_item_ops xlog_rud_item_ops; extern const struct xlog_recover_item_ops xlog_cui_item_ops; extern const struct xlog_recover_item_ops xlog_cud_item_ops; +extern const struct xlog_recover_item_ops xlog_attri_item_ops; +extern const struct xlog_recover_item_ops xlog_attrd_item_ops; /* * Macros, structures, prototypes for internal log manager use. diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c index bf1f3607d0b6..97b54ac3075f 100644 --- a/fs/xfs/scrub/common.c +++ b/fs/xfs/scrub/common.c @@ -23,6 +23,8 @@ #include "xfs_rmap_btree.h" #include "xfs_log.h" #include "xfs_trans_priv.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_reflink.h" #include "xfs_ag.h" diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c new file mode 100644 index 000000000000..00ade15cf1eb --- /dev/null +++ b/fs/xfs/xfs_attr_item.c @@ -0,0 +1,441 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2022 Oracle. All Rights Reserved. + * Author: Allison Henderson + */ + +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_format.h" +#include "xfs_trans_resv.h" +#include "xfs_shared.h" +#include "xfs_mount.h" +#include "xfs_defer.h" +#include "xfs_log_format.h" +#include "xfs_trans.h" +#include "xfs_trans_priv.h" +#include "xfs_log.h" +#include "xfs_inode.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_attr_item.h" +#include "xfs_trace.h" +#include "xfs_inode.h" +#include "xfs_trans_space.h" +#include "xfs_error.h" +#include "xfs_log_priv.h" +#include "xfs_log_recover.h" + +static const struct xfs_item_ops xfs_attri_item_ops; +static const struct xfs_item_ops xfs_attrd_item_ops; + +static inline struct xfs_attri_log_item *ATTRI_ITEM(struct xfs_log_item *lip) +{ + return container_of(lip, struct xfs_attri_log_item, attri_item); +} + +STATIC void +xfs_attri_item_free( + struct xfs_attri_log_item *attrip) +{ + kmem_free(attrip->attri_item.li_lv_shadow); + kmem_free(attrip); +} + +/* + * Freeing the attrip requires that we remove it from the AIL if it has already + * been placed there. However, the ATTRI may not yet have been placed in the + * AIL when called by xfs_attri_release() from ATTRD processing due to the + * ordering of committed vs unpin operations in bulk insert operations. Hence + * the reference count to ensure only the last caller frees the ATTRI. + */ +STATIC void +xfs_attri_release( + struct xfs_attri_log_item *attrip) +{ + ASSERT(atomic_read(&attrip->attri_refcount) > 0); + if (atomic_dec_and_test(&attrip->attri_refcount)) { + xfs_trans_ail_delete(&attrip->attri_item, + SHUTDOWN_LOG_IO_ERROR); + xfs_attri_item_free(attrip); + } +} + +STATIC void +xfs_attri_item_size( + struct xfs_log_item *lip, + int *nvecs, + int *nbytes) +{ + struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); + + *nvecs += 2; + *nbytes += sizeof(struct xfs_attri_log_format) + + xlog_calc_iovec_len(attrip->attri_name_len); + + if (!attrip->attri_value_len) + return; + + *nvecs += 1; + *nbytes += xlog_calc_iovec_len(attrip->attri_value_len); +} + +/* + * This is called to fill in the log iovecs for the given attri log + * item. We use 1 iovec for the attri_format_item, 1 for the name, and + * another for the value if it is present + */ +STATIC void +xfs_attri_item_format( + struct xfs_log_item *lip, + struct xfs_log_vec *lv) +{ + struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); + struct xfs_log_iovec *vecp = NULL; + + attrip->attri_format.alfi_type = XFS_LI_ATTRI; + attrip->attri_format.alfi_size = 1; + + /* + * This size accounting must be done before copying the attrip into the + * iovec. If we do it after, the wrong size will be recorded to the log + * and we trip across assertion checks for bad region sizes later during + * the log recovery. + */ + + ASSERT(attrip->attri_name_len > 0); + attrip->attri_format.alfi_size++; + + if (attrip->attri_value_len > 0) + attrip->attri_format.alfi_size++; + + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRI_FORMAT, + &attrip->attri_format, + sizeof(struct xfs_attri_log_format)); + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NAME, + attrip->attri_name, + xlog_calc_iovec_len(attrip->attri_name_len)); + if (attrip->attri_value_len > 0) + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_VALUE, + attrip->attri_value, + xlog_calc_iovec_len(attrip->attri_value_len)); +} + +/* + * The unpin operation is the last place an ATTRI is manipulated in the log. It + * is either inserted in the AIL or aborted in the event of a log I/O error. In + * either case, the ATTRI transaction has been successfully committed to make + * it this far. Therefore, we expect whoever committed the ATTRI to either + * construct and commit the ATTRD or drop the ATTRD's reference in the event of + * error. Simply drop the log's ATTRI reference now that the log is done with + * it. + */ +STATIC void +xfs_attri_item_unpin( + struct xfs_log_item *lip, + int remove) +{ + xfs_attri_release(ATTRI_ITEM(lip)); +} + + +STATIC void +xfs_attri_item_release( + struct xfs_log_item *lip) +{ + xfs_attri_release(ATTRI_ITEM(lip)); +} + +/* + * Allocate and initialize an attri item. Caller may allocate an additional + * trailing buffer of the specified size + */ +STATIC struct xfs_attri_log_item * +xfs_attri_init( + struct xfs_mount *mp, + int buffer_size) + +{ + struct xfs_attri_log_item *attrip; + + if (buffer_size) { + attrip = kmem_alloc(sizeof(struct xfs_attri_log_item) + + buffer_size, KM_NOFS); + if (attrip == NULL) + return NULL; + } else { + attrip = kmem_cache_alloc(xfs_attri_cache, + GFP_NOFS | __GFP_NOFAIL); + } + + xfs_log_item_init(mp, &attrip->attri_item, XFS_LI_ATTRI, + &xfs_attri_item_ops); + attrip->attri_format.alfi_id = (uintptr_t)(void *)attrip; + atomic_set(&attrip->attri_refcount, 2); + + return attrip; +} + +/* + * Copy an attr format buffer from the given buf, and into the destination attr + * format structure. + */ +STATIC int +xfs_attri_copy_format( + struct xfs_log_iovec *buf, + struct xfs_attri_log_format *dst_attr_fmt) +{ + struct xfs_attri_log_format *src_attr_fmt = buf->i_addr; + size_t len; + + len = sizeof(struct xfs_attri_log_format); + if (buf->i_len != len) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); + return -EFSCORRUPTED; + } + + memcpy((char *)dst_attr_fmt, (char *)src_attr_fmt, len); + return 0; +} + +static inline struct xfs_attrd_log_item *ATTRD_ITEM(struct xfs_log_item *lip) +{ + return container_of(lip, struct xfs_attrd_log_item, attrd_item); +} + +STATIC void +xfs_attrd_item_free(struct xfs_attrd_log_item *attrdp) +{ + kmem_free(attrdp->attrd_item.li_lv_shadow); + kmem_free(attrdp); +} + +STATIC void +xfs_attrd_item_size( + struct xfs_log_item *lip, + int *nvecs, + int *nbytes) +{ + *nvecs += 1; + *nbytes += sizeof(struct xfs_attrd_log_format); +} + +/* + * This is called to fill in the log iovecs for the given attrd log item. We use + * only 1 iovec for the attrd_format, and we point that at the attr_log_format + * structure embedded in the attrd item. + */ +STATIC void +xfs_attrd_item_format( + struct xfs_log_item *lip, + struct xfs_log_vec *lv) +{ + struct xfs_attrd_log_item *attrdp = ATTRD_ITEM(lip); + struct xfs_log_iovec *vecp = NULL; + + attrdp->attrd_format.alfd_type = XFS_LI_ATTRD; + attrdp->attrd_format.alfd_size = 1; + + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRD_FORMAT, + &attrdp->attrd_format, + sizeof(struct xfs_attrd_log_format)); +} + +/* + * The ATTRD is either committed or aborted if the transaction is canceled. If + * the transaction is canceled, drop our reference to the ATTRI and free the + * ATTRD. + */ +STATIC void +xfs_attrd_item_release( + struct xfs_log_item *lip) +{ + struct xfs_attrd_log_item *attrdp = ATTRD_ITEM(lip); + + xfs_attri_release(attrdp->attrd_attrip); + xfs_attrd_item_free(attrdp); +} + +STATIC xfs_lsn_t +xfs_attri_item_committed( + struct xfs_log_item *lip, + xfs_lsn_t lsn) +{ + struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); + + /* + * The attrip refers to xfs_attr_item memory to log the name and value + * with the intent item. This already occurred when the intent was + * committed so these fields are no longer accessed. Clear them out of + * caution since we're about to free the xfs_attr_item. + */ + attrip->attri_name = NULL; + attrip->attri_value = NULL; + + /* + * The ATTRI is logged only once and cannot be moved in the log, so + * simply return the lsn at which it's been logged. + */ + return lsn; +} + +STATIC bool +xfs_attri_item_match( + struct xfs_log_item *lip, + uint64_t intent_id) +{ + return ATTRI_ITEM(lip)->attri_format.alfi_id == intent_id; +} + +/* Is this recovered ATTRI format ok? */ +static inline bool +xfs_attri_validate( + struct xfs_mount *mp, + struct xfs_attri_log_format *attrp) +{ + unsigned int op = attrp->alfi_op_flags & + XFS_ATTR_OP_FLAGS_TYPE_MASK; + + if (attrp->__pad != 0) + return false; + + /* alfi_op_flags should be either a set or remove */ + if (op != XFS_ATTR_OP_FLAGS_SET && op != XFS_ATTR_OP_FLAGS_REMOVE) + return false; + + if (attrp->alfi_value_len > XATTR_SIZE_MAX) + return false; + + if ((attrp->alfi_name_len > XATTR_NAME_MAX) || + (attrp->alfi_name_len == 0)) + return false; + + return xfs_verify_ino(mp, attrp->alfi_ino); +} + +STATIC int +xlog_recover_attri_commit_pass2( + struct xlog *log, + struct list_head *buffer_list, + struct xlog_recover_item *item, + xfs_lsn_t lsn) +{ + int error; + struct xfs_mount *mp = log->l_mp; + struct xfs_attri_log_item *attrip; + struct xfs_attri_log_format *attri_formatp; + char *name = NULL; + char *value = NULL; + int region = 0; + int buffer_size; + + attri_formatp = item->ri_buf[region].i_addr; + + /* Validate xfs_attri_log_format */ + if (!xfs_attri_validate(mp, attri_formatp)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); + return -EFSCORRUPTED; + } + + buffer_size = attri_formatp->alfi_name_len + + attri_formatp->alfi_value_len; + + /* memory alloc failure will cause replay to abort */ + attrip = xfs_attri_init(mp, buffer_size); + if (attrip == NULL) + return -ENOMEM; + + error = xfs_attri_copy_format(&item->ri_buf[region], + &attrip->attri_format); + if (error) + goto out; + + attrip->attri_name_len = attri_formatp->alfi_name_len; + attrip->attri_value_len = attri_formatp->alfi_value_len; + region++; + name = ((char *)attrip) + sizeof(struct xfs_attri_log_item); + memcpy(name, item->ri_buf[region].i_addr, attrip->attri_name_len); + attrip->attri_name = name; + + if (!xfs_attr_namecheck(name, attrip->attri_name_len)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, mp); + error = -EFSCORRUPTED; + goto out; + } + + if (attrip->attri_value_len > 0) { + region++; + value = ((char *)attrip) + sizeof(struct xfs_attri_log_item) + + attrip->attri_name_len; + memcpy(value, item->ri_buf[region].i_addr, + attrip->attri_value_len); + attrip->attri_value = value; + } + + /* + * The ATTRI has two references. One for the ATTRD and one for ATTRI to + * ensure it makes it into the AIL. Insert the ATTRI into the AIL + * directly and drop the ATTRI reference. Note that + * xfs_trans_ail_update() drops the AIL lock. + */ + xfs_trans_ail_insert(log->l_ailp, &attrip->attri_item, lsn); + xfs_attri_release(attrip); + return 0; +out: + xfs_attri_item_free(attrip); + return error; +} + +/* + * This routine is called when an ATTRD format structure is found in a committed + * transaction in the log. Its purpose is to cancel the corresponding ATTRI if + * it was still in the log. To do this it searches the AIL for the ATTRI with + * an id equal to that in the ATTRD format structure. If we find it we drop + * the ATTRD reference, which removes the ATTRI from the AIL and frees it. + */ +STATIC int +xlog_recover_attrd_commit_pass2( + struct xlog *log, + struct list_head *buffer_list, + struct xlog_recover_item *item, + xfs_lsn_t lsn) +{ + struct xfs_attrd_log_format *attrd_formatp; + + attrd_formatp = item->ri_buf[0].i_addr; + if (item->ri_buf[0].i_len != sizeof(struct xfs_attrd_log_format)) { + XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, NULL); + return -EFSCORRUPTED; + } + + xlog_recover_release_intent(log, XFS_LI_ATTRI, + attrd_formatp->alfd_alf_id); + return 0; +} + +static const struct xfs_item_ops xfs_attri_item_ops = { + .iop_size = xfs_attri_item_size, + .iop_format = xfs_attri_item_format, + .iop_unpin = xfs_attri_item_unpin, + .iop_committed = xfs_attri_item_committed, + .iop_release = xfs_attri_item_release, + .iop_match = xfs_attri_item_match, +}; + +const struct xlog_recover_item_ops xlog_attri_item_ops = { + .item_type = XFS_LI_ATTRI, + .commit_pass2 = xlog_recover_attri_commit_pass2, +}; + +static const struct xfs_item_ops xfs_attrd_item_ops = { + .flags = XFS_ITEM_RELEASE_WHEN_COMMITTED, + .iop_size = xfs_attrd_item_size, + .iop_format = xfs_attrd_item_format, + .iop_release = xfs_attrd_item_release, +}; + +const struct xlog_recover_item_ops xlog_attrd_item_ops = { + .item_type = XFS_LI_ATTRD, + .commit_pass2 = xlog_recover_attrd_commit_pass2, +}; diff --git a/fs/xfs/xfs_attr_item.h b/fs/xfs/xfs_attr_item.h new file mode 100644 index 000000000000..c3b779f82adb --- /dev/null +++ b/fs/xfs/xfs_attr_item.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * + * Copyright (C) 2022 Oracle. All Rights Reserved. + * Author: Allison Henderson + */ +#ifndef __XFS_ATTR_ITEM_H__ +#define __XFS_ATTR_ITEM_H__ + +/* kernel only ATTRI/ATTRD definitions */ + +struct xfs_mount; +struct kmem_zone; + +/* + * This is the "attr intention" log item. It is used to log the fact that some + * extended attribute operations need to be processed. An operation is + * currently either a set or remove. Set or remove operations are described by + * the xfs_attr_item which may be logged to this intent. + * + * During a normal attr operation, name and value point to the name and value + * fields of the caller's xfs_da_args structure. During a recovery, the name + * and value buffers are copied from the log, and stored in a trailing buffer + * attached to the xfs_attr_item until they are committed. They are freed when + * the xfs_attr_item itself is freed when the work is done. + */ +struct xfs_attri_log_item { + struct xfs_log_item attri_item; + atomic_t attri_refcount; + int attri_name_len; + int attri_value_len; + void *attri_name; + void *attri_value; + struct xfs_attri_log_format attri_format; +}; + +/* + * This is the "attr done" log item. It is used to log the fact that some attrs + * earlier mentioned in an attri item have been freed. + */ +struct xfs_attrd_log_item { + struct xfs_log_item attrd_item; + struct xfs_attri_log_item *attrd_attrip; + struct xfs_attrd_log_format attrd_format; +}; + +#endif /* __XFS_ATTR_ITEM_H__ */ diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c index 2d1e5134cebe..90a14e85e76d 100644 --- a/fs/xfs/xfs_attr_list.c +++ b/fs/xfs/xfs_attr_list.c @@ -15,6 +15,7 @@ #include "xfs_inode.h" #include "xfs_trans.h" #include "xfs_bmap.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_attr_sf.h" #include "xfs_attr_leaf.h" diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index 004ed2a251e8..618a46a1d5fb 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c @@ -17,6 +17,8 @@ #include "xfs_itable.h" #include "xfs_fsops.h" #include "xfs_rtalloc.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_ioctl.h" #include "xfs_ioctl32.h" diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index b79b3846e71b..2b6b6f0434ff 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -13,6 +13,8 @@ #include "xfs_inode.h" #include "xfs_acl.h" #include "xfs_quota.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_trans.h" #include "xfs_trace.h" diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 89fec9a18c34..8ba8563114b9 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -2157,6 +2157,10 @@ xlog_print_tic_res( REG_TYPE_STR(CUD_FORMAT, "cud_format"), REG_TYPE_STR(BUI_FORMAT, "bui_format"), REG_TYPE_STR(BUD_FORMAT, "bud_format"), + REG_TYPE_STR(ATTRI_FORMAT, "attri_format"), + REG_TYPE_STR(ATTRD_FORMAT, "attrd_format"), + REG_TYPE_STR(ATTR_NAME, "attr name"), + REG_TYPE_STR(ATTR_VALUE, "attr value"), }; BUILD_BUG_ON(ARRAY_SIZE(res_type_str) != XLOG_REG_TYPE_MAX + 1); #undef REG_TYPE_STR diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index dc1b77b92fc1..fd945eb66c32 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h @@ -21,6 +21,17 @@ struct xfs_log_vec { #define XFS_LOG_VEC_ORDERED (-1) +/* + * Calculate the log iovec length for a given user buffer length. Intended to be + * used by ->iop_size implementations when sizing buffers of arbitrary + * alignments. + */ +static inline int +xlog_calc_iovec_len(int len) +{ + return roundup(len, sizeof(int32_t)); +} + static inline void * xlog_prepare_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp, uint type) diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 96c997ed2ec8..f1edb315e341 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -1800,6 +1800,8 @@ static const struct xlog_recover_item_ops *xlog_recover_item_ops[] = { &xlog_cud_item_ops, &xlog_bui_item_ops, &xlog_bud_item_ops, + &xlog_attri_item_ops, + &xlog_attrd_item_ops, }; static const struct xlog_recover_item_ops * diff --git a/fs/xfs/xfs_ondisk.h b/fs/xfs/xfs_ondisk.h index 25991923c1a8..758702b9495f 100644 --- a/fs/xfs/xfs_ondisk.h +++ b/fs/xfs/xfs_ondisk.h @@ -132,6 +132,8 @@ xfs_check_ondisk_structs(void) XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format, 56); XFS_CHECK_STRUCT_SIZE(struct xfs_qoff_logformat, 20); XFS_CHECK_STRUCT_SIZE(struct xfs_trans_header, 16); + XFS_CHECK_STRUCT_SIZE(struct xfs_attri_log_format, 40); + XFS_CHECK_STRUCT_SIZE(struct xfs_attrd_log_format, 16); /* * The v5 superblock format extended several v4 header structures with From patchwork Wed Feb 16 01:37:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747787 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 7E95CC433F5 for ; Wed, 16 Feb 2022 01:37:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245520AbiBPBhl (ORCPT ); Tue, 15 Feb 2022 20:37:41 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245515AbiBPBhl (ORCPT ); Tue, 15 Feb 2022 20:37:41 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1580B19C29 for ; Tue, 15 Feb 2022 17:37:29 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FN8dxr028726 for ; Wed, 16 Feb 2022 01:37:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=5WVFp0a+1w/GnHPw/DNIoQZm5wiQhg7eKdgUWN4DsOY=; b=sK8o+dU7GcAfGbQa0Rab731+CGk+CO8TGDIsdCYIt8xvqmohqqd1RgepBVjYO7Mg8Gzr b5KivpovMDXApMrgx+IhykOaHMBpZndEcOJGRpuQBWCHALIETPi7mLPiScKZwpJGDYNs 1XMz1zk2ZC7hLFz/lmqQeVMGPCI3JyhTKVOQVdvyopn+TXrdqR49tcs0wkm3l/3Ufpd1 4EpHvh/X07FAP8qk/eu2FDAr8W+U4odLF9/l9Y+sEi63DXLtxE7H92eneRFeNQhPt9Ug mCzgPl8BBZeOS9/q8twWVfN8jisHbZMHkiuKE2dI2QNd8NH1fsKpOUW1Hu9ZP9A2RO4U Pw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nkdg6kk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:28 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1UZxJ165528 for ; Wed, 16 Feb 2022 01:37:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by userp3020.oracle.com with ESMTP id 3e8n4tuxvp-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jjNk/yE/QEkBk7wUm9YU03x69kyoUZY8ljLy41AZimpOwqwgmYXE7YDG7+RmM8lhtBA9plCnQPsQUKwEcTm7vb+xlE2DSzQx+TF2T+frXujqGrlW6EsiZr5I49QVN6Av/PVlWRT7i3a3TPEfBgKLE84Dk29QjpUjyPDDS1lbv5ULjCtJtwNXV5toy05gGbc6UFiEBOD9Hd4TJ0Zey3Uo1Y9UcMrQ4/amYFa/YjkMhX/ICJU0KKvZQFJsp54KP6jxByM/bG9JGtvLFQkOjHw8gX9LfMbE74S0rBgjjHlLwXfVCRaSMkmz8SDd9rw1JA6Cmr38rPW7+tnOsQADWyjq+Q== 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=5WVFp0a+1w/GnHPw/DNIoQZm5wiQhg7eKdgUWN4DsOY=; b=aRodJAOj47Rum5sXlM3z73a3ZYlSoWshKgSgcysfNgZspMb2T9TuCT9tyrMuoWW/Uz6Jb16739oww+WVUVtsTFfVJ/jVFBlJMcIsNLQCWaMXkRy1TzZboZ2FxIkbVQGUiUSESWFzhO9Afkvw4lSWC3bbl4OlmNjeTrf67TcQzYXqJO16ws3v1Vv+XIQSnkuKaSNT19aZDXqf3S3YQFMR47EOdSqzime2iEdJTyznAP0jei2E+c0/zm96O8mUr8KTqDNjPZuD+rG71CVJnfskUAXr9Q6ZcNppA40RWpxbluYOzVdAuVPDzfjPOyQHN+mzEruH8Sh0AlXqHF4evIy1Ng== 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=5WVFp0a+1w/GnHPw/DNIoQZm5wiQhg7eKdgUWN4DsOY=; b=Wd22zl4WbgizNZaksNE/AMJuHEd3qOvL8o9JL3s6ddXegI5SAW76c+TAUdV/NbsLhe/BuC0foE/5xcOvYQERMBhFvLycramfQfwmgVg8aznGiq44q+LwwzBzWzlbBSPjhwPbsTFZ8rfDkXBvB5iWaOv/XCSWNGRGbO7doefKpfA= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:24 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:24 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 05/15] xfs: Implement attr logging and replay Date: Tue, 15 Feb 2022 18:37:03 -0700 Message-Id: <20220216013713.1191082-6-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83f85994-3ff0-44bb-de2b-08d9f0ece067 X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:231; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8pfGOvSXmWtUDrlnL6cs4yaaULbeFE93lbP1LUM+QhClqJ2XmXqHbBi2VYctOVMInsaSr3bpXAJrXtWvkCsSp1ohJfU1pjCVenVTh/rkRJ5LygskrDSzcVKkn+mptrB/kmfM6cIXEPgqn/B+AelRjw/1yyezi9Y+QVXR+2ZSjHN8015Z+x4fUuZ6XoPnIdtAhQ9rEaYOodX3psQmi6z8slnaPTmN87x5FcThUHbc7MnrGl8PA0Gs2svQupeyIcVjz3QGxIUf/KDEe3wy3daaSV7V0FjyJMLDHADOja4meVIw+TYOPdm1T4Kybc8Re5vrXAUr6fwvFukNQWfdfUVyfJuU093ZPwfbpUYS9TFHzZhxMhlXf+DjQlE623BegAbJzdMCAFlL8Az18amD4EuhuifYPaMKiXUVgBNjcDGlVazWdfeZimLnaz4BHSOvElXtzFwfiabhQy5WRxjoFJZIt7msmymwPGbZrERmShZnTfoIACpHu4aiIiKKF9krbsF6nmqYyQexT0osyd0tCm3X92aJvL73n3dlWPHz8Abz8GC/L5wY2JlljveNyLWJzkjnisA4h0lwwPkagfWlPSVkAjYvA6FbLaUJeFbAtrSDcB5SmCsblKwKvT6oA9zEzY+eHJpoae5Db8hT7pvI3LQ3ZTA5+6rXI6oGq17UKc6Me1LeW/usfEHyoRwsgL9IQw+0X7VukHZ5Bc2Ik9twH5Rzzg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(30864003)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yTLYE8ZUieP2G+tTbw/CQ4DsXLxSbnB1x2EC6p3/op5g8qud5zMMKMtLHFwL2YflD4fHY3pGCaXZS1hCta8E6MhedvI9WlkyRAw7N5jid3K+du99C+135vWfWVo1g7R6tkVVU+cyfZge7ahEqJQM+UPWB8L1Bzie/i7b0LOkgkPG23djQixNXNq0SksJrTYq8mmj1n18IozoMVaYqbRLVrfuQg1D5Q79pvH1qyUeu2HRkB6/k3e5EaA0A4bQYlIoiTX9P5uuRbmnjWbp1vA5m+ps63ATpfZv32JYlAtht1YKvCoruhclhhiynDhmsNPYSztuSVkIGBYqba3ZIeGIc5KMMKHdqtewkP4q4PMV1gDCdO2Yoar02/K44L9IBEn79Q1At5Y32JVALRcpRCqglTAr6zGtpJTW0GvbRHBCMSmTjd1nwlYNsk/iVEXPb7gnIrWFxVctoev1gnfJzVKMfL+gJvfDxGtrzzTWSIM3Lgh5tLCeqFYg8wrnab0D4TI8iDY+4TYDiPmIFkAAE7SDMJB0Xx2wkisgKd+SKcY2ZIdm+r6gj1QnNKqZ6Okd3ZcTRboZ2BPqHOhaLd4oPH+68/Nk0qg2KfxQYjKSDf2ni7Qeiou1MlV7Wpp7YQb1PgQTwz6OG0lqgOnwe4pT/R1z9EK0M2ORxSbrq3JfQ/r662JnQT1pUSWJWmDp7qLAVUQFEzb7DNtCQLN5vlzxLpUsn1EDtSaI/3r8dLiZGIdfC4UBKVEyGJuWR2RKsQQIIBV66bFPWIR3xLJX1oKgw5Rm+s9M4Rd5WMa/EndpgDXBGBYZRAqT9Jdqhexr4quAHAEq6NpRZtc3cdg5Y9z9763dAZYA4zlKgNIslxA7fPfN4vrWkeU36IxdHIs6oFP24vLSywaGrWIluCP23EJilWQx/rjjTR3q9zweh6kOfOUNKwt1wSKN7+fB6nO6Zg5OdXjz7pjMEvBhqgzftpsb8+zkOWRpzwMU+RRIlDgPLFq8tyoyw2GsR7RWbjQkF5rcjla7CiyF9GrAyFBEj59JCyNR6dNZRfmkPHNA4lWkgsQy3YcL40vzkardoMSwwV17APtbA7OB6kW3bnKgMmIQtUv0uvzg3TsqikMfJFwqazaYLCfPIh7ltetyJCtpjGQXaWKjKe2Mm3WexNB6rwd3t9jvpunnZCUN6hEj0lA5XMx5ad3EXf7y1iMEHZ+YmtCJCMBrHNpGRH4oD8Xn1o8vbSQB2uYnVBgrbD7BLy3DbfFDVVW6CgSLNApZnQoaMJJZKKaUtvK6l0If/8S/fbV6Xzi64mU9Sq40uaRpAfETQdRi90EnYXokSj7Wg8KZFZRLDd1QEa0EMHjHPcGu2nT+Ei4sAQ7GKpZq+RzAjEANdX0hRO1J9hJZ90BDmcd5spb+Xzbef5uE4rSaK0692nyes8tbbD7ZNkocvae46eXqPUBP1xOEzDyKB6EayD8UzHkPQ/Jg6K80djC43fFz8XasI/BNczt07k2bPDzn3GasnyOGUBcEfZx3ZPs5U57pfzsd2CsWuqNXqdy8OX3iuBnvIrVewrhqVH1zI/ybL0bS4c2zf4cwEPUemxDd+f3fuUzE2EQjU8XpqwTk99ArwFBiBoovmFPPF+zIfo72fxYd5CJWWIV7H4RLaRvmey+cox1PZqaYCrPrGWuN2oUO8NGKpRCISA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83f85994-3ff0-44bb-de2b-08d9f0ece067 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:21.8893 (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: k4Mxi8tThV8DSJUcqk1mBSjtg7AvGuHtgS/GLqWJHoPMtVMqvLG+QtgDZh6BfDK+AgzfPV+Q84xMc9Ra38X1pVjMeFfcObk8ke5VeG4v5CQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: KVuMOGdGwTjzXFzljMwT2VPbku5B1zc5 X-Proofpoint-GUID: KVuMOGdGwTjzXFzljMwT2VPbku5B1zc5 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds the needed routines to create, log and recover logged extended attribute intents. Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_defer.c | 1 + fs/xfs/libxfs/xfs_defer.h | 1 + fs/xfs/libxfs/xfs_format.h | 9 +- fs/xfs/xfs_attr_item.c | 360 +++++++++++++++++++++++++++++++++++++ 4 files changed, 370 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index 030a865ed481..1761d752673e 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -186,6 +186,7 @@ static const struct xfs_defer_op_type *defer_op_types[] = { [XFS_DEFER_OPS_TYPE_RMAP] = &xfs_rmap_update_defer_type, [XFS_DEFER_OPS_TYPE_FREE] = &xfs_extent_free_defer_type, [XFS_DEFER_OPS_TYPE_AGFL_FREE] = &xfs_agfl_free_defer_type, + [XFS_DEFER_OPS_TYPE_ATTR] = &xfs_attr_defer_type, }; static void diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h index fcd23e5cf1ee..114a3a4930a3 100644 --- a/fs/xfs/libxfs/xfs_defer.h +++ b/fs/xfs/libxfs/xfs_defer.h @@ -19,6 +19,7 @@ enum xfs_defer_ops_type { XFS_DEFER_OPS_TYPE_RMAP, XFS_DEFER_OPS_TYPE_FREE, XFS_DEFER_OPS_TYPE_AGFL_FREE, + XFS_DEFER_OPS_TYPE_ATTR, XFS_DEFER_OPS_TYPE_MAX, }; diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index d665c04e69dd..302b50bc5830 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -388,7 +388,9 @@ xfs_sb_has_incompat_feature( return (sbp->sb_features_incompat & feature) != 0; } -#define XFS_SB_FEAT_INCOMPAT_LOG_ALL 0 +#define XFS_SB_FEAT_INCOMPAT_LOG_XATTRS (1 << 0) /* Delayed Attributes */ +#define XFS_SB_FEAT_INCOMPAT_LOG_ALL \ + (XFS_SB_FEAT_INCOMPAT_LOG_XATTRS) #define XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_LOG_ALL static inline bool xfs_sb_has_incompat_log_feature( @@ -413,6 +415,11 @@ xfs_sb_add_incompat_log_features( sbp->sb_features_log_incompat |= features; } +static inline bool xfs_sb_version_haslogxattrs(struct xfs_sb *sbp) +{ + return xfs_sb_is_v5(sbp) && (sbp->sb_features_log_incompat & + XFS_SB_FEAT_INCOMPAT_LOG_XATTRS); +} static inline bool xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino) diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 00ade15cf1eb..6e4c65d82db5 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -13,6 +13,7 @@ #include "xfs_defer.h" #include "xfs_log_format.h" #include "xfs_trans.h" +#include "xfs_bmap_btree.h" #include "xfs_trans_priv.h" #include "xfs_log.h" #include "xfs_inode.h" @@ -29,6 +30,8 @@ static const struct xfs_item_ops xfs_attri_item_ops; static const struct xfs_item_ops xfs_attrd_item_ops; +static struct xfs_attrd_log_item *xfs_trans_get_attrd(struct xfs_trans *tp, + struct xfs_attri_log_item *attrip); static inline struct xfs_attri_log_item *ATTRI_ITEM(struct xfs_log_item *lip) { @@ -257,6 +260,163 @@ xfs_attrd_item_release( xfs_attrd_item_free(attrdp); } +/* + * Performs one step of an attribute update intent and marks the attrd item + * dirty.. An attr operation may be a set or a remove. Note that the + * transaction is marked dirty regardless of whether the operation succeeds or + * fails to support the ATTRI/ATTRD lifecycle rules. + */ +STATIC int +xfs_xattri_finish_update( + struct xfs_delattr_context *dac, + struct xfs_attrd_log_item *attrdp, + struct xfs_buf **leaf_bp, + uint32_t op_flags) +{ + struct xfs_da_args *args = dac->da_args; + unsigned int op = op_flags & + XFS_ATTR_OP_FLAGS_TYPE_MASK; + int error; + + switch (op) { + case XFS_ATTR_OP_FLAGS_SET: + error = xfs_attr_set_iter(dac, leaf_bp); + break; + case XFS_ATTR_OP_FLAGS_REMOVE: + ASSERT(XFS_IFORK_Q(args->dp)); + error = xfs_attr_remove_iter(dac); + break; + default: + error = -EFSCORRUPTED; + break; + } + + /* + * Mark the transaction dirty, even on error. This ensures the + * transaction is aborted, which: + * + * 1.) releases the ATTRI and frees the ATTRD + * 2.) shuts down the filesystem + */ + args->trans->t_flags |= XFS_TRANS_DIRTY; + + /* + * attr intent/done items are null when logged attributes are disabled + */ + if (attrdp) + set_bit(XFS_LI_DIRTY, &attrdp->attrd_item.li_flags); + + return error; +} + +/* Log an attr to the intent item. */ +STATIC void +xfs_attr_log_item( + struct xfs_trans *tp, + struct xfs_attri_log_item *attrip, + struct xfs_attr_item *attr) +{ + struct xfs_attri_log_format *attrp; + + tp->t_flags |= XFS_TRANS_DIRTY; + set_bit(XFS_LI_DIRTY, &attrip->attri_item.li_flags); + + /* + * At this point the xfs_attr_item has been constructed, and we've + * created the log intent. Fill in the attri log item and log format + * structure with fields from this xfs_attr_item + */ + attrp = &attrip->attri_format; + attrp->alfi_ino = attr->xattri_dac.da_args->dp->i_ino; + attrp->alfi_op_flags = attr->xattri_op_flags; + attrp->alfi_value_len = attr->xattri_dac.da_args->valuelen; + attrp->alfi_name_len = attr->xattri_dac.da_args->namelen; + attrp->alfi_attr_flags = attr->xattri_dac.da_args->attr_filter; + + attrip->attri_name = (void *)attr->xattri_dac.da_args->name; + attrip->attri_value = attr->xattri_dac.da_args->value; + attrip->attri_name_len = attr->xattri_dac.da_args->namelen; + attrip->attri_value_len = attr->xattri_dac.da_args->valuelen; +} + +/* Get an ATTRI. */ +static struct xfs_log_item * +xfs_attr_create_intent( + struct xfs_trans *tp, + struct list_head *items, + unsigned int count, + bool sort) +{ + struct xfs_mount *mp = tp->t_mountp; + struct xfs_attri_log_item *attrip; + struct xfs_attr_item *attr; + + ASSERT(count == 1); + + if (!xfs_sb_version_haslogxattrs(&mp->m_sb)) + return NULL; + + attrip = xfs_attri_init(mp, 0); + if (attrip == NULL) + return NULL; + + xfs_trans_add_item(tp, &attrip->attri_item); + list_for_each_entry(attr, items, xattri_list) + xfs_attr_log_item(tp, attrip, attr); + return &attrip->attri_item; +} + +/* Process an attr. */ +STATIC int +xfs_attr_finish_item( + struct xfs_trans *tp, + struct xfs_log_item *done, + struct list_head *item, + struct xfs_btree_cur **state) +{ + struct xfs_attr_item *attr; + struct xfs_attrd_log_item *done_item = NULL; + int error; + struct xfs_delattr_context *dac; + + attr = container_of(item, struct xfs_attr_item, xattri_list); + dac = &attr->xattri_dac; + if (done) + done_item = ATTRD_ITEM(done); + + /* + * Always reset trans after EAGAIN cycle + * since the transaction is new + */ + dac->da_args->trans = tp; + + error = xfs_xattri_finish_update(dac, done_item, &dac->leaf_bp, + attr->xattri_op_flags); + if (error != -EAGAIN) + kmem_free(attr); + + return error; +} + +/* Abort all pending ATTRs. */ +STATIC void +xfs_attr_abort_intent( + struct xfs_log_item *intent) +{ + xfs_attri_release(ATTRI_ITEM(intent)); +} + +/* Cancel an attr */ +STATIC void +xfs_attr_cancel_item( + struct list_head *item) +{ + struct xfs_attr_item *attr; + + attr = container_of(item, struct xfs_attr_item, xattri_list); + kmem_free(attr); +} + STATIC xfs_lsn_t xfs_attri_item_committed( struct xfs_log_item *lip, @@ -314,6 +474,160 @@ xfs_attri_validate( return xfs_verify_ino(mp, attrp->alfi_ino); } +/* + * Process an attr intent item that was recovered from the log. We need to + * delete the attr that it describes. + */ +STATIC int +xfs_attri_item_recover( + struct xfs_log_item *lip, + struct list_head *capture_list) +{ + struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); + struct xfs_attr_item *attr; + struct xfs_mount *mp = lip->li_mountp; + struct xfs_inode *ip; + struct xfs_da_args *args; + struct xfs_trans *tp; + struct xfs_trans_res tres; + struct xfs_attri_log_format *attrp; + int error, ret = 0; + int total; + int local; + struct xfs_attrd_log_item *done_item = NULL; + + /* + * First check the validity of the attr described by the ATTRI. If any + * are bad, then assume that all are bad and just toss the ATTRI. + */ + attrp = &attrip->attri_format; + if (!xfs_attri_validate(mp, attrp) || + !xfs_attr_namecheck(attrip->attri_name, attrip->attri_name_len)) + return -EFSCORRUPTED; + + error = xlog_recover_iget(mp, attrp->alfi_ino, &ip); + if (error) + return error; + + attr = kmem_zalloc(sizeof(struct xfs_attr_item) + + sizeof(struct xfs_da_args), KM_NOFS); + args = (struct xfs_da_args *)(attr + 1); + + attr->xattri_dac.da_args = args; + attr->xattri_op_flags = attrp->alfi_op_flags; + + args->dp = ip; + args->geo = mp->m_attr_geo; + args->whichfork = XFS_ATTR_FORK; + args->name = attrip->attri_name; + args->namelen = attrp->alfi_name_len; + args->hashval = xfs_da_hashname(args->name, args->namelen); + args->attr_filter = attrp->alfi_attr_flags; + + if (attrp->alfi_op_flags == XFS_ATTR_OP_FLAGS_SET) { + args->value = attrip->attri_value; + args->valuelen = attrp->alfi_value_len; + args->total = xfs_attr_calc_size(args, &local); + + tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + + M_RES(mp)->tr_attrsetrt.tr_logres * + args->total; + tres.tr_logcount = XFS_ATTRSET_LOG_COUNT; + tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; + total = args->total; + } else { + tres = M_RES(mp)->tr_attrrm; + total = XFS_ATTRRM_SPACE_RES(mp); + } + error = xfs_trans_alloc(mp, &tres, total, 0, XFS_TRANS_RESERVE, &tp); + if (error) + goto out; + + args->trans = tp; + done_item = xfs_trans_get_attrd(tp, attrip); + + xfs_ilock(ip, XFS_ILOCK_EXCL); + xfs_trans_ijoin(tp, ip, 0); + + ret = xfs_xattri_finish_update(&attr->xattri_dac, done_item, + &attr->xattri_dac.leaf_bp, + attrp->alfi_op_flags); + if (ret == -EAGAIN) { + /* There's more work to do, so add it to this transaction */ + xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_ATTR, &attr->xattri_list); + } else + error = ret; + + if (error) { + xfs_trans_cancel(tp); + goto out_unlock; + } + + error = xfs_defer_ops_capture_and_commit(tp, capture_list); + +out_unlock: + if (attr->xattri_dac.leaf_bp) + xfs_buf_relse(attr->xattri_dac.leaf_bp); + + xfs_iunlock(ip, XFS_ILOCK_EXCL); + xfs_irele(ip); +out: + if (ret != -EAGAIN) + kmem_free(attr); + return error; +} + +/* Re-log an intent item to push the log tail forward. */ +static struct xfs_log_item * +xfs_attri_item_relog( + struct xfs_log_item *intent, + struct xfs_trans *tp) +{ + struct xfs_attrd_log_item *attrdp; + struct xfs_attri_log_item *old_attrip; + struct xfs_attri_log_item *new_attrip; + struct xfs_attri_log_format *new_attrp; + struct xfs_attri_log_format *old_attrp; + int buffer_size; + + old_attrip = ATTRI_ITEM(intent); + old_attrp = &old_attrip->attri_format; + buffer_size = old_attrp->alfi_value_len + old_attrp->alfi_name_len; + + tp->t_flags |= XFS_TRANS_DIRTY; + attrdp = xfs_trans_get_attrd(tp, old_attrip); + set_bit(XFS_LI_DIRTY, &attrdp->attrd_item.li_flags); + + new_attrip = xfs_attri_init(tp->t_mountp, buffer_size); + new_attrp = &new_attrip->attri_format; + + new_attrp->alfi_ino = old_attrp->alfi_ino; + new_attrp->alfi_op_flags = old_attrp->alfi_op_flags; + new_attrp->alfi_value_len = old_attrp->alfi_value_len; + new_attrp->alfi_name_len = old_attrp->alfi_name_len; + new_attrp->alfi_attr_flags = old_attrp->alfi_attr_flags; + + new_attrip->attri_name_len = old_attrip->attri_name_len; + new_attrip->attri_name = ((char *)new_attrip) + + sizeof(struct xfs_attri_log_item); + memcpy(new_attrip->attri_name, old_attrip->attri_name, + new_attrip->attri_name_len); + + new_attrip->attri_value_len = old_attrip->attri_value_len; + if (new_attrip->attri_value_len > 0) { + new_attrip->attri_value = new_attrip->attri_name + + new_attrip->attri_name_len; + + memcpy(new_attrip->attri_value, old_attrip->attri_value, + new_attrip->attri_value_len); + } + + xfs_trans_add_item(tp, &new_attrip->attri_item); + set_bit(XFS_LI_DIRTY, &new_attrip->attri_item.li_flags); + + return &new_attrip->attri_item; +} + STATIC int xlog_recover_attri_commit_pass2( struct xlog *log, @@ -387,6 +701,50 @@ xlog_recover_attri_commit_pass2( return error; } +/* + * This routine is called to allocate an "attr free done" log item. + */ +static struct xfs_attrd_log_item * +xfs_trans_get_attrd(struct xfs_trans *tp, + struct xfs_attri_log_item *attrip) +{ + struct xfs_attrd_log_item *attrdp; + + ASSERT(tp != NULL); + + attrdp = kmem_cache_alloc(xfs_attrd_cache, GFP_NOFS | __GFP_NOFAIL); + + xfs_log_item_init(tp->t_mountp, &attrdp->attrd_item, XFS_LI_ATTRD, + &xfs_attrd_item_ops); + attrdp->attrd_attrip = attrip; + attrdp->attrd_format.alfd_alf_id = attrip->attri_format.alfi_id; + + xfs_trans_add_item(tp, &attrdp->attrd_item); + return attrdp; +} + +/* Get an ATTRD so we can process all the attrs. */ +static struct xfs_log_item * +xfs_attr_create_done( + struct xfs_trans *tp, + struct xfs_log_item *intent, + unsigned int count) +{ + if (!intent) + return NULL; + + return &xfs_trans_get_attrd(tp, ATTRI_ITEM(intent))->attrd_item; +} + +const struct xfs_defer_op_type xfs_attr_defer_type = { + .max_items = 1, + .create_intent = xfs_attr_create_intent, + .abort_intent = xfs_attr_abort_intent, + .create_done = xfs_attr_create_done, + .finish_item = xfs_attr_finish_item, + .cancel_item = xfs_attr_cancel_item, +}; + /* * This routine is called when an ATTRD format structure is found in a committed * transaction in the log. Its purpose is to cancel the corresponding ATTRI if @@ -420,7 +778,9 @@ static const struct xfs_item_ops xfs_attri_item_ops = { .iop_unpin = xfs_attri_item_unpin, .iop_committed = xfs_attri_item_committed, .iop_release = xfs_attri_item_release, + .iop_recover = xfs_attri_item_recover, .iop_match = xfs_attri_item_match, + .iop_relog = xfs_attri_item_relog, }; const struct xlog_recover_item_ops xlog_attri_item_ops = { From patchwork Wed Feb 16 01:37:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747788 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 D0E4BC433EF for ; Wed, 16 Feb 2022 01:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245521AbiBPBhn (ORCPT ); Tue, 15 Feb 2022 20:37:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245513AbiBPBhl (ORCPT ); Tue, 15 Feb 2022 20:37:41 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78E6B19C2B for ; Tue, 15 Feb 2022 17:37:29 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMrdxM024697 for ; Wed, 16 Feb 2022 01:37:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=piXmY+S1S6x5J8G42q3OPS42p4KfHP7SjH6+nGTm5Xw=; b=ec7Xuj+onWBhwUOcH6V/t6xaxjRYkOwewBirU7rcKQDTWF1DU7+5pq7Nb/TcOjr9nvY8 AY0LUjBMvQJB++j5L55hAcpZqkGxxSSTwPVyBdFOIXdpZb2+1D46IApvjWHa+SDTK0lv rX+y7zfNRU5c9iTcLbIRkZ3hdtJ2bprLdNROSwUv1LCvhl5qWS3wGqWyVRCBIRUQcZ/1 HPIDwiYRAInqiWJ0Lx3meSNrMoftr6Dcwg5LkAyeqkUqFjsNAEnq+sUBzuhOQe5qxeAv yAkkzJ62qXZbw/NKZJqLSKGjdz0kObCRAs0L6N/aDcVAU+n23taLqPilHfn6EiQ2VrsH Sw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8ncar77b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:28 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1UZxK165528 for ; Wed, 16 Feb 2022 01:37:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by userp3020.oracle.com with ESMTP id 3e8n4tuxvp-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLDb3ppU5EI0R0tueOl3skzg6c7Nh9dQDrGJByKEA7oTMF+i4dbA9sX1atG7o3vHbCwfEMLDpZimy/9p0pk9E/Lk7rrcrY+jhPOq3vJ/Bbj9UwUlm2QBC56GYQVrv7jMy0ylDMi6++Gvv2MoAwNR6pejgmouSTq7/D+jeELIZuxaxK8XoumuYJKq7T73ZRfTi95Ygs2o+hQnhXHloy5RaJ4ZDYSxVF7TkcMmIj/NxksciZyECNyXkkMzY/lfCob1tpohSu3GBJNpDqZTBuQbwaVwb1BShEtOMPvfCB0FjxDNl5HkbQxx7L7bFb/7htefkJz+raopzY8OwSCrd9+89w== 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=piXmY+S1S6x5J8G42q3OPS42p4KfHP7SjH6+nGTm5Xw=; b=l4IDfJhb0ZyLSPhdu38eyyjbDYeLwfCCqQ2osUXSR5ddfH9Ev1z6apvhRBjNeNx5KSViho6WwTbkYfkYILv9coHqSCanGV0GAwPTyGLDRl2tgvl0Cf16YU1mvGEzaoioFtVHV44nXLtakY9xgHroWWDKO95AlZVlhOpsFxyExK8hiF7wvEzQnQ8ln5jha8dp7c8xOfY4Wums26CbVXZjoSEXoSvNRsja1cIgqlpkpziQ1kxJizX4mxHurzEgC3CIlFhhj53n12pM5XZNCDcx+htb/vd+NYI8obrPpH3T4qZkI185a0dLJJVRTUA2W9zHT6gY5WANMwdT5ieBqAnNlw== 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=piXmY+S1S6x5J8G42q3OPS42p4KfHP7SjH6+nGTm5Xw=; b=Dv+0KlbIbLnJuExNrYEj+b8wUQYbsdvLsgy42gAwW98U6o0pM8fUtvXoQSa4GtCEdfyociU5mu6SJkbDLxIPZAl5cPUVzqfh4iIejSgKw1SBKR0QtSC7GYlxucH5ROUHiPCF5zF/teeQMDlydj+ewksolzNMjAxndar+K6jb10Y= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:25 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:25 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 06/15] xfs: Skip flip flags for delayed attrs Date: Tue, 15 Feb 2022 18:37:04 -0700 Message-Id: <20220216013713.1191082-7-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69b0ae9e-5b14-42ab-b1bb-08d9f0ece09e X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y5nwANfWYA54HcygPD7DgU+0Qf7ohasyjQaxLp6YMZws61QjKzRIp9ie1mQ3SU/6zh2oLVkIs0C+XJpsA4STu1+M8J1HzAFekZQ/ykwDHk37bgXsP/T1vr2xBWqWoTx+JIulu2EeSBf/Ost7qVdwV/IObDhT3Mu+bXJtxcU629BHSrCrDllPN67nqR5yWHlB3Sf3tlaLDIoaAmxqVqyY0LQjQRy6EQA2bx9ffHs0EcBYalKuGUNsid66zefQmRNpBmvoU2HLcjej/mhLrM5UW5kTv7d6ckMOtz/saD+KaQ5mzHH0bIp5D2N2lSctFi6qhRJr33k7amysfQdpzJsBDxDv+R08D9KlgAItC8cD4l4cTQcf5uXi514Zw9pKKsg7hHIBumHd7xj3IzI+qhujCPU3jbhign2oM6F6mv/rjsXrXyLFRvh1eOT7OSI8UV1H8JOyL2CryZ/Xccq5b6LRFlXgoa5kM8ysskvLWo0UsI3GvyT0D74uTEOFxQOMRBwQwybXS2ufloKTTfR5EU3ymlIoPrH4Wa3t9Xa2RLiweIC0sGu2NeCLXNnetlm0fu7Fouww77MMIftydHhU9p7vigUsh+VWSs1xPdsOQD4D1OOuFfwtaBNscy+NqKB6505z+r6MY9rZRFC1umX28/ylvA5MW8FAhiB1uPoicNxtmqSCLekI/iYK4YEfD3WA3Gs56EaXBvJpzjOnnoygM8Q6ZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y8w9Tz2s/2/No1dd6bcJeiwr+Vgi3mchWPmi8ONSVTMv48RkZFOuRa+/vJTpmJJhmG7oVE1kJkmGUGItNPoPTL+JrkMTX4i9xwqmqllMMY16Zd9JT1/0PUeudccf/u9xu8TTmIVeSrmN8k6fuJ/XjazlMkmNgJLI5UWRLLWOM/DHRTcnfqs7rFhgDDU9HJbjeUhdEt9sLJj59z4YJdKtZqFg0IdgdUrFAIH9+bc69Ezl9/EdQZVqOyVuf3ZaaGJsGyIBt316/f1s5HTJJvqNb/gjTRp4Jl8H4aU2dvToM0nIgxdHcURuNlSfSCr5UHOguo0z7F/4Bb9uWsM+EGTeCRhopdavWxeFDcbWQ0lO9F2O2qGu8EX0CEPilA5jF8d1u9Vq3GwojXYfm+Mj6DKLjoViE5dgr5XlETNKwR0Qew+LlQxbk8tOpfOWbNfZksjxw9VP5q3ufrw6hZSiMdcizD1rP23Vh/4sqOA1Voo4NGgp0p1eUCcewbLUVgxIKwkVLFhGkLdrlR46kjRJP/N3whHU6HJ91mrXEHOnTHoZjKmlAwwf1NY7ZLvfWm/BewiYE+sqiMuWpyLbqtx5fV6oJgdWMP7EwlB364NZIByRXjT6k+lKq3IrXjDRj4yDwR4owprwCNbD8bSNuUetYz+k6CTR2splEwI+YNIsK59vNXI7lh4Q3GfYHXB6lQG6cU/EA4s3xJuOot0wFS7gwP7IMVSGDiZSrRZdd0zjLbMSUeOhxnOhe0K4itj1exnZCa1Cf2zA9vTcoJUPxe2U+r0T2rstloE6zxhGzV6/w2H5ZqAEMN0swP1OnP5BrbeuwAHdGZSKacUXzFY0g2mC3TzFuek2lrHEd7J4qGzqhoXJn+po8rm9uImY+ZtCXBHzYRRqxaspT5ojXM7fNmRksGQyz7wJJOML12vm7sMT8IdVb4YtJJJ2OZW06vD+0orAGPP36j4ywITt71qErAL+9altQt6s4gLBF/xNIBUhBVGWBSPpAwIikL1bANBJNvaPHnoYR4py79p5TkDPFBh1X/9oDAi+oEzSK7tahLpH5ZCZzXXj4WTTb45I8+jGpsbN6S8H2ZsPe6YdGG0KcaVEni6/KvHwachmyhx2Pk6M8sK8CebzODG0JZpt9qSNTIQceJ7n9tLJSCxmLqZDisOq5DK6kpeo39jTMdA0KZ+4kxMMEg3L5GicsLjuNqKsqQ2HqjNKTzP4talySFWoGrTuetKpXqy4ogkr2j5C1qx9kGbFX43JuCpmeHy+3JnWE/S2gQrnUQ28jFGoAOdO8uwph9w8yLwW1wc3PoiDUoSMp9YAnQvqr3Kf9dVukevJROAIM2/tvxtlnU6GHylrytM4f4Cjavs+F7dDWxLSkDFoEwUc64pBr1+ZClsF6IfMWlv3lkRT+4iNKM5xFWdz1hgHAZieDiT5fU2Egu1ShjmhVsKyBel5Yv6ijcPa6WvEk/ZWOdLZLDcKqhJtJb+R1Y+XSqQpD0EopSgoIQJ7BiVnuRAULcIbM4tRDxj9XDH8gjitZLnZM2lDU1RRlvBf2R5H/IpfLYnrAtFzmw0JvtOU5m+Z0walCkx5XKD6oME+0n+R73o+YfHog6iqL9UDmSS/MWR8yH3ruQOt++FXmBO2erbSmDMoreYHYRm/iz+1Xmq2AEPhwsLgcPYslXdpAMS//PnRvg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69b0ae9e-5b14-42ab-b1bb-08d9f0ece09e X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:22.2330 (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: HtB2rK78gq/0bHhrPlVQ3ba7WdShI9EgU0wgjL7whKU1JT4SXf+QjBstxS3azyWONSJ8VD9jUdgfyRFzKwJeNdqQEULpLiq43cQZ8kfR6Gk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: KEUtBTYs5qwYYhrwsDbJXISrOip_QQH3 X-Proofpoint-GUID: KEUtBTYs5qwYYhrwsDbJXISrOip_QQH3 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This is a clean up patch that skips the flip flag logic for delayed attr renames. Since the log replay keeps the inode locked, we do not need to worry about race windows with attr lookups. So we can skip over flipping the flag and the extra transaction roll for it Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 54 +++++++++++++++++++++-------------- fs/xfs/libxfs/xfs_attr_leaf.c | 3 +- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 21594f814685..da257ad22f1f 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -358,6 +358,7 @@ xfs_attr_set_iter( struct xfs_inode *dp = args->dp; struct xfs_buf *bp = NULL; int forkoff, error = 0; + struct xfs_mount *mp = args->dp->i_mount; /* State machine switch */ switch (dac->dela_state) { @@ -480,16 +481,21 @@ xfs_attr_set_iter( * In a separate transaction, set the incomplete flag on the * "old" attr and clear the incomplete flag on the "new" attr. */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - return error; - /* - * Commit the flag value change and start the next trans in - * series. - */ - dac->dela_state = XFS_DAS_FLIP_LFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); - return -EAGAIN; + if (!xfs_has_larp(mp)) { + error = xfs_attr3_leaf_flipflags(args); + if (error) + return error; + /* + * Commit the flag value change and start the next trans + * in series. + */ + dac->dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); + return -EAGAIN; + } + + fallthrough; case XFS_DAS_FLIP_LFLAG: /* * Dismantle the "old" attribute/value pair by removing a @@ -592,17 +598,21 @@ xfs_attr_set_iter( * In a separate transaction, set the incomplete flag on the * "old" attr and clear the incomplete flag on the "new" attr. */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - goto out; - /* - * Commit the flag value change and start the next trans in - * series - */ - dac->dela_state = XFS_DAS_FLIP_NFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); - return -EAGAIN; + if (!xfs_has_larp(mp)) { + error = xfs_attr3_leaf_flipflags(args); + if (error) + goto out; + /* + * Commit the flag value change and start the next trans + * in series + */ + dac->dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); + return -EAGAIN; + } + fallthrough; case XFS_DAS_FLIP_NFLAG: /* * Dismantle the "old" attribute/value pair by removing a @@ -1270,6 +1280,7 @@ xfs_attr_node_addname_clear_incomplete( { struct xfs_da_args *args = dac->da_args; struct xfs_da_state *state = NULL; + struct xfs_mount *mp = args->dp->i_mount; int retval = 0; int error = 0; @@ -1277,7 +1288,8 @@ xfs_attr_node_addname_clear_incomplete( * Re-find the "old" attribute entry after any split ops. The INCOMPLETE * flag means that we will find the "old" attr, not the "new" one. */ - args->attr_filter |= XFS_ATTR_INCOMPLETE; + if (!xfs_has_larp(mp)) + args->attr_filter |= XFS_ATTR_INCOMPLETE; state = xfs_da_state_alloc(args); state->inleaf = 0; error = xfs_da3_node_lookup_int(state, &retval); diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 014daa8c542d..74b76b09509f 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -1487,7 +1487,8 @@ xfs_attr3_leaf_add_work( if (tmp) entry->flags |= XFS_ATTR_LOCAL; if (args->op_flags & XFS_DA_OP_RENAME) { - entry->flags |= XFS_ATTR_INCOMPLETE; + if (!xfs_has_larp(mp)) + entry->flags |= XFS_ATTR_INCOMPLETE; if ((args->blkno2 == args->blkno) && (args->index2 <= args->index)) { args->index2++; From patchwork Wed Feb 16 01:37:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747790 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 04417C433F5 for ; Wed, 16 Feb 2022 01:37:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245524AbiBPBhn (ORCPT ); Tue, 15 Feb 2022 20:37:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245516AbiBPBhl (ORCPT ); Tue, 15 Feb 2022 20:37:41 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D96C19C30 for ; Tue, 15 Feb 2022 17:37:30 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMpMG0008456 for ; Wed, 16 Feb 2022 01:37:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=NgASYlGXeCI2OjdBzTPcOoAwcBW1hYgdU7d7rd86Q+g=; b=Fhysm06tUCuCPkEjNFIWasoXzW4oLtMcKGAgDwPlxcUVhlOWaog4IpN9lryqkQp05jyL zyJk/nF/W0RgtYb6K9VWJZ6a2XSGDLG1vg0cYH/X4ovSre8Lss0hXnCTgLqpPDl6onnk FaFSmzF0OLIx36BpnfEVpjZugkKCLtf4CRY/Wkd8e02YUUK1MZEo8CMyDk2euSKx1BJh wkab7SJ5Y4CFhm9zYH5Hzc07CrXEK+RongG4OJxUO23PoKW3dZEMHbE0X6CdBh5ngpPt IKfhgfPSF2VCeWbhiTkmxm5v7zVN4wlawnWJjUnNwevJQIrRKujYLNRTAwvXoMm9fWz2 mQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nb3g7a7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:28 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1UZxL165528 for ; Wed, 16 Feb 2022 01:37:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by userp3020.oracle.com with ESMTP id 3e8n4tuxvp-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XSwNc7ncXHUuLLikRxUMbqwJZ4eWtMryHJOF0sdNHu6W7BGe+zMwewnXm5D5EYEecfY5MWY4457PsbylY3qddFox9VlqPHYH6NxBPoxwQYkcZ5Fvwova4auEh5oImC3PvbGN8xumTtZ5yb7QGpHylqVH907OOjxFo0ZlRn5vmjctsUYmBNtL9GOcQLr53YpvBP0wtSUbxIta8Xcc/MJnnfOUSEeYMPrGhY6KOO9pMBew4ge4r7cIjx9MRUSfCZj+lm7IOaHplKxt1qxZgXgSXTle+qPOW02CxAjAd6RTHXFg7zRzwq0SDJFjP3AZHN+11bHN+Frliqh2LYBG5T9voA== 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=NgASYlGXeCI2OjdBzTPcOoAwcBW1hYgdU7d7rd86Q+g=; b=YmO0zqIZFF3mYbNOVaE0x5RbjpOabbzrloMYm6Cr60/6orszzP/+zPhb6G4v3dMQLy4PZA2Kxj/s69GQ6ruPi0XiUSFntkk9TursV9LR07HkyVTI+4KtWgoCaC7kc13+3cZgYAaQ5L18paYz7cUnFXPHsv4UvQgEqqS/w46DxvhHXYPz7a3D4t1X6V7qHcDQ+fHotAnNd/hhjZp/csqLrC4qMlyUG9HPsXW1y52S4RbQhAG8HlkGN5vKgFrvOgWkYf6zcGNcv/Thv7jf7XS3p/A6kKD3NtGJrqsxGoy6mZ+X2ufeCubKTGECNbBxZHYyNxmW5nTjJpAO8+1jcn3X6w== 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=NgASYlGXeCI2OjdBzTPcOoAwcBW1hYgdU7d7rd86Q+g=; b=OK779/03Js5psCybUZ0MHM+C7m4h1emipvBRaNX0t595N+echPiLLuHsqKKSrUF9wPO6WCsAF4pASRYclDPA8C+FZK4nKuXZQqX4P/c8B65PbkOESxO5v5zCwY13eEUOi84NulZ1Uz0KzTiHrmKBmKXtdYj/bg65cV7FOF5BOpk= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:25 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:25 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 07/15] xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Date: Tue, 15 Feb 2022 18:37:05 -0700 Message-Id: <20220216013713.1191082-8-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6051c612-695e-435f-1bf5-08d9f0ece0d8 X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:207; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qNVna252lHki57+P4rpKtQG+v0rwdu/eVcQHg8ee1xhFoaWvi0XAGnfhP/p9bKPRNA2209DuPSsF7k+T44eQVOxymVkOT5Jv87+fMcmcqIiQoH28QGl7pDWi0BaZgU2Y4Wfwnzur71rfdFHV+ThuudAb9vAbqavkl8Xc1FwJqBRXXkY7w8tXdwY16GL/c75AeB7XFrfKEh461mdl6VCFBQqZ3GRxWBkdB15KhqsuKV8EZXuRU7lonweILTqE9Xtm3TsEt8ZlDuxYsW9cgrv5vNI0AA0nAOmtTsBOHgE9L1dzrLLiSNOs/O6J5c/gBadD9gxt/6nwv6b7Q/CPn9x/EVPewlnD89pFTEt+/xo+ouKkBEny4nygfg0Y1wDgbVf7ZLNmwg+eL6W0VfV4DaKZJjIYlFeUjdnNvKSf2wjsuQ7MFjrDx6aTsGxRW+1UcWW0/JFnvv4p0dZqkwvTGyBMWfmM1Ys8WbDJLDM4zAuu740lSlYU/itglRDwmGliBVCHYOu7k7jqn3Us6JYagUQOrUFfrHlUS0MStK5fizyU3tGSrcn5ca5xgVmYE4WHRoFLowxf8+nSFGQKLQbwSelnhzvudc49aBe5ravvSsUZT3daCGTUXmGFLkzJ+64tf1Ip7R1oI5wAF1nT41OovamLL4Oku02df0xcgd2x73s51Rg18aCWzJhtVVB5n+vN5c1OZueGBSTFb/Ms9alWD8UpbQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jBY5YZiOhQfsHN3BvsCoUDAhVajL4Rim8Q7tfTGbBU1mBJRGll96X251Amt8H/ElsdNJOu7YfuK6fGmFCLn+RklxTP+TCpsh2tUM38gr7wPpEWrBazI8Xz5pfndW6kY/ptL31ztoU0lPTNzHGq/9Wun8GX2wSF97Rk1sowwnQZmQ+DpHfTNdVos+FWM26lpNPZfMUcSFKOY9tu+KjLzvtitCPAQ957CUkNkA90zlP9OHqoYdqmcLk+s9hxtcxIkptPit4LCvbyCy3cixKebQLVpKppj+9x+Kz8zlhprvP1pjdSLOZJS3K2aSuIzbmxqk74eGDDsonl9r1YTs7dHlXcB+0+mJOo8tU22/IIv25371lxOZDLIcCgZW3rWifYpDIpwuXPVZoL3Had7dFxlN+tItRsXveTYvqtD3DSwj2ZLWLiAAyobir9nkeeIBUeJiDUUQqmBGYEA1JQmFUYTzWOILmIMtabXUi5nzE00OGG1qp6wa/0cyJh4hAMZiU1h+2YnSUqHMw3eczShWZ44QYGKImuDQAxfr80/ZYXLsoLfS2S35cgnptUX3td4VjG9MnrA8IpvxbwZ2wldI1D5rn3lHcmncj8FgYvWHeer+I7NZ6HPVWbjlfFG0xswj4jVq0tXFjBx2/0yH0UQR5iaou9nm+I2Xtm0uLhDmSNbkHXdRlLvmcigXEdXvYWEXGt7lo1Lm+zyK68bJWnQ6tsJBaIBXJVqhk+2pnL6D0aDR2kBrelPqoDFhPsGGDeifqK6FdpjXzLotbfC5iGd7lmNBgjymSjYStd1ESJwioxiQOAvK/H8X7cVoB4vfzqW9aHTmJ2XMwJNigdQxHZOXtzFUnPFm7upJrbCbKGMdutj0vZjkqurfGr53h60Gq0QqDe8a4xPhpAMaVQGcZ4qpNT/gIak38GqCdagj3o8Pxcg9Zz4+MNgIvVk1UjRnyaLjAckC4MTlBBEpPY1iOhjrX5nByNjkShPMBmHjlsgLTTkoN3IhuWmhOUTcXIEY0UnEY04oW1+lbR+saZ/ar9rpr4+4uhZrpAPYye0btq9OVTHqAJosksN6zXJyEbJp7vddo6bK8Zq6TWzS5CMd30FHlfvSg5t4Y6QGJ12GeTA4c3DsnoRLAH1b5CWv4evMMp/JlCQjd3er/9ft4Sdtz1D1bP5ZMmYu1Df0Q9T7VvQ92bBHrZNTwJyOg0Amt2C7pGEJgCFbyvnFNRSY/iUOCHskjKB9ZKpsekVhjIYVBJfELdpZBZ+/KBtXWITewBEzmlrWhaiLoQeNKwP82IKw6XgKO+W2la9gBOzwgsy6IfzoKMhtNaPqNo1Q6L3bjIRrhh8nKjQOomL6aD3UqgDCbYBBAQEaN5ZugGc1rTmVEGkxN0VBS2G2IsA3+trjbdx3md79AXcm2XzWM4wlmQfmDL4dgfcF/GvJi1EIXG4n5ntXeXU1pUl18pm7RHAYeyRnWGOnimIf1T+jaqLYVWcsu2IHZioc3/jc7Q4UUU6VgBxxnvQ+TwpsbDmXQbDeO7WQoJxPyR/nfzXEeUdbDYb5dK1dwQEzV1fQP6wgeye0XzsRucEzh26DXrup8fZMImkGGN4qWO0CLCMTIJQxNEEweX/ZqMF0Tn2jnLnBvBVP5W+0UAj+iUSDzM3C65r4JizaWEmeYgJFMMoRlS6eEu5YYCV5amM4zA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6051c612-695e-435f-1bf5-08d9f0ece0d8 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:22.6405 (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: a6j0K95TIvleZq+x7dQtnyd5NQRSXTVj01g1uRX8su/vGMv9TJF/GAZ0my+yCH5YDZZTiX0TBOwEGqPvKc6781fpI+8rdcFCUGsY+PUMiOo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-GUID: 63mNVoU1r91omqzdOaCv_fvKtoKkVR2Z X-Proofpoint-ORIG-GUID: 63mNVoU1r91omqzdOaCv_fvKtoKkVR2Z Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org These routines set up and queue a new deferred attribute operations. These functions are meant to be called by any routine needing to initiate a deferred attribute operation as opposed to the existing inline operations. New helper function xfs_attr_item_init also added. Finally enable delayed attributes in xfs_attr_set and xfs_attr_remove. Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 71 ++++++++++++++++++++++++++++++++++++++-- fs/xfs/libxfs/xfs_attr.h | 2 ++ fs/xfs/xfs_log.c | 41 +++++++++++++++++++++++ fs/xfs/xfs_log.h | 1 + 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index da257ad22f1f..848c19b34809 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -25,6 +25,8 @@ #include "xfs_trans_space.h" #include "xfs_trace.h" #include "xfs_attr_item.h" +#include "xfs_attr.h" +#include "xfs_log.h" struct kmem_cache *xfs_attri_cache; struct kmem_cache *xfs_attrd_cache; @@ -729,6 +731,7 @@ xfs_attr_set( int error, local; int rmt_blks = 0; unsigned int total; + int delayed = xfs_has_larp(mp); if (xfs_is_shutdown(dp->i_mount)) return -EIO; @@ -785,13 +788,19 @@ xfs_attr_set( rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX); } + if (delayed) { + error = xfs_attr_use_log_assist(mp); + if (error) + return error; + } + /* * Root fork attributes can use reserved data blocks for this * operation if necessary */ error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans); if (error) - return error; + goto drop_incompat; if (args->value || xfs_inode_hasattr(dp)) { error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK, @@ -809,9 +818,10 @@ xfs_attr_set( if (error != -ENOATTR && error != -EEXIST) goto out_trans_cancel; - error = xfs_attr_set_args(args); + error = xfs_attr_set_deferred(args); if (error) goto out_trans_cancel; + /* shortform attribute has already been committed */ if (!args->trans) goto out_unlock; @@ -819,7 +829,7 @@ xfs_attr_set( if (error != -EEXIST) goto out_trans_cancel; - error = xfs_attr_remove_args(args); + error = xfs_attr_remove_deferred(args); if (error) goto out_trans_cancel; } @@ -841,6 +851,9 @@ xfs_attr_set( error = xfs_trans_commit(args->trans); out_unlock: xfs_iunlock(dp, XFS_ILOCK_EXCL); +drop_incompat: + if (delayed) + xlog_drop_incompat_feat(mp->m_log); return error; out_trans_cancel: @@ -883,6 +896,58 @@ xfs_attrd_destroy_cache(void) xfs_attrd_cache = NULL; } +STATIC int +xfs_attr_item_init( + struct xfs_da_args *args, + unsigned int op_flags, /* op flag (set or remove) */ + struct xfs_attr_item **attr) /* new xfs_attr_item */ +{ + + struct xfs_attr_item *new; + + new = kmem_zalloc(sizeof(struct xfs_attr_item), KM_NOFS); + new->xattri_op_flags = op_flags; + new->xattri_dac.da_args = args; + + *attr = new; + return 0; +} + +/* Sets an attribute for an inode as a deferred operation */ +int +xfs_attr_set_deferred( + struct xfs_da_args *args) +{ + struct xfs_attr_item *new; + int error = 0; + + error = xfs_attr_item_init(args, XFS_ATTR_OP_FLAGS_SET, &new); + if (error) + return error; + + xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list); + + return 0; +} + +/* Removes an attribute for an inode as a deferred operation */ +int +xfs_attr_remove_deferred( + struct xfs_da_args *args) +{ + + struct xfs_attr_item *new; + int error; + + error = xfs_attr_item_init(args, XFS_ATTR_OP_FLAGS_REMOVE, &new); + if (error) + return error; + + xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list); + + return 0; +} + /*======================================================================== * External routines when attribute list is inside the inode *========================================================================*/ diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 80b6f28b0d1a..b52156ad8e6e 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -525,6 +525,8 @@ bool xfs_attr_namecheck(const void *name, size_t length); void xfs_delattr_context_init(struct xfs_delattr_context *dac, struct xfs_da_args *args); int xfs_attr_calc_size(struct xfs_da_args *args, int *local); +int xfs_attr_set_deferred(struct xfs_da_args *args); +int xfs_attr_remove_deferred(struct xfs_da_args *args); extern struct kmem_cache *xfs_attri_cache; extern struct kmem_cache *xfs_attrd_cache; diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 8ba8563114b9..fdfafc7df1dc 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -3993,3 +3993,44 @@ xlog_drop_incompat_feat( { up_read(&log->l_incompat_users); } + +/* + * Get permission to use log-assisted atomic exchange of file extents. + * + * Callers must not be running any transactions or hold any inode locks, and + * they must release the permission by calling xlog_drop_incompat_feat + * when they're done. + */ +int +xfs_attr_use_log_assist( + struct xfs_mount *mp) +{ + int error = 0; + + /* + * Protect ourselves from an idle log clearing the logged xattrs log + * incompat feature bit. + */ + xlog_use_incompat_feat(mp->m_log); + + /* + * If log-assisted xattrs are already enabled, the caller can use the + * log assisted swap functions with the log-incompat reference we got. + */ + if (xfs_sb_version_haslogxattrs(&mp->m_sb)) + return 0; + + /* Enable log-assisted xattrs. */ + error = xfs_add_incompat_log_feature(mp, + XFS_SB_FEAT_INCOMPAT_LOG_XATTRS); + if (error) + goto drop_incompat; + + xfs_warn_once(mp, +"EXPERIMENTAL logged extended attributes feature added. Use at your own risk!"); + + return 0; +drop_incompat: + xlog_drop_incompat_feat(mp->m_log); + return error; +} diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index fd945eb66c32..053dad8d11a9 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h @@ -155,5 +155,6 @@ bool xlog_force_shutdown(struct xlog *log, int shutdown_flags); void xlog_use_incompat_feat(struct xlog *log); void xlog_drop_incompat_feat(struct xlog *log); +int xfs_attr_use_log_assist(struct xfs_mount *mp); #endif /* __XFS_LOG_H__ */ From patchwork Wed Feb 16 01:37:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747792 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 EDACAC433FE for ; Wed, 16 Feb 2022 01:37:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245516AbiBPBho (ORCPT ); Tue, 15 Feb 2022 20:37:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243706AbiBPBhn (ORCPT ); Tue, 15 Feb 2022 20:37:43 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D8F19C28 for ; Tue, 15 Feb 2022 17:37:32 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMrfZW024709 for ; Wed, 16 Feb 2022 01:37:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=6oksdl0xSeED8x8EbDpEW73VohtH6i/Cuf108ctLttU=; b=f5NIbpusFfpoq/KDZQCRHH3b0T6ACCaa77HRc7SkQIxZU8gk9ckr+xP+cLDy5YX8S966 npSk4jQ1YihfOe1oLDAe/EDpX4UC1jzI6oCqHuekhpA4jp9uE/BBYqcbpkF7bGwIgMLx CE8QMPxPMaHLCnaYraZ1LM+HMlbDiBVShnRQx3nzSAdYZOtQK+ecx6dldTijJkpJjtMl Uvdy9p8XBM/XtqtR24IGhIGPRHY7ae1Jrj1sQqIyDpDsJEiAEmNBZemRZByhoVm6zdb6 oPbBdg628V3THvH+3H+DWRIxyqg08h7Ths19lo+OuF8eQWpHaGhkfceEHnaZjMtj0NUl VA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8ncar77d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1UZxN165528 for ; Wed, 16 Feb 2022 01:37:30 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by userp3020.oracle.com with ESMTP id 3e8n4tuxvp-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZR7hvSVEv5IxqRL0KqUMECsI8ECYk3sIGD99iffWVUHO73CrlrxueYi+9hmJTkyT2aPrxxa1/ChgeLO9wicHR8nFlWXE3bANpRYvZspeRxWXxnXL0DM4UDOJF6aiIlVGqUwRCvkzvDZo4yKyXxh7Xnp7XyBlyme2+GJI0R19p2e0WhzNxgMX0j93Cgd6S1m+NQfUTnClucrtF7ZYmJRyTIj3vkAaC8jR0NjG5jBgKc50tueraJS8v3HBMTqm+OXRwaTmS5HlfN9gOrRhp4wZywh0lj/qhLMN0LguAe/4ilnf2aR/RcfvlnnxoGpRPIALgisO8VK6LjT1o9HpnK8aAQ== 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=6oksdl0xSeED8x8EbDpEW73VohtH6i/Cuf108ctLttU=; b=HC8r+UqpPPB1eUx5dKy0oPlnf71yRiUgAp2u7BlTT9vjeZvu2aWwZaaJeXGJC73urabQRo+i6TZ2xHr9BKeZBqVLdoxlpqthbGPHEWesXjeNuDXtDtotTxifCnz7of0i7gdanUMXMMM5vqcD1Kow9G6mgMjCY4f39YaoExP9H2eJ1HvvvDjpYIIdLDE5yF18xUQxqOSs1fpKbabAz8jqNs4nRdT4Q2A7+BeEiy/grtWXovp7L+JVGbSwatOz5P/7iibT6Jz6i+yFwqz/dacN32Jjwv332s8q+WMYhwGCPQQPS8DYwxBbxaXkWX8M1CoaszkHCkzNCnTR9hVELYWCkA== 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=6oksdl0xSeED8x8EbDpEW73VohtH6i/Cuf108ctLttU=; b=XKzK979RzA+X7gX8U+TadBsT/ZVemas9TnXBBxNL2xrInM0B+Z/eRwCuzwqVtg5S7e4WTWLQa/8mhwOkJ8uIIZFarzCArIMMIZ1IqGQIO94a7LErrmoASgUvZ5TIl/gQFdBlXMtsiFBnsBH5GmZUidHOhDMPhWnRFy7JiDDjZyQ= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:26 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:26 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 08/15] xfs: Remove unused xfs_attr_*_args Date: Tue, 15 Feb 2022 18:37:06 -0700 Message-Id: <20220216013713.1191082-9-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 32b7a87a-0e3f-423b-51af-08d9f0ece111 X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s5b1+DJoj/GIq7Exm4CEOC5a+yqBZlvWPDnglF9vD6BnA8fyNVeP3fdqhU9LLtCG9HSI/bm3SzP0cCgFMlvymd6ewkuYv2DpmcNuCHmma0JJwP/YKhyTappAQ9SXxDhG+ZKVvBQget5RcRHIfzyoAqreimby3WDF6PgJaFuShU2NCE75gWrM7Wh2znsS7BYFz+YTPAeL3lxImhbKA/3zMXgKSHpYTwpS/34cHT+N1lYkzk/rrCGC++E3Dq1FIOUYfAckFHlYdSqBoG8P5mIPx8K2Mm8+Lssje/m3ypWRF5a78PIDFYi008wIuKyxgRmxTusZWoNp6xA/yS8inopvc3d/e7zdCuvLOmS+w745z650Q/Q8X90sXEEE0RoQzQFJU/LYXq5AfI1P0DRUVuJV+A9tXVyY+xW9QKuYPgIaxTOBvmglurwmqO52uAi0kkLd3w321gZYKBwqdIrd8biH05uP3EORocfI7vhLXkl0LAj7/oQt267DVTH1byGUUbo/5Ys66j9i6Ix0GJzLvEXOoA3IkZtHUXdibwhLF2oKgWLcQpkauQM1cdH9btayrbDrm8ox+vQY3TyEe9dy+7iLAARl+hNbvy4ftR80V2SIJiZ/70BpBGzTAl0eHNBg2CxwFlr1ievlKDBFMR8irU8WeulADxjVODsrmmHND71dPZJg4IYhapA+NW2BdWX3rD8OVPnZAf8QiIKziZOOis+Aag== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iVWb1KMVPzLvw+1BThxti12IAXlapUs/A5DcrzW8+alLZ0WvRbQi74rDpDN2I6lFQwyVAiXhs5N+hBgMRBpt3wUDK1O3NDyPyF/g+pWlSHaF/Koj5aShYdwekm0RsQSne3gf36ZBNiHEK5c15B1S5CtXlhtr/NBo0MnvPwCoKqR+rZ7SelfOuPPgQPoEjfqbAGSz5xTAyNAkGgSicrA7CySnNrZvW//FrJauCklbbFtLuIcJSliFumLwAiagypz6MY4EUe2k7UwVPsAvdj5VcGKJKwuoqjfU/gqsw5Ps1VDGY8hvGJbqowC/Qo9wVnSRKBHdbR03gn2WnDJTR45/3yJw0Q0UqoZfrYEgibW4rLUOQmQTNWZJS3G2YOw7vJG4Ix8u/7XZRXc9EjHASV3Ds8lhRvGim9AmE5fY3/yeG4HpgP4EdGnCiWAfdDZYFy9jXVCNHbRjJ5isQATazP71fCaft+oTV0bX/Dfhtl3eW7tee8fJGrG9OZ5rQkgKIQRNfqt2x/eE/Lxo+ggO/gdEaFd2z2VY+9iuLhQZak/OYniMN18LdI5CEJ9vJ2wDE4S+n5pX6i/+4nAFEdSI1BJZCM+GGvKZK7cRPh20AdqDkbg3+8c7FwxCPBp3nNNP3BSTMDUIiSwueii42GjDoUjtplr2RvD7nfyHnoMvrp9QREuS3mqGPKfoJWB5+rpuDC6cURxx8Z8o/IyYQo63tqTspinX4bVA3KTxgW0wnr69sRGnj23Qfv87sOnQ2tNdp0xYF9V7TG4XKK5HjZDM5Y/pMJty6QzqryTVlePV3J3bcA+GKGUv2gQqIui6vnhmdLLe+mDY4UrIePFo1XfjFzhsF+iTr3pE8ZXh5H4F0Qfti3mLkfzHn1Kfj4FqBdnrgFjb9TwaCvSNZWjPlO84JwPxTqO/mzepsXEXt55NhhG1zdBL+7Xw67P979O/z8nufKEUG0kEdjAihOy7TLtvXY9GJZs/U/YZ52skQnk2Bk0jgNF2/yxb4ZZ0FrB0KI40qJMvJjXPd2XPJOYyHP1KQKMN3BSOE4FQqcKzweX52g1TDiEenlw6sQIwbFWAnf6JhFZ2iF/cTXIzPVB0Q2RAzStuJGWtIaPTAulCexh1KvudvPtUSJEdMu6yFvS2+oYMjwSKw1Lyv9dGWeCSuX2IBXReVCW3QPfQSqt2r/pYybLQxuWHE0ZIflLI46U6vPlGH+ibp09AoUG/abgs8EgwdJ0WZKop8isi7Q5RJfcZKDGiupmSszAakDJP/LlRFkY5OeRDsjHzTZTY4wnnipPtsGhpEcLNFxblVFOV0UPMIzhMbxIQ9ZKlJUc4j8PbQaWRj2cv8NqOm0U25275T4fo00yWROJHtcqo5D+fvAcsD3y8Fnqz48QcE/b+JLDHY6XHr61ew9y2dUkJncYlLGH0c/9LexF9FIMl51yQQUIqVM30e9SVe32ecOQKaTtXUC36JUpxz+ULxP71S1Z1fZKfGh0+EJ6KjsEHezTtxPaIsAzkpv2mlyO1N7YjX3KQy9KI20RXDo05f8adiZQDDgxwtIEl5M3zy8HzpLMH4bMFviRRkyli7ROQUiq0x+x+XNWK1IeQWn26ypksSQUqO3h5qWH+M3IVAbQrpLlbNcP57F1p2c3zFIHZbJaYYQDyquXVsP6AN3Cq3N4wnwUIl7eDoTfMBA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32b7a87a-0e3f-423b-51af-08d9f0ece111 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:22.9373 (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: Yjo0+Te4XAYL7NUCb9ajpTlzonwUpnhYDwKdca6MQubZ4kTp4yNP+XvHCknjZ4CxZi2MT6E/AJdRtND9XQNyrZavQfcDbgsMCEN3/JO6Eic= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: bSZkylBlNCWWWWwUBsOANgY6eRxW5-te X-Proofpoint-GUID: bSZkylBlNCWWWWwUBsOANgY6eRxW5-te Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Remove xfs_attr_set_args, xfs_attr_remove_args, and xfs_attr_trans_roll. These high level loops are now driven by the delayed operations code, and can be removed. Additionally collapse in the leaf_bp parameter of xfs_attr_set_iter since we only have one caller that passes dac->leaf_bp Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 106 +++----------------------------- fs/xfs/libxfs/xfs_attr.h | 8 +-- fs/xfs/libxfs/xfs_attr_remote.c | 1 - fs/xfs/xfs_attr_item.c | 9 +-- 4 files changed, 14 insertions(+), 110 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 848c19b34809..3d7531817e74 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -247,64 +247,9 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } -/* - * Checks to see if a delayed attribute transaction should be rolled. If so, - * transaction is finished or rolled as needed. - */ -STATIC int -xfs_attr_trans_roll( - struct xfs_delattr_context *dac) -{ - struct xfs_da_args *args = dac->da_args; - int error; - - if (dac->flags & XFS_DAC_DEFER_FINISH) { - /* - * The caller wants us to finish all the deferred ops so that we - * avoid pinning the log tail with a large number of deferred - * ops. - */ - dac->flags &= ~XFS_DAC_DEFER_FINISH; - error = xfs_defer_finish(&args->trans); - } else - error = xfs_trans_roll_inode(&args->trans, args->dp); - - return error; -} - -/* - * Set the attribute specified in @args. - */ -int -xfs_attr_set_args( - struct xfs_da_args *args) -{ - struct xfs_buf *leaf_bp = NULL; - int error = 0; - struct xfs_delattr_context dac = { - .da_args = args, - }; - - do { - error = xfs_attr_set_iter(&dac, &leaf_bp); - if (error != -EAGAIN) - break; - - error = xfs_attr_trans_roll(&dac); - if (error) { - if (leaf_bp) - xfs_trans_brelse(args->trans, leaf_bp); - return error; - } - } while (true); - - return error; -} - STATIC int xfs_attr_sf_addname( - struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp) + struct xfs_delattr_context *dac) { struct xfs_da_args *args = dac->da_args; struct xfs_inode *dp = args->dp; @@ -323,7 +268,7 @@ xfs_attr_sf_addname( * It won't fit in the shortform, transform to a leaf block. GROT: * another possible req'mt for a double-split btree op. */ - error = xfs_attr_shortform_to_leaf(args, leaf_bp); + error = xfs_attr_shortform_to_leaf(args, &dac->leaf_bp); if (error) return error; @@ -332,7 +277,7 @@ xfs_attr_sf_addname( * push cannot grab the half-baked leaf buffer and run into problems * with the write verifier. */ - xfs_trans_bhold(args->trans, *leaf_bp); + xfs_trans_bhold(args->trans, dac->leaf_bp); /* * We're still in XFS_DAS_UNINIT state here. We've converted @@ -340,7 +285,6 @@ xfs_attr_sf_addname( * add. */ trace_xfs_attr_sf_addname_return(XFS_DAS_UNINIT, args->dp); - dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } @@ -353,8 +297,7 @@ xfs_attr_sf_addname( */ int xfs_attr_set_iter( - struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp) + struct xfs_delattr_context *dac) { struct xfs_da_args *args = dac->da_args; struct xfs_inode *dp = args->dp; @@ -373,14 +316,14 @@ xfs_attr_set_iter( * release the hold once we return with a clean transaction. */ if (xfs_attr_is_shortform(dp)) - return xfs_attr_sf_addname(dac, leaf_bp); - if (*leaf_bp != NULL) { - xfs_trans_bhold_release(args->trans, *leaf_bp); - *leaf_bp = NULL; + return xfs_attr_sf_addname(dac); + if (dac->leaf_bp != NULL) { + xfs_trans_bhold_release(args->trans, dac->leaf_bp); + dac->leaf_bp = NULL; } if (xfs_attr_is_leaf(dp)) { - error = xfs_attr_leaf_try_add(args, *leaf_bp); + error = xfs_attr_leaf_try_add(args, dac->leaf_bp); if (error == -ENOSPC) { error = xfs_attr3_leaf_to_node(args); if (error) @@ -399,7 +342,6 @@ xfs_attr_set_iter( * be a node, so we'll fall down into the node * handling code below */ - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_set_iter_return( dac->dela_state, args->dp); return -EAGAIN; @@ -690,32 +632,6 @@ xfs_attr_lookup( return xfs_attr_node_hasname(args, NULL); } -/* - * Remove the attribute specified in @args. - */ -int -xfs_attr_remove_args( - struct xfs_da_args *args) -{ - int error; - struct xfs_delattr_context dac = { - .da_args = args, - }; - - do { - error = xfs_attr_remove_iter(&dac); - if (error != -EAGAIN) - break; - - error = xfs_attr_trans_roll(&dac); - if (error) - return error; - - } while (true); - - return error; -} - /* * Note: If args->value is NULL the attribute will be removed, just like the * Linux ->setattr API. @@ -1309,7 +1225,6 @@ xfs_attr_node_addname( * this. dela_state is still unset by this function at * this point. */ - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_node_addname_return( dac->dela_state, args->dp); return -EAGAIN; @@ -1324,7 +1239,6 @@ xfs_attr_node_addname( error = xfs_da3_split(state); if (error) goto out; - dac->flags |= XFS_DAC_DEFER_FINISH; } else { /* * Addition succeeded, update Btree hashvals. @@ -1578,7 +1492,6 @@ xfs_attr_remove_iter( if (error) goto out; dac->dela_state = XFS_DAS_RM_NAME; - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_remove_iter_return(dac->dela_state, args->dp); return -EAGAIN; } @@ -1606,7 +1519,6 @@ xfs_attr_remove_iter( if (error) goto out; - dac->flags |= XFS_DAC_DEFER_FINISH; dac->dela_state = XFS_DAS_RM_SHRINK; trace_xfs_attr_remove_iter_return( dac->dela_state, args->dp); diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index b52156ad8e6e..5331551d5939 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -457,8 +457,7 @@ enum xfs_delattr_state { /* * Defines for xfs_delattr_context.flags */ -#define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */ -#define XFS_DAC_LEAF_ADDNAME_INIT 0x02 /* xfs_attr_leaf_addname init*/ +#define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/ /* * Context used for keeping track of delayed attribute operations @@ -516,10 +515,7 @@ bool xfs_attr_is_leaf(struct xfs_inode *ip); int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_set(struct xfs_da_args *args); -int xfs_attr_set_args(struct xfs_da_args *args); -int xfs_attr_set_iter(struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp); -int xfs_attr_remove_args(struct xfs_da_args *args); +int xfs_attr_set_iter(struct xfs_delattr_context *dac); int xfs_attr_remove_iter(struct xfs_delattr_context *dac); bool xfs_attr_namecheck(const void *name, size_t length); void xfs_delattr_context_init(struct xfs_delattr_context *dac, diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index 83b95be9ded8..c806319134fb 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -695,7 +695,6 @@ xfs_attr_rmtval_remove( * the parent */ if (!done) { - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); return -EAGAIN; } diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 6e4c65d82db5..468358f44a8f 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -270,7 +270,6 @@ STATIC int xfs_xattri_finish_update( struct xfs_delattr_context *dac, struct xfs_attrd_log_item *attrdp, - struct xfs_buf **leaf_bp, uint32_t op_flags) { struct xfs_da_args *args = dac->da_args; @@ -280,7 +279,7 @@ xfs_xattri_finish_update( switch (op) { case XFS_ATTR_OP_FLAGS_SET: - error = xfs_attr_set_iter(dac, leaf_bp); + error = xfs_attr_set_iter(dac); break; case XFS_ATTR_OP_FLAGS_REMOVE: ASSERT(XFS_IFORK_Q(args->dp)); @@ -390,8 +389,7 @@ xfs_attr_finish_item( */ dac->da_args->trans = tp; - error = xfs_xattri_finish_update(dac, done_item, &dac->leaf_bp, - attr->xattri_op_flags); + error = xfs_xattri_finish_update(dac, done_item, attr->xattri_op_flags); if (error != -EAGAIN) kmem_free(attr); @@ -550,8 +548,7 @@ xfs_attri_item_recover( xfs_trans_ijoin(tp, ip, 0); ret = xfs_xattri_finish_update(&attr->xattri_dac, done_item, - &attr->xattri_dac.leaf_bp, - attrp->alfi_op_flags); + attrp->alfi_op_flags); if (ret == -EAGAIN) { /* There's more work to do, so add it to this transaction */ xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_ATTR, &attr->xattri_list); From patchwork Wed Feb 16 01:37:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747791 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 3C059C433EF for ; Wed, 16 Feb 2022 01:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243706AbiBPBhp (ORCPT ); Tue, 15 Feb 2022 20:37:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245513AbiBPBhn (ORCPT ); Tue, 15 Feb 2022 20:37:43 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D98C919C29 for ; Tue, 15 Feb 2022 17:37:32 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMrfZX024709 for ; Wed, 16 Feb 2022 01:37:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=O+6Y00U7BLZAyS8UvwlS2YOYLgiyr3B3vi5cG63Sy5U=; b=zbH+dIYLfVUADzVLRQA29HUp6/Hp59LgNFVtdixN3vqWcubqgTu84B+E7w20T7gs76Y7 kRZlm9Qmui22hbzQWLWyG3Bm2VYEVpPEnTIWx68+FcFdBeWoAl5i1HcnTg/kc9LKcjZD Q2/mIkWWDu6zM0xwizKFLhliNhUBX7iC4P4471DsoUmkwRdnofSiyn+INGBr23L2Xvi0 TJ4SAlpxPks/D1l+mnTt10mxwzO/wTC7rVtB9ho+qpupUZRDbe14SZks/02TXMYa5mda RZcVLOXVm1WIG3LJJEqzIh+TQtlFWrDBxODBwiRY7l8YEdXL+L5IeZmftUgTxL2kX8R3 Cw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8ncar77e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1UZxP165528 for ; Wed, 16 Feb 2022 01:37:30 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by userp3020.oracle.com with ESMTP id 3e8n4tuxvp-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kPjzp33QA2LVWVXhST9R9XFQwEwpvczNcz6YGxaKz/swBcaooOzg+518ommffGK538bPpjAjTPJRXtl0Yl1vSQU0zJJWOPWZwfMYbpD9BJmfVDw5cEhGy+1uGowSqNcIUG9VJUA36ys18d6Tv+RFJlqewZOwYWiqHuVqZLugW2kSCf/fO1hh30Saas2Yz0/pzeK2/SyDh45pbydc/EF2AaUG6M0+uuQDtJ3kdKHRAGm0blDC40w3nL3kDSov9xEzEDfxJTPbRdiiw2kUjvMRDK1zt5nesk6jN6JjJlH9b7XV7KK4c6DUzRRV3C7s+dcjs31AjMs45VKP7x65MuJMMQ== 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=O+6Y00U7BLZAyS8UvwlS2YOYLgiyr3B3vi5cG63Sy5U=; b=iPdRiOfv3IbDQrjLrJKBJ66pnAh+3kSMIhxrHg3Dp8lbLiFfNso6RB2KdZgh1riqlD9Y/e6uTOc+RXdsZVGfwsNcgpWyXqZwYuh8qn9OcPZxC4PGKSvobNYtR9qmo5QZImpq5TQofWhs4RBCZ1ohJJzXYph2Ir4wG0xv+LEvghDmdzMFvSfitvz4jVtd1guYhALUTX2ooAtwQOqP7/XC5fHiI58wesyTPIKhJRWFdLQUze5EWpyCs14aSq2Oh2Ku1XT8BX0E4Ylq9nsaBjpF5MCqHl/pILLSrcZ3TrHHhHIFy96HbaOa5WN8Z4NKKq/DcDlQ7Tu13key5+qn+khIIg== 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=O+6Y00U7BLZAyS8UvwlS2YOYLgiyr3B3vi5cG63Sy5U=; b=P0k+KUEMfLX8iLW7+q3Jn/We1oPb1HtSWhD51wVbLzkg9Z9x/Py5N6lxCSAnV5DV/EUDphkhJLaJXjJCirHhP83oVTnMGEPxewWfWUcHHsLqLHbomIu6eK5XVe3+04QS8hiIYXyUz+vikqRGz5m6t1Fzgm/PuuqlPCdjBgVDvyU= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:27 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:27 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 09/15] xfs: Add log attribute error tag Date: Tue, 15 Feb 2022 18:37:07 -0700 Message-Id: <20220216013713.1191082-10-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b26f5ec-9815-4a1c-9c35-08d9f0ece13e X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NXs/+YSdFba+v3J7eXcw4wVcLf82Bj6RoW5srS3hKY5bKVrar6aSejnR+Zc+/84bVP4MAHF5pCP2vloKCwYJuQ4f4h+SZDnk8pRvx20WsONfEoMF0mK0/21vZUfZJaO6kz2E7lj8nxCwgclIlZPbUk7A70GD3lMjYxSJD+tEHo6fYD0PvqIw/a8YzsxfzRrLREs421nUHebdS140KKT9CFDCuiFh3R3KQnDGmxozR5vj46itygVKIJCaHmqG/4cFXAMVEmNft7OyinKe47eZw5ymQ7ObHviRt4RU5uISJCcFztvh9P1ctqAa6FUDPrW5jyIV3GhfYoHxyeojGmk7cohhtCplUDP2m93ouLdopX21OVxA305mR7BAd3uqW+wDLUSivdjv74jfumhY1BxiailD/qEMItnSwd0rgDWlAY1ro2wZO0LRbC4MCrqthujyI0JL/TABUPpUT25CSzZFe70tvF5gBlOKu67YW8Jz1xLzQ1cwLkThQ0RvTX6eoQYuWxJCRvu+WsCohDdhm816uHNErlUY/BFqVAzv9gvjWS9swDmNaJtGS/08B7hMpBrslGaFtVbRVOcZ6XiJ7Ig6EHFE4CscpVhhBcS4PdBQNhME0evywvk3zu+pvUqF41kkXz8Hbv1FerJolU8PSL4OPNiUlgZfvv9ijDEULjn7AKdjgxORvFYHy5qVNb3Wc1TkvD39lx/5ZhOPJioWlNkyjA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gOqww0tfuQgfa1QZ1bogJf9N9Bb0DvhuzZaxUkS6tXaTURLAU/2dlY3JH2VijNksn5d0vgJ5guX4+RSYzOQ8HT/JpauDL2aJzmi5X6wKvsMRC9Nf9xkFfpS/klX5v8o830fOimyxEW+7bUpahyWeOmYf/HNCdUN4tkm4/Y8iLo2dRbbmwUG/3RGwgnPmmDk2a8o9s8nxi9DkSG8DkEEu6s7hO4VDB5ddP7l+/S749Z4p0EJavoGIWW3Am9A8b6VM9Q7PEDII11Z9bR0+15wYKwktfYZecdbHCg/3V6oaurfoA7QJDh2V/W+YiYjLxJgYu5W7CVxk7ioxautpH2NfcTiWJP+NnpKwgPmGKaiy0LQOGFJ6mSLV+hmRHd7/10nEPEvAiwaXeYUGgzBmlISiEObjJdCbhIcRNrBPelXIt8CiZOK4b7pDNoMJLtdM2QF5/YL1krRaWDEVHV2N5PJLRJf17mmFCdsVjiN3Oshd89GjgjqhsPB073728PNcTd9T1ax2unhxoepsYmXL91q60fAs1lw4cP96EnINKQxx1xof9Pw/1BwlIKWG8UrkdHgNT2Plqk8wrm6dkpbhZ6VnYA/48nABgFAtoedsiOMFrRryoukonppMYOQhckWxv+twbGe9rDThBwrLoJgNkR/KLWQMJeWOI4jHybO91n/HIHJef/tzWBvhPXK0q8GYfaDskC29WvAV4Ey0FXsrOItBBjQUps5apepH5y59w7a9VO3dq9UsVGSFEBKjGXrIVX7XikodrzKjfyEuGCqE4tuqyHyUtCzWf9mHAT8ePR/tjn6mADhcJbvnoaocMLfNpNPpcBGNLm9QBLyiUPE1Et/XprDQNsGB+k7LvQK5F44Zy8Q1UTutRUUsRYaCs8XfXEJbrLGn5P+OeqJv+GeoN6iSdX7Q9ds7Vguip5Bg6L+TWFyP6ha7X0Cwyk2KZjlzG6Kbf+IH9sLWCYOOA3YASP1sEozAQdH0oFOufbqYKPupPcbXtOV/XlAeyPsG+o7kF0ytoEzrRBolbIzO59PqoDtVYNd0GDA+vpvEnxrgocx29JhxPsOaNgtl1j8vtb2pAfiR3BFjY0ORKRlzX/yX9/TssfG6EwpNg5j4BrpIXlnZBW3xPTzEooO1C7TvtHWSEUEcuCpRP0R1c1fwNQrAG4pUVM3ppQSVRV3zyQzkdQhs/OqwAFFQMf1sSDqR3ul0p5pvGifiY644B5eWhBbQ1xhQrnkNS33SWQYWHbuoo6COC4u2zfOH8x1wkDwpWZi18I7VCaOrcZXTLu5/PeT1dWllkoid15g3OlHafldQ6Oiz2tQDpL9OUiiI3phyux+2tQWnYrfSJbTmQyQyuijFXBYYJSIuHrSGQilRV+vor9sFfdL44Z2AEYKIEAEXNyT2JAoknMtdQ8twPFmLrH2FkLwFSW2eGVfEOfQsUk1q/b2ZKMl5MJIwZIDtplSVQaJKAw6CCyy1RRas1ydnrYNPR2rc6/FxvBPNnXGCYGTpSS55fljRZhz3s+rNsqWeXKX0drgUFudD4gXbp01pMyo+NjDEixAd2wmdb5khbbEYI5EvKNZF8l55VCDDDnG1Yku7zC9dBPisP1xQbHaDlrC7bJeQpSs4W47VfKFD/Ao+9nQJsOLmB+cncb1kBTi+HRWvCSRTvDwND8NysiiQ/9WLljHc1Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b26f5ec-9815-4a1c-9c35-08d9f0ece13e X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:23.2966 (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: OcAmOJhqoNvKCu4/H8TWxqDYtkhqbkMSM1MtTYs3IwGyG4Ko/V/VO20YiXPvraDPIWBJ8CHJ6Tob8xLuwzO//4F3C0sMCThmyqRoEGaiEs4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: MIJCvnN4yBNRqDmSrbCN3HeFLI_-snLJ X-Proofpoint-GUID: MIJCvnN4yBNRqDmSrbCN3HeFLI_-snLJ Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds an error tag that we can use to test log attribute recovery and replay Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_errortag.h | 4 +++- fs/xfs/xfs_attr_item.c | 7 +++++++ fs/xfs/xfs_error.c | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_errortag.h b/fs/xfs/libxfs/xfs_errortag.h index a23a52e643ad..c15d2340220c 100644 --- a/fs/xfs/libxfs/xfs_errortag.h +++ b/fs/xfs/libxfs/xfs_errortag.h @@ -59,7 +59,8 @@ #define XFS_ERRTAG_REDUCE_MAX_IEXTENTS 36 #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT 37 #define XFS_ERRTAG_AG_RESV_FAIL 38 -#define XFS_ERRTAG_MAX 39 +#define XFS_ERRTAG_LARP 39 +#define XFS_ERRTAG_MAX 40 /* * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. @@ -103,5 +104,6 @@ #define XFS_RANDOM_REDUCE_MAX_IEXTENTS 1 #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT 1 #define XFS_RANDOM_AG_RESV_FAIL 1 +#define XFS_RANDOM_LARP 1 #endif /* __XFS_ERRORTAG_H_ */ diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 468358f44a8f..71567ec42dfc 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -24,6 +24,7 @@ #include "xfs_trace.h" #include "xfs_inode.h" #include "xfs_trans_space.h" +#include "xfs_errortag.h" #include "xfs_error.h" #include "xfs_log_priv.h" #include "xfs_log_recover.h" @@ -277,6 +278,11 @@ xfs_xattri_finish_update( XFS_ATTR_OP_FLAGS_TYPE_MASK; int error; + if (XFS_TEST_ERROR(false, args->dp->i_mount, XFS_ERRTAG_LARP)) { + error = -EIO; + goto out; + } + switch (op) { case XFS_ATTR_OP_FLAGS_SET: error = xfs_attr_set_iter(dac); @@ -290,6 +296,7 @@ xfs_xattri_finish_update( break; } +out: /* * Mark the transaction dirty, even on error. This ensures the * transaction is aborted, which: diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 749fd18c4f32..666f4837b1e1 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -57,6 +57,7 @@ static unsigned int xfs_errortag_random_default[] = { XFS_RANDOM_REDUCE_MAX_IEXTENTS, XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT, XFS_RANDOM_AG_RESV_FAIL, + XFS_RANDOM_LARP, }; struct xfs_errortag_attr { @@ -170,6 +171,7 @@ XFS_ERRORTAG_ATTR_RW(buf_ioerror, XFS_ERRTAG_BUF_IOERROR); XFS_ERRORTAG_ATTR_RW(reduce_max_iextents, XFS_ERRTAG_REDUCE_MAX_IEXTENTS); XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent, XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT); XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL); +XFS_ERRORTAG_ATTR_RW(larp, XFS_ERRTAG_LARP); static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(noerror), @@ -211,6 +213,7 @@ static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(reduce_max_iextents), XFS_ERRORTAG_ATTR_LIST(bmap_alloc_minlen_extent), XFS_ERRORTAG_ATTR_LIST(ag_resv_fail), + XFS_ERRORTAG_ATTR_LIST(larp), NULL, }; ATTRIBUTE_GROUPS(xfs_errortag); From patchwork Wed Feb 16 01:37:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747793 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 0F976C433F5 for ; Wed, 16 Feb 2022 01:37:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245513AbiBPBhq (ORCPT ); Tue, 15 Feb 2022 20:37:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245525AbiBPBho (ORCPT ); Tue, 15 Feb 2022 20:37:44 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 563F819C28 for ; Tue, 15 Feb 2022 17:37:33 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMpU3e008678 for ; Wed, 16 Feb 2022 01:37:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=3CKt3Kwzn19dUSRfAM8d8zKP6m2jL9pOOdLbeTl0s6g=; b=ooL3kR91MFSLHezAL6PQj4sBpEvCrRKSG0MAxP3URu6CKndsNkQNcHGs81LrjXXwAQkY qjLxRWZRSR2OXoF6zkQrLC4H67E+61fykgMIULF1omvMkpOxcHBpDGPfI2N8kLYhgM3t fnokrdrbUYG4nNV0I4Fpg50x2J4Vbjj35u6tzV4g5Bp9ZXOZpZQipqJqNB93PvJcUaJ7 o5fzst/yol5K5inr9lNz45QwNTAzb97Q9DpdkcSvUgG77NOWZgLeww1aPdJQt9QUXAqz qdJxdn19X19jB6qpIdu3FRhPcffeRkfBHcjOIP+h7kuWoCFKO/gVJdwqHq1yIs++EGwO WA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nb3g7ab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:32 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1UZxQ165528 for ; Wed, 16 Feb 2022 01:37:31 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by userp3020.oracle.com with ESMTP id 3e8n4tuxvp-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k59I4RXr3TQgXvPIMc/mdnzGK9a3DEnjqv787lh4trICkNSFMjmb3tcB/iUrpoSPkFuvGL6Fv+k3Xbeuu7D1i7E2pOYKpRmxhC9SAqhYd9ojTAtWxJJYewU1lNAfqE4ZHnnM7f5iFN9zHeNd8rvdxwOdiQRDsv9gKKP9kMECVYH+RZSi+MbESxJYZBHSZGkhLgWQ6wTSwKijNizSXZYwIESGEigSnuZ10B1hgFDGd/TcsVFf4Y6REuEdzvvxqikjw+qyng59e6u7q2i2yEhDCRBXTYiCCcwUU7fZRTPi4UuJ20gE14DwIONLgMNl7L3h4mOjeta4ihsX7e7aiP0ykw== 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=3CKt3Kwzn19dUSRfAM8d8zKP6m2jL9pOOdLbeTl0s6g=; b=aXUsIhKGiVT5wgg8a98hYz0hxyNrmJE8s2d3h/lkXkRsUmV0MhByTHDb4ytBjxC5OMcRfr4pp69vV/3RlG15bSnUkbQ9Rc8ONc1XMS5kaH4/sMHNb1TW1L6kwY3xGjZKRo51Vv96UmVE1CMXVcKpwMmOboC2mHKHJMtJLVV1UQTdLEmBJgyIcKu3sxmbeFoIHJ87ZHnXO9ZODPq2xCNK14UWZc16OlSWF5E1TbGg10xAyVwVjYmg5dkNZtUj0Z5J/dGlzCyXzCNKP+Rpa1U854Ic6hNy1EwXk1OX/ft01WGWrKhAgzK05Hnr/xcHOouRsMVpBOWGlAFBZKGpw/W4FA== 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=3CKt3Kwzn19dUSRfAM8d8zKP6m2jL9pOOdLbeTl0s6g=; b=uIiY8P3r50ksmX3GvQqyHkcO0zbfslee93F4u0pIkjLRsQyLq+1smBtxtdr/6T0kIlNntV6oW5rF9yDFDVr3pGrH4PwO4ciWiDpCQ+6JvAa+PBOaYheGwFy9LVLmBPegTQ+kz5xIvzt6ggDonNERmbJOf/CZA+7z4++O/8GAAmU= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:27 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:27 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 10/15] xfs: Add larp debug option Date: Tue, 15 Feb 2022 18:37:08 -0700 Message-Id: <20220216013713.1191082-11-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aac39917-990d-444f-d205-08d9f0ece177 X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:644; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C48PAXBNHic4yb9opdjQsk0U0/nJD1YeNBDOpWWjEFt+PQizys6GKcLO33gMl+5g2gVnuKfDBuwFAaN39VzKe6leB5JN5TJ2kgyMgS5/rpXhzqcx6VSH9/rYW/P+8EXF3ihaqbCud8mpqFidF4zaaFdnA+8NziTNm8roLVTggcXP4AFU5oNn8xccsCPComKnqYAGQHWfVWg3hCJUweENi2S5P/wbCPAxF/k/Bv4RlGmIsU+Qwa7o2P9BbegltkjJvH90kv6GeJ9S2zFXXPjYRfqVSTEKgyaRq4KKRR8RpuX8yueNxqYYPU8NBKXSdSbzMIaXGw0vPwygeVkRx9LtPsS3qgwsz3t9ze8uGYBDFdli6VdsyM1jLltoDXKS7vYK4WVpSGrETKwDWTzAT0IsQ4+9ROg1LeTpJ7LqN/c2ddYHWqMrTGm8JmUubNb0vdKZaLzhoOriFbXNfWj2XwNGMIWJhOGv647M0FV9eq775IYOcAQYsblUd2s9WaBnsQLOBjU3UjSgnFdD4kmIoN8AgPIv/ERyAZ6daovwPxWqqrsqkd1SKpJhehlW1FVK4vqyhN2HY61JqFN3rUmoUqdTIgOv3QnT4PLiyxTUdprhtit0mERvYFg5gdHHRB8Rwkbq+5+cFRlep0TFSvV7EJXvtZANaEaL1rjrm+aMb1QYD4xKdgoP7jyUdAm4RgZdej9vTf8v/zLUQBFdq/ghUasToA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: erJZCgHQ66nEXbK1uNBJ8vOwu3VYt/vO81LmKIG6ZWSimE5Z/sY4taPzEv1ExWa0+vYROrzFwdH1Q3SQumOMJ9PZz97saY1tqralaqyc2VAMrj/IASy5tpPtkmzEzHNKHWlwA/JEBoadEJAmvZtwFaeEc71tn+X+HGrXc/4IThWWafBVVY+EuNwny8tI3eJguuJroJKcxaZLeEJi0WfBZXyLQVeBGd1tQmhcisduIoYqup8FLmxqaMuhQgUAlTuxz+Izkg3mR1A8RDmiKEQsF0qqIORGkMDZQiTpsZD0G2n8giBKa8NxN1FPj8XPyY1UQTlhKEpZP+FMKjDRV3rrp9399/oUwpM/nE/Hkh6DGFHgu12waEU8Deu0+7BAoEyzQ1gj4lK49yMsGjX8Gk4WA5V+VJA6LlYJXsUfdWEW/KS/sFmWr8JEcxIg+d7q9giGqFjbO36AH4RrQ9ZPZd6FnOVG7zCi8WE7hjQ9lzqCI51rNECEHlHEb7o6+pbrFfNFW9PnDUdQgYHBv8MHH1LMF23MnrzJCfdUZO1VUt4gpTs1N03YuTqtosWvkOLc19rEHGF4AtrnwjO3WS81AGvYyg1jFNkJUzB66uemNK6QvnindbRhfT0PTrzOxybNyZtBAcz4k5SYLmj+U1+OGSzjDAZ5WKDHlqWf8heqau6Wyqo8QonfFJlUx0XhFimMTGFlEskf0S0fOiL7Ev3jPqyR2BEst/YPoKYU18W3wVTCn0MFmhlLwZE/XjJLes6fAy+HB1mLKc0vYse+MAMt1XbmHfu9Vhhy80mGhMQc8+StnEDoyNDE/wtAuVK6BtcsWK3qLT7o9AOJxKwIrVemqVuXT9aDAXO8rEWxp3RcompNFaTKgrJam/0P1JKgS1QOTa7Md43VJcgTSNeaHHvmciFaU2ukQUicF8R0Vc/9ZE8qiHaDbJY6lsu9DFXPuWFIW1DwALWyitnD4qmbrzT4srPKRFnEPJQSkbZZ5rxqVLe6vM53sv2G02Kwg3kKRtZWMdKen5vBfsGGEJNKhi7VgEU+wGgXDPOjarecqGSAy/eb2XVv6GEpybNrZwLBu2UodvOt74V7m8FkUy/BM8Sp2WKfHZMJULY/c3zWxg5JSD0b/HV73/ZMNwzn32n0howu6lqVdcrhUmSNyLRhAN47weIVk+HHPfZd7RNgrQXl8jThhZJWBsXCa9wrD+/ieKuDJ9jsW5v2jyt4LAfKYqMihEf6uJnVCGpyBcUttfo2Kq7QH8oBhfp1E4hoT5egMlCw0UhVP0/4wg3S87WJuvVXEz7QD9frsGIo4B7b3a6Wn6hEfouGsJ7zBFwkGvAQCRdlXIo6i3hZWrJjANpUjqedQ/dXXEMLcZGpHZCUIMtLj6063yBNn8dY24Yv3/m5xKvH9FcIZnLXpcH6nifOrFyzK0kbfZWk1BJgQ1SLJIWPSQMh5K/qFzL5ccSQW0ki4oQTw+Nd1QHJVwVcj31IUw4FBcHMZbX2kYoJ8B4PraP8pJdn6F7XN3QzK2YsAq7kZfv3PhJfM1DvZ0bV1Qe2L22BbQb6U+hoWvw11rEsZyodBdrcAtJs5uTAZTBF3fOlA9FloFOy9+8Yi4GzfJMhDHA53mXX0K4SSBjiKzs1kOxrX0CqqjWfiyRMgocu2H0WkNw/T/0IxTe01lMTZxE2Zy2IhJmRkg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aac39917-990d-444f-d205-08d9f0ece177 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:23.6404 (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: lcAQP9OWT5U9uBtPPRnTwO/T6ar7u4DyU07jzTdIDrPhQCgW/ejxulRIKWKPK853oBkKrgBxKE5ybiB48go2spSDnvlqFUq+SvbjCbfXL/A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-GUID: k2-GcXHHiOK8gHL_1nSrtHA75-sFThoM X-Proofpoint-ORIG-GUID: k2-GcXHHiOK8gHL_1nSrtHA75-sFThoM Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds a debug option to enable log attribute replay. Eventually this can be removed when delayed attrs becomes permanent. Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.h | 4 ++++ fs/xfs/xfs_globals.c | 1 + fs/xfs/xfs_sysctl.h | 1 + fs/xfs/xfs_sysfs.c | 24 ++++++++++++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 5331551d5939..78884e826ca4 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -30,7 +30,11 @@ struct xfs_attr_list_context; static inline bool xfs_has_larp(struct xfs_mount *mp) { +#ifdef DEBUG + return xfs_globals.larp; +#else return false; +#endif } /* diff --git a/fs/xfs/xfs_globals.c b/fs/xfs/xfs_globals.c index f62fa652c2fd..4d0a98f920ca 100644 --- a/fs/xfs/xfs_globals.c +++ b/fs/xfs/xfs_globals.c @@ -41,5 +41,6 @@ struct xfs_globals xfs_globals = { #endif #ifdef DEBUG .pwork_threads = -1, /* automatic thread detection */ + .larp = false, /* log attribute replay */ #endif }; diff --git a/fs/xfs/xfs_sysctl.h b/fs/xfs/xfs_sysctl.h index 7692e76ead33..f78ad6b10ea5 100644 --- a/fs/xfs/xfs_sysctl.h +++ b/fs/xfs/xfs_sysctl.h @@ -83,6 +83,7 @@ extern xfs_param_t xfs_params; struct xfs_globals { #ifdef DEBUG int pwork_threads; /* parallel workqueue threads */ + bool larp; /* log attribute replay */ #endif int log_recovery_delay; /* log recovery delay (secs) */ int mount_delay; /* mount setup delay (secs) */ diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c index 574b80c29fe1..f7faf6e70d7f 100644 --- a/fs/xfs/xfs_sysfs.c +++ b/fs/xfs/xfs_sysfs.c @@ -228,6 +228,29 @@ pwork_threads_show( return sysfs_emit(buf, "%d\n", xfs_globals.pwork_threads); } XFS_SYSFS_ATTR_RW(pwork_threads); + +static ssize_t +larp_store( + struct kobject *kobject, + const char *buf, + size_t count) +{ + ssize_t ret; + + ret = kstrtobool(buf, &xfs_globals.larp); + if (ret < 0) + return ret; + return count; +} + +STATIC ssize_t +larp_show( + struct kobject *kobject, + char *buf) +{ + return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.larp); +} +XFS_SYSFS_ATTR_RW(larp); #endif /* DEBUG */ static struct attribute *xfs_dbg_attrs[] = { @@ -237,6 +260,7 @@ static struct attribute *xfs_dbg_attrs[] = { ATTR_LIST(always_cow), #ifdef DEBUG ATTR_LIST(pwork_threads), + ATTR_LIST(larp), #endif NULL, }; From patchwork Wed Feb 16 01:37:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747797 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 AAB37C433FE for ; Wed, 16 Feb 2022 01:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245528AbiBPBht (ORCPT ); Tue, 15 Feb 2022 20:37:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245529AbiBPBhr (ORCPT ); Tue, 15 Feb 2022 20:37:47 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80ACD19C28 for ; Tue, 15 Feb 2022 17:37:35 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMpU3f008678 for ; Wed, 16 Feb 2022 01:37:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=81CiBT3zURwxTjFTY8vMCZC7Ut5ifRzQ27IZt5OPKS4=; b=Pu/F2bBpUf0d1Tx3Zkd2quS8VPiVwZjw/cacMfvm7hPjoUFI00aoorpeJjGwXmuMkZJ2 TxJJgwrS/SbboUFk8nH1LdbifR7SPultiQYW5yc2L2Rxl1kVRK3cktvnLCFPEwwpV2NC xtUCN8LSftdsQ4yCjdKskX7mJmQJgBKaTuNFSEjd6CJAmjJxQ27B1R6McTk8pRF1ort1 6puo1CmdKQs3qWvgm8G1eN57VFWfpsiVfZneGoZDd5mDWjnkp+pbLIF1l8jz+A4SlEbN jFI/z4ElBucBU14cqqFICz0RziRrOzLSOLBkFV7Eikq9W6YIxV86QCS99+zbcFujh4BM Hw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nb3g7ad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:34 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQ5V138923 for ; Wed, 16 Feb 2022 01:37:33 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by userp3030.oracle.com with ESMTP id 3e8nkxj2tr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0OclHRiGMiEMcbNJ6nRthgynlhOD40BZzGxRAJfR8VvB8YXOel1dvJXFkMSeWGTNjid6ngmD2+6D8izboy2qA3E8t01Z8e3B9RSsbckj+dx+0DQ36+gN+6ulhx70O5FiKl5ByEIQS82bOEhtEpPz2c49n/0ew3k4en1Om8KVRnwiquATyDkyByNPtVrOrTwU6O8jbV1bJ1ydC6HCXoptTxhmscBHkdbC3xOP3F8uMQa44a1Fl47NvcV9oK6XIhyAZreND5nEcsAvd/kjKk0C8oRDQnmFLNLPGxqDCZuOOtx+5M68KYUgY647RhV2bysExuhhuQioBgCASQtz7L9dQ== 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=81CiBT3zURwxTjFTY8vMCZC7Ut5ifRzQ27IZt5OPKS4=; b=IAwlZRyI46kxxuK2jLoQHrhGXssQKwS+/RsprcdgZerJ5ouJ3LTvy+OdTcsGnM+rzhvn0ix9l8PmowA9fU1qHmZbQFg5Aahn8alkCEamRo75vK4TYElum2iVkjON1VsyPUK8HmmBiNCOUv28GomSY863ew2noGFFUU++F6e3C1qvI9AzOrmZfQCUPPn3KZuWPEqz5rUKOHfk5HSXhXDuG485znGF3IKTfAECOf8JtCp9hB0q/vUMrdYbzVDbJ10gDcF1kFDc5h08ByxK5GrNG33QABpc0VVG9Rhcej0ume5yxcBuOTwYT+PtMRldY3JgaBZs3I0dKJFeTX7lLkSAiA== 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=81CiBT3zURwxTjFTY8vMCZC7Ut5ifRzQ27IZt5OPKS4=; b=Vzv+KSbAbN07mIVBuTrc08NXDD1KJoBoQ83NrsjKNBrHnmZZTuXRdsDhpM+4Au3yZhoq1AHB09VkjhYAd/kRPV0kw34HIsBilpUen0X5x4wDNStPPh7H2aCBaTJvh2lticii/DJZRQ6iMbzHbGunbN8e57YzzEzANSmhUIQtbb4= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:30 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:30 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 11/15] xfs: Merge xfs_delattr_context into xfs_attr_item Date: Tue, 15 Feb 2022 18:37:09 -0700 Message-Id: <20220216013713.1191082-12-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6f366f2-116b-4f2f-4354-08d9f0ece1ac X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:250; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CFNFFkiouwQtG6oT/rKDiBkjEJEcuQDIzXYTh5rSvGn20LtqEBxiOG96umhUtCsJIH4K1kvw0tX5W3agV7Qb7/xhgtZxcYIWCx6zIKXiftCMogRwxxI+FRQZ2t+/qZPseDGuT5o0np4dGrcyC5aUfcSK9yZC3hWM0fK8rYHKlSDVY+BaE3n9tnziMUt0QlqyXfPFtzad02i+XjlAt9GYf4TeTOzwNfLJadE6ppYG0V9UyERwo2EmUrUiQVtEHe1JmizG6fgVEzc3uch7fP1SsSQ23BW7br8gJ3V3lyV3Ja0Dxn89g+8EW6lHKrUkryoqLYYs21rVhLFEyzEiwDZIln5er6dYMj7PtBUpmq8CuxWMotPo3N+88jqHPNOHmwWzZEkKqFd4eGucmo8YPpriGILQ+ZsINHHs+TYRRf3PlJJBtnshlD0VWFsrbVSBclyD02OeNSKO91RsDfa4MLEijNPNx2jSZp1CQIw4lNduZ+idYD3M7f40ng37PW9bF+yFXQqmhJkw3DDc3CX6rtEKd2Mp8jQ9ANLhtYyA9VFAgIy8sPrYExN48k2fmtn4YuNhnhl/P/TIaHN8Pcjfnir413AnxAyONOGK4eK0gh3EnNM27BHt3C/cJvKwvHYx65wDpCBPYw2g5Xu3LJ78S+rGcHd3UJMp/4XR62ipzU46ZQbOGOI406ZXno8vDoDa0ovsB8rQ4jaxK7BtfgUzC2Lzsg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(30864003)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QNxwIFjGoLyahxgVJtRsJDO6g0dHU7mClgiU8C9elgJU+LYYe8kmLm/abRZQXeABJfLdt8ZlQpNwUUE6049VTKuknzFh0kVADEPg61IGMZToRnveAXAL+oETIwcxlVAsY8G3yo9wEzCwqpfmAfx0I7KrCjdD6URfJEmusohnAE79qvwxo0w4rAeHG/gHZf6wnVf6YCYjx8BI5S139qmN6pe/zPUjLM0sZ7AVoQ4Won2Uo2KglJ8F7zKsM+UNUDIYDz7hzkBVXAhDiqDlhJD+Mj+hkfDQAGcgMbq9BHZQvjZMJWbYN0emPVpujapkIcVhh4MpjWVwiMyuYFtjbzHmGT2lrNL249VEbiOuUyJDHOsaXOY08MEdnvuPEzRKDbyvjF7oK1sFnOwwpTu1dueqKi3ctGmFh/1TlSAEBIwnAiyyrauF2/JyrZcGM2mU5kx6TgAxYUFpyOExJ9qOiCzutbt7J8micVv7pGMnJ7TCdu9bts8cuW9O2sT0k1RWF+jxdVhpIn/hGk33xS6nj2E1RKGH/qJT1zP0EcGI95GhTg5wT3He49+4nztDXhKhJ1Up11EgSO+Vn171gP8Hr2e75nyiF01/huiqhXBHugg3qvIFabZSFCqFhtEfk+x9wwcmsYSoq2sXHavXzZrWG2KRPIyqd/PfBzhkL0vuXPif4slm8QfKqUxnYTFJf6+h/maZVMdLHhNQx0HT/hkeBuERdQP5O/XRQfl7VZSALtmzwQKbldVMCIhBioofFbsumKLVarJhVD4mCFrWNDdIByYU9LOd2zGidMDphvDyD2z63aUlusr7erHgsBYoQOZ674mD2EbfvArqPhtbhPNpdUol+WhKDnoTg2WhO7DS+AXDIKvQHOK/raHquTCt+p9R9kKbkZf+YkusLaxkiCpsTUsdeeqecY63ERWHNM2qVZlsg7VS6OYzPu6Yg7euPN2QRRa4rhex/uioaRv1wiYAhWLJlaXKPljhwaGYgPhZPe3CTQd2kkB/FP4SHc1D25zPiTJT4ITcEBypoEwkCEhNLzOGSgN8SRKk0FtEVz6XLT3tJrpgJBrqmZ2J9LnTKCwzVbWGoB8AJQDc0lfSIgERuMoMYgsseyBEYtqsIl19OeAL5YsNe/N+P2lCARpxiM/oqRKRtuofkJGE2gWyXiB4YuF7301HRRNXOIjGzS8kAlgfXzVIl2h9MEA+FwxzNMbi9w0IZu6SVkRP2+2VwrMXEA2VxWmocSWrGzQKu4tILeQtOG+u2xcQrQlSLybCE+U9KcqmXzm0XBRHcS8Vx0yAMVBbL+Ey27fICfuz0lmoPMjJaVT+Ryx5VKHMLDOJ54ilZfZg5l924JtWKJ9gPHTEfqiTbH2xxNfCaKb0VzBEzvxq7jhPYOyzGh6XHJ4QqYZUIaasS7HgPTpzQbz0fj6+U90BNNtzXrlYPAljLpGUrcbpcBXVZsTfADYrHAiHdfGtSqSk6WcJT8Gok4srJBeO6e0YSgDgTQM+gcWfxofU2hNyBJjuJn5ocHhwjMXkrL6RaWJ00NlMkX+Xa/r2Jgb+YGN7iB5d/eVgyz2pMU4kczbhj8ZAecgZ/twV1q49zTV3MUomKYJme1AIltmxyBWjQzQmBaGl2tKbcAN87qu9bb0GmL7VvMqFyMJvEW8h8w4CdLml84IAakfW4NxCtvPob1mIqg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6f366f2-116b-4f2f-4354-08d9f0ece1ac X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:23.9684 (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: I8CDUGUGxikyQcBq8dn8FX2OrrFuiDVSmZ8VtaUZbyu6AAaCDLGAuPKPtPoBbSRIqzEigvmvNNuqk7AThD4juTmPAW46xZnYipT09WX32b4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-GUID: QozPXVEA2aVeDxyMKzzIY8Fn_XvrZPyA X-Proofpoint-ORIG-GUID: QozPXVEA2aVeDxyMKzzIY8Fn_XvrZPyA Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This is a clean up patch that merges xfs_delattr_context into xfs_attr_item. Now that the refactoring is complete and the delayed operation infrastructure is in place, we can combine these to eliminate the extra struct Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 162 +++++++++++++++++--------------- fs/xfs/libxfs/xfs_attr.h | 40 ++++---- fs/xfs/libxfs/xfs_attr_remote.c | 36 +++---- fs/xfs/libxfs/xfs_attr_remote.h | 6 +- fs/xfs/xfs_attr_item.c | 42 ++++----- 5 files changed, 143 insertions(+), 143 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 3d7531817e74..1b1aa3079469 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -59,10 +59,9 @@ STATIC int xfs_attr_leaf_try_add(struct xfs_da_args *args, struct xfs_buf *bp); */ STATIC int xfs_attr_node_get(xfs_da_args_t *args); STATIC void xfs_attr_restore_rmt_blk(struct xfs_da_args *args); -STATIC int xfs_attr_node_addname(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_addname_find_attr(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_addname_clear_incomplete( - struct xfs_delattr_context *dac); +STATIC int xfs_attr_node_addname(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_addname_find_attr(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_addname_clear_incomplete(struct xfs_attr_item *attr); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); @@ -249,9 +248,9 @@ xfs_attr_is_shortform( STATIC int xfs_attr_sf_addname( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; int error = 0; @@ -268,7 +267,7 @@ xfs_attr_sf_addname( * It won't fit in the shortform, transform to a leaf block. GROT: * another possible req'mt for a double-split btree op. */ - error = xfs_attr_shortform_to_leaf(args, &dac->leaf_bp); + error = xfs_attr_shortform_to_leaf(args, &attr->xattri_leaf_bp); if (error) return error; @@ -277,7 +276,7 @@ xfs_attr_sf_addname( * push cannot grab the half-baked leaf buffer and run into problems * with the write verifier. */ - xfs_trans_bhold(args->trans, dac->leaf_bp); + xfs_trans_bhold(args->trans, attr->xattri_leaf_bp); /* * We're still in XFS_DAS_UNINIT state here. We've converted @@ -297,16 +296,16 @@ xfs_attr_sf_addname( */ int xfs_attr_set_iter( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; struct xfs_buf *bp = NULL; int forkoff, error = 0; struct xfs_mount *mp = args->dp->i_mount; /* State machine switch */ - switch (dac->dela_state) { + switch (attr->xattri_dela_state) { case XFS_DAS_UNINIT: /* * If the fork is shortform, attempt to add the attr. If there @@ -316,14 +315,16 @@ xfs_attr_set_iter( * release the hold once we return with a clean transaction. */ if (xfs_attr_is_shortform(dp)) - return xfs_attr_sf_addname(dac); - if (dac->leaf_bp != NULL) { - xfs_trans_bhold_release(args->trans, dac->leaf_bp); - dac->leaf_bp = NULL; + return xfs_attr_sf_addname(attr); + if (attr->xattri_leaf_bp != NULL) { + xfs_trans_bhold_release(args->trans, + attr->xattri_leaf_bp); + attr->xattri_leaf_bp = NULL; } if (xfs_attr_is_leaf(dp)) { - error = xfs_attr_leaf_try_add(args, dac->leaf_bp); + error = xfs_attr_leaf_try_add(args, + attr->xattri_leaf_bp); if (error == -ENOSPC) { error = xfs_attr3_leaf_to_node(args); if (error) @@ -343,19 +344,19 @@ xfs_attr_set_iter( * handling code below */ trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } else if (error) { return error; } - dac->dela_state = XFS_DAS_FOUND_LBLK; + attr->xattri_dela_state = XFS_DAS_FOUND_LBLK; } else { - error = xfs_attr_node_addname_find_attr(dac); + error = xfs_attr_node_addname_find_attr(attr); if (error) return error; - error = xfs_attr_node_addname(dac); + error = xfs_attr_node_addname(attr); if (error) return error; @@ -367,9 +368,10 @@ xfs_attr_set_iter( !(args->op_flags & XFS_DA_OP_RENAME)) return 0; - dac->dela_state = XFS_DAS_FOUND_NBLK; + attr->xattri_dela_state = XFS_DAS_FOUND_NBLK; } - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; case XFS_DAS_FOUND_LBLK: /* @@ -380,10 +382,10 @@ xfs_attr_set_iter( */ /* Open coded xfs_attr_rmtval_set without trans handling */ - if ((dac->flags & XFS_DAC_LEAF_ADDNAME_INIT) == 0) { - dac->flags |= XFS_DAC_LEAF_ADDNAME_INIT; + if ((attr->xattri_flags & XFS_DAC_LEAF_ADDNAME_INIT) == 0) { + attr->xattri_flags |= XFS_DAC_LEAF_ADDNAME_INIT; if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_find_space(dac); + error = xfs_attr_rmtval_find_space(attr); if (error) return error; } @@ -393,11 +395,11 @@ xfs_attr_set_iter( * Repeat allocating remote blocks for the attr value until * blkcnt drops to zero. */ - if (dac->blkcnt > 0) { - error = xfs_attr_rmtval_set_blk(dac); + if (attr->xattri_blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(attr); if (error) return error; - trace_xfs_attr_set_iter_return(dac->dela_state, + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -433,8 +435,8 @@ xfs_attr_set_iter( * Commit the flag value change and start the next trans * in series. */ - dac->dela_state = XFS_DAS_FLIP_LFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, + attr->xattri_dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -453,17 +455,18 @@ xfs_attr_set_iter( fallthrough; case XFS_DAS_RM_LBLK: /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ - dac->dela_state = XFS_DAS_RM_LBLK; + attr->xattri_dela_state = XFS_DAS_RM_LBLK; if (args->rmtblkno) { - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); if (error) return error; - dac->dela_state = XFS_DAS_RD_LEAF; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + attr->xattri_dela_state = XFS_DAS_RD_LEAF; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; } @@ -494,7 +497,7 @@ xfs_attr_set_iter( * state. */ if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_find_space(dac); + error = xfs_attr_rmtval_find_space(attr); if (error) return error; } @@ -507,14 +510,14 @@ xfs_attr_set_iter( * after we create the attribute so that we don't overflow the * maximum size of a transaction and/or hit a deadlock. */ - dac->dela_state = XFS_DAS_ALLOC_NODE; + attr->xattri_dela_state = XFS_DAS_ALLOC_NODE; if (args->rmtblkno > 0) { - if (dac->blkcnt > 0) { - error = xfs_attr_rmtval_set_blk(dac); + if (attr->xattri_blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(attr); if (error) return error; trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -550,8 +553,8 @@ xfs_attr_set_iter( * Commit the flag value change and start the next trans * in series */ - dac->dela_state = XFS_DAS_FLIP_NFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, + attr->xattri_dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -571,18 +574,19 @@ xfs_attr_set_iter( fallthrough; case XFS_DAS_RM_NBLK: /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ - dac->dela_state = XFS_DAS_RM_NBLK; + attr->xattri_dela_state = XFS_DAS_RM_NBLK; if (args->rmtblkno) { - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); if (error) return error; - dac->dela_state = XFS_DAS_CLR_FLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + attr->xattri_dela_state = XFS_DAS_CLR_FLAG; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; } @@ -592,7 +596,7 @@ xfs_attr_set_iter( * The last state for node format. Look up the old attr and * remove it. */ - error = xfs_attr_node_addname_clear_incomplete(dac); + error = xfs_attr_node_addname_clear_incomplete(attr); break; default: ASSERT(0); @@ -823,7 +827,7 @@ xfs_attr_item_init( new = kmem_zalloc(sizeof(struct xfs_attr_item), KM_NOFS); new->xattri_op_flags = op_flags; - new->xattri_dac.da_args = args; + new->xattri_da_args = args; *attr = new; return 0; @@ -1133,16 +1137,16 @@ xfs_attr_node_hasname( STATIC int xfs_attr_node_addname_find_attr( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; int retval; /* * Search to see if name already exists, and get back a pointer * to where it should go. */ - retval = xfs_attr_node_hasname(args, &dac->da_state); + retval = xfs_attr_node_hasname(args, &attr->xattri_da_state); if (retval != -ENOATTR && retval != -EEXIST) goto error; @@ -1170,8 +1174,8 @@ xfs_attr_node_addname_find_attr( return 0; error: - if (dac->da_state) - xfs_da_state_free(dac->da_state); + if (attr->xattri_da_state) + xfs_da_state_free(attr->xattri_da_state); return retval; } @@ -1192,10 +1196,10 @@ xfs_attr_node_addname_find_attr( */ STATIC int xfs_attr_node_addname( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_da_state *state = dac->da_state; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_da_state *state = attr->xattri_da_state; struct xfs_da_state_blk *blk; int error; @@ -1226,7 +1230,7 @@ xfs_attr_node_addname( * this point. */ trace_xfs_attr_node_addname_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -1255,9 +1259,9 @@ xfs_attr_node_addname( STATIC int xfs_attr_node_addname_clear_incomplete( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_da_state *state = NULL; struct xfs_mount *mp = args->dp->i_mount; int retval = 0; @@ -1361,10 +1365,10 @@ xfs_attr_leaf_mark_incomplete( */ STATIC int xfs_attr_node_removename_setup( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_da_state **state = &dac->da_state; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_da_state **state = &attr->xattri_da_state; int error; error = xfs_attr_node_hasname(args, state); @@ -1423,16 +1427,16 @@ xfs_attr_node_removename( */ int xfs_attr_remove_iter( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_da_state *state = dac->da_state; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_da_state *state = attr->xattri_da_state; int retval, error = 0; struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); - switch (dac->dela_state) { + switch (attr->xattri_dela_state) { case XFS_DAS_UNINIT: if (!xfs_inode_hasattr(dp)) return -ENOATTR; @@ -1451,16 +1455,16 @@ xfs_attr_remove_iter( * Node format may require transaction rolls. Set up the * state context and fall into the state machine. */ - if (!dac->da_state) { - error = xfs_attr_node_removename_setup(dac); + if (!attr->xattri_da_state) { + error = xfs_attr_node_removename_setup(attr); if (error) return error; - state = dac->da_state; + state = attr->xattri_da_state; } fallthrough; case XFS_DAS_RMTBLK: - dac->dela_state = XFS_DAS_RMTBLK; + attr->xattri_dela_state = XFS_DAS_RMTBLK; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1473,10 +1477,10 @@ xfs_attr_remove_iter( * May return -EAGAIN. Roll and repeat until all remote * blocks are removed. */ - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) { trace_xfs_attr_remove_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return error; } else if (error) { goto out; @@ -1491,8 +1495,10 @@ xfs_attr_remove_iter( error = xfs_attr_refillstate(state); if (error) goto out; - dac->dela_state = XFS_DAS_RM_NAME; - trace_xfs_attr_remove_iter_return(dac->dela_state, args->dp); + + attr->xattri_dela_state = XFS_DAS_RM_NAME; + trace_xfs_attr_remove_iter_return( + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -1502,7 +1508,7 @@ xfs_attr_remove_iter( * If we came here fresh from a transaction roll, reattach all * the buffers to the current transaction. */ - if (dac->dela_state == XFS_DAS_RM_NAME) { + if (attr->xattri_dela_state == XFS_DAS_RM_NAME) { error = xfs_attr_refillstate(state); if (error) goto out; @@ -1519,9 +1525,9 @@ xfs_attr_remove_iter( if (error) goto out; - dac->dela_state = XFS_DAS_RM_SHRINK; + attr->xattri_dela_state = XFS_DAS_RM_SHRINK; trace_xfs_attr_remove_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 78884e826ca4..1ef58d34eb59 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -434,7 +434,7 @@ struct xfs_attr_list_context { */ /* - * Enum values for xfs_delattr_context.da_state + * Enum values for xfs_attr_item.xattri_da_state * * These values are used by delayed attribute operations to keep track of where * they were before they returned -EAGAIN. A return code of -EAGAIN signals the @@ -459,39 +459,32 @@ enum xfs_delattr_state { }; /* - * Defines for xfs_delattr_context.flags + * Defines for xfs_attr_item.xattri_flags */ #define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/ /* * Context used for keeping track of delayed attribute operations */ -struct xfs_delattr_context { - struct xfs_da_args *da_args; +struct xfs_attr_item { + struct xfs_da_args *xattri_da_args; /* * Used by xfs_attr_set to hold a leaf buffer across a transaction roll */ - struct xfs_buf *leaf_bp; + struct xfs_buf *xattri_leaf_bp; /* Used in xfs_attr_rmtval_set_blk to roll through allocating blocks */ - struct xfs_bmbt_irec map; - xfs_dablk_t lblkno; - int blkcnt; + struct xfs_bmbt_irec xattri_map; + xfs_dablk_t xattri_lblkno; + int xattri_blkcnt; /* Used in xfs_attr_node_removename to roll through removing blocks */ - struct xfs_da_state *da_state; + struct xfs_da_state *xattri_da_state; /* Used to keep track of current state of delayed operation */ - unsigned int flags; - enum xfs_delattr_state dela_state; -}; - -/* - * List of attrs to commit later. - */ -struct xfs_attr_item { - struct xfs_delattr_context xattri_dac; + unsigned int xattri_flags; + enum xfs_delattr_state xattri_dela_state; /* * Indicates if the attr operation is a set or a remove @@ -499,7 +492,10 @@ struct xfs_attr_item { */ unsigned int xattri_op_flags; - /* used to log this item to an intent */ + /* + * used to log this item to an intent containing a list of attrs to + * commit later + */ struct list_head xattri_list; }; @@ -519,11 +515,9 @@ bool xfs_attr_is_leaf(struct xfs_inode *ip); int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_set(struct xfs_da_args *args); -int xfs_attr_set_iter(struct xfs_delattr_context *dac); -int xfs_attr_remove_iter(struct xfs_delattr_context *dac); +int xfs_attr_set_iter(struct xfs_attr_item *attr); +int xfs_attr_remove_iter(struct xfs_attr_item *attr); bool xfs_attr_namecheck(const void *name, size_t length); -void xfs_delattr_context_init(struct xfs_delattr_context *dac, - struct xfs_da_args *args); int xfs_attr_calc_size(struct xfs_da_args *args, int *local); int xfs_attr_set_deferred(struct xfs_da_args *args); int xfs_attr_remove_deferred(struct xfs_da_args *args); diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index c806319134fb..4250159ecced 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -568,14 +568,14 @@ xfs_attr_rmtval_stale( */ int xfs_attr_rmtval_find_space( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_bmbt_irec *map = &dac->map; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_bmbt_irec *map = &attr->xattri_map; int error; - dac->lblkno = 0; - dac->blkcnt = 0; + attr->xattri_lblkno = 0; + attr->xattri_blkcnt = 0; args->rmtblkcnt = 0; args->rmtblkno = 0; memset(map, 0, sizeof(struct xfs_bmbt_irec)); @@ -584,8 +584,8 @@ xfs_attr_rmtval_find_space( if (error) return error; - dac->blkcnt = args->rmtblkcnt; - dac->lblkno = args->rmtblkno; + attr->xattri_blkcnt = args->rmtblkcnt; + attr->xattri_lblkno = args->rmtblkno; return 0; } @@ -598,17 +598,18 @@ xfs_attr_rmtval_find_space( */ int xfs_attr_rmtval_set_blk( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; - struct xfs_bmbt_irec *map = &dac->map; + struct xfs_bmbt_irec *map = &attr->xattri_map; int nmap; int error; nmap = 1; - error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)dac->lblkno, - dac->blkcnt, XFS_BMAPI_ATTRFORK, args->total, + error = xfs_bmapi_write(args->trans, dp, + (xfs_fileoff_t)attr->xattri_lblkno, + attr->xattri_blkcnt, XFS_BMAPI_ATTRFORK, args->total, map, &nmap); if (error) return error; @@ -618,8 +619,8 @@ xfs_attr_rmtval_set_blk( (map->br_startblock != HOLESTARTBLOCK)); /* roll attribute extent map forwards */ - dac->lblkno += map->br_blockcount; - dac->blkcnt -= map->br_blockcount; + attr->xattri_lblkno += map->br_blockcount; + attr->xattri_blkcnt -= map->br_blockcount; return 0; } @@ -673,9 +674,9 @@ xfs_attr_rmtval_invalidate( */ int xfs_attr_rmtval_remove( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; int error, done; /* @@ -695,7 +696,8 @@ xfs_attr_rmtval_remove( * the parent */ if (!done) { - trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); + trace_xfs_attr_rmtval_remove_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; } diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h index d72eff30ca18..62b398edec3f 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.h +++ b/fs/xfs/libxfs/xfs_attr_remote.h @@ -12,9 +12,9 @@ int xfs_attr_rmtval_get(struct xfs_da_args *args); int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map, xfs_buf_flags_t incore_flags); int xfs_attr_rmtval_invalidate(struct xfs_da_args *args); -int xfs_attr_rmtval_remove(struct xfs_delattr_context *dac); +int xfs_attr_rmtval_remove(struct xfs_attr_item *attr); int xfs_attr_rmt_find_hole(struct xfs_da_args *args); int xfs_attr_rmtval_set_value(struct xfs_da_args *args); -int xfs_attr_rmtval_set_blk(struct xfs_delattr_context *dac); -int xfs_attr_rmtval_find_space(struct xfs_delattr_context *dac); +int xfs_attr_rmtval_set_blk(struct xfs_attr_item *attr); +int xfs_attr_rmtval_find_space(struct xfs_attr_item *attr); #endif /* __XFS_ATTR_REMOTE_H__ */ diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 71567ec42dfc..878f50babb23 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -269,11 +269,11 @@ xfs_attrd_item_release( */ STATIC int xfs_xattri_finish_update( - struct xfs_delattr_context *dac, + struct xfs_attr_item *attr, struct xfs_attrd_log_item *attrdp, uint32_t op_flags) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; unsigned int op = op_flags & XFS_ATTR_OP_FLAGS_TYPE_MASK; int error; @@ -285,11 +285,11 @@ xfs_xattri_finish_update( switch (op) { case XFS_ATTR_OP_FLAGS_SET: - error = xfs_attr_set_iter(dac); + error = xfs_attr_set_iter(attr); break; case XFS_ATTR_OP_FLAGS_REMOVE: ASSERT(XFS_IFORK_Q(args->dp)); - error = xfs_attr_remove_iter(dac); + error = xfs_attr_remove_iter(attr); break; default: error = -EFSCORRUPTED; @@ -333,16 +333,16 @@ xfs_attr_log_item( * structure with fields from this xfs_attr_item */ attrp = &attrip->attri_format; - attrp->alfi_ino = attr->xattri_dac.da_args->dp->i_ino; + attrp->alfi_ino = attr->xattri_da_args->dp->i_ino; attrp->alfi_op_flags = attr->xattri_op_flags; - attrp->alfi_value_len = attr->xattri_dac.da_args->valuelen; - attrp->alfi_name_len = attr->xattri_dac.da_args->namelen; - attrp->alfi_attr_flags = attr->xattri_dac.da_args->attr_filter; - - attrip->attri_name = (void *)attr->xattri_dac.da_args->name; - attrip->attri_value = attr->xattri_dac.da_args->value; - attrip->attri_name_len = attr->xattri_dac.da_args->namelen; - attrip->attri_value_len = attr->xattri_dac.da_args->valuelen; + attrp->alfi_value_len = attr->xattri_da_args->valuelen; + attrp->alfi_name_len = attr->xattri_da_args->namelen; + attrp->alfi_attr_flags = attr->xattri_da_args->attr_filter; + + attrip->attri_name = (void *)attr->xattri_da_args->name; + attrip->attri_value = attr->xattri_da_args->value; + attrip->attri_name_len = attr->xattri_da_args->namelen; + attrip->attri_value_len = attr->xattri_da_args->valuelen; } /* Get an ATTRI. */ @@ -383,10 +383,8 @@ xfs_attr_finish_item( struct xfs_attr_item *attr; struct xfs_attrd_log_item *done_item = NULL; int error; - struct xfs_delattr_context *dac; attr = container_of(item, struct xfs_attr_item, xattri_list); - dac = &attr->xattri_dac; if (done) done_item = ATTRD_ITEM(done); @@ -394,9 +392,10 @@ xfs_attr_finish_item( * Always reset trans after EAGAIN cycle * since the transaction is new */ - dac->da_args->trans = tp; + attr->xattri_da_args->trans = tp; - error = xfs_xattri_finish_update(dac, done_item, attr->xattri_op_flags); + error = xfs_xattri_finish_update(attr, done_item, + attr->xattri_op_flags); if (error != -EAGAIN) kmem_free(attr); @@ -518,7 +517,7 @@ xfs_attri_item_recover( sizeof(struct xfs_da_args), KM_NOFS); args = (struct xfs_da_args *)(attr + 1); - attr->xattri_dac.da_args = args; + attr->xattri_da_args = args; attr->xattri_op_flags = attrp->alfi_op_flags; args->dp = ip; @@ -554,8 +553,7 @@ xfs_attri_item_recover( xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); - ret = xfs_xattri_finish_update(&attr->xattri_dac, done_item, - attrp->alfi_op_flags); + ret = xfs_xattri_finish_update(attr, done_item, attrp->alfi_op_flags); if (ret == -EAGAIN) { /* There's more work to do, so add it to this transaction */ xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_ATTR, &attr->xattri_list); @@ -570,8 +568,8 @@ xfs_attri_item_recover( error = xfs_defer_ops_capture_and_commit(tp, capture_list); out_unlock: - if (attr->xattri_dac.leaf_bp) - xfs_buf_relse(attr->xattri_dac.leaf_bp); + if (attr->xattri_leaf_bp) + xfs_buf_relse(attr->xattri_leaf_bp); xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_irele(ip); From patchwork Wed Feb 16 01:37:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747794 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 8C0DFC433EF for ; Wed, 16 Feb 2022 01:37:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245531AbiBPBhr (ORCPT ); Tue, 15 Feb 2022 20:37:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245525AbiBPBhq (ORCPT ); Tue, 15 Feb 2022 20:37:46 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE2F619C29 for ; Tue, 15 Feb 2022 17:37:35 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FN8ikr028773 for ; Wed, 16 Feb 2022 01:37:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=yluYH/y/nDVVHizcZZ9R5ja+IfwuIadclopKpGEkWOg=; b=cktDmsZbBFgoeF8qR15iL2/UNx7/fKDZ/Pdi9mzJuGm2zIrTPINfniMo0GYwIlTK2RAu 2touCKAsXwcZUJ7+4nvhfr2ZIorn2DZgmNtJbgz5Za/OQ3uK05CzawM9kcmwZGBcVtqo OR3XrysvptUhfgqA29TSON/ABYnqGhaeNkHT+eg5w7HLY/900xhnGkatyYnzuB6GBti3 g6Q8W9+P13E+mgS1wMSK6OuCOPK+x176wZ37gGu7siF/ZEiEB8f8gzW3e55RZa+8bYNB MErBUoajxaA6w4BuvcQafzIUd0HMypHnuLM0fUT/kCZ5yv44BIKlXhvdjrqcpA/durfk Rg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nkdg6kt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:34 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQ5W138923 for ; Wed, 16 Feb 2022 01:37:34 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by userp3030.oracle.com with ESMTP id 3e8nkxj2tr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NplVZuqduAlP3a+g2BgmIx9uoY2H28iMDQ0KRS4/R1D8M/uZoAkobKwxApKC3ba8PQUM1KinTsTfpuuo9jqB6y/JQCBkXEMCL2sUJ19F8JAuPTe7uiz2LZuzxccewduQMermoAqZuxYr0RGebpGNFR1mnvpfRaE8Knma8TJ9Am3nfhOuhEGpAYpVrKKcN/8ELq8TvwvFgzGFUtMe8LBCZmisPxTQcRcRGXW4bt2DEsah9VUetXTceX26cln9c7tde0WQ82/Qrp9hToC3BVz3DINXXVaP0Oonkve9PjumSIi5QMgTtGRUKkebPKV1cygzIV8w00b/+upL3nzoGY11Aw== 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=yluYH/y/nDVVHizcZZ9R5ja+IfwuIadclopKpGEkWOg=; b=VpN4i3lod5a/5iyAZDhLGonsG7WGchHe0uWUjw60zgYC4nRN/MtVsc7BD+sZUhxTJXHQYKXw1TgHd8GHWYUKJKoToBZqEut/W0UwhGbdVsMFQXii9Zyf+P6hEvh8yJAoAFEfMFGemjoV1SmoVoG5rdk9XD0nQdWg+rQwVHeXEWrfJxb14zXGMLculvP9QqTOHy7IW0iAWTSTovVatoQdcK7EcnBHyNj8pfS2ZJnrkg+kc41Wzns2O3TX4kN1y72IYDe2pv+u9xHfLshuIeb/FDxURUd9Usgad76XQypoBo3ttyP9RpNeG+rGM7W1CoSXJzepBLnUJ/vf3/uP/abz8A== 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=yluYH/y/nDVVHizcZZ9R5ja+IfwuIadclopKpGEkWOg=; b=FMMsPhJZrk+QRSHqytC5xLRIvnocNK+ZM4PbS5++yRGYajR7o7E3zDHfu05vgwc71uGiATamVUyAybOLhtIN+dSy/JMtRXkdiwrvKIvi37GTAt2J1M1L3CzItNap1C16FJMfaKhcwBnhnUNcB2XKGujVG5oSGAcFtx5KIKfm0Hw= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:31 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:31 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 12/15] xfs: Add helper function xfs_attr_leaf_addname Date: Tue, 15 Feb 2022 18:37:10 -0700 Message-Id: <20220216013713.1191082-13-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6644ee7d-54a6-4f24-f070-08d9f0ece1db X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: he4/DPGWrgkoEdJzGfT/I379dQkKb4/6gp9qpaw1ElhzGrVmZhhmyo+KGm73mqhdQpUThfmGTrar3VSJ15v1ek8eteikJr3fwAAcK8M6jg1YUe0SzxUZaUqKn0pNcunMwo/2Fw8iaaV1innaXEwkgiaopBHbM9LABp0WvzkOrhAVSZnfLZQdhnyCFCfyXTP8A7gmf5npAwvJ6ywbZypH35YUgj/dptjmZGkcz6GtSQcwKoqgwjCrrmLRtoDfGZ5ChkglDcntd7qLzadB0R6x3fBcIxw9jKoX+6nYO3RSnebZDwfP28fxwfUCuDhOVD4FnEsu+Er4xUki4j88Fr+kGUNK0+bLCJCwH3MVC8znvBKrpLIOCRlYg0F8KMTTDCmcYGAfFFaPKTBYf6eOwY9TCWS+/O4+prLMsEKtDp+/+k5o3gNbnFYHR1ICTJXgsv70lJYXMF1M1XDrH44a2RnJFBzOg8frq3j587ttthG3efQvSIV//M9z4jke1lRxrIdyjlcfJ1HFztdKmzvB/6plTexe7gMs1bvIJJLZd5gaQAQqIxD+vis7Zzzp08VrejzzDVAU+qy4+eEmtgMs+xpL8qVNdQoXfudwalidhOeyvnxrCjr0pevWjS42lnPNrlBgL9bfujBekvFbOshbb6sIwDNHQo9Ss23j1XeMOrM+m2I9PgMe36kbgq5Tb2j92W6KHTN/BD2LhiYOsxAJD558OQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LlygHyTyUVlwabgo/PAnYGOkIxiOGajQMT+oUUDhboXRuzC9QJySZpWWS94qV0TcEW3LjM/Rv8H/LilWz+VK05e/r19C7tYk1hQKXZDykIES5cMbmL2lVvoT1VObqKorIE4tMSCQTYdcsZkZ1cAGcBdzd/c+nRryNpxtFT5HM0aRztSt6pFoKzuIjrjgXrEz8sMfOp3yqmFy6Fuw2xAoCHRx8aQU2TalZhhWXXI4ZF367oVZMtChZsBvSvu1cLiAshOrPJYhMYZ3jbq4JZyjWryZZ0gvyL8B9tcEvGcPviA5bSJUqMD7pbcqnAGE1ucZdWpSELpAutPBIhHe3eM9a0hq3JlnJiNRLn7BvWCJCvMm/FFrybPJ3D4Bi46UADOTsTdx2mOITATrghhskKML/bPdOfqxInm3i3EjHiUvzpxhZYttADXztK+67JQbo/S3+jhe52O6SsvjxUhofoxnzMp0gjSRppjeR6GxtaBqoTZchOjlnuoUHdhhtUgyDRFuBjrjvliqkuiaDFTGrfHqoXEni1/nXrFkEJcL1ppwoZE7m1sS7sj4D5GD/5S16xROj/+BW59edL/0OLU8dnw08CzeGTDp6JU6x1tZgL0IbDqPjt6ZL3b5NeC7uPoIf5YU+G10T2RQLrbtSqxxzS0312thCzrDZmnrYYcLKxWq35gtvb3gzbYCdxgM+42tpMXsvTUqRfKX6TqNlY0LBXXRALaz+sMnOmHzlV8tujnVxBcX19F8jKAcrDgyxl9PRF2G5R3R8X0th6FTqw+6cqgogpnD+kW33ox9CQjxb4wQkSDsuo/Sjg5o2mUVHjXiGWwAnfubIGYa5H8CMe1KxAv7jpjIOw2zn7SwAp5R0/aaO7JZmbjyfWP6LU9Hz1w35t3obSMRb3Lg2n99uAsmAvya8ieAn0F+FS0Rch8TWQym3hgJYrs30mRQE4W3cSnT1dUciBH/Zug6AAmVTVRih1XHq/0FgwWpcqawR+442mZXaQjJb1XFQ1HSuFoR4lGBT29BA62Jer6YEPA7UnnSHDKAKb4XhqtA/gMXuGLgQvhqPmp4WkiDfCOMds8FZ9UOxSxmQNTnu+G3Gy9ikLJ7oJyHZSddt1y5HFMmgUqC3Xvryftus18f0sWP/k+e9EySiHSKkYZBQfpyZSjPxtCuoIViIxayllRtkA7H6R9rVRBKXZap23p9DPqfayUBhyK3OSUpBWoxDKMhgwycAF93q8y7P8nTK7wxbwS+dKZ5UHYLmjccARdyEm938zaJ6e4zk/hA5/BD8BG5zOyK+aXd104ZcgvtxDHf6RKw4tAc5/rGtGqV0NS2qt0ZRV2GGznXaqM8iOLH3CdB9YcF03ranYd7RGOBPd04JH8msQFMdyJCMNfZuhIpTp9nYNx+kGho9Q38D7fI9POdE7ytHp9khFcv6eMx95+19QQnqpzQOWK82leMjl9lhWbMfUwcFd+1lCrNDg9TZQ3nhNDVyytsTNhn4Ez99xfc+5KUFyM6vZ+qjkP/6LWAohf9Z/Q68ShOngmFcxxpEkDa0GQ0nL8okeNfRuV1qvddKTnaTMArXn6WTeES78lrG7SEi8ZLAUMfbyrnMbfQw6Gt9TgJZxk4BowPin9XpiaI36OPryPW9ZhgdAjRNVzhF2RV2znnbi98yNsH/+Y7CJUakK/LZqiWzlnivw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6644ee7d-54a6-4f24-f070-08d9f0ece1db X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:24.2496 (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: cKC4zjFFTs5ZURF8yZlTIQrIdckhh86xRewoC83+2cRu3nPGd0X3fLFbl6X/L3ORsVScUNTN4gGiMMgtB1tvLWWawGrmi06ZDwHo8hgNOng= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: un68w1TLD3aDgw0wAQGguyuu8LH5EVlN X-Proofpoint-GUID: un68w1TLD3aDgw0wAQGguyuu8LH5EVlN Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds a helper function xfs_attr_leaf_addname. While this does help to break down xfs_attr_set_iter, it does also hoist out some of the state management. This patch has been moved to the end of the clean up series for further discussion. Suggested-by: Darrick J. Wong Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 110 +++++++++++++++++++++------------------ fs/xfs/xfs_trace.h | 1 + 2 files changed, 61 insertions(+), 50 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 1b1aa3079469..7d6ad1d0e10b 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -287,6 +287,65 @@ xfs_attr_sf_addname( return -EAGAIN; } +STATIC int +xfs_attr_leaf_addname( + struct xfs_attr_item *attr) +{ + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_inode *dp = args->dp; + int error; + + if (xfs_attr_is_leaf(dp)) { + error = xfs_attr_leaf_try_add(args, attr->xattri_leaf_bp); + if (error == -ENOSPC) { + error = xfs_attr3_leaf_to_node(args); + if (error) + return error; + + /* + * Finish any deferred work items and roll the + * transaction once more. The goal here is to call + * node_addname with the inode and transaction in the + * same state (inode locked and joined, transaction + * clean) no matter how we got to this step. + * + * At this point, we are still in XFS_DAS_UNINIT, but + * when we come back, we'll be a node, so we'll fall + * down into the node handling code below + */ + trace_xfs_attr_set_iter_return( + attr->xattri_dela_state, args->dp); + return -EAGAIN; + } + + if (error) + return error; + + attr->xattri_dela_state = XFS_DAS_FOUND_LBLK; + } else { + error = xfs_attr_node_addname_find_attr(attr); + if (error) + return error; + + error = xfs_attr_node_addname(attr); + if (error) + return error; + + /* + * If addname was successful, and we dont need to alloc or + * remove anymore blks, we're done. + */ + if (!args->rmtblkno && + !(args->op_flags & XFS_DA_OP_RENAME)) + return 0; + + attr->xattri_dela_state = XFS_DAS_FOUND_NBLK; + } + + trace_xfs_attr_leaf_addname_return(attr->xattri_dela_state, args->dp); + return -EAGAIN; +} + /* * Set the attribute specified in @args. * This routine is meant to function as a delayed operation, and may return @@ -322,57 +381,8 @@ xfs_attr_set_iter( attr->xattri_leaf_bp = NULL; } - if (xfs_attr_is_leaf(dp)) { - error = xfs_attr_leaf_try_add(args, - attr->xattri_leaf_bp); - if (error == -ENOSPC) { - error = xfs_attr3_leaf_to_node(args); - if (error) - return error; - - /* - * Finish any deferred work items and roll the - * transaction once more. The goal here is to - * call node_addname with the inode and - * transaction in the same state (inode locked - * and joined, transaction clean) no matter how - * we got to this step. - * - * At this point, we are still in - * XFS_DAS_UNINIT, but when we come back, we'll - * be a node, so we'll fall down into the node - * handling code below - */ - trace_xfs_attr_set_iter_return( - attr->xattri_dela_state, args->dp); - return -EAGAIN; - } else if (error) { - return error; - } - - attr->xattri_dela_state = XFS_DAS_FOUND_LBLK; - } else { - error = xfs_attr_node_addname_find_attr(attr); - if (error) - return error; + return xfs_attr_leaf_addname(attr); - error = xfs_attr_node_addname(attr); - if (error) - return error; - - /* - * If addname was successful, and we dont need to alloc - * or remove anymore blks, we're done. - */ - if (!args->rmtblkno && - !(args->op_flags & XFS_DA_OP_RENAME)) - return 0; - - attr->xattri_dela_state = XFS_DAS_FOUND_NBLK; - } - trace_xfs_attr_set_iter_return(attr->xattri_dela_state, - args->dp); - return -EAGAIN; case XFS_DAS_FOUND_LBLK: /* * If there was an out-of-line value, allocate the blocks we diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 4a8076ef8cb4..aa80f02b4459 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -4132,6 +4132,7 @@ DEFINE_EVENT(xfs_das_state_class, name, \ TP_ARGS(das, ip)) DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return); DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return); +DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return); DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return); DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return); DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return); From patchwork Wed Feb 16 01:37:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747795 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 E5D0AC433F5 for ; Wed, 16 Feb 2022 01:37:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245525AbiBPBhs (ORCPT ); Tue, 15 Feb 2022 20:37:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245528AbiBPBhr (ORCPT ); Tue, 15 Feb 2022 20:37:47 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC8C19C2B for ; Tue, 15 Feb 2022 17:37:36 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMrdxP024697 for ; Wed, 16 Feb 2022 01:37:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=Tf0NjEddFWUOcwlNC6i041NAtCePLr1M7UTEClECjpc=; b=YTeS/sOR/QkxNeszRF9UX0l795iKwLolJvhj44qbx9sYtziDaXJLvLBckbOUCi8URhHn mMX/9lrS3D/M9FYWsxfnnMcGcw8XdyJaLqF6WukouPmUuIit6Y3cCL+PRPbhkzo1Ji/D VXT3D50vX6vh9qrgsWCr4JPrexr9WMr9dMbjL30mm5Z9qOG3WoBDJbgEOq3kP2UiBe1Z 6uMWC7r7/IAqn0LAbfvyTFzJDVylW6xMS8p1HUDD5eCfH0KhtqO+Zqbnj96M9V8LdXr3 zcFc5Jl6+62QyrqO0O1Knz0GlxUh4JXuudESsC+OHW/Mz5m0NBIPji57eyi5T6kh2YO8 2w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8ncar77j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:35 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQ5X138923 for ; Wed, 16 Feb 2022 01:37:34 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by userp3030.oracle.com with ESMTP id 3e8nkxj2tr-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SChpCh9xBfRkOyr7WSoJVMywaIzRLdjNKsmCLv5q2CHfIcskMJr+JxZ1YJcIDAaykSAU48UsrU30/peI8DKhGKJ3QAY9nY4GAWC1yueA5P9dIn3zvgbqzFfJ+cxsh2Xh06xHGAREX3vZZsMuO3rnQ8d7/L1x6FkzissE3RpmkxGoL84LC6sLNrS0YB3sQYflaQc+3BXy1ew0Wg+EGCFr5jH+he3f4FxeCqy/0XPyieLSZbM3Z2dqq+Oc2F26BHRbpysU8FysZSGLZC7obfZ6fNlWu9r1XTpkLCD/h7ea/03WVsn+C6o/GHbxVwlBhb7p/zSxBcVb6IJFLf6o4F0R8Q== 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=Tf0NjEddFWUOcwlNC6i041NAtCePLr1M7UTEClECjpc=; b=dFtTTEB00jPaRpK0U/M4XfN/DzlhL5EorE2FDV8RW+l2AVYLubq9Pg7cNKnWV3wSPIMICdFdLV/2NhZ0q3QuFJDeqVkxPHnrdX/iTrF2TyR/HUxKy4LUVL7+xHTcCtIx21W3cDlvqBtWqxGf+ije80bCsT2UYg87ZPi7dyMAFTkeJ5YnzZq7TPhc3jRMJ3/IpeGCMFaEyQpJ4QVlr1rHd09WQNwV79rxXhILF/EDV+7ib5dq7XeV6JeuMEFZvDWYe3n5EEHaU2eJ/IeGfJsXxPjjjXOu9hvImCppE0ewEJq0uisLHrf4nd0zLV4KGiI5LELX9hYlF/mlzgSvvgYRzQ== 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=Tf0NjEddFWUOcwlNC6i041NAtCePLr1M7UTEClECjpc=; b=n6rNMBuFUSB2h7AyLEspWILd9EwLaaqF0PKSI0dk2U+fQV8v0Zvohxz3NB/kBQoz/pvWqMOKIhzmJvd9OnDSD/GSJlf1juMdJGdLTiJl8svhhNdBCejK3A17eHWJQI/dgTA1CB0DpW+8lM2wqNMSHHS/XwLFfjRLozMTLRjxMjg= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:32 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:32 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 13/15] xfs: Add helper function xfs_init_attr_trans Date: Tue, 15 Feb 2022 18:37:11 -0700 Message-Id: <20220216013713.1191082-14-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0769c9b6-a0ec-4a5a-6a60-08d9f0ece213 X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rBFrCVCS7tgtpcEd2dOScMXHOnnSOGMdVSYKDquc32OFFeMMqeUdBB2OjX2qCJeoYNGc4CzRHbTmnScm6+bwxP3uGQDnDsI3pEXy/Gh5dYk8wlrzIEg8Sq4zrhrMQ9QAzJqWZ29eU/DplKq4HYIgEINXdEt/zb5HMJ2IIRQi4PNmXeWH6GRS+aWqF1P/JlPa5ojh5eZrSRCjNr8ts9LgMQM7C12Z4297MemjJ59Ms0dvX3XcRsbrbBniWI6CpaqqIoKgjbS4vK2Xgi831ZiTxd9q3/Ofl3hmUMzFGgz7RQNG6xEUoV6to96ORAGBmRBwu+i+ebgnuwSzYbpFitvmeb1lJm6ZfKTrKAq+zV5JymFjF2+bO+BnmyRyQE2bEfGSA2VHUFYqbX9PycKOtgPOvUsD1YPm0oavY5rBMvC8Z2JCp2/p6vZn+tu63vzDD/56Sx+yHZBQE55SzeOE/HTDpvP3Fw8nqc4QjpJ/ENMC2QC5oM4GyEpww5EqqFPLRPBxZj5Fv19cBLAFjmnxH2NDDPwUH89wbYmUao0Xfro9x2Jf/TKErfwvA8GMyjMdq8ut4q5ClbzjYpp5qlzsX2fXi9B3pubsqBNMml9EPQ6EkvA9BaB1l5R1H0Brqg/7XebX/XJOStHs2MS7E5nHrq/x6OGwqlFPZVcsHUHlUdmbqnlQXI/HAP2JLwa1TGUWlbn7nvgciHeeFlWnhPLcs6vgAQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dOfDXCVYTN4Q8qRqWNnVaoe6UB7L0Cu+zxSFvZMQ1b5zal+BUHvjBTa/0nOuTYRXbfLtffZV4GQZVeVjWAR4bpRz/+liIeZvqCa0dUqf6ui21LpnRoVGwQpyb+3wK9UWB6aYoagknwhMUnMBthTxth4vOS6q6lBrTkLWwisExpq1/8Vz1PqCE9Mc9HYRX2gJJ34k+aUru/d7EI/DDnLMP4Lg0pxcD+Gom542AQOuNxhGS2qu1DIZtThR4PwCZabta1bUnK6JF2l7STCBhT3Y3tuFqa9mNZp2kcoQqeG+70IM9dlSFecOouzSrVIZuL30tD4+XkP86pB3byET9Tvq0uWQrjvnjKR8ReCqofrfT1XwDEic65U/xKcP0z1jymqJfX1zwjeffoVvUG5oCKd8HiBwqmWprT+qHLyypEnQ6u80VoUyiHFln+I5Q8PtrSb8R4KY+AlNR88ge/rhih5Mu0kVboVDO6yI6nLoHXWqCmo02lJsgdvxuRLRydbNDcsVVA+SPG1KA4btbMkvcWYSDPTyIHbe5f9OrSdvGR3JltG5JuC6RDFKS4NRQSx9HSOZq7KVKlr6qM9H1yQWN1Fcql6ehJzPOVq8GyIL+Hx04pX2/lW7ZH5IKvlXD/qNhWAJ+0/pzpiZrN61C6lc/t/JuD7jrUWIZ/xYwLPAdNZSKnEI4phBzo3G7vYXIA/wJ6waGRYLhgNJDz0ZQoWezYcGGZAsmNPCJ9r2Z8ZeBPI0xy/hbDOz89Utafpg//nw8NB6I8EUmg+PCNyPvoHQiLQioOFBEq3ViTq4CvV9okQBIbpZ5/o5qWXlN3XID8/IjsKvkANiBagmbtWHiTAKhA2o/OWFXcD0zuM74dtA+hDPxnSSvZ4q+43+Bi535vPEZplCfURVJxEeRFoHwPO4ZWfRJHRhCelrWcM/sA5zjukiPFUMkGQ6fi8t3I9XX816evK6QLM7OhXqOMojyAJA2oWFm7pLGUk3Yf6NJbO7cGiM7hPFcs2GLJz6zA/WPAIOiChpR6720hjbab4D5KyKOj9ou2QTVjlHmUkm2sHHrbgJtjOW70CwFcHj6Fv+qrY1yo2yUEwHxxc5vkIdwyGbmjNH3EjwU464PePvalHHMm0ezAOxwSQ/ahitgATXqFR0ULwnRGti+DzMh+xKBE6V14PzgA6Pgi073693Yjq3qolBBv5ihqTu4HWKFBs++Nwfp9d5j5InZyhxNAyUyjp308UJn4bJeIy2pAJQ5tJriaIOsZ478Dpka8+biSzRwxv8Rn7qB2h827FWukPpq2oOlAjg6g9yfu66CRm/P2B2ge5mAIn4CiA+QTBOm5xM1/M914pF3xQjwnO2YtvIURjujsOJYoT6iEksMVOo8jryKSuJbctO2MTFSFZJzxVIy/ALmr2QLlmWlW5iDZthmuDZv/uiGlExiAO5o+o3O/VuXdfzPqlzS7bV6yiBYu5QYOAjF0MlPUFV97qGSxrIa/68zXa33tzxN7SQgqVoeC8pYmCu7FKM2JWldhbtlQwOL3NqxRF0jnerzEnOLnueRZA+GK6+b5/RbJCsFq7sCyt9dQQKpVkaM4LonGAi80lPipe+v5O3L28URpQrZG81SghfSjm7O8IIdKy4x1YvkoRPpv1rIyCyf42zDSn708x8xkICtLjmLmlk+Ptblile1zU6egXKcQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0769c9b6-a0ec-4a5a-6a60-08d9f0ece213 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:25.0506 (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: M1kQOyjoOBjUkjJyEtG8M0OfpCCqvkaOZCeNO1lOIK1cZg3lmCJuMpJH9RLgEv5ypaSLXMz+uiVFQxBoWAF413AYEfoM5mV2ASwuu2R5qXU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: 2JILwwm2BiJUszH1_3ASqqFvGlJyu_X3 X-Proofpoint-GUID: 2JILwwm2BiJUszH1_3ASqqFvGlJyu_X3 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Quick helper function to collapse duplicate code to initialize transactions for attributes Signed-off-by: Allison Henderson Suggested-by: Darrick J. Wong Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 32 ++++++++++++++++++++++---------- fs/xfs/libxfs/xfs_attr.h | 2 ++ fs/xfs/xfs_attr_item.c | 12 ++---------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 7d6ad1d0e10b..d51aea332ca1 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -202,6 +202,27 @@ xfs_attr_calc_size( return nblks; } +/* Initialize transaction reservation for attr operations */ +void xfs_init_attr_trans( + struct xfs_da_args *args, + struct xfs_trans_res *tres, + unsigned int *total) +{ + struct xfs_mount *mp = args->dp->i_mount; + + if (args->value) { + tres->tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + + M_RES(mp)->tr_attrsetrt.tr_logres * + args->total; + tres->tr_logcount = XFS_ATTRSET_LOG_COUNT; + tres->tr_logflags = XFS_TRANS_PERM_LOG_RES; + *total = args->total; + } else { + *tres = M_RES(mp)->tr_attrrm; + *total = XFS_ATTRRM_SPACE_RES(mp); + } +} + STATIC int xfs_attr_try_sf_addname( struct xfs_inode *dp, @@ -701,20 +722,10 @@ xfs_attr_set( return error; } - tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + - M_RES(mp)->tr_attrsetrt.tr_logres * - args->total; - tres.tr_logcount = XFS_ATTRSET_LOG_COUNT; - tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; - total = args->total; - if (!local) rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen); } else { XFS_STATS_INC(mp, xs_attr_remove); - - tres = M_RES(mp)->tr_attrrm; - total = XFS_ATTRRM_SPACE_RES(mp); rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX); } @@ -728,6 +739,7 @@ xfs_attr_set( * Root fork attributes can use reserved data blocks for this * operation if necessary */ + xfs_init_attr_trans(args, &tres, &total); error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans); if (error) goto drop_incompat; diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 1ef58d34eb59..f6c13d2bfbcd 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -519,6 +519,8 @@ int xfs_attr_set_iter(struct xfs_attr_item *attr); int xfs_attr_remove_iter(struct xfs_attr_item *attr); bool xfs_attr_namecheck(const void *name, size_t length); int xfs_attr_calc_size(struct xfs_da_args *args, int *local); +void xfs_init_attr_trans(struct xfs_da_args *args, struct xfs_trans_res *tres, + unsigned int *total); int xfs_attr_set_deferred(struct xfs_da_args *args); int xfs_attr_remove_deferred(struct xfs_da_args *args); diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 878f50babb23..5aa7a764d95e 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -532,17 +532,9 @@ xfs_attri_item_recover( args->value = attrip->attri_value; args->valuelen = attrp->alfi_value_len; args->total = xfs_attr_calc_size(args, &local); - - tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + - M_RES(mp)->tr_attrsetrt.tr_logres * - args->total; - tres.tr_logcount = XFS_ATTRSET_LOG_COUNT; - tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; - total = args->total; - } else { - tres = M_RES(mp)->tr_attrrm; - total = XFS_ATTRRM_SPACE_RES(mp); } + + xfs_init_attr_trans(args, &tres, &total); error = xfs_trans_alloc(mp, &tres, total, 0, XFS_TRANS_RESERVE, &tp); if (error) goto out; From patchwork Wed Feb 16 01:37:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747798 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 CA662C433EF for ; Wed, 16 Feb 2022 01:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245534AbiBPBhu (ORCPT ); Tue, 15 Feb 2022 20:37:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245533AbiBPBhr (ORCPT ); Tue, 15 Feb 2022 20:37:47 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B241319C30 for ; Tue, 15 Feb 2022 17:37:36 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FN8hX7028765 for ; Wed, 16 Feb 2022 01:37:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=QKRhngz1ig7RfzMJFbuci0mmSGtDzcNvz+nr47s/MiM=; b=iG1Uc5CWnkP+ZCrnEixaaDvXiXgVoDa0RZeghV6n4ED9s3SvfJBp5pV/paHdsys82QKU GnZZvIq9RDDxt0pORaXbzvXAg9ZVrjNYsDJy00oJr1cyO1io7mY+xnnwC9Za0widrWod EAr45vZ7ILTaPzAPW3Yvi+OuLabG4uNR4E31xJomMWLElvwrWkVa737Gi+RxqM3hqk90 5iQaM866ccSf/15mLLp+LV3b9qr5kkrMvV+vsFbqFCwVCzvxANsT6wGTAWctwjWvCzZz HJVJT8QDgW3ysrp81ou9uZOY+oU/08RsfSXSAkjkSus2OY2UH7ZN2zmxa36JkXsuRmMm ww== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8nkdg6kv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:35 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQ5Y138923 for ; Wed, 16 Feb 2022 01:37:34 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by userp3030.oracle.com with ESMTP id 3e8nkxj2tr-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZOztVGeR3me5K5pz+VEluyHpaKInpL935W08XpSSfi9wYekzMsbkcVYbdfcyhw0LyinWHBaNt/8j9v9K3aim0g8iiuCC4c5RgJuX7FVNbO4ksmQBW8amTBHemPlQZTi15YZ0bPzaiTiDjxBK4ccSYQAcFcZeNJXuRZrKYSffNKFEF1E3J5eSpbjx3oTBwRG+lSWZu7Izjs871QQQ1tRU+WCBDZaKdDgzBn8+SNhqYK/hf1kTxBghwH+bwF9LATZBka4d3Xch9YL7TCJgd3MYtd2n5N9NcgrgLc84fqfr3P5wE7TTaVgRiUJwsM9kp/alpyTN4klHF1ymZI8dAvAmjw== 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=QKRhngz1ig7RfzMJFbuci0mmSGtDzcNvz+nr47s/MiM=; b=AS1oqjosrk+en6Xr8X8P8iHgcR2eJPMJaCAFtxXbZFmkeauTunOmkN9aQc5hwv/owfGqJq9smNkeotlUWM4EnZ3/+G08tT0BW1OmCBeofcQHj0f8J5CCgenRr4obX427f9p2d5TigTgq8Thzg59IhH6CtAUrzH4hufGc8jC3Nd9gVJTrVb4uuxV8V344kuYweOJYosJZ9fFcDYCr4pt7ureIrfhY1Qlh0sZm+AZ6oQjqUEkp6JHZg8X4fHDVilkuKo/BW3mPGwbkAYFDwKoEWP/SuCjvsouPgt8uxASCwO3zCbugDzMCL34TGDqfVInWDaneBWLLKByeaVaOrTE2/A== 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=QKRhngz1ig7RfzMJFbuci0mmSGtDzcNvz+nr47s/MiM=; b=r7dAFkslkfHqICig+oVJCQARbBTG7+S6XOFoNGLeSNndGMIfaGuoc4Vtp3meK8ZRunznjeh+ussdx+w+RDnFj1tYMBS1EGBGWWNbyRMJ6tKNjkiPw59vTLJfY0T+VTAaYpxx60EeuBKpFC935rHM3H8791safF1GTE69H10aWnA= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:32 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:32 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 14/15] xfs: add leaf split error tag Date: Tue, 15 Feb 2022 18:37:12 -0700 Message-Id: <20220216013713.1191082-15-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60becd33-50dc-48e9-10f6-08d9f0ece281 X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o3kbmtla6rzH3T7HKf83yanr44hJxdKli3dkS0+xGH1n4YSViTSIn78tpbeljnj8341U6xA1sYi3hwVhlYJYZieuyNi7v77qTTJCWuJJEylUjwn28zn8jruYfKA0DdtEPmQCh2GnQQG4EYiLgYMqr2F3MVrq3oKBahzT0UZiS5MOptXbJhMb/qm1DYQkh/yvTIxK6GQL6Ax2chqnd3vbxmeo5PCEN9jWVZAB00QkCrXySOuxMBJqEK3V6mHCxV2sHS1yuXjgZlqpXbh98USCjczL7krFtqh9JJe+NbdnnCsw2Q/fJu5FLKRCbJdusF7ZhqGI88TlCqDHLR3EJ9sylCJ0QE5F+bvpLh/hmSgHAdvtFQ/RrH9nTZSemC67bYqOYLmIWnGln0x2tcBr8EEcm+My1S77Pn99F8bj8s7lywQxQXpwjtgg9jR2N0MHM6TJbKYER5rROhytfIgG//QXcCqzIj8CoDwxkvk7hvVyPCGhhhmuTI8BfKS60Tg8uXZVgfvmleGgNj+goVcS3fDLfw470WmhD0QFRYdKhUcxPQKvKMgjeR/fBMo9xBYRrpyUPSHmFWlQ0PuPFm6IDu9MJ32iif1CbS7DLhCTHCggMbcTM429NlKa8w+BwP6E4YyT9C4V7vaZvioo0JZc6vrBJUonItObmvxFdZinH40O6bsSFzZMDjz2bPPeAQjuA91cnigWJZUyzhgi0MMsXo6gOw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IMnuoA0QTWHACM6O2HoyGwSxNNH8ap2xAa7AGkN9WZg2e5mDdCKXZb9OgCY6yVtpVwcYKOligUlqB2aXaEgBNVP7QHgxsrra6fKFWa7L76wZxqrcd7jmD97W+9SA+tfiUh1wLSZaJFGa0KkhIUl6xqcLEpw4SGQdU5EM+qWWzUkpFeilHTyz1lNRwWnRsH1FAtVRNRjUFQYLGR49PT3oUtv8Uf/NELWBmkiEU4Pqoob7GJWn9UsB/aX6g1XHitVGAqvzRPgsJSQceRaeUw7wO2WLcer14EVGaq9e/WuYY2SU9RUO64G6Cz0ZQeHzWoH1ZSKxeOdNAaHfCLElnXAtMzj6CGs0jR2AvOAaY4dJmsHMe2QPOIm4Byfko8ExVNlgb38KJPza1FEOxkQhFg/saSYjtGb09gH506bsqkJRtknSg3ht8o8+JuThx3dqA7KNoraq2VI4ytuZWswruV+xLQuCcBEbIg9gLM3A4NV+ynSJp7lYEWycndnWOW5F/8i4yArhFQEsf9DjDbRyAgxbVbt1p+OccwUK4mOoWj9KfSXjXAUm6vDveoP6iCpeYyC91+73DFi2vThnIgLJZtumYkVwQNcX82xoq+x7zP9VLFlCqYlN7kPJcARveUam0qOVIX9Rq65VyPuGUFt7ISuJvkHWC4Yeyg2FUxs7xp9zOQ/rUV+ca038Nc1BWoRo23zLMrDe/MTbWEW9QaPrz5EvXEystm/wPRc8o5FghmY96lQ5btmoVpIpmmxj3DhqcwIOqCeiQtSeuH/kybHPOOIsOaw5F1TmHp3wWqKyowEJb5oRoJE/RlBYGlxb1S49TsuecB083M3wg6N6jWtvT3eQJmYqRrjRr8brGwD4SwX6ZpwxaWRwATVnuT3+ypeYFYwQozHsDoP3Ddm3lddtpNPNAwalf0a8JJbzxBrgrrHEbLklt2A1bmq5D3D0eeeOWAEUucOIdGqRhgf6IieSA2yY9AoN8/kLD+LzGPHM5IRGYFJAam8d5y4DvTFohrClDYESat97SAWZCUWdit9ICo0jH4g9Ns64XM1sk6JZ6gdh0Gyem1RGKJWAcIZRDk5jiPVQf8s5/p3cXOY/wwFmes6KCJ5fA2x585unEt6XxjmG1Cav8XMoMTWPJb2frQ8m6yokcm3VolA5ZRAg6BQihy7XQVKVhJh6LSAHXbQ+vT6ABHL4eEslXehS0lCexbqEYbY1CB1SeHgVNYPpO72yMk2ardneexJvrV0unmYwd7Dn+EU6XvjYMaClhLZDs8iog6Q7GL0wkZgssdpKStw0UO+qdxHZpteEzwQoE9eKMNgOUWbx4cK/ezFddfeqNq1rH+tG6KoIjXUbDhITexmjRwyzDr1s++UqchWbhYrWwTLuR5UuAgreGeixLQKIm5gP3BbhgX1TBaKtH2gr8QddaxtF4nLu7lOJmH+88Off5un+NSBuoJy425oRdujOhnFV9p766T9PJoqSoeHaLahYQz8PAF6pDcSmuoGVXz6vkhYZWk+4hzNTVI6Nj0oUZ6QTuQtIS0Ufx0dDvjKJQ3xOk/kHjxOjO8qVV4IurWxln25lNRWrWg/v5eWNhHp99hBXoJkmpq8TldTqRq3QYxYVYKpegK3xIyAZKSLY2eNIiwYGZue81xou0HyD5riysasNeQq0cK4NyvJKgokb4Rv+QIqJfQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60becd33-50dc-48e9-10f6-08d9f0ece281 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:25.3943 (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: /fnGwevfXQz573pt+tzWX0FZ7MrIxgVynCjpZxZZADd4lqj4pqFo4R/MTdwhmk86jhX+XKyYhXR3IOOK+/t/VWPVQZOpanS1lbfbGe0SK3Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: NxpxHocL_5si0xuIhfyoifPlHo_wYVeA X-Proofpoint-GUID: NxpxHocL_5si0xuIhfyoifPlHo_wYVeA Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Add an error tag on xfs_da3_split to test log attribute recovery and replay. Signed-off-by: Catherine Hoang Reviewed-by: Allison Henderson Reviewed-by: Darrick J. Wong Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_da_btree.c | 4 ++++ fs/xfs/libxfs/xfs_errortag.h | 4 +++- fs/xfs/xfs_error.c | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c index 9dc1ecb9713d..aa74f3fdb571 100644 --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -22,6 +22,7 @@ #include "xfs_trace.h" #include "xfs_buf_item.h" #include "xfs_log.h" +#include "xfs_errortag.h" /* * xfs_da_btree.c @@ -482,6 +483,9 @@ xfs_da3_split( trace_xfs_da_split(state->args); + if (XFS_TEST_ERROR(false, state->mp, XFS_ERRTAG_DA_LEAF_SPLIT)) + return -EIO; + /* * Walk back up the tree splitting/inserting/adjusting as necessary. * If we need to insert and there isn't room, split the node, then diff --git a/fs/xfs/libxfs/xfs_errortag.h b/fs/xfs/libxfs/xfs_errortag.h index c15d2340220c..6d06a502bbdf 100644 --- a/fs/xfs/libxfs/xfs_errortag.h +++ b/fs/xfs/libxfs/xfs_errortag.h @@ -60,7 +60,8 @@ #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT 37 #define XFS_ERRTAG_AG_RESV_FAIL 38 #define XFS_ERRTAG_LARP 39 -#define XFS_ERRTAG_MAX 40 +#define XFS_ERRTAG_DA_LEAF_SPLIT 40 +#define XFS_ERRTAG_MAX 41 /* * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. @@ -105,5 +106,6 @@ #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT 1 #define XFS_RANDOM_AG_RESV_FAIL 1 #define XFS_RANDOM_LARP 1 +#define XFS_RANDOM_DA_LEAF_SPLIT 1 #endif /* __XFS_ERRORTAG_H_ */ diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 666f4837b1e1..2aa5d4d2b30a 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -58,6 +58,7 @@ static unsigned int xfs_errortag_random_default[] = { XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT, XFS_RANDOM_AG_RESV_FAIL, XFS_RANDOM_LARP, + XFS_RANDOM_DA_LEAF_SPLIT, }; struct xfs_errortag_attr { @@ -172,6 +173,7 @@ XFS_ERRORTAG_ATTR_RW(reduce_max_iextents, XFS_ERRTAG_REDUCE_MAX_IEXTENTS); XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent, XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT); XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL); XFS_ERRORTAG_ATTR_RW(larp, XFS_ERRTAG_LARP); +XFS_ERRORTAG_ATTR_RW(da_leaf_split, XFS_ERRTAG_DA_LEAF_SPLIT); static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(noerror), @@ -214,6 +216,7 @@ static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(bmap_alloc_minlen_extent), XFS_ERRORTAG_ATTR_LIST(ag_resv_fail), XFS_ERRORTAG_ATTR_LIST(larp), + XFS_ERRORTAG_ATTR_LIST(da_leaf_split), NULL, }; ATTRIBUTE_GROUPS(xfs_errortag); From patchwork Wed Feb 16 01:37:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12747796 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 338E9C4332F for ; Wed, 16 Feb 2022 01:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245529AbiBPBht (ORCPT ); Tue, 15 Feb 2022 20:37:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245534AbiBPBhr (ORCPT ); Tue, 15 Feb 2022 20:37:47 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2687219C29 for ; Tue, 15 Feb 2022 17:37:37 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMYae3008658 for ; Wed, 16 Feb 2022 01:37:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=sQZ5OGSkt4+b23rHasRTGScBZQs+sjsUTUO4NULhIXk=; b=s48cL+gPElkBjT3eWwqiIyNbnk7oI14IQZRwnmS+wWcEv9KByASUU1IGrT4vzyNJOzaS gsf2zisrRHKbNGjW2MesGgRNZeqmkZ3a70jhju+B9PqKKTS4uZTkL9xuIvMOzIZQWp63 KmlcdBECJz4dijIuyby0cUllkibyWnh5ghHC/6jdg/uOd+KAAjgghgbzT7DufPRPK+t0 6pvEQDYrzlc0oIf22a/1JuVHwFZyVtpPtDluZ4Yeged+dM0GoHOORFdJ8DOiip1eDwzU AuCZizEFBxWEKIdAvSaySqh+q3mAXjkS4T6EdMdilovOuEDyYFyBzP4ICcE34tdi62VZ XQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8n3dr8cw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:36 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21G1VQ5Z138923 for ; Wed, 16 Feb 2022 01:37:35 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by userp3030.oracle.com with ESMTP id 3e8nkxj2tr-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 16 Feb 2022 01:37:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UZhwvInonod/zVuEraR6wQ80JiCH2GjElJMMuL3rmkOFi8IhhmrjReIjwSfs6efTca6V+LzLHiAVw9bExobxm+len+6obJoqW+gXmmY6K/2J6DrWjwvMkkkkVWfkQoRORen7F5zGeRGQw6GAlnrGUga2ZvJa3lSfsTdwLLRdc39DFZ+OwdBzejTHkWBnd5s7ZgshMK0vMz5r2I5GRkFEODRdDN45ly0WW4i6j/J4SRzbhYnMwZzQ1kbKesLse6ECom/ANMzZkv0C3XaAzt9GYsAdYYBr2HKcvbTH6bbpJB3kYGO3Nku4pbtOIy2GIeBIaeI5uRQJ86hmHgIBfngOhw== 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=sQZ5OGSkt4+b23rHasRTGScBZQs+sjsUTUO4NULhIXk=; b=mXWpYcw4Of1QvLVQdRNwWzc16Vpx6PMpm393DyTLwW0zE5L9TnrnfP6m2BdxkYtn+oyjrjMlyGPEe9DHCuTP5IF5CWMIVkrDfgXwEr66rsVzzWR5w7aIXT5nmssXv2IdMe5jcHpY5HYlSDDzsKehW6hQR1dk/DuXZaVGrxD7ypow2970mNHTY2Sb0TYmiNvFqRj9/TtJBe84cFuSJeeggTxh/zfzgUSEgDi6uMj3gYgkXuPNQvUALeswuFZK4TqpgwEly7UzmUPPMR6DrUZpiV4/yht0HHF7fCCymoulK3gG4hNoeMBR91bg9GJwmBayEddoa06o9leWnOdIokMorg== 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=sQZ5OGSkt4+b23rHasRTGScBZQs+sjsUTUO4NULhIXk=; b=KDf2yZzmFFvFDRd3+WSiw1yjyrfGPY+PvGD/UupCqRiaC1HG86ZT7k6W+Gd+dq5vWjP01dDS6vzuIex/lCvE15n5tIadUvV0E5esKvsWJnXt6y8A2zwuPhqeJVlQ2t5utG3Yr5DukvFi8PB3ev/L+xX30l7qhL7iixJqJTqmvQw= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BL0PR10MB2802.namprd10.prod.outlook.com (2603:10b6:208:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Wed, 16 Feb 2022 01:37:33 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::a91b:c130:5e3f:119%6]) with mapi id 15.20.4995.015; Wed, 16 Feb 2022 01:37:33 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v27 15/15] xfs: add leaf to node error tag Date: Tue, 15 Feb 2022 18:37:13 -0700 Message-Id: <20220216013713.1191082-16-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216013713.1191082-1-allison.henderson@oracle.com> References: <20220216013713.1191082-1-allison.henderson@oracle.com> X-ClientProxiedBy: PH0PR07CA0046.namprd07.prod.outlook.com (2603:10b6:510:e::21) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 29832798-40b2-42be-46ba-08d9f0ece2ba X-MS-TrafficTypeDiagnostic: BL0PR10MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FXbytw/br/a3LaOQGhVsHR9k4jDgaMV541Af6iXM3pr/hfjAFcnZb18MwRLv+kxz/AbFnt8en/+Pd6bNHCbiwTBQ4YxzzD0LLDR/oAJT79kVp6/PNP6PwbJH6/m3qAXz17c7XTxxOd6OAqvyG9u+w+EbkB+eDtdatZq5TsZUKh88yYTvux2QrA5m7ktP02mMEbajSlAcJtH0JstDMfqhKvUPAAq8ZShx9pyTSLY9RviApmpJuzg1H4zJNlitXUxti7mmUr/ljftSEVrniDou4MdDCbOsH5D/po9qLOYDkvj69/gvXgEOiQlF6WLHCS/OY0txav2p6VQn/3f2mjGZtCYe5PKtXuGMl6XkMfpSBHeXMlxjvtZAyOfaVUgGqN6mZSOoMP7B7lq+0IUXBhxtYnFhdz2awdtdbHRNp5ba1nXOS+KwTJQ47yybuhzDRR/nRG1aR0WcqGRU/MMw8w7togXlseBq0AdpXbYs6xdoh+HHtsP7GSSljHgFxoHgCyOrGqbVhrRH6uWq2E/PTgtcDtkRuhVTjnwDk7R4/pA8t9KiYWLQ1/D1apIdXyws+U+4tThGmoBeRPGXol37IjehuAKeUAoP8XjDkMDPBMAiv/+U74/Bh//PQh6qz6RWFMsCtJ/ci3J+kmKnci1DpRzHkyS/aw7YsHxjRLefPHiOoVNF5qzqkM7MyX46Zdrs/5ITYOWieuvzUOSj0w714tcWCA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(6506007)(186003)(26005)(1076003)(6512007)(508600001)(2616005)(6666004)(66946007)(5660300002)(44832011)(38350700002)(38100700002)(6916009)(6486002)(66476007)(52116002)(36756003)(316002)(8936002)(86362001)(2906002)(8676002)(66556008)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uxR3cU87yC3/9P05x3IzbM3/p41IrOzX4b9bDYgoFacAiYsIezapqYMl1K6pnmAiQm5FRSUrdvW6niFg5aJYWTScNX/h1icwpSPkmV2fXDoYM+j7QpOdTY2cKVZdA7fj1qJ4ZLvvYAYBWN9F93V5B4cAB+xNQwKqccws7D9I1cDomNkMp4koMLKwon9NmEr2mOtmuiYIU4cXfB8CV8j8QRr6M8TBiVeSSBCkPvKZ9lA3H/PzNaqhCb0pKruHea2g4oCovJWJcLd78dVAwn3YNhIrCHNYBNUblQvywooL8R/C+neUnpRHtPT0Wow/dtnRA8y5F0xmKlOAZY3GZU4q3KvtEcIZHPGuWTxnTWVWWM4UBIxlO2peiwI2aTn2QjoL+xW27GdmqH9cc7bNFNRHURr3Q8cKpC1UgnWllyrVyD77Df2XwPx8KmvtKee/IPv2cep2gvMMR9ds94HsPEkwy9VqBAwifqEp4WgpSvw3JDN5KwXw9icLQ10eVUgDVgZuZBwoAQYr11jTVsXSb/05NKFDiys3ms4i7SsrpQBfpKloOCKPGe9I/34z0Tf9GEYrX88G+2c7CzAKx5339VaaLG1ENGS9E6TgkgTWxmKBrl35JNKHDp1VEsRsya5MdaoKU3RLf/ZclWAH0RCldQ1vy+8qWNdjBHrG13f5g+W92HvcI6UAMaJo+1oQHrM6yVxCE69H2VUvsDbjrSwcBopPVEKDaXL0zobmqkoRrL7ebkrFVoWiSorpup+uMN7Ghp6TDLqI81bYrMGj+jov7nhbDRsroK1skCXPMCBmHaqe5UI+wUkJn/yq40+ZvIuYFWWsLpGqnyrY7ve2oJOXIuXF3uTFQ0hpd7uI/JzkhTyanzV5OOHP5TMtPPc6MWVHlS4LeIovZ9VLlc8X7qRCu4eFJA+Q2ENySrYUdYdYg9z82l0eLoTMxzzNJkQAJjHkyYfRaR6lKJzdK6O9NG0Lyh+FHPCRCaamKukA/qo35fo1HjRNValQWyr22A2/YbIY4jjStLlZihYI61jkbx8zZWdRmhYndO41yjGf9N4fp69K0VLSEZsE9c1vovYjF7TnbRsX8Mx7It0q5Od2V5EslJcMxdZnwY9iYNRQ0r84SlxxWE4REvOzCOHaIeKO8EjC64CCO1ryXG2EIj3x2yDi3Kti20gXoPdl4iD+nSStRZB89u59sb8ft6i855Nq3kNuZ2050IHUuAZEKiKM4Of0tHE8SLhZp5QTWSak8JVbldw4XE5Y+cAk1BPMMCaVIZFRTUub1jRMLvCelK9cgVUQMdUuF8qgZO7mUve9cuGBReKkEqMrdNO+ZNH1rSeJRBQ1HZmx+vDnwiO7Lvv9ra3VrH/a3lU0Md7PnnBr4LMa+YoIyEBePwaGRGNW9w+myrq6Y4Oa4ekYLrxzsJqsPUl662TF+fp24MgvmhBxTBQ+26GG64CzsOdnoHmDZ33fnmYKvbjB4Kk2PSNNfeAKUu3nkyYpiF2SgM5y64eywwMp2GqtZSVHIsYZBXjmcfGM3j3iaNMFdOiLFXo1ylUMX1iSyoQ5RfEZuJFrbBhDxuZ4WWCWhvucE/XJtzv+1IpbyMjJUTAkXLX8l/SFP8hLDXn4l/gY/zYGzwnRKVnvg/s9K0IXOzXStFVy0ywLjVAE9Ta6MmoGHCLd9M32cG4jN/HIShjeyg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29832798-40b2-42be-46ba-08d9f0ece2ba X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 01:37:25.7067 (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: 7XYHpQKh4tOxbuptbVDvLg1mDQLPaFg9MZMG73CBZNep03Bkf4ZzKhnCTQS9m5cLxJdubNxiI7BQs5X5E3DhJ+1gp6LQoW/lcSKgYEO2Eo8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB2802 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10259 signatures=675924 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160007 X-Proofpoint-ORIG-GUID: XWLqv00p9F5bnVJrUwFjBVtiZC3_VfVR X-Proofpoint-GUID: XWLqv00p9F5bnVJrUwFjBVtiZC3_VfVR Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Add an error tag on xfs_attr3_leaf_to_node to test log attribute recovery and replay. Signed-off-by: Catherine Hoang Reviewed-by: Allison Henderson Reviewed-by: Darrick J. Wong Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr_leaf.c | 6 ++++++ fs/xfs/libxfs/xfs_errortag.h | 4 +++- fs/xfs/xfs_error.c | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 74b76b09509f..e90bfd9d7551 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -28,6 +28,7 @@ #include "xfs_dir2.h" #include "xfs_log.h" #include "xfs_ag.h" +#include "xfs_errortag.h" /* @@ -1189,6 +1190,11 @@ xfs_attr3_leaf_to_node( trace_xfs_attr_leaf_to_node(args); + if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_ATTR_LEAF_TO_NODE)) { + error = -EIO; + goto out; + } + error = xfs_da_grow_inode(args, &blkno); if (error) goto out; diff --git a/fs/xfs/libxfs/xfs_errortag.h b/fs/xfs/libxfs/xfs_errortag.h index 6d06a502bbdf..5362908164b0 100644 --- a/fs/xfs/libxfs/xfs_errortag.h +++ b/fs/xfs/libxfs/xfs_errortag.h @@ -61,7 +61,8 @@ #define XFS_ERRTAG_AG_RESV_FAIL 38 #define XFS_ERRTAG_LARP 39 #define XFS_ERRTAG_DA_LEAF_SPLIT 40 -#define XFS_ERRTAG_MAX 41 +#define XFS_ERRTAG_ATTR_LEAF_TO_NODE 41 +#define XFS_ERRTAG_MAX 42 /* * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. @@ -107,5 +108,6 @@ #define XFS_RANDOM_AG_RESV_FAIL 1 #define XFS_RANDOM_LARP 1 #define XFS_RANDOM_DA_LEAF_SPLIT 1 +#define XFS_RANDOM_ATTR_LEAF_TO_NODE 1 #endif /* __XFS_ERRORTAG_H_ */ diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 2aa5d4d2b30a..296faa41d81d 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -59,6 +59,7 @@ static unsigned int xfs_errortag_random_default[] = { XFS_RANDOM_AG_RESV_FAIL, XFS_RANDOM_LARP, XFS_RANDOM_DA_LEAF_SPLIT, + XFS_RANDOM_ATTR_LEAF_TO_NODE, }; struct xfs_errortag_attr { @@ -174,6 +175,7 @@ XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent, XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTE XFS_ERRORTAG_ATTR_RW(ag_resv_fail, XFS_ERRTAG_AG_RESV_FAIL); XFS_ERRORTAG_ATTR_RW(larp, XFS_ERRTAG_LARP); XFS_ERRORTAG_ATTR_RW(da_leaf_split, XFS_ERRTAG_DA_LEAF_SPLIT); +XFS_ERRORTAG_ATTR_RW(attr_leaf_to_node, XFS_ERRTAG_ATTR_LEAF_TO_NODE); static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(noerror), @@ -217,6 +219,7 @@ static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(ag_resv_fail), XFS_ERRORTAG_ATTR_LIST(larp), XFS_ERRORTAG_ATTR_LIST(da_leaf_split), + XFS_ERRORTAG_ATTR_LIST(attr_leaf_to_node), NULL, }; ATTRIBUTE_GROUPS(xfs_errortag);