From patchwork Thu Feb 18 16:44:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02B36C433E6 for ; Thu, 18 Feb 2021 18:45:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABDBC64ECE for ; Thu, 18 Feb 2021 18:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231537AbhBRSo4 (ORCPT ); Thu, 18 Feb 2021 13:44:56 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60366 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231624AbhBRQqk (ORCPT ); Thu, 18 Feb 2021 11:46:40 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUZ3Y059604 for ; Thu, 18 Feb 2021 16:45: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-type : mime-version; s=corp-2020-01-29; bh=PAMUuACTRGIujAa2Ft+VkOaXt1vGoXhu1Bn3MNi2w48=; b=lF/CTyml1kAKwDQJLpl/XzDBH1EEN22yZiX9Uu7EqyIq4zyTCuGv7F+EkkFRyQ/2NhS+ CH2J8GVkOA/m9cu7eJjzPy1ChdG+eE+iFV0rGSTPUp7LWYLqnyA8fCLnZZyJA5/i80Ta 1R40nmgvOU+MhKpSHbziomWoGS9LfFTiNyodcgwhT/N6+An1h/bD1AMvJSR3TUs4Oqn8 B8/itokGf3KSfblE3Cc97SI9nbxVSj2eRHSRpXL/RMPnT7Z4b280eXdWje0pBLQbJqV1 FC6VKWABK4SUf67+O2aSlIlEKp1gYSsLHzAd42fPy4yspyK10lYRL51vlHenI9cE+zNL Ug== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36p49bersd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:32 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUHT4067740 for ; Thu, 18 Feb 2021 16:45:32 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by aserp3020.oracle.com with ESMTP id 36prp1rjuh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AlCXH2kRCT/SH0YNZvQj/YnN0XcHrZlxXPrL6D2ZhdbAb2X1s899neyINS4aW/shXr7moxlYhqZfBI3MFzmFnrUbVSFC+0FogrMcy6uQh+JXeNCxfm3KrTDmqm05Wpw7BUyXEfI9n44QMuTjHwOfEEGVgaBwGNlwWIhoXPBRP/O7LJ3cbm9TlywXF2tXRLicD9yqd9f5bFoaKWLXE5gYNSMqvlV+VTPFrHhKuz335bSFI+P8HI2RDqThOCi4Ad+7vmgESJecl8xtZ+jvDmG26QFg8WIFxu0aZQwCOYUErYrCQZS+6w3ezEdXcApx6D2mZk25Tmem6KtodLmiUuaqEA== 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-SenderADCheck; bh=PAMUuACTRGIujAa2Ft+VkOaXt1vGoXhu1Bn3MNi2w48=; b=TsQMROj+wJKjCrxe7ZXlS3phCxfkbeOygPrO/lOCrTDBqnR6BP3L2cGnro5m6m7JTDV7qN4TwKX+O7M70pRrCWc+c0aFHseflYkOYa2Y3SAD466YkhZPmSJe9qzKfVRWJRba9KTG/iHB7cbn9de3vHlMi3f4UTgr/Q5txOsUDecJBCmn/JsrQS3/mgBlpBD01AYy5hgDrK9yU9KaPWDYfNriT2No2MoUYcotdpvxDlfGA5zmmdCh1ekWatWOEZEQBsS2R8R2luSEuU+Nx/OZ1j7kqLEw4kPA+Q/mN+RJ5b4gApVcwkp4NeWJ598bI0mTBcXEkcB/vQP5Ju2+PUvOHQ== 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=PAMUuACTRGIujAa2Ft+VkOaXt1vGoXhu1Bn3MNi2w48=; b=f1S3vJS03iX7tjOIFWJwdDmTEYnJ0bsALymCw9++k31QfUy2NjgLfayx6iegG97jI71PUuP213cnWqS1IUoZLQ/mo0RP9NOvwCvIKAIHkEeoNxuvzSa6kNAhg1bcapkJUlyvkoMmnqsk4FIuX/T5PVAB/iPSYvueuoB+lpp9LB8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB3461.namprd10.prod.outlook.com (2603:10b6:a03:11e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 18 Feb 2021 16:45:30 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:30 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 01/37] xfsprogs: fix an ABBA deadlock in xfs_rename Date: Thu, 18 Feb 2021 09:44:36 -0700 Message-Id: <20210218164512.4659-2-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dcfe9b26-b75d-4563-2055-08d8d42c99f4 X-MS-TrafficTypeDiagnostic: BYAPR10MB3461: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:758; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H8d5OTtu+SoaGr9zQd4XgxqgLj+eGvM3UAHb7rp/4haW/4QS/3XE+Q/JBDrZCn7NJUBnMixCwaQ2o+YDZkBrL46WfWZe4Zkm4e+IXSkV3u5OH5061aK3xonMyG9aLocMyvCxDMGKbURw3yTuK805G0wMrUuOvpSf7yvEsIq6aOWhZk55yFRCyx6dHEekOIC7ODb5G32MV1nZ9IXHziqUc7oDH+jGaZoi3n9zCItdQVHZiqJMYwx+g06m/3Ic3Gy59J8iKgZtHhQzWMsh5XECRtGGzgMSjxjh+tk+nNrODZSYZN7h5OPcP48CNwgZwrafa9X21tmb8mRV7ZJmGhx1BDG63jEa/gJFpe+Zf+J3XNoOwfrIx2RUrgQQvqVkpl4M1F/OP3EnhBk1Fc5HGiSHvfy7fS2rHzKSNZOjyKj/FE7CWMnisDK+Ogy/JRisleMrkesRNX84/DFNbABUszsYCyuXV9lEWY243JL53Y7XTGlVT+ALJJ8HoeQYSLUcurCnoiyFFG909mHdmBBpq1PVCOG5MhZT9yNFLxNXJGhvhz8EAvUdJq9w9TqUEdK2v7Ww0kVXw10JMcNysQCrNSVbBQ== 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:(366004)(346002)(396003)(376002)(136003)(39860400002)(8936002)(66476007)(1076003)(69590400012)(6666004)(66556008)(2906002)(86362001)(316002)(26005)(6486002)(52116002)(16526019)(8676002)(6512007)(186003)(36756003)(5660300002)(83380400001)(956004)(2616005)(6916009)(66946007)(44832011)(6506007)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1wapOv9HxuPYy8FSathlSR8bdVRAAYtHWSV88WqI297GnX3UXpC/KHTwFhednr8rlSXqB/SyrDsC1AZh4UVk9PEU6qbFO+ZmMXnS9PQW8Fell6hN05lOKj32PqThr74GpbVW+p4gj8VDHAD08lIIudeYQwN0GXm16rI0J+ReFkNPQmOuJIVSX950ptfZg4vOkkMpTTnezUcVqZmo++EgXaEC8PxRuIvmDlpeRDAnuc8IY676969hj9DR8tMT2tvu1yrEXR5OdBgb59liwCprQI6K7P8ANBymYLZJ9UDTa+2gxg6gqth3Q0I2462uKMBDeghe/DyTKAApEfgoZpcZkJtVehqFouKygtO9nwhC9LYAxGRBcUwnP8eGnalFoUPj8hfpBVTwXQekqRkWk+IRfSx4Y8FzT/i0OiRgo2RjExI7+3QOGX3x9n+8bOF/8WNHu56uF4SHzSpIkg9IbXnqy2bwePSkb+3Mk8id5RIUxsVGFUE584krYQ8T1XsJ3FuM10/32SGFUyTqVSaK4n7vD8FjsCgk4ygXGIwzlNJe9vqB18vaHKAkeGIgCaD+TYaNDnSs6meELIN0vSQwjZHUHDFH5OXemRfuLGilZLsasFpRtx2soOtkNrN9z8yohplLHBLGnS/mt7VBxJJTX37rzzPvCAkw0wlpNTDKw4P9crBv17GBG3e84c3LB5zk031tmGVo0ZVAlKYs8QwiCdaP/6O6TfArsu2h56FujhRsTNtkmcAiIaaS7Tn/69k7mpQk7P6cXVkgc6D5lBOSjJVRanY9tsQNoocneGJM5n2tUrudnQaXEVQFhSgOXc1V0GxKgw6LtahsoqZKk0X1Y4P3kkAYbqZxz0vdwG5lfjZJEazs0j3Y+beFNUz7bhNUKRdtXaSrkoVUHAEfkfV1y/HRR0pJ419zuJ2fNvz/5BvnH8UmVQUHyJ0G0Tx2bbKLfjuQnmIoHlMbBHlQ+033yh/170m1fkMS9gYQ+un2aO6/vWCqITCvea8NZ2wS2bR96mF/NvK81AQl3g1IwPvSNhUwSr6iPVrd6+g1Oa33hJ/pHsR9XOX/ieWT9HBZOXk9QpChblrjZTT46wGsQw9ud/ZGSmTFYtPLe8GBz6OGsBlifV1/oHIhYdglFgAJkD11OKXPV1OUoqHnZTgzwRG7E8iC8nu6Ma0exmcjynPQop8sdiQPSEcZ6ih26AUFoHeboVsDyyeApfG9H5zxvPSjkYSD9xkbdON7wEwWT6ixuiRPoQjDtoJBqe0vXlu8lAEwTnPbyj0fkexK9S9k1tXeF26iG3YTjvJrT/ADj9AogBz9Mknnac/Y7MMyUVP6Tsv9Cvsd X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcfe9b26-b75d-4563-2055-08d8d42c99f4 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:30.1648 (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: qyfEsLAlJ4CUgDQ24sKFQT0HaY9rMbU2fXCgsbfAb/6/24+1iQ5FnOu9i928+DJwTxYLdsLjQ15N/7eslXKQx68xEgdeWJcdVjOimC4qwbU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3461 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: "Darrick J. Wong" Source kernel commit: 6da1b4b1ab36d80a3994fd4811c8381de10af604 When overlayfs is running on top of xfs and the user unlinks a file in the overlay, overlayfs will create a whiteout inode and ask xfs to "rename" the whiteout file atop the one being unlinked. If the file being unlinked loses its one nlink, we then have to put the inode on the unlinked list. This requires us to grab the AGI buffer of the whiteout inode to take it off the unlinked list (which is where whiteouts are created) and to grab the AGI buffer of the file being deleted. If the whiteout was created in a higher numbered AG than the file being deleted, we'll lock the AGIs in the wrong order and deadlock. Therefore, grab all the AGI locks we think we'll need ahead of time, and in order of increasing AG number per the locking rules. Reported-by: wenli xie Fixes: 93597ae8dac0 ("xfs: Fix deadlock between AGI and AGF when target_ip exists in xfs_rename()") Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Signed-off-by: Allison Henderson --- libxfs/xfs_dir2.h | 2 -- libxfs/xfs_dir2_sf.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libxfs/xfs_dir2.h b/libxfs/xfs_dir2.h index e553786..d03e609 100644 --- a/libxfs/xfs_dir2.h +++ b/libxfs/xfs_dir2.h @@ -47,8 +47,6 @@ extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp, extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_name *name, xfs_ino_t ino, xfs_extlen_t tot); -extern bool xfs_dir2_sf_replace_needblock(struct xfs_inode *dp, - xfs_ino_t inum); extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_name *name, xfs_ino_t inum, xfs_extlen_t tot); diff --git a/libxfs/xfs_dir2_sf.c b/libxfs/xfs_dir2_sf.c index fbbb638..e5a8e0c 100644 --- a/libxfs/xfs_dir2_sf.c +++ b/libxfs/xfs_dir2_sf.c @@ -1018,7 +1018,7 @@ xfs_dir2_sf_removename( /* * Check whether the sf dir replace operation need more blocks. */ -bool +static bool xfs_dir2_sf_replace_needblock( struct xfs_inode *dp, xfs_ino_t inum) From patchwork Thu Feb 18 16:44:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AAD1C4332B for ; Thu, 18 Feb 2021 18:45:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4951764ECE for ; Thu, 18 Feb 2021 18:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232455AbhBRSpB (ORCPT ); Thu, 18 Feb 2021 13:45:01 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35524 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231750AbhBRQql (ORCPT ); Thu, 18 Feb 2021 11:46:41 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTgSw040315 for ; Thu, 18 Feb 2021 16:45: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-type : mime-version; s=corp-2020-01-29; bh=TOOBB0sq3MTNlwRa7Cz/k3KxX2lVRPUBo0E0YE4Rq2A=; b=axUSlGN2nwGT2o5v9cChKfmQZIcGnFFJkBQ7/8N5oDjdOrzG3i+id12JqGZ4jR+qZS9I 4O+TRrpz4/jfpK+LCsk2duK3oVkkDg5Zc2gxWUAkPhDSV53I4PSOSxIqa6kzyBYeyAaQ mpYwZmFr+qOweh0FQBoQ8OE33nEnpXoGI+9HIeaPWv2Xa7ApMj+aJoTzmCqWrdzZCGjC bzclB9ZuKjsQUPXwdvs7f5Dc/OcFhAxUzQbcnu1/VycO3JHr1XJRF55PLaGwaF17yQ/9 BgOe/7f93PdScCpRBLduD75yjFv8zDm83P2NmSCE5JhSGGkLz1UKJ+GkolyyuBSCfvzQ BA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae3gx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:32 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUHT5067740 for ; Thu, 18 Feb 2021 16:45:32 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by aserp3020.oracle.com with ESMTP id 36prp1rjuh-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hnvhyse0JkGufClcXHBvYKEZ9U6BdcjBNf/6PuPkK3hiIDxscL2Em0yl4eqwvHfV96qkohVfMHAGiRfgn/T++tImfJVFYqvKB7EpptX3joEoXzHUCf9l84Zn7ux5aw4ZUX3Mq+rCqpGxm3MIpDt5D6eh+u/MyscY3tHPJHePhh/BsctiQTDYPNrNoeT3Htv05ZEHXHUoKzp7ByHcovUK5QzTfyFRZdES+6ldpzxMq3vRr0x/7zGXqCGNxEGiSOSvy14xXaeDX4JVPqAvyPv7OykEUOG8kdkKBFUelaAUq9APK2jx5GyNjvBh1NETGfdICzHrmtzzZvt3acNZbpDG6Q== 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-SenderADCheck; bh=TOOBB0sq3MTNlwRa7Cz/k3KxX2lVRPUBo0E0YE4Rq2A=; b=BDJ2q7nonU+Dosw+yUkX0j6sw0GvUDQVUgNpd47KlvaTo3tcf8PwGreEc/MiT+nabMe6IIH5c+ZKo9rIt7T3aOxo4GzM4UjxbAIK/KIvjV7UUtO1KnU3fHxEFgOJRrHJWDYbycPErYh1sSC3yPnyv3NYVXlNHUY20pvk48UgwAF454CKBfGl3TvGGqd5cELpo5W999qEhhexMnckij7WNYmKD8jXAP0uhF7oAcOrfvFZB+CxrePgWgi+c0qKZO6zUFVWx1sY3P3UTmz7mT160Y9bI7a1VsfsFEeERm7HTDABtRug4x9aZ9qzqVlwfEhsEtgM+Usn7tTzc+fFtT/Rfg== 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=TOOBB0sq3MTNlwRa7Cz/k3KxX2lVRPUBo0E0YE4Rq2A=; b=rOHJWRW7wc0YTBtCQ13BoavU/8B9SY9wHmaVYMsXtRdeQMMxPMaMu+LiRpR4XpS6wPWm1PJI3ivOU4FSBeM/gtpLLytFBsBnOu5b7rKaQWMNgtFTlWiHxNQZDysR6f9gHbnNMIuWp1maMaXcnxVBBtZJareiavesxIWC+s+iplo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB3461.namprd10.prod.outlook.com (2603:10b6:a03:11e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 18 Feb 2021 16:45:30 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:30 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 02/37] xfsprogs: Add helper for checking per-inode extent count overflow Date: Thu, 18 Feb 2021 09:44:37 -0700 Message-Id: <20210218164512.4659-3-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e668917-29c0-4f42-2cb1-08d8d42c9a3f X-MS-TrafficTypeDiagnostic: BYAPR10MB3461: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:883; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F6gqlfcFrvA8qVm1s29IV1V4DC3symnGXuej1OdcwVM+whZexa/dSpo+Dbrk1Hu9rT16R4TQATvrSqbOiCFr85slziUUYJTC1tkv5rmkZPtOmgxrTZDjfHRB0OMlbaS0stbhMRSi31ejd+x8BK47jXoZ2YcMogZAjIwmdLyJKv4DWcMa+6h/XnX88ndPNgbDzF5K62mVNKNQv+GfSIoBOmbocKD133aiZfwa5PjT/DEleOSp/+QXgAvVeqtzvRQd0tjQaDqU4YxPjmf0TQKScHmE66TEh5Kx53O91ZflKsyl/++DNChy38kn5GE9CTGwuSkUYfWDmxICHzAgRDHy3n/HTiXjFwxEmIQHFEjzgQSnP0IJn1RZ+BHxalI7Gtyd8e67aM/ZmfxGCOykZSEfRI/QcHJhME5y6rGYT4uCbHytuGZVrYDPFPcbWoetXPv5K87iXCuVNUhlU6B+T256sUlXUsO/L0hjthb3eMHWJ+JknJWkdpIz61eEKhx56CMXsEvktQiAPMXBdloEjSNeC63zptUiiUa++gC6D9Nz7Fu0b7CWkhj9ZkWIzMSe6pw3qGkpBH9BosBC7dqqBX9fcA== 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:(366004)(346002)(396003)(376002)(136003)(39860400002)(8936002)(66476007)(1076003)(69590400012)(66556008)(2906002)(86362001)(316002)(26005)(6486002)(52116002)(16526019)(8676002)(6512007)(186003)(36756003)(5660300002)(83380400001)(956004)(2616005)(6916009)(66946007)(44832011)(6506007)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: oJ4/lyOS7h97/97nKPx5vOtK4TOKmjiIfH0+fxnjquBsT3HCfPz1r1/MuExyO6+M3VIqDRk+QWmWXspNPcuYyVAan7rbGF4WC37Qp8MaI4u35pqqT775pGp5YGdw2aJVmePLB8Zh0IqQI1vnvJdmIb7wDcTElzxftWNsQQsVBxeSIlFPLGBFA8sjROaTyWu0Gt/aUV3W56d+8J/qgAbP4TXiAQ8Tipe9T6On2IzW6FOy1nIUxKhPV9EBpwCZIF0V/Oez3rGrJdTBpUvdyMugJE+hOLEW2rX/24abxO8fL31nrXOJUfuV7qWaV5v20rtXwW1Or/Uk9cjxrRC6SzYL0j7I02FpaIUiNRhmWd4EaWWiiFhjglUMbOqXtjM19po47OGxMUPjqJihZJeUaejuynqb8JX8VeBP/drZQiGR/BxCjn3b5P1TphaX9cQuywMlnqdJFqCEDtvb8GVebp3eMUnouNloYe2YD7IUCajKndArFrIkcTUnWwWhk/YVHA8Be/M28FqVdCzYVdimTb1kWb/oDmg4uKVqxkyOxjX6ro1nQWoGkoD6RxA71sksNWJCZhGWFqLJjt7HtaOY5OfpW5NiTkTEtKEfAHs63A/mTOJsYVdwM29Uzy7Vgr/1ReMA/3D/ksK9s1PtFHKpunsas0Pbv/I78vP8SG5SFOcanm+vauYWxEraJFX1Y+ETGJTXjdhb52DrgU6XZSQd3WZ85ZZLmpZHONJqOOnDfLqgtDA0rWAtQdXmpxIyabrowx4TZWJrDBD8x4oGyZsghfdCxpN8jwcyn33mbwZ+J6qJ0uBGuBpgl0qd8PlOp6xAvksm/DUFOY0lC/9VEhH19E1625wWFA4VBfKTekziJlq8hTsQXslWJEoeJsD/GSEAu7TPVhzzad0ViEQIiwzLFbhDalXLoKl8/4e7BSPDxYYl3iM+wc0AFKoudn7hUgejOzjQpaF18R3YgWVB/As1ekglgVDPrinzOgExGRpw5gBPzLsn0aVOuXY+sJAZ9OaXkzqktcQYtEenXzdFkU76DcusO3ycnMNTtiB4hzb1EBp+78wmFdCaDe7RNBH2kZkoXqy3I+Z/PRgdrsjzKohJG/sBerYRG3vsb2fGJ1IBwaz76NpXFIL5uiaNxssPExMiLhW/p53jBXqyDcc4V7qHkcFd4defwQYnjJ0o/s1q0tWzeJ8dNMtfkxMCsT4xf2/lsOd1itD3AMKGo+fie3G8e5DNiCZF56Jgad2h//inXEvqmR6q0sFxhws+La68VsAvye/IL/q6Fy0xcy6pVcmVCFA1vcWus3njFQzTjnAAp6fbbAUvaTrlsEJ0v4V/x+EP39B8 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e668917-29c0-4f42-2cb1-08d8d42c9a3f X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:30.6666 (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: xSfi1Sdf6nD35haRV03kItVM4FymNvlOKFu/qafBGV1LItzxi6M+vW0FPeYabX0JJjQ9yQvIrSutId4Qo3XD2VfcW3ZBKQpKaUcjz1CQWMg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3461 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: b9b7e1dc56c5ca8d6fc37c410b054e9f26737d2e XFS does not check for possible overflow of per-inode extent counter fields when adding extents to either data or attr fork. For e.g. 1. Insert 5 million xattrs (each having a value size of 255 bytes) and then delete 50% of them in an alternating manner. 2. On a 4k block sized XFS filesystem instance, the above causes 98511 extents to be created in the attr fork of the inode. xfsaild/loop0 2008 [003] 1475.127209: probe:xfs_inode_to_disk: (ffffffffa43fb6b0) if_nextents=98511 i_ino=131 3. The incore inode fork extent counter is a signed 32-bit quantity. However the on-disk extent counter is an unsigned 16-bit quantity and hence cannot hold 98511 extents. 4. The following incorrect value is stored in the attr extent counter, core.naextents = -32561 This commit adds a new helper function (i.e. xfs_iext_count_may_overflow()) to check for overflow of the per-inode data and xattr extent counters. Future patches will use this function to make sure that an FS operation won't cause the extent counter to overflow. Suggested-by: Darrick J. Wong Reviewed-by: Allison Henderson Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_inode_fork.c | 23 +++++++++++++++++++++++ libxfs/xfs_inode_fork.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c index 0b1af501..83866cd 100644 --- a/libxfs/xfs_inode_fork.c +++ b/libxfs/xfs_inode_fork.c @@ -21,6 +21,7 @@ #include "xfs_da_btree.h" #include "xfs_dir2_priv.h" #include "xfs_attr_leaf.h" +#include "xfs_types.h" kmem_zone_t *xfs_ifork_zone; @@ -726,3 +727,25 @@ xfs_ifork_verify_local_attr( return 0; } + +int +xfs_iext_count_may_overflow( + struct xfs_inode *ip, + int whichfork, + int nr_to_add) +{ + struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); + uint64_t max_exts; + uint64_t nr_exts; + + if (whichfork == XFS_COW_FORK) + return 0; + + max_exts = (whichfork == XFS_ATTR_FORK) ? MAXAEXTNUM : MAXEXTNUM; + + nr_exts = ifp->if_nextents + nr_to_add; + if (nr_exts < ifp->if_nextents || nr_exts > max_exts) + return -EFBIG; + + return 0; +} diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index a4953e9..0beb8e2 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -172,5 +172,7 @@ extern void xfs_ifork_init_cow(struct xfs_inode *ip); int xfs_ifork_verify_local_data(struct xfs_inode *ip); int xfs_ifork_verify_local_attr(struct xfs_inode *ip); +int xfs_iext_count_may_overflow(struct xfs_inode *ip, int whichfork, + int nr_to_add); #endif /* __XFS_INODE_FORK_H__ */ From patchwork Thu Feb 18 16:44:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1139C433E0 for ; Thu, 18 Feb 2021 18:46:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5E1F61606 for ; Thu, 18 Feb 2021 18:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232422AbhBRSqO (ORCPT ); Thu, 18 Feb 2021 13:46:14 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:44106 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCem180367 for ; Thu, 18 Feb 2021 16:45:33 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-type : mime-version; s=corp-2020-01-29; bh=UpD4SMWJ+lyY3P0GXAXH8Zkyhl6RYdNTDY7yrpL+68M=; b=Ek3Ked1ALkzv6gnu225VI7lCyLr1rS6eUEe711yvXer8ObRbgK27IX+M6ZLqmJzDdpzt f28Qs3fuUzO3cEGtmXA/+e1l3qX+fR3XgLtovi8Y83j7ras7fDE6vE8P41pGU5kw+xAd zy/X7Ha0/skqlOoNJ70i9EE5e/DQ5zYTNdYgvdaTFNef9T8NppgkOqPJu2VfpAd+jq56 lZyzYallUHnO5KYakAZDOInvvXGOM8bQjjUAimiORLYGCMcbnpvGACAlU9e3wtKD+4dG 8GNcFGgzyXCSdaeU8jkjroDraHsi7j/q16xIlJpnGlnxwY+bMNmXvgttx6YAVxjroIK+ +g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 36p7dnph16-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:33 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUHT6067740 for ; Thu, 18 Feb 2021 16:45:33 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by aserp3020.oracle.com with ESMTP id 36prp1rjuh-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CxVh+CAIVishSY9Eu3UIW6wzcM/TyNlfSZvvedJJ2CRvryxaAni39LisfH94zm6uDvJgeImAUmwA4h7svGL1oH/vdH2ky71ZzRWRGm1rNOgWjL/7pMvDEqi4ZGjOs1MaUgRwmYcvpN6qnGyRmcc/ggtvhcWiADjYTqkTT2ka5rZw6Vmq5G+JzP7+faGD6PT8RO2jWvSHAp8h7vpbV/WM7qQBpXOe+C6jLszZwmTMkoxabCDUhwOf0pl2bc+ZS4csa4p8UzHkK+eb1TxrudxadZ93q0Z4WW4b3K9b255y/D4aaj8zLo5SOgDQ3HqnfqDAk+ue69zOG3keoMmeb9OrTA== 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-SenderADCheck; bh=UpD4SMWJ+lyY3P0GXAXH8Zkyhl6RYdNTDY7yrpL+68M=; b=dsw1T2QPvRad77b+ik7ZHohGYGCo/gb+9HiQxdxKpSlE1WoHwHePxblFlJ2b8W1eZTwZyU0y68MRcKNcg/rjI/ffi5ToyAsMm+GW9ko0UjPLkRdXyy+sU9HS6Fiv/X01G6KrPyyH6Ye20gXNNKcInbb+tnCr3QXL1gi1axebigIAJVItcMGntwt3PJQx9oALzenKzrTV70f0RWEMNQbwN/P1rMQ8sqfg5LjN4shz7esKef8k5F8y4SGsSkunqN4exDvLtCnaXW3h4JpTUiKBQL++WFClm1pW01lStkkE7bJ4ADo6hMZGtVqaOlV1uURwTDfB+nzyvUnSHxGzhACYpQ== 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=UpD4SMWJ+lyY3P0GXAXH8Zkyhl6RYdNTDY7yrpL+68M=; b=hmgr0jWqY05vubxorrfNiV905RONCtupCIoSNhHWyaf6+qgcRiCCIWUBy/XYLSNmJ06D69G8lfNXITcVbEpLql7Xo/o5YcB2oIJYTVD2iEDTnOerIygjKBzjWOijogz/K0AN/tu5O2XEByFL/FTjwCIZyBC1pn8GnBrqeHgcSAc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB3461.namprd10.prod.outlook.com (2603:10b6:a03:11e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 18 Feb 2021 16:45:31 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:31 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 03/37] xfsprogs: Check for extent overflow when trivally adding a new extent Date: Thu, 18 Feb 2021 09:44:38 -0700 Message-Id: <20210218164512.4659-4-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6573889e-bdc6-4c09-7063-08d8d42c9a8b X-MS-TrafficTypeDiagnostic: BYAPR10MB3461: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:409; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2ZdBXaDFYtzd8xsxKapn5+2xvQTR1KDVVyCLEraNwnP7Krre3ATyJ9IDDM0OmxlF+EByFWu8UCQK1VlDhqUMjKK7M4khSfbrpCWKFHD8ma6yYvBW523ZfKt/22dlXJL1owYndcrontWBLmoQnCKhmcHxDPB8jJRLEt8RRNypDRG+k+cK8MwiGhNBQQjTaqLXouXL17s5u4a8qf7gptjjU0whLlvjpo/D59UKcut1u8T8Y47z15js6Qx9x+bSFkHoJD8LYp1tTFA+NSRDx4NTkvQm283dvCG8vaZnaWywnmXWrDOnEHjyTT3C/xi7oVvI1c6t0ohdXdFRzyz4wtzGVuTbTgAjYw0dzPZYY+ZKmC9Qosjs/0RGw51M3ex54eqj2N7CzTLBnVoHeUAFJWwwk5f6zV3ioG9CI7fmzFJ1J/Agp58JSLg8QsWCXYfQgBEjaPxIxkLjAyWt6KChnMvfPVNI9ZRZV1r1jnHWYWcCsOXi17NOFDHlXiqileX3o5lfZkKKddsWeELKrNFw1p2pN8afhLyhHiDY0JDNgfuCOt9NFGRXuCybqFUZRbr5MpmzD//qTS/KWWtUzh6hqhxxaw== 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:(366004)(346002)(396003)(376002)(136003)(39860400002)(8936002)(66476007)(1076003)(69590400012)(66556008)(2906002)(86362001)(316002)(26005)(6486002)(52116002)(16526019)(8676002)(6512007)(186003)(36756003)(5660300002)(83380400001)(956004)(2616005)(6916009)(66946007)(44832011)(6506007)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vvkvNeI4pm4loYo7KdgasfmK2HWPmxTJL3+Eq5m1Zd0Tt7+6FRAfnXOnzj3nD4CdYfmHxbgkJhJF6128hH41Eu5Es3Ww58IjfHEUGWnZRX/8ZZLva5rskqHD37SzDttnHqczW7a/FKfM0xq6qIsyJ6kuiNjvlriOBMfsIXjNwG9vrQHwra7ETPpzToucTBIbtU/aEZGdocSB+D7vMUSUssRLj5XIXqkRsKtoEE5aviqwd1MwFCp6S9gp8cQ/SiMkiSVrH+glguCXboGftf8YNe57tk7RMosQP8yVLH5Cw4T9nsvX1zN1n1uKN5BrPnvNaDeVJ8WzbvF9b42mepHNAR4f+vyAUik/7+4cAYurJL1ewY3n83qmyf84UhfdnL9Fv68F85aPvPz9N9tOjD4wjIUEJBzUKr03HB6PYMp8lcYxsg1hVkExYI+Tfyu+DU/Uo7DnFye7jgnRBFBtDNDN+vXnR71Q4+g3gUx4tlmIBaHYcDhjh7CH4E3B3MXdHoNr6W0yoEV3QTyXwKsdlyspYJxK4ODZdyrYmRQ/HV71dm5VI+rfp25Qa7iySiDvclstWlMOW+3VG10dFqgdLvXsQeNrVsW9Y45h7H4Ln+NLP6JAv73WfJ8wu5lPmgZ870eEzFijNxWezWvO70OSgoCzvvrnIBPVjBdCEuV2nK+95WzJHm35RrZFRgUsvwGwdIEBE+VynVkmsf1vF5DdMYKofXUCbdFCEBgoGDt11lTgQzngWQhOqxdS5LCzaBlJ9rtbEC1vY8OxAoxxC96cYo41sNhAQ1dbQ/L/N2EXrMS901WVja7iiPf8icTPuPJv6/Zteqd13wvI9/FfTFvBh/iYPQ1gSK04acZUdTtFlR/x6Je7oyj/SHyEtuotP08LHZ74/C2AZvLr5FuY3QEyY+EdLxEhy2D/l+tPByQO3bVErIiHBDD7w+DaIOlXvwNyuNG4Wj6xMZUuk5t55bhUWc2B2eZTEX0mTquDpxMdosB3MKvB7guZOdL5R8QVc+KcInC6Z4TbmfdULpkO1gihFHTDOf6GFBLogAPsQsudWnFADnCPFRMOgiUUKVDHdB6rXGhdz3f1oVOu9GH/Ri1WkVzAC+H2VG2Gt+/ZiFPXzKvmCDgv5idJcl7ZheMZ9UR6qxQtdhQUk8tGJb5YXAgym6DOz7Lm889u8lot3xk2zcpsgXFoKUmxbr3K4Ekw/42Aaxzdu/xy6hY25T7Dda4SVyplsZVb8AQ8o8XxQDp5H5VPAmqm8nQn0L1yZptIhv6Q3hqkSDc1nUTdxJoJENrYSUR6jjn6MiBwFlysE/s2rWC54ama+HUS+bxOkmGTQo+BW5ta X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6573889e-bdc6-4c09-7063-08d8d42c9a8b X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:31.1106 (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: giYpBHGrfFqCb8wU3ixy5TGtBxaIVZn0cL+vQTnemenIHgsz6dSyWmNLhC60huOR1LhfMP4rLVdp6P74i4WQJ45mUh22GefsC8qjUgpYsh4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3461 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 727e1acd297cae15449607d6e2ee39c71216cf1a When adding a new data extent (without modifying an inode's existing extents) the extent count increases only by 1. This commit checks for extent count overflow in such cases. Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_bmap.c | 6 ++++++ libxfs/xfs_inode_fork.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 1e53cbd..336c6d6 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -4520,6 +4520,12 @@ xfs_bmapi_convert_delalloc( return error; xfs_ilock(ip, XFS_ILOCK_EXCL); + + error = xfs_iext_count_may_overflow(ip, whichfork, + XFS_IEXT_ADD_NOSPLIT_CNT); + if (error) + goto out_trans_cancel; + xfs_trans_ijoin(tp, ip, 0); if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &bma.icur, &bma.got) || diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index 0beb8e2..7fc2b12 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -35,6 +35,12 @@ struct xfs_ifork { #define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */ /* + * Worst-case increase in the fork extent count when we're adding a single + * extent to a fork and there's no possibility of splitting an existing mapping. + */ +#define XFS_IEXT_ADD_NOSPLIT_CNT (1) + +/* * Fork handling. */ From patchwork Thu Feb 18 16:44:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24DBDC43381 for ; Thu, 18 Feb 2021 18:45:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D890564EB3 for ; Thu, 18 Feb 2021 18:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232428AbhBRSo5 (ORCPT ); Thu, 18 Feb 2021 13:44:57 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35536 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231718AbhBRQqk (ORCPT ); Thu, 18 Feb 2021 11:46:40 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUQZo041132 for ; Thu, 18 Feb 2021 16:45:33 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-type : mime-version; s=corp-2020-01-29; bh=zayGktjTziCYHsvpZ7Y70sIEhUGWYy6e4ZjjVOk6Ba0=; b=i8Dd0toUXjLOuh+ykiuQljUKWGyVXhbfqQg9Pof2OHu88M4OKVktmL4F3exvmPA5tVDG syxxkqwqJC/tYnKtUL/9AAJFnalaRTA7j+zqmG7hsP9HvXJQKtlFr2y4q+zCilcb1+/+ eQxMht394m9IxnvCGwn5Wa2S4u0ZPiG6jg/dKi3xI2+MJSbB8qEXnx3XcTNck+NMIz7x /CnBVNB0OuehAWIfOmIXXhCJ+1F/sHUGTlR/k9hF9LTQoBGLRHVicOkqp6DdV15FEBWy ENl/YQk0wWGwA9WnCoYT3NXEygfLqGMvTSYQkuAbcymaniHNtQBXEnGVc6i+VJGpYY4q dw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae3h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:33 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUHT7067740 for ; Thu, 18 Feb 2021 16:45:33 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by aserp3020.oracle.com with ESMTP id 36prp1rjuh-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YU3mBWEX2vsHRxuqC2K5kobgD6GFzVPvCa9zf8oDRaa/MihSwfwPjHrWisbsq7+olP+9Fn2XXOUUXNNDlztGugQmGbMjqJL4/co4WRpmJjV8OlyXssGzYQyOz3DZlJapuXBWe0Lx7rRNS/kCx5TW34vs8pptMju8U2G6JmviRh6JIPb+zPRoaePWF35v7h5QLEKKEcDSUn4xa4mz2kpdsZvouFh7E+Vg9wuue9gX+akCEL7HjmWdjUEXjF6bV0ubTuIS+ZXsTCyzpa9TJcpG/Q7LG/gspAdWJl2IjQhwmWeXqnt+MSP9aCzSxduWAPd/C8kqVzXDeATDYAazwcp4+w== 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-SenderADCheck; bh=zayGktjTziCYHsvpZ7Y70sIEhUGWYy6e4ZjjVOk6Ba0=; b=Zi8qjMr+O2QgKuyCOaXWnOVlHRbIOs7x9oOhqIeGGMDYnWozxRwaGKb9MkcdRMan79iHOiqubDgR7RNC9es5tc5yGH80o4m0E2O06hEfpZRLNWs0sp2hBbO0LLsK/G5ik7dn2CHdS94QAZscFa68OY+3slzR2wA/R6OhJdrHEDQ7RV3x0/3WzUcsOECfcZuHJ64DgLViTn9/tptL6KeV5xJhuDzmG3SpKqyjLe5lyPMdhP/7bnJLNrjzJy2XawMRcEiCyd9Ajv7z+ZpAY+NJBotEC+bjWgTqLJWHP4K5THEsg4BApvzh9mLXzD502mOsAxxyardpA2smCSSTIKy6/Q== 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=zayGktjTziCYHsvpZ7Y70sIEhUGWYy6e4ZjjVOk6Ba0=; b=TRVuksIIAWoX9cHB5KTuBirrmjCMmig5WQsSLKqhEwKSuRtrxL1Nc/JEEui/hsefY6hDzbUA+epl1WsG6s6erISJaqmMc7lGDIdA7hMFYz4djfGGqCDYMdUiDZsK7jVj7dHRRF2lutbsgakPZIsx0M55YuEs2hX77dTb6c5/5yo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB3461.namprd10.prod.outlook.com (2603:10b6:a03:11e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 18 Feb 2021 16:45:31 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:31 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 04/37] xfsprogs: Check for extent overflow when punching a hole Date: Thu, 18 Feb 2021 09:44:39 -0700 Message-Id: <20210218164512.4659-5-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc8b06ea-74d7-44f0-1511-08d8d42c9ad2 X-MS-TrafficTypeDiagnostic: BYAPR10MB3461: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:364; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4Gi/IMPu7Zhm2v1399yskOAEh+X0fo8JEGxFQTGqjoAp4v8LLtH6ERS6iiLaqtggOqUuqhEoY8sV26FKccbDYdUfrl25k1w0z06HiWiUvqgOxzZFTx3R8GomDL9ZKQ7GQcMzrjVj2g2sg8x0PwMYC7lsxFbxTS9AcvuVYxpPeZPZim8RPKiuxQbTCiTyMhDGFJrUMOuBbuzzE3A9uDVDwwiyQ2zWyHAwbDzYvJBJNN/1xl7PvByuOK4QER5/CHkcpgOiauV9UO9X06GcYXAgC/Yxl5bV42tMcrg1YFk8xDqLQb5kM6OGKGgnbuzMlanKjplIk3FHyGSz1VwicXcjH5YKSuPbt/x7h0qg4Sk/f/YcAOaFfmzwQ7yNDKc28DavjPd2T+4hs1c84Mlk8fMSzVjyDiIPFtXTD2NSXH6hNx+pDAIW95sMWsAEdQ3o8u6ocQR9TjQ9jzFrrKqBDvNVVFMX0jlT8123O3BOpDnKyMkkpQHAzGHxLWGOy+kBdMERiadyH4Iwa9LgsHRH1eDbqWzQQuqajBWn7Wx71gS998DyJfR1+yW5s0D/bF2qa1gAADG0Gx3u+b3UsAbQL+Gurg== 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:(366004)(346002)(396003)(376002)(136003)(39860400002)(8936002)(66476007)(1076003)(69590400012)(66556008)(2906002)(86362001)(316002)(26005)(6486002)(52116002)(16526019)(8676002)(6512007)(186003)(36756003)(5660300002)(956004)(2616005)(6916009)(66946007)(44832011)(6506007)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: srQVRVHWuF4Pkix251d++/3lsgGeUtkCPO5E5AwTsouc5B9NeMF+RtXQVzZ8+vlqCYQYoXwQ5c3HHYJ4YWChq7rGLIUGSeHIYenXSK7f0ezpnb0HZv0CruxpgLxBP+OV9Var0ebgmXoE0J4XEwNpJJTU5aEf2Dy25frB1QeySkJA70IikDKMYAjTUlArXBenxQNNOUmK8q0MSakC+Kb8oeennrmNXq8IuBN6A+zDIpTwN5YZMhJ1HYr52bRRWXVuHiU4vHPH82W1QSzFitOr1CLQqCXm4c5yo+v4TjLHF/RfnrjvqSwLPdDfaMNIBFFqhfLelcpzbN81TiUDrtuTBczSUwateEP4564YHcYvWODto4glyzHdx+LeJrXtVlLogATuUybuKkDIxEOQxLqr2WqxxfCa1r4gPJQ3wQ93JxyYQ/yi2BvYxEEfdMrbnb628mRogOXHnNCzjZGEVZbELr+yt2qKdfbb2X5qTz3jtZSQpQfMpsT1P20eHCRRIa73GPJWlIrUmVbscjEls1zmuTQjQDPvPrBNKqNxwd7/mVzlUsqFfx0CQc7asnBalofftFZh7S3fhaJVdgljPXNYycwOR5st0b48j7b56rngLGBu+P6VzYS+NF+0gnMdlK6j11mjuO16fVBrcrRA/NDY7qnm/wlIVkeN6OpMNW8my827UzNURkpWptxuBkrqIglchrmfR3ArAFphncchV4ACm7004RFkjsqhhOL80NHHlxoktvlWjRCHa4D+3Fqg9kbc7iQgxp9qDik6HhZp+NETu5iprbKK824saINjA7ueeBsPbdl0ibOpmpMDgzcpBa1nR+JyN/sKc9MXbiDKHv/sDblcMoBbWsB/Jf6duk9sZRJk4LEnFWw8JsJWY9DoxHkPrsB2Kf4U1JT3FFjCV6r5hTLYWGwX4+6+mjc1Ngcp6G83QSGzCSFa0ab2Q20JrgpM1fRzlhuSvv2UcvTNmC6FMUUiZSZjLqQV3iN/w6oBPOn2ZWRZRqLiLtXCJ7kENVeMFafv/RKjuSGgXKaeRQ8TiSxnOvt3IINr36XvuJZLokLRuGdpkaxXz9tJEJxFlga0nkmaE+ikF+aBkzPzGcDVTdOHZNgac3JT2zNEs13hH+GCPrNJNE5dbc9EEatCw6HU2ytmD/AMZdaN09lc3pku+YFOwA+B6mAFATeWH0zYGAk7ZETkzdl8dcb44xYHub/VPpbzi0C0cym9AIeAq8tiYxkQM+8r+Bl9quecIWDJvSDSZzOONUrHrrx+IZ+q8SXol2veKsUWWPy4s4bbELGOlD/DXq+UUAVWVaJ0BZupnIdLKQtIjeRW0aZNDitYjdG/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc8b06ea-74d7-44f0-1511-08d8d42c9ad2 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:31.5636 (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: C6Fv/8V5I5LUdwVyEs5n+2oLvttdC1szHvcYZ4GrD852rFsf8U3TPl514WZ0FXD23WbDP2B7IAXf44MzytRFj+nzryP3kAeFrpOcs/GrBDc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3461 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 85ef08b5a667615bc7be5058259753dc42a7adcd The extent mapping the file offset at which a hole has to be inserted will be split into two extents causing extent count to increase by 1. Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_inode_fork.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index 7fc2b12..bcac769 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -41,6 +41,13 @@ struct xfs_ifork { #define XFS_IEXT_ADD_NOSPLIT_CNT (1) /* + * Punching out an extent from the middle of an existing extent can cause the + * extent count to increase by 1. + * i.e. | Old extent | Hole | Old extent | + */ +#define XFS_IEXT_PUNCH_HOLE_CNT (1) + +/* * Fork handling. */ From patchwork Thu Feb 18 16:44:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 711AFC433E0 for ; Thu, 18 Feb 2021 18:46:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2998664EB8 for ; Thu, 18 Feb 2021 18:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230482AbhBRSqV (ORCPT ); Thu, 18 Feb 2021 13:46:21 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60386 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231754AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUSJh059524 for ; Thu, 18 Feb 2021 16:45: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-type : mime-version; s=corp-2020-01-29; bh=d1cgS9gGRVyt4lzZgTDwwEPzKeAYfXnZ9Hbtx5B/fUg=; b=cueS513BdwBsXUbB2wob41XR53o1WJUQcH27CtY6M1NrmKEhP0a7dHAtodZhNIG+009C 7jP3IFyvZ3JjFFB16lARLW7BkKwvDSiMTE9Yas7kEhp3OVRrNEojgH6OO7uD1q30QYkt EecsDf1gfIhzCx6PFsg1CQMXDzy6zwtLgWK4UaEqChMXrglzCKlMCxjopAOlxoCw1v+C 1msHqEO2seqwMUVOs6jpgip6/uVb+XlTTNA6RXhgkLLeTsHSSnzJBwWp3dYqb1gzwQtG 9+xSh2p1R6Ryp+KNnWMWXDBi8iUlIHkMJvfgTpO2jGBPmFkR6RVc+thQ0psHaSxuBn0U AA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36p49bersg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:34 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUHT8067740 for ; Thu, 18 Feb 2021 16:45:33 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by aserp3020.oracle.com with ESMTP id 36prp1rjuh-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z0BTWKgSt9TqM6XhNL1i852ZdmNtpmC11FpzGq0XDuP3y/IBFE/yGmDmu926YMAt0R8GEdwxX7s69RN05Phk5HpQsru0CNrcQ7x2DCoSAsD3yIs7tQ2jtQQMMueawLfWeAHGi4zzuPmapxZ/C+7OectvbrV01rTqgWvRQMvjJVsB5dCCaNeOaWvc2Yhq5wyr/93ONXbYExWF06L7/zpKvxN92RjYeancorFNKa+J2XeAN4fOSPilnhsYVG03WmeYP3FqCFwRteaf/ArH5UfPDd0HcCUia3WWjXsfPvnik0XLeXrv/P00G6wYCgH9FKa535Dc59ji/O7JkbUDVfDu8g== 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-SenderADCheck; bh=d1cgS9gGRVyt4lzZgTDwwEPzKeAYfXnZ9Hbtx5B/fUg=; b=iNCOyrYt8FNDlOlh43WKRHAlrIvR0I9dtJOstnOcaW6iJq0hMFNXvLD4wUFg2Rq4gtJZpIBLstINiWBLrqW2in6WDrEOx78b+fZGfotCBJa6FLCpBE26G9Hgf5eI9XuNrVxQyiugEoAAglOB8n73DYNsPScf5oOjmHzW7U1Hy2WSahlharhncfjJ2JEIYrA0mywBu7fcsUIRGkXbOwvBew0aLbq/dnGhriG7x9CsCui/AooggXrb7Sicc06xNXMytDuPEswJPxj5K5CwA/9QFq3liiMOzngRK71AMDyoysUyKw0tcKDeG9OZ25fkTzPaQC51WCq50E/oQQV1FNOiHQ== 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=d1cgS9gGRVyt4lzZgTDwwEPzKeAYfXnZ9Hbtx5B/fUg=; b=f52VieVvWWesDwsLTyq7zN11VhPz6qk6NA/AUxFJs0FCADaLtbhq73XS+cobegs+vWAGIas+kCAOrvEQac9AKzhgah3Bd9jTgmTl28FtN3Wx0iq+3xfn9yCfLVUxG5a4UWtkAzd0sGRyfnt12lISqmk2x4F5/FnqcQrBehKDIDY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB3461.namprd10.prod.outlook.com (2603:10b6:a03:11e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 18 Feb 2021 16:45:32 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:32 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 05/37] xfsprogs: Check for extent overflow when adding dir entries Date: Thu, 18 Feb 2021 09:44:40 -0700 Message-Id: <20210218164512.4659-6-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f297e62b-7d4d-4a39-c718-08d8d42c9b20 X-MS-TrafficTypeDiagnostic: BYAPR10MB3461: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:506; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ay+C+AhlZZVlhANX7TZYQlL/LyRNct34D2K7g0zP5VewcZXZPxD7RBkRanYSu0lBiA8RSkLx/jPkENlu76mrv3cpEdIU0FvOmPDJWFDP7hxP7+L+NcfWiCbNNimrqBXpfaZ3iOIzlXuvBTl+xB7HwBMXIQpPVEmpnytYdthyooO5yWj6WYJD80V1Y5pwzD5TtvB/BkO5ij3Pq4CfSywD0KEn0DIYKfxmIQYMB53fb4bVthUaGO6VtLinIM5/s9lq0yu+Jr3gZ31p9u/l20EO86urLzq0jp2yhtXdFKZYhibUcVC9PcMTeG/fhHaigMOp8aD2x6soKR/7XYQzkJMJUENVNZM/rgwnp00VMkaPAUx/OnJom4zxBK+XZcCIdTZHKHONJ0CSHM5h1lDNuXoj9ordCh7h1+j6oq4lgNFhReyzDx7SaxE9ltVvY5SB/ci3PcvEj8hC0r4nlurNuUSz4J6dcBZBHE7LgzNY1oiIp8B3qnkFAZPdXuHFUz9NIOAX0mZeVQRUah5yQaISXYfewoS9dS5ilEe75allbQnk1mRc2BqEFhAB4POZ5HV+An7+RywR3439/7pnwmCnSnSHXg== 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:(366004)(346002)(396003)(376002)(136003)(39860400002)(8936002)(66476007)(1076003)(69590400012)(6666004)(66556008)(2906002)(86362001)(316002)(26005)(6486002)(52116002)(16526019)(8676002)(6512007)(186003)(36756003)(5660300002)(83380400001)(956004)(2616005)(6916009)(66946007)(44832011)(6506007)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zAzrq21SA0Ci0hoMxZ9pH18qU47XA8fyshVsrYkHAW4LiOHYK8K9of0rboWWBRQfgIZ+aBcHBrKwp4OpX9DLBI1Eg2LDRX9e/kjhK7SDJwCUZdLURH+p86XSYnfFytFzNZz06YsXBc9M2s9o5WZ1lzaCfP9lSpaN4m4mFklvqLBRmDuABQB0kHt06NfXcstPMgBw5RaPWX1iIsNtc9b/x47ZSlA5G/NtgM6zDYOjOgbj0F+RXV5eV2bMZniatJ1OIIxXiaMBzP8U/Gx6GT2shxWOQKwy+rGDCZAkirpnxVeAopIxluF30fBv3TAbnjRRKKboIcw+yKfOvTBmMnQqgLdGBFbasHDxzAaapW0qo91fJIjrqiKlw1afCbZX8B8FXXp8HzOVzMvVIzfjQtQefG6vfqRhmSCjCyH07a+A7b0B6h+8xNORA9Z5E6AF8aOM6FHGsjXakfaQof3BgIztRbBEgq5RJ/aHa25Zo89M/IuJIvafg/T1SEWYFFnIO4gHcjpGDGDr4ZhACDEpuGnB0KNzpI8hc3WlFffaFRmrdPtaGKea3rarGvKo0fz7nAeWshp0IPC9o2DTfUV01m1iRmkA2MeHq8wTU+sElNlHgabRX/XegQMrOuYhDcMWAeKC/LegjtivlABxTvq+LxCx+cPPyNLDBsdlkvX2z572z/tpoeUkTgE0JJe0eB8fHO+gJtl2Odi41ia+K+S/V8jYorqFfY2BbowVtZdlw8HHUeL2paRQP20ptVaBHLlh3KIHFmPX9SlliNuEavx0c6iRWDsy6a1xXJGcaVgze1qCrgfkJltmbgiY0ZtCTPHBHBO+kSFqMaE9DW6F8UaXZnJV0yWL4r+e4QEUHDEeEQ8U1dPbb9dmGrsnpCtrneN3cKGFPef5GA0uMxnXVoqYepGbpmmOd/HZiojzeLuPguk7NpDq1T/BY5B7nGqUPy8OEo0P1W2nDmvGxDlM9gO8K4fqhdy/AYifS+O8+RCbORHaOo813YdlWXhc/ZL9XNgsNH6hoAHoGolxiO86j/sgpHwEUpcm4Ck5iaBr+lDYl4eniZGNNBnKgoWpplRC21OXnj1qmZfxx6qAcCjQaoUnmPL7tuTGiLWnMxfsAmztO/PO4aoBA9H/TPiW4K9QNh9y+FB2PCji4HLy/Ahk+Q0D91jl+yQrSY561uGH/ndDXdkfHHTQBuVKBTmEwCEYnLeZDFghnb/p1qOBBmGVwy4Ktez/Ul0c5Y/D51drmHZ/Ud584gIO0yAA1dyQOdadVdt0AQNms9MbbmUVJJHsyiK7lsv22pqt2vFczngJJNjLEKLT7s2wqXZmq4OJd8GVTBASh4lK X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f297e62b-7d4d-4a39-c718-08d8d42c9b20 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:32.0495 (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: FyyeDJtZ3n7IcKT2bq1Ui33RI9Nw83C3gjqBdPKdjMh3GS872/TxxVz78Tx8gcsfLuXCvDX+kisvRLaHT70HTRD5aRn2IpylhghMt4J+UlE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3461 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: f5d92749191402c50e32ac83dd9da3b910f5680f Directory entry addition can cause the following, 1. Data block can be added/removed. A new extent can cause extent count to increase by 1. 2. Free disk block can be added/removed. Same behaviour as described above for Data block. 3. Dabtree blocks. XFS_DA_NODE_MAXDEPTH blocks can be added. Each of these can be new extents. Hence extent count can increase by XFS_DA_NODE_MAXDEPTH. Signed-off-by: Chandan Babu R Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_inode_fork.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index bcac769..ea1a9dd 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -48,6 +48,19 @@ struct xfs_ifork { #define XFS_IEXT_PUNCH_HOLE_CNT (1) /* + * Directory entry addition can cause the following, + * 1. Data block can be added/removed. + * A new extent can cause extent count to increase by 1. + * 2. Free disk block can be added/removed. + * Same behaviour as described above for Data block. + * 3. Dabtree blocks. + * XFS_DA_NODE_MAXDEPTH blocks can be added. Each of these can be new + * extents. Hence extent count can increase by XFS_DA_NODE_MAXDEPTH. + */ +#define XFS_IEXT_DIR_MANIP_CNT(mp) \ + ((XFS_DA_NODE_MAXDEPTH + 1 + 1) * (mp)->m_dir_geo->fsbcount) + +/* * Fork handling. */ From patchwork Thu Feb 18 16:44:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093895 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E0CFC43381 for ; Thu, 18 Feb 2021 18:46:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55AFB64EB4 for ; Thu, 18 Feb 2021 18:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232600AbhBRSp4 (ORCPT ); Thu, 18 Feb 2021 13:45:56 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60396 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231858AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUTS1059536 for ; Thu, 18 Feb 2021 16:45: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-type : mime-version; s=corp-2020-01-29; bh=Pwi8W5JQ/VXAEsCu8s+pt6HfHMOKFOFm+RgPQLKMLL4=; b=MJr5En3v9Ec/AkjgfoDe33e6Uw3OR/V2eMrtUQzlkVHeU5t9jtWROqsGguLS77NXuUz2 sS9+/4nOluyrigIeO1uwRoPvGArbBp6eRt8wvDsZvz7HxerkHMFSewWi0y/Jwt1m3C9h gE7t/MoadmB59Rg+opA6GJBJsgswSTGZ+vHETFkBu7dxK4GqKTBO/96UuEHrk7JdM+Io uxVSNmDlFh3NwB+ZCi8l/ypkdiYL8VzaJn9PsyUYTZzUxXDgq8444SKR6m0zmFuCfjbJ Z01zySVmAsqaRIvbcYDarKR3643CUNozRohGLMM8vb7Nv9hv6EJrbNFac8YPmj2FSRd+ dg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 36p49bersj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:35 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUSZR114925 for ; Thu, 18 Feb 2021 16:45:34 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by aserp3030.oracle.com with ESMTP id 36prbqyww9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F7/wG4kKBwJlnOtBxRmXqg2yrawqIH2/vncjK+YNStAigFzrr8ePqqHhQR/iChlj2wVcCEdniwdMsNla6EVQ+aFwl6mfR5YqCJ91DRgUSU6Dqd0P2vpds+3tVNqlYKewW2sarnj2xkTyfp7/yApJtDB91sIrAY/wnh18/mSPRPHCc+6n57y9zypyqglTghG/vMJYuTEdY1Kx2LGfanl/E2moZjw7P8PrxnGLkU/hlyKbQM1ySJDYTWGJYZxMZBmfxtjytwCt3ZzmpbvtfIB9IkRgFvDvDq8j+G6qJquladZoStwg+CoutbTsBqrMFwXZmgd48LVGcNOJRwPHXE3wUw== 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-SenderADCheck; bh=Pwi8W5JQ/VXAEsCu8s+pt6HfHMOKFOFm+RgPQLKMLL4=; b=CzPJmVsBrNNZT+SGxOA9mIdWUXN478OmyPUxU3dOx41TjpbEeufcBvccYEJiFD3rUxxRlsO4A9Dz/mpX08DgQ6cSG9QOsyPr7RBmelQ6BpkDlpifGtK4A8E+J+4QLOGBw9SQYinAc9CfPZkHZ1Yr6/HM1XsiCIoJcjcLTPrIPybgxtTuamYHbFfl3rX9wYyThWLKS4DQQNU3kq+A4v+Y/32IIvAyMfNQIDKWhrLUw+uTEJQazeanNI2Z4f1G/bSCnEG7NdoZ+2KY57EXiq5ycW/b1NXX8gffHNsGfg1VpBt5q3xJYn9gvlvVWRd7sqTtUcS76yfoYCZ5/VLIG+5xLg== 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=Pwi8W5JQ/VXAEsCu8s+pt6HfHMOKFOFm+RgPQLKMLL4=; b=pB/9jG0wCsIVBhmQgb3QTWFHXVp5v2AMv7TSPvlkOKQo2lEffo2llve19hT6Wr1+7l5hmhRBaqXE5P3Gdlf0PG0/tQCYHkSPtQw4r0RDb4VLG4pUOWYcIB69yCTd9xQF4tlWNlkNCY0Cx6UsGz7+IBWRhXAJxqrcR3BTDYiZLmo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:33 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:33 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 06/37] xfsprogs: Check for extent overflow when removing dir entries Date: Thu, 18 Feb 2021 09:44:41 -0700 Message-Id: <20210218164512.4659-7-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a14a1a27-49f8-431b-f6eb-08d8d42c9bb5 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WlDWvtxN85t/z3PM9u/ptb7tJQqnp6iPoWAs5CQMyu/fYOzxh3YFFj0a3u90b0uPM0YSy1m6+DbxqF7TRr/GJG9IkugpqRjtrIzV2vtnlbu1PMN5wc3dgGF5ruSuL5p3zcunqRwo54EJWaPTWecq8oThrqba8Yq2Q7pwPT8dCeuG+/DSBRWLIFwKTMir4/yN5kJ7T/udmdoRC7N3rAMHd8tWhGFCH2bST8zbwnJRul52oNaPTac6aNKYpEPe478FavcrEzC89TcDatZNAeJL4LsbE0nb7buSX905fuP+z9l1y4QF/RXy7NnlwpHHuJaj7oX2iWzc/6foD0r4EFLjVbx0UmbPKlyblXZbOkMHaUOwelXzuhh2yKcnKsAuZqo99vnx8rOgcxDEITnhAbwiK5Lu+fR1RMwLx/ODCjmFbm2VrcpHXuiE/mSK74LyNHG7UjRotl7D8aDp48BmFD7xSgNXd/6BocuKWjKQs89KnoOnaoHYMWElRl01TFesBExI17K15uXo6Tbtn7FaO8g9LYfxpVkyWt5z8+IXVcslsLGabj16dJ4Y/mhJyq6IEG2vqZIZxQbxNmI0+8f9Dvg7Mw== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(83380400001)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: j+ueJ6j28znGakJXpJR03Nc2J5r8w+EWHrw5ap490wobQp9xu6OXdz5x+vgbWgKcnFE0VLWiK0hCtDJonqekMc/bjSVoeh21hRokg8o3I9f4XcVASphCOu2j6lK0j1REREm5T3Pj7wCRFFihygHnHrZZVLF7YBvWBES27XpiCKx7CGfoeXgh6x6n/AuCVwbROF0gQRHXueIlwo1zhdIJUAg7DhA3ixOa7ck4uvw37th6+POnDPHhcDlcbD+FHfyqH8vRrLsfraMgHdwSAGIoINgTNmLBYtSngEGsdK0ZZCs/2JDbC5USO9ZKkGizULJpCpea7bUTsw2v4Aj1S3bBbM/QNzB3pnhCndGuurh7oTfk0tPH8jBLlPDmGoVxIjp9riQ1rYxkKztgjncDbOUMWwpRZPqG5YUYRE3csL6+Ddyal5xkpY4yfS/APaflu+k1axl930ClMInzRKSweOTXotDGMzUK06koLrkE6qXT+3+wYa6OkMtZohqsmQ7DageadmnpmFO+zelcP/01GZHZTadRCvLK3F7V3zFujZzh72EGj680VlVlIY1zdG4ox5HWQ+0yZogZAO58WY3cZVYZWQHkK4nT8wfdxnCtgiQo4fJlwC9v7UP3G2NMaxXz7tCe/BdtpkULQnubfK4Ljhmm5kOqXQEMyFnQA1hUzCBuYMZMcVobI+bSr94X31UA29PZ4mi4HRbqqP6gsVwU/DapPqxoncFjA8h2M1FakkBcbN3VkTuUc6lP91NXAzkIm6Bh10UP7d9Spi7JPRy3hZQcfBkJ/izcgHgLqjN/tvy6ZfK50LfTgaERU1/E+mXqqikA3/XuTiK0Jm+dqBSk8DWQ8ptAGW87Y+BtLaCrUkYCISBZCWg8FYz09W0IKPHXFX4RWGJ2LAsnTpMvxuuaXdL8omk0oUL+XpxZi+UspDVfhwY6XW8qvz8OSgEgX/UXzc0bR1C3RPpf4091StAm2HLMvZoMtl8qWHmScVXFEBCFCcZWLAlefs5lzF22nSk7F8OIMbeb6EU2XlPqaRsVVoRKoxq5FyssE0zQDF1a0DQcAmM7ZM/2cmgawN8c6rspXJDctT8YSJsclJ0TeUSgPSVXyGma3PAj3fMtUdYzkabvuFMs0U0O2ZoihOoPk7CByqKQBrFxpy3x365sRMJxu5CbxqBQn5fzcXDRxT3zw8raXeaHAyx8J2CQPgyxucu1SGDxVC+FcFZbrT5BeerRP7TydpLNNIWaB60B2gv4PbyPVfKl3/6ZIpzuHrmZWswlgMfLS0+bqVzi+J+6IqFmB9pYA4+tSz9OCn/ax7BO4gAsJia1dNV7TWQbhRECCNgYab/L X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a14a1a27-49f8-431b-f6eb-08d8d42c9bb5 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:33.0810 (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: YibSoX9vt701wrM0ZCpaS2/8XEKL6FD0oKm8oFjXxWZWORzctNRog1smrKFzGKX77Fw4WMAPQi47+5qX0TZZpAm/M3yctzjtCVdWNICY7eQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 0dbc5cb1a91cc8c44b1c75429f5b9351837114fd Directory entry removal must always succeed; Hence XFS does the following during low disk space scenario: 1. Data/Free blocks linger until a future remove operation. 2. Dabtree blocks would be swapped with the last block in the leaf space and then the new last block will be unmapped. This facility is reused during low inode extent count scenario i.e. this that the above mentioned behaviour is exercised causing no change to the directory's extent count. Signed-off-by: Chandan Babu R Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_bmap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 336c6d6..e3c6b0b 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -5144,6 +5144,24 @@ xfs_bmap_del_extent_real( /* * Deleting the middle of the extent. */ + + /* + * For directories, -ENOSPC is returned since a directory entry + * remove operation must not fail due to low extent count + * availability. -ENOSPC will be handled by higher layers of XFS + * by letting the corresponding empty Data/Free blocks to linger + * until a future remove operation. Dabtree blocks would be + * swapped with the last block in the leaf space and then the + * new last block will be unmapped. + */ + error = xfs_iext_count_may_overflow(ip, whichfork, 1); + if (error) { + ASSERT(S_ISDIR(VFS_I(ip)->i_mode) && + whichfork == XFS_DATA_FORK); + error = -ENOSPC; + goto done; + } + old = got; got.br_blockcount = del->br_startoff - got.br_startoff; From patchwork Thu Feb 18 16:44:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38917C4332D for ; Thu, 18 Feb 2021 18:46:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E54E764EB7 for ; Thu, 18 Feb 2021 18:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232876AbhBRSqB (ORCPT ); Thu, 18 Feb 2021 13:46:01 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40722 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231927AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGT0Lo155614 for ; Thu, 18 Feb 2021 16:45: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-type : mime-version; s=corp-2020-01-29; bh=bvbRpUaipwPs9RD8GcYyviomal7AeV+4qbbnioKNnBE=; b=sy4C5gzy8DT9dGudLgKsr26qzUixZ2Gfov27CsgUQKT60guJJ4QQ1/EXB4rMv+8N3Dyx hQdgOxaSdbJO34eT5kOCdoZhJLYRWW0Q3srbVT2C1o0P/PXNqviYSlOyAsjGr2Wsuxmz q7blCNn0qkfUSR6cKVDSSVB+83L2Qda7m0pS9xBZfJ0aNHe5woJxpyRDAdoidLXN+/+A VbDGdePXzB+3+VhurmcQT1HuG68UW9tM0j8aL/jRUfiPxlcRPezEwNK7fd68QGo0RMrQ /W52X85bVWEe9RlDO1cZsPyfXFO9iq+nyaAL7cI0fPZRvJB0MRwz7jVbOd+FFVZl7Ani Hw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 36p66r6m4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:36 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUSZS114925 for ; Thu, 18 Feb 2021 16:45:35 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by aserp3030.oracle.com with ESMTP id 36prbqyww9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjG9qHY0eDRm53GiUqzrdNoXolLFZCUtlx2go7U41VDf2Ck/pwgVr/oU+P/+g4VV9rhA19SK4x6RWP4lSOMfNmSA5r3r+SA/16VpTzOfvx9iKX/exx4TL651HLbTW1oVk5axqgrrVWrqOqfBUDm1kpQEAP1VLU1Kd+cuZDqhfxFzpxFjkKEXfShwJnZsqHEx4ZyCCWXPjs2NQNoDh7R66PzID5vaQy1yeGUlgfSniit25kMGjmHPIDTTSYIbfBR9lgMupv2fVf4ZrUp0XkQiwS5O7kMAnfTvMWVthYR0j7C1EVwpf01jAHlnr+OsmGov/y10ZZUEvX0TkzcZ27acvA== 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-SenderADCheck; bh=bvbRpUaipwPs9RD8GcYyviomal7AeV+4qbbnioKNnBE=; b=XmhdjSFAPUqDQ2hDCACCZdd2ErJCtPAW+NFH6u1gGzSONXZFYgEVxXy4t6UfvoDi0SPTsTSqLHZl2sfiaV8UFi10s4IuS4EEx6cR+RmiwyzWiaWwfeRtP8lZZEpWd32GRplV60+EH/cGp1fAE2qsqHWzwz1R8hhBbLlqJNOCb5NOuvDgLRFBISHV9J2Fykuh3CtrtSjpeV0nuxd8KHAmlEUYdyxHny2R2gGzZR/w4FnyN3JiqX/bMV3c6tJnoxaq5scTb6GYIFfHgrp3PY3h4UUl05oLecCwxANqHGFA+1qfLBeMLtVEh5abgxx+eg3Gwm33RJf2fqcKOrbSSRU4zQ== 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=bvbRpUaipwPs9RD8GcYyviomal7AeV+4qbbnioKNnBE=; b=neX8SMypnt/Ua7oVg8BZNJzX7iVZduTp5l1eoq8gB/VzPd1nDcYvJvEfyItCULyMi2efZ4tTC6YOxCALbfLm1ZN8o21OerxIOJ86MaqOU9NMMnURD0o2EMPycm046a/gl1e8vMvx7RTWOk1DFDcvYxRV2cKlr0x8O2z7YFrJ8Lc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:34 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:34 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 07/37] xfsprogs: Check for extent overflow when renaming dir entries Date: Thu, 18 Feb 2021 09:44:42 -0700 Message-Id: <20210218164512.4659-8-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 064c274b-eb2f-4996-47a4-08d8d42c9c59 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 40tONnggPDIKrssNSdiF32blswDmXivlJTGe3SpmdQ1u6DzZtk6MioTNepmNm2uAc8B8+mSRhDmVqoXqplZh8Qt1+DcrcMi/YFfD9hz2GUFc3s7ymINJ0fCehd6soAR+Ltd+RP+eclePDFY1NpWXi+812rw9Hs6bZi5OpuEVQu3ffSB+HZIZL7Abh20kSENkzupLWo3DlV86oSQair9Gi4vLCaBY70PuwEKigu/VWJXYuB93eWWVuA6AWX34xJWmd66iHYr+ttu1rGMQ1RzihbVVnnF4VKFdBKYX5eUXfCoUP9dHt+Wi4BovI6CkgPFp6T7e6YMquKrlsJ11e35boTZalpFcdDsB3U8FqMqIfqVTm2B73if3b0lI5C9FCuF5MZ4+hDNHJiyzjdcV1V6keQr5h8vCZp2jObon582PkVuq12na02hRvUat8EoOuLPxw3bD2WNboaCz+Ngg1npWPj4gjJb/pghoyNf2NFHCysFvgZ3DAOL95v/pDfN/RU1fqqGRwVimCnTqTL5TUzH2K8RPUlADHSMWi40kVIPxyXd/P9EdJ1MoZIlyjvWGewifQjo0cyf+uGBvODzwAezNaA== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(83380400001)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HQMtj5TRZ3aXvfgmEBfj+7YE+uqGChxglK5vyoMak2FSLLzRHYlGnePnSLYofuHpNLC4E8w/1N/WJNAEIUQLdBQ8zQjsmsPVzRP49GI+LXi+58nHU4xg9CY2VvqEjhZM47OFf4CIc6GpDxkO5438kYTcusrKFsrGZlKivyPLQr3ou5G3wxFEBxxvyQTMAIaUCEQdverGb14zWg4jO41wLieIhZPhKG5HLS5yONL7EhUHVIpi+M3VjkAWWatoZ2toJdWtG3sKWcJxhiU3iJry632EFFrvDb135VV02bbNx9MeN59HNvd3cSDOEWMuISv9s3MnSr8KwE1slWe00umgqXlrNj/BVhN0BB1xgVQUnBu1I59QR5kIBhQH9Yig9uEhnQTEyCMSnGdENhVzbO8YJkZUyq6UY1731j/nQP33G3kEit1BPYCkTInywnpxxv1lagqxCCKuQpDLPEbme0F73GcFKbRkt94Rp9aMRIhw0FWZozTv3WD0gWbgTf7WtdelUn1Xt5x/ACKJHaoTIXgkGyZAhwFowW+sNrHGf3h7GKrUPJqRFInmOS6zwNK8/gqB9Re9U7pRuRWEC9yfAEyWcc4vQu/5NZ+827IbExIsE6K3Wak/qh3/lGKAsxqYX/1Poqn6HlW7aXoU0CEIvRNw3dRLICV4CUtHIxwDpqLZlsyhmZ/UoFdF3tmMvMW+FyrPRGRywi2xT7DbOfazJU8SerqJiN+DhIqT6EsBmrJgq54nXZlngBn3+06CVOoKIX5n1HCwJveX+UbcyHLli3MlMu8Run4da+hLP4c4iKlOK5QQsRJ8KcNmzNMHqwFxlKwxhBgFYjSy5g1ozBqL34PZTbwkX3QOOvi034jWqVbb0pumUA67E/uiGBgej8hN2Z7g7RNf1guPEzc5bOjAYgguq8lEmurB5il5OkgdRWFndAYhTJT37Src4IwjoY+ANYTvoFi59JZy0iAzBhkaMpXJJ7rLMBUj86P3mhtDoyotSBSIJfD7CLmPm/qVs/m9qVovsCITfctZUPKh7qdg5xu+fihpZrhcaW9pt/TMa4/c/3aScm9x8OvDxljdJ9VxU1w2z1zmuKHZiLVSyB2YeLxLS8Qm1vfF0KL884WGjyX5lLmmes78kYw+hW0Oi1hos90lQrGeQ72LoqRJpuVoI+YvQHB7Y4GrO3c6etRksmc3N43j8jR/Wndwju0Av26XC+zkEGYVS0eCqMyTFCvXdJNdXufKlz7s4eyZp9tfwzMfOOcnUxcVAEmR5/2Hfz2s7/IZpj41koKF0matNDWGnXGbhvpGro1nNPDlzV7NBgsHf8rsutbSYfxTka4gdQZVRo1y X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 064c274b-eb2f-4996-47a4-08d8d42c9c59 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:34.0816 (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: 9CYqX3BUARer2Ue3I9vmvtmavgWfVh1YnRKVx8HuPzJpw4Ym/ZEYJRXkYtqRE+r04Gk29oHtmM+SXqj0wL+Saci0JIcQ9a+mcgHkKopmaKw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 02092a2f034fdeabab524ae39c2de86ba9ffa15a A rename operation is essentially a directory entry remove operation from the perspective of parent directory (i.e. src_dp) of rename's source. Hence the only place where we check for extent count overflow for src_dp is in xfs_bmap_del_extent_real(). xfs_bmap_del_extent_real() returns -ENOSPC when it detects a possible extent count overflow and in response, the higher layers of directory handling code do the following: 1. Data/Free blocks: XFS lets these blocks linger until a future remove operation removes them. 2. Dabtree blocks: XFS swaps the blocks with the last block in the Leaf space and unmaps the last block. For target_dp, there are two cases depending on whether the destination directory entry exists or not. When destination directory entry does not exist (i.e. target_ip == NULL), extent count overflow check is performed only when transaction has a non-zero sized space reservation associated with it. With a zero-sized space reservation, XFS allows a rename operation to continue only when the directory has sufficient free space in its data/leaf/free space blocks to hold the new entry. When destination directory entry exists (i.e. target_ip != NULL), all we need to do is change the inode number associated with the already existing entry. Hence there is no need to perform an extent count overflow check. Signed-off-by: Chandan Babu R Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_bmap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index e3c6b0b..e9c9f45 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -5153,6 +5153,9 @@ xfs_bmap_del_extent_real( * until a future remove operation. Dabtree blocks would be * swapped with the last block in the leaf space and then the * new last block will be unmapped. + * + * The above logic also applies to the source directory entry of + * a rename operation. */ error = xfs_iext_count_may_overflow(ip, whichfork, 1); if (error) { From patchwork Thu Feb 18 16:44:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87CBAC433E9 for ; Thu, 18 Feb 2021 18:46:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AAC364EB7 for ; Thu, 18 Feb 2021 18:46:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232303AbhBRSqk (ORCPT ); Thu, 18 Feb 2021 13:46:40 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35586 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232433AbhBRQrC (ORCPT ); Thu, 18 Feb 2021 11:47:02 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUGhE041018 for ; Thu, 18 Feb 2021 16:45:37 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-type : mime-version; s=corp-2020-01-29; bh=JZ0gj0rJsZ+GxKmzl7PpaMqUcQWoH+366YTJeQKNCpY=; b=CSjoHxD5SGMsh1Vh/xPEoGLZmNexpbYU97FHyw5OWJop8q+O8aKSRgxRMFUaofdUqSit s5iehICbO31bLWxIDZQ0kIXdARmr1rak6+mv1iy2rJW6nuFv0U7Jo0iksjt6C0fwZyNc 5Q5sfIUZ7ShzB1xwO308iDxNiYm0n0x8vtvwz+DMT0p3uF5+K9kZSXSl+RyCS9RkZxsp NJSjMphDXkgYhuPirOsUgPwGH7xDo2nwO10/r7QJ3bYzGUZeg7U17oEhY3Nv2FpycqEw 4t1bs/iZVWeWgtOt6HkLBzoAn7kElaa1wBQQlmDUnVJwlms+t9Do9wvD3ZkfoWnoOnWU lA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36pd9ae3ha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:37 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCa6032333 for ; Thu, 18 Feb 2021 16:45:36 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ah2R7yVeVPjgP+4WQanVbecbcQzKHQnV88sPNbbsJOQlkFR/us6a/vzaUVhwrSzss9k+tE3ur8mCfxgvKORSjAP/O94psKIqVDCZuKbDlpybqLu5UgFZa+xUAiKPofeolKrntFQ/1eYok9ko4fOp0VCbv1QkTuizA1Gr4eyzCThInk7h/7Bf58AeShCfy+/4kETXijl3y0dkyW3APtAEuYVSZhnUgY3QRD4/zrKgshjPrLc5RDLLPlemareepkXlemSl6PBdxZ02+sHAyM1Ic+51BWCpMKA/uZoxWlzK2BSGGGwa8iq8fbWxt5QVEL9Qfz8NdQ8vnXSO0Afo4qbuUw== 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-SenderADCheck; bh=JZ0gj0rJsZ+GxKmzl7PpaMqUcQWoH+366YTJeQKNCpY=; b=AT6IgvWLuQazoiYAZ2J4XNz5lQkHb8Kp+L2pM/BNAy60W46kopFwA13zDkzeJEgwI7DHQMPNWz1SLloMJQQTOE8FnbyMcQGHnqLn1D9/Bpx8o/nROsftIkHijn6a2zHR3oKus03ISWp59A9iW5QLO95YYS9x9XkldRdBKm8k+VvzwwZFgkc31wWq4PSB0nbAX7eIsgJXpE6EjEJ9mdDpHnFQI4aG0a45s+uvwf2FS8guhPJvRva49yZYFEDTy9k9hCe+yOlXfr/T3ZDcEmN5hljpxfaJrssw8j9XBshlK1gmsS8FfhL8PVevEKJUdLDyywH1ngqnnMVSKVjhSHjKmg== 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=JZ0gj0rJsZ+GxKmzl7PpaMqUcQWoH+366YTJeQKNCpY=; b=Nlt7kQSry616Xwb709MvXxbCpbTEHZRcCTJUNZhkBtqMPx135haXVpyvXyGml6dhEB5/ZB8MBnxeHlXg/T+0TnIwCF3ghi0fmgfc9/rZ8M1GnJiHkt0RbHVnfyhG8QrguLi3kKEhPGMdMej6Dku4JuhFvw5Dq2xK4qLi94glawY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:34 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:34 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 08/37] xfsprogs: Check for extent overflow when adding/removing xattrs Date: Thu, 18 Feb 2021 09:44:43 -0700 Message-Id: <20210218164512.4659-9-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87783017-fe46-4e96-d255-08d8d42c9c9b X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:549; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J4dbKOgUoSAiiol8ObOxREVn9bSg4eXVjCa81n4/2Do3u3C4JuwxlCNHd4Vw1akqkMBcZUPMrklrEEINpQH7UhimC00EpUl4ngZEFNCwSHU7eMyBr8rp5sGWcwvMtWj4P/eAqmopjhntY5nJmAhWhO4gIU9obSpAGkiiuNKlWwcZ9PSuazBuXC7qyOxor2lvyh25oEh9mo9g3OLUvoTuqMXO6vCvPgcp3qqNcVjaLtAJB6LvQRydL6FUyaks2UGbtfFQpFkR+6QwXbNHHTFSX48Olq+Mzhy8YUQIM3Q1q1KW9IiQvxp1lbD9GlOfQ6q3tZBnLv/Sx4nB1+UhxBEEmhtVG4kg3nQYQtS2IaFWGhaHs3YxL03yA+nIZV71EbTjeAlhuE9QdlqNmkQszr7+vm3i2QKjTSQ8loCNo280fGyZDWNQXSHyl15zXUiPFpyaaB+1URkl8Cazu0Gu+Kh5ElwT1xGUmcjNnFifGTUDmWst684co6iK1rS4I4K0o9ePScf/tpVW7OKHluwOvbf/m0iaduPjUlKD4IXcS78F0fnzDz+MEMFI2cNyhJxZ9qCfhjy+ySMYbfOHSWznXpmnfg== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IjQrNe19o3gDyh0SJpyIKYyuJw60IhXLF4ZBa28DnGcRtm4gJRApF8mfUo0tm2dCE1NEyLQuwc9t05gssAJgy0Zwzh22C4Twj/GevvkAhbVcDA2ohr13n0oFKk3XLLiZO+1JClEtMyeTw1DRZtq9hXkeGzia7mA0sZ3WmfeG3iZUpz/z3nbiDdQ+3zmVc2iLm8K4WEbDY7a0E04z7szxfHqfWvoDD1vGI8s/WpdBj1DPUzkmDd+Xrn7SunDoroDn4Vh7SAgc7pLYwSezFw1QLrYtnKMnRMbwpD/Wxmd1pADj4tiHUoQ3jzwau+NRo0i5fmCXD51tw20zvKea9/XVzsLn6q/IEWxeYrbSHg1IM6R2bkclXSjrjYukRIvcQIIdtvf/i8Q940tQ5t6ZXmH4L1cKW9ACdGOsEEZOdFL+lqH0OQ0ApuI9p+W5TxYvF7wo0O2TspRIfq9cuSa1uTepuCSGdxa0XFm7r5FyDp7vO3Gnddwh1UZwv/vFW3nZ0BfUHD2hmSd4G2ZLe5crNgQF+4idRXvC7gF13oUz5Ikd4FgSvmkPutS1OVbkBoRrKW5KCKpMBQmq20xIJvmwlyioc19bD9U45ZZGNgvsW3nQGj42aR7RBdVG357s07Mv8wzk4xsWeWyQid7WYYd4i3OEjzD2SENdNUBdRl/gqKRa6TQ5mDjOutaEDBXw207XqY4TSIqLw4uIKAR/mKrGwNlS/eANVBGFllhZ+z3J1hLpOXFdyXO8oojSh2AUj1T4aXJsIPo/RmeQ1xuyCpuVzOGpmqqjAg9z9jjdweA+bMrbcLqic0T6wu3TgN9Ay83GAQ3QfojSKHQB8cZhKUNC/nhd+81TSEVWKpgRwT7h+uIItru6h1VQV6tZ7nKsRt412V/aw8VuXI5MDAhYMR60Aen25Lo0apUArWDAfpKjhbbHWlZnv1KY21D2lrnxh4+dMtdOLE5bNS3A056LgdgMjT2Dy17yF7YD0RhUTTgDXapRxnL4CvKqIkzWcJF6eWLd/behM13IilVNHjlJ55yEbmzsv2Kxp7uYwd1vygS7wgjStowHAjbGPZF/NAnUdjyUdJDrIWdmTOS5r7XqhxoEDu3SF5hPw7mcOY9uWArIDmnL+emRrT1HDi+PgVIMNeHfrUL953sTFlI1Uz8OOOf2P14F2tmgxgeSWyRQ8RLqO9F3+iotwY3wasCmf3WOaQ+DXYqtJiiUwt5SmUT8NMc7yRTkycnH28kLLVgJOwBMvpK4GVANx56YjJae3R3ZfmSTSdT8ig5Xb86A/XvxMQyK+tJIMuZkvl6g+jcQ0XCuZnyEoxpzPw9J3NnaYVCSCYTsx6yb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87783017-fe46-4e96-d255-08d8d42c9c9b X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:34.5495 (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: rN0z4GvjKPk8VUs8qO5rIGp3SAsROPpPvMlbdLVXSlwoLxC3wmvulGhCFJLrNcb1bYAexfn0s+cbY25Zip1I93j8B5OVjRwL5ETYlCVytpQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 3a19bb147c72d2e9b77137bf5130b9cfb50a5eef Adding/removing an xattr can cause XFS_DA_NODE_MAXDEPTH extents to be added. One extra extent for dabtree in case a local attr is large enough to cause a double split. It can also cause extent count to increase proportional to the size of a remote xattr's value. Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 13 +++++++++++++ libxfs/xfs_inode_fork.h | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 0c75f46..237f36b 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -396,6 +396,7 @@ xfs_attr_set( struct xfs_trans_res tres; bool rsvd = (args->attr_filter & XFS_ATTR_ROOT); int error, local; + int rmt_blks = 0; unsigned int total; if (XFS_FORCED_SHUTDOWN(dp->i_mount)) @@ -442,11 +443,15 @@ xfs_attr_set( 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); } /* @@ -460,6 +465,14 @@ xfs_attr_set( xfs_ilock(dp, XFS_ILOCK_EXCL); xfs_trans_ijoin(args->trans, dp, 0); + + if (args->value || xfs_inode_hasattr(dp)) { + error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK, + XFS_IEXT_ATTR_MANIP_CNT(rmt_blks)); + if (error) + goto out_trans_cancel; + } + if (args->value) { unsigned int quota_flags = XFS_QMOPT_RES_REGBLKS; diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index ea1a9dd..8d89838 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -61,6 +61,16 @@ struct xfs_ifork { ((XFS_DA_NODE_MAXDEPTH + 1 + 1) * (mp)->m_dir_geo->fsbcount) /* + * Adding/removing an xattr can cause XFS_DA_NODE_MAXDEPTH extents to + * be added. One extra extent for dabtree in case a local attr is + * large enough to cause a double split. It can also cause extent + * count to increase proportional to the size of a remote xattr's + * value. + */ +#define XFS_IEXT_ATTR_MANIP_CNT(rmt_blks) \ + (XFS_DA_NODE_MAXDEPTH + max(1, rmt_blks)) + +/* * Fork handling. */ From patchwork Thu Feb 18 16:44:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFEA2C433E0 for ; Thu, 18 Feb 2021 18:46:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6F35A64EB4 for ; Thu, 18 Feb 2021 18:46:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231490AbhBRSq0 (ORCPT ); Thu, 18 Feb 2021 13:46:26 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40784 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232292AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTAqW155830 for ; Thu, 18 Feb 2021 16:45:37 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-type : mime-version; s=corp-2020-01-29; bh=LTxh0Leuv5LYESHWFdjj/Jd8KVPTaqxdnNTe2z2c4OQ=; b=x8JC1U+kPvrUZEqEd/ecmdF6MNBBq9adZ0mYfL9fdvb20Hgs7cbM4vnBHwl4BFFihzQA ZF5KKuZnbrxpZtYZhazJ3kCgsIoPduO8m7py62LBqb/lwdS5AvXz41obe53NTSPwUGyT 8/te6UHZz7FpwVs3AQzHvBDej6UpHVVg7L3rgyonjSTIhjrlIlbPUSI65uPGO32RRw+Y B3g2PMWJp63QS2IlEk+WPVrvYN2GqokMtMENpxOZdOreuRTUemA3AyXO58q6/25Xrd70 lhkBCM3UcxTlvSFFFL+308TvVCMDpKHpe/3oXscQtlLpxIBRl/0LwZQ8RfnWN/b7kMAO 7w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r6m4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:37 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCa7032333 for ; Thu, 18 Feb 2021 16:45:37 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XRKKhNdv9e1mIZ0O9afHJ+LhZaTJruOLPfEXRSJ/c0CmV81ZhVOTWOpKVehf7NTsNy8Cr99BARzaqZK62amDkfKZxj3dsWsuS1TaESdMd8XXUYm0XzVoS3bDe8h2zJahloJCKz5xEIOjwWuvpae7tuAi6hdJU4ulFg6xFwCmWYvCvQDmEB51XRiTbqNNdLiUrPfrNa5KONJGosCfrfuBf/3aRFsTLTnlQdsK2ZPzNf17zwZOkz4SeO2L9/NJM+yVwcntc6Onk2YKPQuDZ3FYHU9v61aPpcacoHN1gI83xOU6pEeUF2B6YX0bl4cvAXpoeWwkC7405cP9+SxIV1b8Ug== 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-SenderADCheck; bh=LTxh0Leuv5LYESHWFdjj/Jd8KVPTaqxdnNTe2z2c4OQ=; b=dv4em7wGH60TOeS3o6D7/pt6eJ10M1d9K/MWvNOgdz9YlLvSe0ll2sHUqql5QxeTFEUz9JkFyEH0eTYx8XERz7DS/9Z39vAxrVrEfK99bLfBChNdn8Kg203N8ojdC+BzfAQdmgSTXaEEfs4/uHeEDSIjUm29xL+IUyJxZsqtaqHh3o86LnFVR0bFMLr/T8FGistcLiYobdz6uWsG1eXIftl1WesaicEwc0kEEearWq8k9i01Z+d7wPq0YO1WfP1F9+mk0Nj2Y+vW6AKwfjN3PDMY5nGYj2iZoJrq4gBiVAVB75nnQWjTHtbvA8BuvJMbCF/yuh1dUYm6oxZPSN9ZFQ== 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=LTxh0Leuv5LYESHWFdjj/Jd8KVPTaqxdnNTe2z2c4OQ=; b=k9OLd/UNf/PeMBRL9650GkMbfaxkA5uG5hc8850LUfEQLOKr+toHKtSfgYY3xWjwSRh8c/w2Xlw6CvdKaC3zwEeX4H6S9+4+n2ahRsN+/HH+y2O6iF1e5XvABbt3eqAGDufhFGNDaSN8M2XeQz41zCs5qgtuuNRjcQrN4C0WzII= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:35 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:35 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 09/37] xfsprogs: Check for extent overflow when writing to unwritten extent Date: Thu, 18 Feb 2021 09:44:44 -0700 Message-Id: <20210218164512.4659-10-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2704af1-5f7e-4d1d-5d02-08d8d42c9cde X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:220; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lNjqRo8xz+Gj+vRtpXNl0ovooPT2jhpTVVKrtuQDFq9tyzfJVKMFEpIclcoOW8FDIagYHBi1zXBcyh4YgHBlSoSYYKsmZjRQaR836zEYsgdontNrDB6HQZ0A+IISXFfzh9ZFDLGjbt40xIXahZ1rjQAS52uQyfoiAQaVViPxzgIsa+2HCN2iggUGcP2NCsQ4MnHDOnmD/K4GCDGnXDki26Ub1ImLXRDejMQV2IYgl51wZba4kyFBTkPbSkNwvcvpFBrMRMja6n2htg4yez0x8d5olwicj7FocPhWmOATXo3Fk9kcSAwoyOW9ubGG49pf3U9ev4qAeP2lCJreCZVGPYczxNTFjMUWe/8Qxvf94uFbSFp4nI7bTCE8hkoBOHuJ0Vnu+gwxlODR0KVB8nWH+37Bej/aAYVQMt7fC5RoUa7cXenkJH0VsjfjA/imPbx/AJH28dSpGs4CVBAbJAKrIlNtLYIiYY2w5/dsPjio8pX1ZUHuryuLVdLfKhaX+AysR/5BHjqHIqtRcExfEvGB/iUaSaXaHWuL2EwGV6IkJZ/j8MQ2o/oBZkLDV/2iQs2zHVo2vv+ZeJqoBXN//QjG3g== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rT/FNfQPBRye9fnye4eC2mwkm5PcbX/mi26a5mNhShUIQmJFdIkhGUWEbFy/hE61tQhGhk8YwJxB3d8DSR1PU/6HTBhXlCfyDarcMMPvXmeQx4HuHeJU3gl8+dYilKIZqhKXQQjbSGWlIpV28DHQ4z3IFdAbthGUBrWMeYb2txhJJHknntN/wmZJk1lmOZv+BgD4ihEV3v+pRcGo3G1NsYJvUI9VDsF+6JS1t18luRaH+GXNcPqGKG4XCSsQDoutM2R0LMLr56vEt8aKCLrizBB7/JLAN/HvwAwgBx7qtGCwOivJI2WK4gmQ6JK6bSbpPSzRS5VWFugsop/wx0/UuuFSLjLYh9P3B2jBSa+qyAXJQH99OShCiSwV7qdrYlK7UV92mVWgulASDJiM+CMwQN0bdOz0M92R4F85jxWp+uybvnJZfeJdHDnabTmHCfnqjR1S4LAmO4kgKQyS5IXqkzzkWDXW1qwoPLjA5A71L6DK3RY0MuYfxDibHCaAcQyIBudwsv7SOMDVt05RNwi0cwLaIJfQsQka+P9QrF7CJRIOvEiQmVn06EIPypV8CLSpMxexvVgZfjzWx7784M4jGR5N5sSUjHRuaL32cr+A6ejcEA8eiUYRZayOqWTbNUdLbCLNq2Udvx44m0OKcGmhXft9ifRxYPzsQR9MrinRCrZ9uE680IuNVat9iuu4OfIE/VJrjrYMhj+6WPTuXXvHgpUOpCqpvRi+2cf8og7wGp6Y0qFzo1R3C8wrMw6SGbAj2hIYzzIiT/OQuRqC23x5BtmaDm/Kxxd0UMiWYoOQNOKtJRslRy6/722/0PvCSG+f0ygaop3u8IS1fxYJfEzsRD4jN6Nn5gLXuMbniyzJpSLNT+LzSCn3jnyRXdixmQNhJv3mAZrxZYtE/+HYptWQ4aWBURDPHks+DhIdqbICXoIveIYAr0p+N+06Awax39cB+ATY8KUDEcbmBWKSsr2X33+tB0f+BNAJGwAxACW4a3MKpFeQremjUwBhU5lvRKtBD42ianlFheq/cIDbM8HywijEwMM1CFDIGvA8+7+yFG5ySmvUWapB9ToMPNcCdVzo6THVunktpis4okLDEboieab0xR77Ad6RvFKUPUk+UBmFdjWC29JhhSD/nz6g9VNUwQy8VK6QovjEaB00aH2xL2FvRrspjzDLT628G4/THs5jn7fb6q9DqHRfTm5DaqPe6GQy5j8O/hw/wYialy/RnhESvFYhyPZ0ObXwJH/x9FmgLVObVwNdWYBNnD51wD5UoNwXCs4uonvpsxWYSzAtGoQxcChRkkDsiFzjgSqrWiz+a3KSY1Wqme9BXiK9CdZ+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2704af1-5f7e-4d1d-5d02-08d8d42c9cde X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:35.0115 (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: eAz7WjINrTYriM7waz/T0a2Tf6BMo/3Jgf4uMp12a38+uncnSHFC6GWFXsXyFUDPtAj46pqqfPD+lBZVQBLfau4A1J4DE4hsSbESij4WvHA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: c442f3086d5a108b7ff086c8ade1923a8f389db5 A write to a sub-interval of an existing unwritten extent causes the original extent to be split into 3 extents i.e. | Unwritten | Real | Unwritten | Hence extent count can increase by 2. Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_inode_fork.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index 8d89838..917e289 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -71,6 +71,15 @@ struct xfs_ifork { (XFS_DA_NODE_MAXDEPTH + max(1, rmt_blks)) /* + * A write to a sub-interval of an existing unwritten extent causes the original + * extent to be split into 3 extents + * i.e. | Unwritten | Real | Unwritten | + * Hence extent count can increase by 2. + */ +#define XFS_IEXT_WRITE_UNWRITTEN_CNT (2) + + +/* * Fork handling. */ From patchwork Thu Feb 18 16:44:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 709B8C433DB for ; Thu, 18 Feb 2021 18:46:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CFFD64EB4 for ; Thu, 18 Feb 2021 18:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbhBRSqD (ORCPT ); Thu, 18 Feb 2021 13:46:03 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40796 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232495AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTB38155857 for ; Thu, 18 Feb 2021 16:45:38 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-type : mime-version; s=corp-2020-01-29; bh=OuUEtaU6C+uVckHqV3oAuehatGq61B8GbE/ww1ZJaSQ=; b=hO5fREbJxEPilfJarH35Is5wvDybL6fKIXeyq+03ge7YOe9DWwVpcg5G263P4WsNzUf7 QnfQ1KdKyQWY92tJL2i6HAnrRZ6fY5JvUsxgQvidKvbeAWajTAtws9nuXZFtFODFknDJ m8+XT0sY6IcRwckfJybRbbbSAeBa3E3lgL5LenMD5xi9cqEMuikmVLVu1ghIT5C7Cj+b eBBmsTr898vEX5j+5SReBXKNdEVRv/WofDP3cgazlSYkeAv0YP3D5XoQ/hbN+GTcE7oD oPesPVIvlceNcEdfrqz3eTtN/kRpnnBM1SWyMC9Pz0uuTWAMAoz2RAzDi3uoNGywYfyh Xw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r6m4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:38 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCa8032333 for ; Thu, 18 Feb 2021 16:45:37 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YrsNfT4PYZZyJ7bRDuv7c6Q1XOAmqhBvCF0wj3BbaSDZEI3Jmb13YdvCyVMSV1skts5ZIx9yMRxb5SAuwu6qFD7o+X9KU9aua+1mGYGcpxejmqPomnziPYGjlBSMGaa43L8mg6q1SmzO1DOW9N+1zh0tlBJXM/AaRInOhKuvFfjqrNXjyB78w02iEdENk1InapJsgafmb2idbf579PdW795GUX4OGlnWwm+PWSOZg+puVh6cX0SOGqUZtgtQPl2uhkKgcWjeVqqRwDg8IZ0oIUb9qk9cJzaLgJjgeBwcxG6SXhOpc3OafkbHlAvpKuVNhDwA6xUJir9FTXvVvVRz2Q== 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-SenderADCheck; bh=OuUEtaU6C+uVckHqV3oAuehatGq61B8GbE/ww1ZJaSQ=; b=GGQS+chq5iseqFihAz2CglnUnCF0cCwf+tCMMNqTR4ZtzrQ7f/9/aAmVc4qp9dMxQ8wm9v5J7tOaC+uXtB7DWcTCjjx/NorzoyyO+FtNp0BLLs72qFE1mf8QUfT2mDb3XNF6nxIdHrXI8sfJnLsE45qb2OiDCj7AfNunI32bdteDaMmQUSdOuX0bE5ymEV9klTPwTPCu+ftdYArYkgMUwO2LX0iGJvlqeMbObjGOfgnzWNjYmsp/85lwFANB+g6O4SU7F2YaN2XUDH7CMJaGEwaYTLkV56TxlOc/wtvgXIOYucXnuY99/p3z5saCgjDHrFGCsaI/681sf429XxKruQ== 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=OuUEtaU6C+uVckHqV3oAuehatGq61B8GbE/ww1ZJaSQ=; b=JTauZPUqCI3sqWmf7nid01jNzLdmZbCTI6fyfkDULqHt51fRGfll6Y3rvS3FY/wXTjHU5qoCQvFB9c7LZ5FA7Ob3X4Sex+8Brq8ncPDctBCNQFwf5UuIS3/Kx7uUs76Y/j61IwedA9BaCkfmWyzc7vHtWYmzaujIbo6fv2XK7fY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:35 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:35 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 10/37] xfsprogs: Check for extent overflow when moving extent from cow to data fork Date: Thu, 18 Feb 2021 09:44:45 -0700 Message-Id: <20210218164512.4659-11-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 638b7250-f3a1-43f0-11ea-08d8d42c9d26 X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:632; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rh50jZqAOpSW3vvWbTt3KE1+ejnlZT3fy6Rg68bqsZYkYDNBIiqWOLnlBmFI0NNq9TIyQHjZ6SaiTqlDicNiOFFLzD37EPMBLWA2hfskGX8FVjc1rsDhVZmJVR6iyBhoM6/9+h16tZG0NxE/iIry3KYVgTl0aRZUUtlLm6qJF/frBTQCQPyc0zQg6C3miiXF0oNIEjAoCIh3IJYqcqDofSqHFu4mYmMZDKyUpPF0TdNtC8SR/GJ/UIIcT87v91sixBx3IFbLpuLhXcEQwUy0eaFd6ZACbTINzf+R8h2Cmw+8nuWbBymdBOLK4ACR/DSwKujqL0mVhIXoYKLXFXKcrLCH7l/0FjlXwzJk8cVjOGRbmF68/NvHXKBde7yb5kYgJBl3ooumdSEQ3+omp7QbzAymUZ7l3ou8Z1sswRrP2lRoN6aczcO8dbpd4oDxeu8TNktLc8uJnXUL9A41fl1JzIEI/DNcVcZzBX5aTOZVkxcHJJ19FL2VSEolc8s2mk9n29Y+HiLfkJMrUbPa92x6cUJd44O11kbUJ1h6hP1dUXqtDtp/fQ7J+oNSIyfihCe9VNa1i0cKMNsifvapFZ2+bg== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OSuPccGoI4g1JCQz/3eyNLt4CUhs49ix0JQAirDMBWNIwjjakp0f0LvVVO6jpvGK4NvwZNoNpdPLsTrNZc3J+amx+gULFDRSFVazNY1q9YscQmEC44L5OIrcT83rTvsE556Hn+u29kyqXrSbjhXR4Sbdv0MzXkYUIu6cIyO5NGdjczd4HechRQhgJ7DLQ9tnktHeedg0S57p993Tzr93F+Vfyiy8w+xZUYF6sxSPZV1ebPny63rAMI9P1Twp0HDe7jJmT7OuodlrHTxQo/RyT0dZwi/A2GJLJuCRapG0U+O3x81IrvbfYjq0A/K4kmO3RNBAdKx8sd4byRkwtW7HRiGQzK9pcuJN/l8arM9dl5GN9cwAVvKcMK0FEbxlSGp2eVZv/SAvLPVO85aUhbCVI+nR8lJ8KODO7AmeRewu+WHIlfafNMm6zaVg1AC3pnYnvudVJRC51ziL0C0ltROLzrdVkpKGTuzEUlfvVLbi760w3p5G19lOR0GWWIWYuf9vNvEjzgjmaz89G54ZVcV392uIyK3eJ4B6lwxDTmdo8Aq6Y6NUMzWMQ6AgQ/3qLE9UC82VY7tAWhnY9c2KrI6T95i/tEiQ8qg4EqdCyuAzmlQUCAH+0bDGp0GQHw2dlG8E0jXM9UMAXTBbtB+qsh+9ESciB9WuvdDbfPP9qn6ccBcku4P3GyDIlluGQOJiFa7GI5k5rIFLQYjDfEk8CeJILwsBKIwl4dSmaK8nUPRX4kMVOb40ugo4zVbXz/LNbhLaoKLRZrWtiNvIsG4Oj38/+gpCtn/iHFtpFuQWKAjLebgegslAEMi700pbTVcp2sebDdx+JVJT8rcUmtmJQf4TOEjZOUsY+duSzOfSwH6AgmMeA17jsb4GWI8Ka1A45yE0J+c9QMrtqYEMqnAlcbWrnsHSXCIm2vL8raUrzVmsiOw1uam5Hh/TPCaGwc7WJ/pRZ3M0fRXJva0jeICNkazy6/1sRKmqGNOJyDqRs2FStF7adQhpjIHou8Rb8o4VcNesLsL3TqHYa2iq7WtgtDCqT7jkFwbdg/mVm/ns4iiO5HY6ENjiuZWwlBW7dDgMHXkwNCM2geHJ6GKFrw04W+kUxUdIFR0dO7y6k9BXMrG4CUYjK7cgEayyMoK5uYzQwtTHfgSXIjfWCzMroxPoBY+PjtXA7+SpBqtTo0USyvcR9oVZlroi1AaLHFVsq8bVC2xH3EzhGygW18gHnoFN+cqb7hQuY6bN6qQl8kgkJppwNk0Ow8PZl8bjNZLTeLhsH0gZyE2IlgOKpLQFuXS10kRZpqlcMIN2xXhEcTh4lVJqyvXSHueSMpoWlpk4nKuEM8HX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 638b7250-f3a1-43f0-11ea-08d8d42c9d26 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:35.5173 (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: 2Uat09e4/PZeLFkEToO7xYLlg3hKZc+uMtMvHO1PhwiSuF8L6TCWEPJJ3jSTw3g4MtPGOURbJ5v8M++tVymC2klRb7qVmwDVe9q0AXkKi2U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 5f1d5bbfb2e674052a9fe542f53678978af20770 Moving an extent to data fork can cause a sub-interval of an existing extent to be unmapped. This will increase extent count by 1. Mapping in the new extent can increase the extent count by 1 again i.e. | Old extent | New extent | Old extent | Hence number of extents increases by 2. Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_inode_fork.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index 917e289..c8f279e 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -80,6 +80,15 @@ struct xfs_ifork { /* + * Moving an extent to data fork can cause a sub-interval of an existing extent + * to be unmapped. This will increase extent count by 1. Mapping in the new + * extent can increase the extent count by 1 again i.e. + * | Old extent | New extent | Old extent | + * Hence number of extents increases by 2. + */ +#define XFS_IEXT_REFLINK_END_COW_CNT (2) + +/* * Fork handling. */ From patchwork Thu Feb 18 16:44:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DD77C433E6 for ; Thu, 18 Feb 2021 18:45:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 408D264EB4 for ; Thu, 18 Feb 2021 18:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbhBRSpV (ORCPT ); Thu, 18 Feb 2021 13:45:21 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35594 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232613AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTgkg040328 for ; Thu, 18 Feb 2021 16:45:39 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-type : mime-version; s=corp-2020-01-29; bh=Ps/fKlwvvhXS8EiYS4hPANWhJ4FP/hAgCAKy2ydTz+s=; b=aAwaWHV2wy5a3MGFaCyZq7DHqdeXwCcBxENaIDfkZLb57Un0BvO0SXB65IBhJ7oTjH9b VEWh+SgiEq+8n8FnxWXcqZ2ld2JEIm6ADRv/FTbirEFWCbMxnhpBj4T2EXv+k+odAzmd 1uH0Cj6+UKcVoYpyNhARP8xP0hVlIRGb7Dml3tCfNO8gezijbAilIOc5NrWVAv3srYQ8 6QrKcxGZRvBBATD+zrqxCIV3hpAP3O3YEaFFqDmbWixDR5pQMgfXI3IumN9n+kXM6Mvc 1kYtIii56bf7c9ZjD5LyfkkPACsNzskQcig8+McHBYGdqwamHjni19Tca4+TtFEeuaEh lA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36pd9ae3hb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:39 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCa9032333 for ; Thu, 18 Feb 2021 16:45:38 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UMg3mGOoLsvWlc+AXL11/ShSgOyeU30SFwajQaC6BYTQvDk/qAneKe/xta7BoA/Xfa3L88rm/B4BXVvUgmw5ztX2L0tI8GSoH/PtR+5Wc6ZRT1IoPQJjkJHfkwxjZpOF7YFiua9luZ6pXNTKlEQg40d25TLfCSA6EwyXjV2JuVhp2HG92xzi9k1unjr7a8j3OlYg4p2xKOPQyPoU9ZG8RQgg0sQBr1qMI9VVbcPqqEBHYZBMII0VI1aV8RX7tBbJ0j24kQUlxek8DbPap9ISn+/WM+WDjnqgUqWZQapZwmyFfNxT4hXFs+SEadrZcIAURHmen4Kxa/wekP0+IfPBIA== 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-SenderADCheck; bh=Ps/fKlwvvhXS8EiYS4hPANWhJ4FP/hAgCAKy2ydTz+s=; b=Z4IikIbUykm9EMaVVYiMRigMuWY203c0HWMls04poIMOqIVU6h93pSMYh6Bq4qrajyFxq6BHBoYpd2x32IKWZ2InhwO8095HibxqfoWjUZqExOMvs3Dxpw0N+qPdER7W/ibjkMyuPmVFMEc00aFTLmVLzwPPDukyuyJa9QVbiDKHpA8TDx6EVjBAytyxYGKIx089i200R5/ThUnumwACNkarWdLQQ6R8bWhGdDB3ds6bwvJeSEsq7gpwBeZuoRP5C0UL1HEfBSuI6Q9OybAOw0P7wMlqADQxEKXXlh+154oyOliRAPToOv7Kv1YH4M1s7IU/KMDTaEWPsdbIeERtbA== 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=Ps/fKlwvvhXS8EiYS4hPANWhJ4FP/hAgCAKy2ydTz+s=; b=RmBn7UtiqhaZmNhZMODWqAXbQs5Y588trOsUSC4R7iwmsLvg8D04SvsbxgvLJLWGqV9mvTnIdTIRhIoR/nC81CS43NNUe8SyVVGV/RILpTK8wdJ+WSzeXPHwuAd7j4udGR7rRDCe+kzHuyPMKxgSvhbMO1HB6RCofJCVwznRKp0= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:36 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:36 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 11/37] xfsprogs: Check for extent overflow when swapping extents Date: Thu, 18 Feb 2021 09:44:46 -0700 Message-Id: <20210218164512.4659-12-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8a13f60-583f-4a5a-f13c-08d8d42c9d72 X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:221; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZUnwaF510S+QaDIoWXfl2doyh6MpJsMNpX645R85HW8Jb9898i70kyiX1fKzPc1gm7MNLGT3os4+pbAkWeiMe65AmPe3fEKPyl0Jp7IvwlW3rR/rVyO/b2tzlm5vVKJdsoy+hmpG8qQpZkc5LPdvOmtBdGfjlYtjM9ZnlO6QNLtDvroLUzr8SVBApof2nFebiRyYZ9faCJvbWl5KS/+4+0uyIxbm/T5FQeqd20gjA4f3BLvK0QCQnGeH6Ng5KsBPw8o9ChnkWwhs/Y/xWnAzZp6Ug0+Y0DPISqZr2h+ilWM2euje61V5r9FZLKaF6bS2mbTBxdFc4qxX3XGs8ptMmGu26uxCiqwhw2TOypaHScQCITeGVQcmEaqW/+fdTKayKUuapDJt3VixYBbYW4KUT4K3bJeZbUxJAhvJOshaYbJUFI0p+dvN3k1mWXNlXBy553wCmuqEtsfxoruqS72dMaeY4PDzUK+3zgpAxLCBmg1mZP+Mqw7eptlRTkiZ1zBspK0+xDWLeC7ZRUqoIAhjsn2HVrY6cMrFY5POm0jD94V1gj8gC+1I17qNi91VS2Xl7HQlek5IDjS5ebDaMUfZ2g== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: HIVtDh1xJAplMTnZI8gAh/3OAfMeeAicacLmEoOQXJsGT2dnzz7N8K3QrXOD9VpuFrf5akkXNk5uxjaDI2fumXxaOzCZpRDZT+KKZYkZr6j/k9KGminmI3vOBepwLmor8j2edVJt6aLbjRw1eCbQbbrbeU+W7gxSClwiB7tx1T3uN8S8TEEows6yr9YpmjhGWEQqDIWt5PEWX4sEVIJn+bjITEdSnO45EvXK4byWmFvEWYDB7stJNEHZWFXhaqfy0PJadMuMr0uaByV+W/dHoRqWuWdJDeolj79ytw5DSRbPWrtUdY39WLOAmKDlyF3wpumm3M9qYiTCv37oDBGdnHiOjmUmqvdfU+ZPAEM2plvUNGchgFA2W/TrLhY4UH/0TF+p+P6yj7MtCdxbUeEkamNm8jCMrFu7rwU7ABtm81wVJ3a2Q9JCVh+6vHOVvkAVWYSYGQ8HmvSoAyME1PZNH5zXxk+bBJmFOf4YQUb0Z9COLQwWH3wqWe8ThbZDpxVfs4fzs2xI6KW9wLZ5dHCN0DINboAiejYOxJdKRNKNUU57mjJ+FAZKwofZSyA4nEXkG8Ukml3Sz3nlq4B9aHxbswEcI4pMkuVKJ5hrp9XJ7lgvUu4LoDA9LAe13xdAGAzpFmxO0cQ2h+Nb8O/DD1jNHsIKDSqcxxbwNqIUtP/YWfLT2ZEPu0jNQXQ0aDWYYlIC3tcJTRR7WiH8IND+OdidPXE8vFNfGahvfgGCt6hCcWwcUW3JbEMVzKTGhHrkKLv+kTbfTRlElhVFcuzUHGBejDiSG6J8oDga7S8gVLjjKPGN1L/8SdqcU2XXwO+v90tlx50sV3M33rOEqUXiY4xcITiXg0Ha/x1lcTxoiMNJ2EuMrWKAmf6Jp6IZzO5xVi/1OLj79vHGypfK05WkhqZk6fxfzYM2oAn+ASqW5fpqt4G6s4uv/DaHaY56uL+lpTuQmDMlQ0kd31VPPdynP4POYIDeWWVtDw5fu77nj7jglj2XrepT4e0ZQtvHw/JSeuJQeHPBG93OaqhZ9QdCfRfZDm7YxumsadID/nxVIds/8Y4LjLPzWLFCqzxOuaBu2YB8wcGQK08mf0GwEsiJwJTDXn7Yy3COhLIYcb0+56n2LVC7rObw4vLhJbrF7bBqb20MTF5vbp5D2U/HDkjCaioGNjN3xFjusXEf1ziLH7EAPItDxe3cTf1WqSQ1MHUbvwov0S1Rao04IZ2ysWpRvDL2AzthwJBk8fbktRMD7az/ZbDKSan3Yb1I6ybQc+928Cfq48bIagRKA7NpdobI/ClNCxUDP5rpChEsvFZvsK1I4QX44kezHiI0X+DLLrqQeaD1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8a13f60-583f-4a5a-f13c-08d8d42c9d72 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:35.9544 (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: QCHgRKtbcuOlf+fTfcF54cWjgOk/vi1439tzM8V9wSOeoOQ2Gk50ZOu8J9ARQyesDM6/T3bSlJ6BhQmdLP9Kv/FOR+gWFXK3PkDcvvtH1iw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: bcc561f21f115437a010307420fc43d91be91c66 Removing an initial range of source/donor file's extent and adding a new extent (from donor/source file) in its place will cause extent count to increase by 1. Reviewed-by: Darrick J. Wong Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_inode_fork.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libxfs/xfs_inode_fork.h b/libxfs/xfs_inode_fork.h index c8f279e..9e2137c 100644 --- a/libxfs/xfs_inode_fork.h +++ b/libxfs/xfs_inode_fork.h @@ -89,6 +89,13 @@ struct xfs_ifork { #define XFS_IEXT_REFLINK_END_COW_CNT (2) /* + * Removing an initial range of source/donor file's extent and adding a new + * extent (from donor/source file) in its place will cause extent count to + * increase by 1. + */ +#define XFS_IEXT_SWAP_RMAP_CNT (1) + +/* * Fork handling. */ From patchwork Thu Feb 18 16:44:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E4A3C433E6 for ; Thu, 18 Feb 2021 18:46:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CABBF61606 for ; Thu, 18 Feb 2021 18:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232621AbhBRSpv (ORCPT ); Thu, 18 Feb 2021 13:45:51 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:44156 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232600AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCsK180357 for ; Thu, 18 Feb 2021 16:45:39 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-type : mime-version; s=corp-2020-01-29; bh=CjI+abj50WR1Jpub8g/BG7jETIgA4+It8y8CxQ3v/Gg=; b=ZC3oW1PyrKm35Hzq5JKO0Kbi3OF3D6AE8Ek3khZBE2axYIZvyAey+3aEvwsXFRgQ9kTH HKQrnAd1azlHp4nzAroJ63OiYBQ/FD/CmBH5KNtNKH/9wyGCLDb8Kx9W2vfcuwNrpMqD eqL60kQNcQo9e/nMVmCwqQ199nVA0b9KjiwqauFHIDQG0O6MafyZ0J3UowvJ9SFfVFxb Wr20yykwlMoE+ZPXfwAqbayRAhMgap3xbG/IS2wxq5cuDY+2LU8UM8Hh8GWLdJ6o8eOe BUtOhGYz/U6jG86/NaZ3NtvU3xIeBkcCTfQk3YFZesIDK7G2hZd9slmAqSnU4I6ebeF4 kw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnph1e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:39 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCaA032333 for ; Thu, 18 Feb 2021 16:45:39 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LCj5nJ46YkHOn/I8t/PIbH1VtwT5RgxtY/vzTKvntEfYc18in6acfLegedQiSPDw5qNQh5QYQD2h6y+YRLWdxgOUUIVdZSuMl+C1Q2+4FEaE/2WabgNXa/kzrxDi/TL2jEmpCZfT4PRcmZOv1/4fhLXDnwbV1tQgSlKYcIhze/l2v6dmveahZ9ByvNrdlmpJwjfcKIigxUOlERQNCbFBQpzHgQ1xwm3DHUMxyqvYgRKdWlWLCYTp81b4BQ7ZvIIfQ4yf6pvIxnmnmOH8aReLeQw0VZRlS6v/ZeT4cyvIwjbC1Qm77rv6nNnCXNGveFz3hIdlWM93Whrgp66AiZuzIA== 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-SenderADCheck; bh=CjI+abj50WR1Jpub8g/BG7jETIgA4+It8y8CxQ3v/Gg=; b=UnsBkPramaCZc9Lr4g2XUSbvMruDORWWZi18JMLvTl5V1oq04JDZL0TNYyJjR5x7LeVG4EmTDMn5eHH0Ek2cFVGLvAA+AthzKO7OrWLM7h+VvhVzMvodYskEstzXJD65jg0vbW3S170z5VtdPAzJ2jyNRiM1UIKXmHz7TVIfPsfo82fNp3cY8B+CiTMftmhZq7yqJ6b0aA7lTggjDLZwM4MBnjx01lKFkrYp0yM/R4xJGGAlXsBDQpvTCkUgJLS2XbYYOFoMcHfZPj8rcszVgD8CrvIB/OLY3wSX4pJY4D7JRqs+QiqbZCfgAYf4QCC6d4H6omlYE0GVUK3yDAInfA== 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=CjI+abj50WR1Jpub8g/BG7jETIgA4+It8y8CxQ3v/Gg=; b=LshPJNvm9TmvvSczDCADaQhIk+KdNFe1TOUF6iUf4H9y/bwtHV0t0YOaXpGvzjuYi4wdSLcVU5mLFU78WSh9b+A/+lSD/N6qvF8wVCSFMpQ3emwqxd0Pvx3aoodo2iR4/4HX9rU0l5PSM9liSBocR2TuUT32YI/BixD51MTs2oo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:36 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:36 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 12/37] xfsprogs: Introduce error injection to reduce maximum inode fork extent count Date: Thu, 18 Feb 2021 09:44:47 -0700 Message-Id: <20210218164512.4659-13-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1e12cdc-aef4-45af-ea21-08d8d42c9db7 X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:168; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r8zZDutKKhgwUBczUyGbtZdSaDQbGtLk+NBkCBWRhs2zs8M2X++FjVuVeImp7Lvh24CsezRCeFhfiZMBLSRTBmPjHtPkqZmHrLXBt9MGcJgW7fdeH+tu5mMwW8icj+bQIdij43O8yA1UcdbpwnKt84a0q7FnDsJajr8LmklzJQHB4pF0b4Dz1WemLr+vji4K6ngCqV+NCvQF1N/nn3mmjOs2qc/HuRjcZJ6JlGQNcmY+Eq53dDxm4Ms6rdZjBjlsFzISjUfctmOCW7y/OhM35itSeT1Y5W5yFW29Q2v0ub6Fyypf77+MFPCbQqpx+rOYfwUPWUgCK71EIAi9Cdx1ZSXEumAJJ7i7KG+uHwBEBQ0KEFEZiCy5zCzvnu+Wu3KF91qZFDL+ySJRxmTiLopcS9CM9el5BNSDFujf4XhCklooLWCfL2sM3+m6ve3T7eRT9rHiiP0jQMUX6tFtK+xI3XIOK8Oj8smdirgf54R6SOV3uKcDZhWgKoTpXaxeaMS6Xd/9oZzhWESk4SDgt/CxKXIFMiKFDrXePvVfLIzTyytIxT21YRWYyLfu2UpIRoty4HwdMscLiC4MBtMjSuhcIw== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: s3K+0x+32tsFAYx90RhwnXccdcMot++utGjGM1wIhJ/wKNI11aN3dIdeAooPfld9gtZtSPfPdSgy+clXkh1lckGnWnZ7GQz6CpepmwpuzS6DLJqg1NECZ0+iaQ80580J0HN1UibcMP+WAkdtIgJ5KzQkp8HGIxWpArxNOhhjROFoIzL2m/02sO+ErDji837GzFRa6MCg8jRoXhChygcWcaFvpLzw4PrQOtjhPKosYbyTMCPJcOz1gqc0q0JTbv37rZoV4HEh49k7EF0wQDqyYy6NISvolJdExEL9hScL8Xa0B84OJeUoVM/1mZC+sG7EScHYJsxwwKRCLxIUu7bVh6KMBBClGXh0NkShffzJmu3YGfvbmTtpe5AXPpr5SoMbRPp0SQs2ji26/9wZjyY3wf4kVAJkkbe4dHp0c3ANJ+NNBUH2nuz2GfX6Lb5awJXLD4gdoAG4KYhExhTtLZijbrAackimcE4DZkJO9YzVK+f3GNTHyKRspZILAwlJcE2u+RTaCzQeMhImaSZBgctbgcWerd1gV+3+Ndm2gYvIvOfXaQqmUAAterDrzOxFvkuDigHYp5aZDASuopTlhktWCkeCe09EKBJXkZsEZ/nyQvkfCLqFlQ4flUaeQlZ9mX9HdqTbE2OQc8KhbmAdh9qKB02TWvGiOThnCpnu2C2zzKKE6fA5ZY3jGsY8y75VmEX/8q0k8oAtCdcdA8ZjYzgz1H+T8773kgV1hZOE0TZijmMZeHRcbUGK4mGQbgkt+d1Ty5EGShZmL1Uqq593GLV48TaAW7jW9p7N5pQnhOhxHq8dusGcSK9CHWnDPBKWKXgzG65uxQBid3F05rgJ0cYoisGxtXyQCLlRHgyoriacXrtkIDYUiNBZRmjU6Mr/ChghoxqM0Q30IUkUSt9fwzqTKMZqpDuWhCsG7qL5GXPECZe9I2eutdRUvnImT9oXh8cBzV+sC0Sy9RqFl9R2J7qQvh7CbsLfaooCyKkj3fgENcTBYJjvP2jWe5CcTeS+NGqgO9cYF8Z9kna5ZOtRehcWdswj8Y3RF2APNOYzN+z/WYIqYDUlzn0VzlKroaKE+KHWwZ74ztI+HO/CF0TB/jNgP+/QVv9pxWNc9LwDpxIYBAHEAuHOCzQG067epiplau2upTvLiTrPt1q59B5EKqsUntAuYsg0+98P/D3+/w6jppvdSzYAULd3vn/JfxIFY8ImJ3G7TIfJbDQ+IlDR58E8tjyXPUWPKxHx5/lrgdTgU/6DgBQTe0NSYTVbEjQRex6KIFacuW/91Xj0azDC23OPHndmlyL5hMT/6HeH0ondzB/qjA8XfPC6USmiulmuagHo X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1e12cdc-aef4-45af-ea21-08d8d42c9db7 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:36.4602 (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: 38z1CCoZWeLoIoiaHkml1M7IVWRVyqSZtAWFIjEsSZEOom72OREWjf/VVBCblWTDVHtQoqf1//pqy486UOo+7HwBzG0ZrkrDuTtD5BPXvKs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: f9fa87169d2bc1bf55ab42bb6085114378c53b86 This commit adds XFS_ERRTAG_REDUCE_MAX_IEXTENTS error tag which enables userspace programs to test "Inode fork extent count overflow detection" by reducing maximum possible inode fork extent count to 10. Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Allison Henderson Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson achender: Amended io/inject.c with error tag name to avoid compiler errors Signed-off-by: Allison Henderson --- io/inject.c | 1 + libxfs/xfs_errortag.h | 4 +++- libxfs/xfs_inode_fork.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/io/inject.c b/io/inject.c index 352d27c..ff66b41 100644 --- a/io/inject.c +++ b/io/inject.c @@ -55,6 +55,7 @@ error_tag(char *name) { XFS_ERRTAG_FORCE_SUMMARY_RECALC, "bad_summary" }, { XFS_ERRTAG_IUNLINK_FALLBACK, "iunlink_fallback" }, { XFS_ERRTAG_BUF_IOERROR, "buf_ioerror" }, + { XFS_ERRTAG_REDUCE_MAX_IEXTENTS, "reduce_max_iextents"}, { XFS_ERRTAG_MAX, NULL } }; int count; diff --git a/libxfs/xfs_errortag.h b/libxfs/xfs_errortag.h index 53b305d..1c56fcc 100644 --- a/libxfs/xfs_errortag.h +++ b/libxfs/xfs_errortag.h @@ -56,7 +56,8 @@ #define XFS_ERRTAG_FORCE_SUMMARY_RECALC 33 #define XFS_ERRTAG_IUNLINK_FALLBACK 34 #define XFS_ERRTAG_BUF_IOERROR 35 -#define XFS_ERRTAG_MAX 36 +#define XFS_ERRTAG_REDUCE_MAX_IEXTENTS 36 +#define XFS_ERRTAG_MAX 37 /* * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. @@ -97,5 +98,6 @@ #define XFS_RANDOM_FORCE_SUMMARY_RECALC 1 #define XFS_RANDOM_IUNLINK_FALLBACK (XFS_RANDOM_DEFAULT/10) #define XFS_RANDOM_BUF_IOERROR XFS_RANDOM_DEFAULT +#define XFS_RANDOM_REDUCE_MAX_IEXTENTS 1 #endif /* __XFS_ERRORTAG_H_ */ diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c index 83866cd..1802586 100644 --- a/libxfs/xfs_inode_fork.c +++ b/libxfs/xfs_inode_fork.c @@ -22,6 +22,7 @@ #include "xfs_dir2_priv.h" #include "xfs_attr_leaf.h" #include "xfs_types.h" +#include "xfs_errortag.h" kmem_zone_t *xfs_ifork_zone; @@ -743,6 +744,9 @@ xfs_iext_count_may_overflow( max_exts = (whichfork == XFS_ATTR_FORK) ? MAXAEXTNUM : MAXEXTNUM; + if (XFS_TEST_ERROR(false, ip->i_mount, XFS_ERRTAG_REDUCE_MAX_IEXTENTS)) + max_exts = 10; + nr_exts = ifp->if_nextents + nr_to_add; if (nr_exts < ifp->if_nextents || nr_exts > max_exts) return -EFBIG; From patchwork Thu Feb 18 16:44:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9296C433DB for ; Thu, 18 Feb 2021 18:46:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B27764EB4 for ; Thu, 18 Feb 2021 18:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232701AbhBRSpe (ORCPT ); Thu, 18 Feb 2021 13:45:34 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35608 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGU1dr040639 for ; Thu, 18 Feb 2021 16:45:40 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-type : mime-version; s=corp-2020-01-29; bh=vuw0zBE/nJWm1btzXP1ms1VkVUUIPHiyYBmQbALBvEM=; b=ouB9SiwpMuhphRfrmzjhux2xK7fXx9SYlJxzLaBwW56I4iVHwclTjn/Ru08XjiPgCB1o G/Kos8tlnNRvkYlKlu45qtUtRsx/ljX2LOmDPQvPhJ8GVi+685oFvcTDF7+knxTlvRA/ uok8F0ZbHRIpMiqwYmooMei6GnKP3DiRFBLpu/izq/hoQ2ZBSvEPBX3dEocr5hH623Vu Br6Fl4IIuU/7ycQtsq6Z1PUgSnALDCibeCh1acNN3tf4XtN7IRJ0znizNUPkLkeQ26Po a6EzsxMH8E4i5/QnGsrHQgjny/CSg8YU9Xp7lOWAwkWhUCcMQF7SHvtGS0/XTCcp1+fI 5w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36pd9ae3he-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:40 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCaB032333 for ; Thu, 18 Feb 2021 16:45:39 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mnU9K9b7ORlz3IKL2md1KdH2KnZWURnyY4R86bxqztem9UCaLt1RTW41y3918Aoh59EMp63NupmeQneWX6JtECYelmCgi/eRVKLPAvEIdpbQdrLuGmufLURCVgVofn7AyUb9fOJPRX8oKuptecAWKuhKaBpnefChgG7cGIzCqq8Uofbmq1q7m10fXIBG7Oow5MgSYKQyrdfiNXlVclUVaPBYdoBNJEFXMLxW9IeaZ/wlJB5EWTbicq18aTSTETzzjRso7jttjQxEzBeGBtRRsKJw5SCIfMY040i2+gmkkSv88vX5hzYDYD3ksgD2jYBdDGwAYRxOSBEzINqTnTx1kQ== 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-SenderADCheck; bh=vuw0zBE/nJWm1btzXP1ms1VkVUUIPHiyYBmQbALBvEM=; b=HQzUKkom7A3OQm6tHpktmzFrc1/m5DonNw4h2tpjp2vylY/ZfXKM/Rf9SDjTdP1Q9/pR1BLBkwSR5aY+RMGrdFr3avtCKvYguI/nDOjBbtlUDXNnvDW4YLKnSW+4xM3MKSNpqpWsohE2pTSnq8+RQROZiHW3PFCNytlUYMPFbZ3Wjcvo82fAA/yakDjl6ASawboWX7izT/XX4fvKTDV/oeNsqFyZDJ6+hqBuLfMUuomyLeB81S2s6lD5ZqyCLNQB+kH8GHfj5vGseRGFyqKlJQua1y+7oclRWTYHBysz6H9dlEEjXVGVlVdrIyUGLcP3stYFSRzDTrhnlqPlWEz1/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vuw0zBE/nJWm1btzXP1ms1VkVUUIPHiyYBmQbALBvEM=; b=KHGLVNJHcF9BEGavNQrl0myX9h1zi5XSA9nhsxtka1b2jV3wjmEzi3wVGxyfr7jf03QLUt6zHsD+EI945ehcQHOzYBMmnEX2x3wq1UBbg1R67i8vqc+Gem5Pk3IajVfn/nlkW1M3BRXXgfFmJH6rYWe4QG5zuvHdbH26qoA5MvU= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:37 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:37 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 13/37] xfsprogs: Remove duplicate assert statement in xfs_bmap_btalloc() Date: Thu, 18 Feb 2021 09:44:48 -0700 Message-Id: <20210218164512.4659-14-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cff7df8b-6334-4d42-51c1-08d8d42c9e0b X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:962; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rgbI1nknmhGRbUCDUcbBNRUJc1WZuL3nhStMLThSvlTc9lIQR8b//F4XsLru23AcR1b6C0LtHkvEV0JiuI/SUPX/MYUPz97cLWYwprqlHiIVtXM3KyDE1XXCRihaq1saTbKV4S5D86+Gc3dd2PiTSAeI+6xYplIMeNyj2UdLLommbiDGgYGl6/3CK/dhFqiy9/YTLw818NnnbGKp7YyOGb3R/QgU2iSCGiqEB48yI1Dxb15+G8J+pMdEfTS1CEijlPorCeyR2f/slyCW0UcZzuv/ah6taSeoWL36Lf9FbiumYv25yaJAOBpk16HVAithThfDIYDNIl+n2/srKAzr0Kcen173YUnTmXs06znP3oPLycLAdkGkdKRipw0x+6C+H6SfWAKmi+qxZtKusEksPyH0gey6p7XZ4lW5XZ04GJhY+yAZUkEl4mG1WH2o698333dXhTiR5SV4PvoCM/DVDN5N4y/twHMSrT5QtYKi3TqLR3vju8jMofh/xFUC84xALLVVO8YmlNgGiMKf3AOAFQDYwCzxsIwZ0rXjKBsGDrbmTL0cEuIXCVmfNqrRNW8F7JZUf+MNKBl791MkORspYA== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ATtV+lxCfvB8+0cjEFYDcPXdq8rL4TXJhejIOzwFu/JAsqSjDhehJgDgBm7yp5j6UtcqO2/G5DNsm6ALSOl9go34DthzMKvTF7aV3fiaM+F7wTbh8llZ60WEa6xEMJeoSGlt7n9ATVPmIuLBw/wY5mm0jdlf/Aze4v+UXNgIG+QMLeJYg/LSG8AsfzGl/mJqkpZdFYczPe6r6E9D2jMq0th0adfyXZiexXkeXF0ZjfAVSCk3rH73FAVd+f1nmcse4b5grZrrbt6JCPOQE/KSzdwuhpZFVSZZhHiEEhj607NoB3xJaLAvRGTcGzRl8xg6JpznKCm6+OjIWFqRw7KjdkuzZRty+cAjxGls4M3celfYIwrcxx+yZTIIbmNYMatFC0QsCgnjDa0fwfutEhMtaLeAWFAsDDQEuJFYEHhpFwQSXGf3zOOydgicaQm/yt/q+I0E1d8NPBPFY8ilzgyqjFVV9+UiDk44jOGGr6Z66qBA1VzbH356eM3+COSe7JSYioPQsoWdU1mHwYG1anJNGyoUqVO9/l6MWNz4suMAkz3pkTt8Skz4G1G3Heh74jTYeUP2Tc8Jrs4duBWLICqBzu9FaRORfKjIVTjJ1ZVKdISzkXGkyCsRlYn4eVkLxXfrNl701+Rkz/atevwJD1stZFX52fZUbJkAiilo2qS7i/wANA6FFTwr5mZ1Y+RyglbaVkVO0GyOVBY0kzkeywN+b8KPXbcWBnBOzka4Mtixqg3K8ESiFIJcwpsU2wi66vXQdRvN9n9pmhZHrvpKEvrevvjmPzrB0f6Jalm2zgNo2XQOIEkdJ4lT5xHWE/MvsB41X/pMXgTGHaw1dOAv/VpsnkKQdGSMgHq4Y5pT8aEcznwPY4jObGct3b2khPQz6OOwlpA/eX4MUeDGSysINe618KaKCAmTLQGwLU7aaADVE0LvxM9+cbEa6LlJ02uYzM4GiU6DQhcbPIYL3i2LzhutimxQKwCJugtmDOFVljLVpp2TdyWzLKVOSXqQvFN16gpv/jV45wkcPkq2vsk2sEMEN3/ckwxc+3Id8QYocrYA2tLsD5KxFfFdMr/y1WW39XCcNFIzTv9FSkeD7RnftlHDlU7wWqq1vIAZeDcOhJs434mBD1A+8upOBvimYptWm7pIjnm7v/Lj68I4qIUVWhojWiAjVVtlFikoCF5DUiGDtVghZ47UCWbHz+W4G+SAj3fbch5qcqJxeqBD3UvyfSLuB6NYQTKRBbjGujRUD8uXu+Vow7AVxpa8XdQRr2aDjHubEVvFjbNnj80T0ecJxO0Ee2f0DpInyXY2bx0ljmhUvx/txQ5byRhHOMvm/IGP1BMW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cff7df8b-6334-4d42-51c1-08d8d42c9e0b X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:36.9928 (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: 42x1EUHSiFNj7wnzWPN8s2kC47/uhFELVO2b50K15/aIf8xBtqnIPDlxKP66qxNyW7wo4KT49fUAJNXdsAbVUL8Z1sa56kpfJbg9W7tjXOk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: aff4db57d510082f11194ca915d8101463c92d46 The check for verifying if the allocated extent is from an AG whose index is greater than or equal to that of tp->t_firstblock is already done a couple of statements earlier in the same function. Hence this Reviewed-by: Allison Henderson Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_bmap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index e9c9f45..836e5a5 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -3692,7 +3692,6 @@ xfs_bmap_btalloc( ap->blkno = args.fsbno; if (ap->tp->t_firstblock == NULLFSBLOCK) ap->tp->t_firstblock = args.fsbno; - ASSERT(nullfb || fb_agno <= args.agno); ap->length = args.len; /* * If the extent size hint is active, we tried to round the From patchwork Thu Feb 18 16:44:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24C2BC433DB for ; Thu, 18 Feb 2021 18:46:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D446E64EB8 for ; Thu, 18 Feb 2021 18:46:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232893AbhBRSqK (ORCPT ); Thu, 18 Feb 2021 13:46:10 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60450 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232631AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGURpH059508 for ; Thu, 18 Feb 2021 16:45:41 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-type : mime-version; s=corp-2020-01-29; bh=8R9jBhTWQIxrQfGEbl2EVctMSu3cDYXQeK81xnE+K4o=; b=qTpAOTuc7ZbxTgtAUwzrNzZNl1XffXrb31JlaPZ02eo7SAZ5waPwHaqV3XqP6hNduGny h0PUFNbg8D7D14qiHsjKvCmTHdaX1hth47xFaBO1rd44WmvgUUOD4+P9qX7WCFRP2EcM TEprcORXqqsWIDck/CXD1o23wT2u/T0yG5Vk4GxmNSS/L0R1huCGiJUJ7cE9LGbcSRA7 hp3Mw3hbvCk7zoBbyyEoL4ZvL+shmTPDAKqyaytVC94f6MfVNtxk/fGsSqpzP7BlfgGw O+DloKQrJW2uZXvuc5/sSk7Pvejrx2x1muHcFFC1LzUaLHUCc6AT1ywtWfobRjeuN745 Mg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36p49bersr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:41 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCaC032333 for ; Thu, 18 Feb 2021 16:45:40 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eLBCjM/ofmmUiFick1ax+TBs+jLKuZS9eniM+S8R303g1tWJmVkd0j0zntje/Kvk2Kzvpjb+6EFhnXgly9TL0D7x20tKzvD0/O2w+BvTsV5CsX9xBSR5jWxq8GkL+2g9iCBFI/fwiw+HnHRWjfOUNrzq3DkWqpwjD+rLYY/eexrvuCX0VUB976HfOD2mMFilBJ8RrGD5LY3bGOOxfZHWBy/ygL+CBGLbhERCgzAwfR6egT1nxPFEBYVhQXmgUVYn3z2PjHf5NPi6AO2Zh9l0Nut60eFyx25++seLwO1S0LslanReb0XnHSGWTGVnmtBUW7E1+9FvJdERKH9PBAjpnw== 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-SenderADCheck; bh=8R9jBhTWQIxrQfGEbl2EVctMSu3cDYXQeK81xnE+K4o=; b=dN3uMS+feAaSzdJ0KBqs9Z/nmiK2yvY/Dbbv6D3j8yD1CNkuQZRhrg4+Vt3d8G3H/FFrNT74ci04RMNlW/lLEcGdAPPIHBrkDcVr+mptZMvohlG+w+dIpZUXQT7S5aMfmmb8auLc50UYwSDh2ULQWBwR2tQKisj+gapLOeycPOdxix0ii01PGpz2p3KA0xpaWjwLulEYarIz7LnntnWuYoolUxVGQmxdRTj3KR0kwaO2dsBftoV7w5vO6O70Xp+8QCAV2DB6YrnzlPhz1WhNRbOIQuNMl1LsxHM4ez8MG79zXotji9P5heO4MMIAgy8OdMmmg/Z19S0Jq8X+Bd5yzA== 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=8R9jBhTWQIxrQfGEbl2EVctMSu3cDYXQeK81xnE+K4o=; b=CLyrM4yqBYsF0H2JTxAqgHSDalHdTgFcK8HL7cs3BAczXMFY1qvImylu4agbGxrherq0tzJEdLm8/UHDNwUTicUIY7z6+o9KARbUVW/xJ+Cl2VWlWLX7ilzaYPjqg/4YAdLZql4YeAIIOno1yzCqDFmk1Pm68q8GyfAqfPxf8wc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:37 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:37 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 14/37] xfsprogs: Compute bmap extent alignments in a separate function Date: Thu, 18 Feb 2021 09:44:49 -0700 Message-Id: <20210218164512.4659-15-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea18f914-e22c-4f24-927d-08d8d42c9e5e X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:499; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UfIXi6q+h+qI1BjDS/y0QRaEfPmk3ygqkBVJy2SXXLiuf89x8fsCUHQ0lmFJBEySS6vMRL0m2zZFOts9bNBbbmtUsBEnrmrLMJjGIvgWCrMTLKl0kKvJhMN+/RGCsaB5kPEIWFBI1cqcQq2ahCOxx45RpIJivUwdjxg0JC3Xo/lvEbkyDzx9WhapP0Pw3eQ85ecbGDKPpEY+qwJwNaB3pFiD/+6B3pvyAXB1gSrzMbaKQytSTEP/bhaLHkmJkWJcAse1AE2oPKPh+CfLQGGCZ42YsjdTrCyDpD1ztd5QUlBNIjAjLUb/7aZgKGXgBrLxXxscM4zJRstdDvqlitsVbOgKEQteyJB3Cep9a/UeDp6KVlIrnVA8BTw5rXRGSkoN8Z6KQU1P526cRLsvi76xjbUkTSPFjuZgHYdYkYskeVKnHRysfrPqnr3cn+0yC2vZQKmYdGjTJE/hXhTAeaZtLfyvQ1FP273avXUtSOxvvTav8O/DiwiXHUHOzrabrk9frjtQfE7Pr1WkenDJurNIXfCzNrBigizIhvehAw6NVvIE7Nwsdu6I0It+HDWKF6MTsgqioHQ7s19kr+xS8t4TNg== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: AUvXNacv46B6kE9tf1OHr+kF/8xI2xKZJY80TWI/mPDezNTft62bghsJJUs6GBpt9h4T8+nGjinvk7GfnfRUzmb5WymI0gz/glaBMwYvarGmSoKVwmuO7vngbDN3QRhkwBV3Fd/JjVgPc6h4iWY0oJ7vsVN7TtiNmGOjJ0W870XAjeKaPkKm91QFkLAxT4tmR7gBZ84Uy9mVlTgzEV3eoTW9CAm66qYiG8HjjKzLwBbaHj7yAyVMQAT6XhplG9xuI6WeIGktobwn+NoT50OecYzz3z5coQf4ZJ2tSt5HGx0y3+5TiAeRkiIaL7uAGo+cKBTccDY4ZHneic1W/WDXYwqqawpdrs3YwZ9WhOnuI5rfxPcIeGMjumUKNakBXXrsvmGfKUuMnuLsFb0KGKY3rmjp6lGHzOLfm1mhdM1RkPhgYRGciAtTQ6bM2/JXDule4Tec7ouuvnOcMsRpg5gfjL0jg3Pv03fOqMWpSjltLYK/LPsqMUVcRwhE0dZxUrj/TDRUPUFkx6zBQOUnprvMk/zVgUNEpiwCt8WR+ODShxancKe8SXgIdLXM7q7lb9cvRRAJHNTVSnYp0ufZWpbQfesdq2NOdwjGx/C8GsWSCpHvVpA4RRaARnJoabu6STnkXjiufGjaAoW4FJyc5gIsSVnccimmChN0KPKzmfbmmS9S0FXxDggzRKpqcyh3Um0IMQDhf9I6O0ZjU7CgC0CCjjitV7vYJHC2bIp/CYGYNvJJrE/VGmYxSy8cWw5KF3sxscWbHfAsCneyUQguNrzMIGZTVDMV/70YLu3S1I+FxlfHwvpJXL6M4iYvMai9sYgZpJ5q9Jhn4nVDGCiaAu+tQutdz1WtDQRfstvKIKtNGUvrgRU5YQmflRq++VcKaWtllvwUR2jc17I9Qt4qmxz7dYcDrF0VnfKmZjqEUI1Nozrl96A43ZTxAQgx/1NSyN16FIHcOj9XMNICBfTBqXa4flgp0CVq6Zn77GvK6m5O9LIbg1coOf2VL7Mj8QtDEQ/MpHdH7PoTT/PFOsZQ0MNUiM3m774PX+ySlxVpDOesIU3Glk8w/9Hm5ya+tb8ayk/C6VKV8n7086dJMSFDrxrELebjAHR5lKa5t4F85ejRe/hk/4BT7i8JavetmO1Hp3NOaey1dFzOUQp4yMuY8SCLPHC2JNazTauuFjM/o3ex0VpubZUyfynvlopGRB35R5rvGTbfMo3RjbGAys3RjyqNts8K/5PskPNYWiscJWN8K8RW3/NFVSkbb4/6JZWBSbgfDmI4sSIKrrs52oKVaQQtYNi0L/4h9qrxpK0T4u3nqG6cH4FsCunSi3uzKC9RiOzG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea18f914-e22c-4f24-927d-08d8d42c9e5e X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:37.5335 (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: SYQv5I4en5NWI6ViAt+6iyNSD8nIFcv9bnwcP3dqLwqn/UA3n82jWRYMJYJ+tdK3x7ABUbIRO74Ftk3njdf1Y8M41lPSEwXsJ42E+CvW2r4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 0961fddfdd3f8ccd6302af2e7718abbaf18c9fff This commit moves over the code which computes stripe alignment and extent size hint alignment into a separate function. Apart from xfs_bmap_btalloc(), the new function will be used by another function introduced in a future commit. Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_bmap.c | 89 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 37 deletions(-) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 836e5a5..57d6273 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -3456,13 +3456,59 @@ xfs_bmap_btalloc_accounting( args->len); } +static int +xfs_bmap_compute_alignments( + struct xfs_bmalloca *ap, + struct xfs_alloc_arg *args) +{ + struct xfs_mount *mp = args->mp; + xfs_extlen_t align = 0; /* minimum allocation alignment */ + int stripe_align = 0; + int error; + + /* stripe alignment for allocation is determined by mount parameters */ + if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC)) + stripe_align = mp->m_swidth; + else if (mp->m_dalign) + stripe_align = mp->m_dalign; + + if (ap->flags & XFS_BMAPI_COWFORK) + align = xfs_get_cowextsz_hint(ap->ip); + else if (ap->datatype & XFS_ALLOC_USERDATA) + align = xfs_get_extsz_hint(ap->ip); + if (align) { + error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, + align, 0, ap->eof, 0, ap->conv, + &ap->offset, &ap->length); + ASSERT(!error); + ASSERT(ap->length); + } + + /* apply extent size hints if obtained earlier */ + if (align) { + args->prod = align; + div_u64_rem(ap->offset, args->prod, &args->mod); + if (args->mod) + args->mod = args->prod - args->mod; + } else if (mp->m_sb.sb_blocksize >= PAGE_SIZE) { + args->prod = 1; + args->mod = 0; + } else { + args->prod = PAGE_SIZE >> mp->m_sb.sb_blocklog; + div_u64_rem(ap->offset, args->prod, &args->mod); + if (args->mod) + args->mod = args->prod - args->mod; + } + + return stripe_align; +} + STATIC int xfs_bmap_btalloc( struct xfs_bmalloca *ap) /* bmap alloc argument struct */ { xfs_mount_t *mp; /* mount point structure */ xfs_alloctype_t atype = 0; /* type for allocation routines */ - xfs_extlen_t align = 0; /* minimum allocation alignment */ xfs_agnumber_t fb_agno; /* ag number of ap->firstblock */ xfs_agnumber_t ag; xfs_alloc_arg_t args; @@ -3482,25 +3528,11 @@ xfs_bmap_btalloc( mp = ap->ip->i_mount; - /* stripe alignment for allocation is determined by mount parameters */ - stripe_align = 0; - if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC)) - stripe_align = mp->m_swidth; - else if (mp->m_dalign) - stripe_align = mp->m_dalign; - - if (ap->flags & XFS_BMAPI_COWFORK) - align = xfs_get_cowextsz_hint(ap->ip); - else if (ap->datatype & XFS_ALLOC_USERDATA) - align = xfs_get_extsz_hint(ap->ip); - if (align) { - error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, - align, 0, ap->eof, 0, ap->conv, - &ap->offset, &ap->length); - ASSERT(!error); - ASSERT(ap->length); - } + memset(&args, 0, sizeof(args)); + args.tp = ap->tp; + args.mp = mp; + stripe_align = xfs_bmap_compute_alignments(ap, &args); nullfb = ap->tp->t_firstblock == NULLFSBLOCK; fb_agno = nullfb ? NULLAGNUMBER : XFS_FSB_TO_AGNO(mp, @@ -3531,9 +3563,6 @@ xfs_bmap_btalloc( * Normal allocation, done through xfs_alloc_vextent. */ tryagain = isaligned = 0; - memset(&args, 0, sizeof(args)); - args.tp = ap->tp; - args.mp = mp; args.fsbno = ap->blkno; args.oinfo = XFS_RMAP_OINFO_SKIP_UPDATE; @@ -3564,21 +3593,7 @@ xfs_bmap_btalloc( args.total = ap->total; args.minlen = ap->minlen; } - /* apply extent size hints if obtained earlier */ - if (align) { - args.prod = align; - div_u64_rem(ap->offset, args.prod, &args.mod); - if (args.mod) - args.mod = args.prod - args.mod; - } else if (mp->m_sb.sb_blocksize >= PAGE_SIZE) { - args.prod = 1; - args.mod = 0; - } else { - args.prod = PAGE_SIZE >> mp->m_sb.sb_blocklog; - div_u64_rem(ap->offset, args.prod, &args.mod); - if (args.mod) - args.mod = args.prod - args.mod; - } + /* * If we are not low on available data blocks, and the underlying * logical volume manager is a stripe, and the file offset is zero then From patchwork Thu Feb 18 16:44:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 101C2C433E0 for ; Thu, 18 Feb 2021 18:46:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5E1E64EB8 for ; Thu, 18 Feb 2021 18:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232658AbhBRSqe (ORCPT ); Thu, 18 Feb 2021 13:46:34 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40954 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232634AbhBRQrC (ORCPT ); Thu, 18 Feb 2021 11:47:02 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGT0Bj155629 for ; Thu, 18 Feb 2021 16:45:41 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-type : mime-version; s=corp-2020-01-29; bh=KddXlnfvuJMuYLnDle/fArJYx9iyty/anKKDxkJYTB4=; b=C3S9aywU/J+/hB2l9jMyZ8QU3h46jEs1zomCsI8/mrMWb72nmPt9rF6X8HoXdWaD+c9E gGKAOWA9sZW+pDrQsMmjMybNqXS57lvHyS+z/2M5OHCpkI+OSFG3mMudtYYUX7D/i2qW LybQQcAU7HRUZeHlRJ6Yo/4TpnuHcZXuStq6YabjID8W1ZKV/gqw3Zird0wRjGsFDn/H LNXNgh+kID5JZgmUwKg6q2Q+Pn8TDeM3QeSXJwAmzG/Uzs+5G6Iqytj9zSnjqicvKoX/ eQLR4vrXpTHQMiCXXslj7gs8YiJA9m8hlXs2YNl4bGOUpvwqo02ddoba5dLRXuVijnco Pg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r6m4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:41 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCaD032333 for ; Thu, 18 Feb 2021 16:45:41 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G/MpUQ7PP2guldjR4eLOYwl68es48aVSvUaIyNO8Wud+ZeoQvqNX+is07xPhhVS8kw/qHLJJnlu18MrVQb+NNt1ZohjYyUW4d2nxg9FvJLHa4sDFDVfX34bHtkyMuhF7hvT/JeDxYTqYt1t9ZsfLXfSzI7tXOjCiy6Y0zOH/nzttq4GKyjcKZgwdmi1m8ucyHk4sNE/8IxEn688bcfkragkU715yHNDtJcsf2gS8Pyzdok2z0GIpS43MWixcJc9kM0NrXNucZNvzu+hEYino/5I6CmQNLJq5DRzEi6BZdj0IYycXLWBZ7kUbEYLJGI36RjF333kMrwexsUMH/ySddA== 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-SenderADCheck; bh=KddXlnfvuJMuYLnDle/fArJYx9iyty/anKKDxkJYTB4=; b=kL89opHlZDjSxQ36I8jpOUIy7ol+hEygvkItFtiTgJmiTRkx3APgRfysA6dRFNDYExz5JJ6XIeuOdzYMXpFIfdDpan7zQ5J+8IMOUnZbKSCw+pYKFb88Mh+G4CIDOIx+ybv419gNXqs3Ck8FOB/TCdU3hPhxAZiqqYyBGpe7pA7aKT/QNx6QaveeVisy+IxT4Rsee0+aX22Fovh2ZasKFlawXfQqi/QWB8Eh+duaCwpQ4IWudKujekOvZ3AvKtnT5h4lZsqoCdfnJa/5CtttGd/fcBhRMmT+FI5FJEWhO0uRPcI9Ylreo1E1PE/mydivokBdxX9ckueeTdiXDocQTg== 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=KddXlnfvuJMuYLnDle/fArJYx9iyty/anKKDxkJYTB4=; b=k6ZbyclYC8sq42LZ7xL00cOqZhHyqZYE7VIOF6AKs63/nIVPCeIyRJ1smE5tAwnLrusX1ZWLIyYoxAWqkh0zMvmcG7F5c1OFjmv9oDNflB8DNi+QXxzUclKMUuDobm3lfP0qFnxQzrbCtPU6a8HFhC53PnMgRirbNE4dMmIIPuQ= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:38 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:38 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 15/37] xfsprogs: Process allocated extent in a separate function Date: Thu, 18 Feb 2021 09:44:50 -0700 Message-Id: <20210218164512.4659-16-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 249c8ecb-5a53-425c-abe9-08d8d42c9ea5 X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e1RuUlDY7IX5ajb6cR9gW1Wpn5C8lkvBpkXxlpoepPccaR2tG19MzMk4vkLyi8eeLipCTuoQY/F/xwilZrZqGng01lsZxZFU6DQWdloYsFd4dxp6+WqF5/FjAGIDmWWRau238pnDXLm0ESTdebhvQzmn73D9Mai3d9NjJr4QtfpKGr6vJ7yWonjbXw+LxG5MVj0k+Wp+9qUcAs/QYynz7NFJfHF/TUiL1Nq993SWmLLAC0UykeEfFiaAruET+Vqe1NC4nEJEpOZa4zbiCC1peyhmCdLQb5dkEaBnCL9jbo+D0n3JRWCfVwaf2qJj0ocd8P+ryzdbmgzNYCHmrBBaW2JHBwRILgjRwvDAOzWePMpmx/HyQ4ms/OuAQtCAGfhIIoiknkfqkB+MYoEsl/qh/uRZDwWnWBHIt4NgJEb6TNdqBmfCYbYJKXjYXxhXNarAoCynTpmX+2RIXn+okuVlQA7IJPzLh/pD6iie6PG9nao728VDKOiGlB7eRqFvTsprcz+WfcvwAtV5pPEIUIo7R8StMcaxxyb56i0URLECThGIPe5aaORos/szK86Q/Niok3FtwfexVZ58Qdg2IEwV5w== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: v8HA2cJUurNHUujCbcYeeJr17BP/UHpz7E0Bg/l8oZxQCdzlBeDGsLP1quReFoTbI1JXXwstj0xVPokXPgXTJMhc5v5SYmTaIwusMZgbzhIBsxSzqNQXLl25ubmFzfEWDzVA+KQJZB/+/WIdKimdrz3FWQKFrE6yfONnSAYX+zh7/c1sjatktbCAcCdBx6OA/pkKmnqJviBSAe/yv0KCy0Krs9ZWOZYQBFbZqYe0e+MzILeXf7o5p/tWDnQddvOG2YhHB2SOv9xw1PUrvtRHWa4aL23b2TaTMUaiPvDHjo4ZDrP3Qu7PlsfOkVWjTYbR0Ic9gXhucGSRzoeUXEWBXFnTUL6IMn8mNa9cSx+3Xo6U0GorpcBgQ7bBmEOdUXA5gjRcUalP2dXmhEMU/lNKK6BsNs8I99DJMr2+RMiFf02WBNiK69lJXyazzKBUg3xRVqTfmsfAxt7TfIjekHnjXoy39VmZINseFfKCQLTAlDLSJfrfGqZSIiArhQ2RsIWAEvONjp1Md08mQ1njRhLPQa8y733yqQ1OXYm26by33eRCjJwVJFWjLYNELeumZTo73zHuCD6V/C2PSDiKpnO+Uhih5Pb6gJoFmZYK9sknE81TtRmAncUXRjATWXjM+KHtxLnadVaJZoI8EnN564kqVfZdcyewZF2/FEdxU4vJjIA4mkkkMpDp8Km/MF9iMqPC2EMi4I3cGyLImxgcyxgJAX82pkaofR/zX52Ccl5bNJYCq+icnxyI6HuC9Lru+qXwehxBzD8rGPoheaKNCigXD5cIzavAhVTpbpSWPb/SnNBT8HxK70zTyQz7+M0h3nRkVDWSlUkFv6LhUCkt5OMdb9tZqDPuRm9QGiMKxy8225lN3GiG6sTeH8cmXjWQRTxbtqitcl652iCTudAmfZDpuewqP4cdaRIxpQb+VoptlYjHzS4Mvhf49OGXfWvT41L8WE6bB1P7kQ6tFR9jkYoiSt+HuCtrFeU1r8eG9LW0ySW91GZXoasM2Id6PFg/3vcAM35jP4NY2XsIaSQSJSLz30cichtN58q8xrRl/Zz97hXMA5M/dza2ReG9DMVX3eqwrQNPa1Mtd4kW+Rpt0ocak084WVzbo94wHRR78JtUkOYyZaAtbdUiRYMNju+gjzjhTtd77Q/5KDV9AEDQCEO/6skrbeaHdl0LIcmUOEnfWEmIxSLDcGPay5alxIP2KK9N0HckVQLjEDmCdQYC5H2c4tgy7DRu9LFvHL41c0mbIKTtx5D4TemlEcE2aQAqODIMDxC6dRJN+lAzrn0CQAvqJ53xe9CORekqtEmPNh2gacFR8gqqgNjeZBCMyzqeTGRh X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 249c8ecb-5a53-425c-abe9-08d8d42c9ea5 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:37.9924 (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: QtGLgoyKD7GP0jkLXU5yT0pMvbcb2nGwCF3C5AJ/04v6FSMRbTm/AJnYz2Tvsh+Q3JJMfMBNZEswREhh43uCuuWzmYmxAinFTKuYnvacRCc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 07c72e556299a7fea448912b1330b9ebfd418662 This commit moves over the code in xfs_bmap_btalloc() which is responsible for processing an allocated extent to a new function. Apart from xfs_bmap_btalloc(), the new function will be invoked by another function introduced in a future commit. Reviewed-by: Allison Henderson Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_bmap.c | 74 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 57d6273..6a9485a 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -3503,6 +3503,48 @@ xfs_bmap_compute_alignments( return stripe_align; } +static void +xfs_bmap_process_allocated_extent( + struct xfs_bmalloca *ap, + struct xfs_alloc_arg *args, + xfs_fileoff_t orig_offset, + xfs_extlen_t orig_length) +{ + int nullfb; + + nullfb = ap->tp->t_firstblock == NULLFSBLOCK; + + /* + * check the allocation happened at the same or higher AG than + * the first block that was allocated. + */ + ASSERT(nullfb || + XFS_FSB_TO_AGNO(args->mp, ap->tp->t_firstblock) <= + XFS_FSB_TO_AGNO(args->mp, args->fsbno)); + + ap->blkno = args->fsbno; + if (nullfb) + ap->tp->t_firstblock = args->fsbno; + ap->length = args->len; + /* + * If the extent size hint is active, we tried to round the + * caller's allocation request offset down to extsz and the + * length up to another extsz boundary. If we found a free + * extent we mapped it in starting at this new offset. If the + * newly mapped space isn't long enough to cover any of the + * range of offsets that was originally requested, move the + * mapping up so that we can fill as much of the caller's + * original request as possible. Free space is apparently + * very fragmented so we're unlikely to be able to satisfy the + * hints anyway. + */ + if (ap->length <= orig_length) + ap->offset = orig_offset; + else if (ap->offset + ap->length < orig_offset + orig_length) + ap->offset = orig_offset + orig_length - ap->length; + xfs_bmap_btalloc_accounting(ap, args); +} + STATIC int xfs_bmap_btalloc( struct xfs_bmalloca *ap) /* bmap alloc argument struct */ @@ -3695,36 +3737,10 @@ xfs_bmap_btalloc( return error; ap->tp->t_flags |= XFS_TRANS_LOWMODE; } + if (args.fsbno != NULLFSBLOCK) { - /* - * check the allocation happened at the same or higher AG than - * the first block that was allocated. - */ - ASSERT(ap->tp->t_firstblock == NULLFSBLOCK || - XFS_FSB_TO_AGNO(mp, ap->tp->t_firstblock) <= - XFS_FSB_TO_AGNO(mp, args.fsbno)); - - ap->blkno = args.fsbno; - if (ap->tp->t_firstblock == NULLFSBLOCK) - ap->tp->t_firstblock = args.fsbno; - ap->length = args.len; - /* - * If the extent size hint is active, we tried to round the - * caller's allocation request offset down to extsz and the - * length up to another extsz boundary. If we found a free - * extent we mapped it in starting at this new offset. If the - * newly mapped space isn't long enough to cover any of the - * range of offsets that was originally requested, move the - * mapping up so that we can fill as much of the caller's - * original request as possible. Free space is apparently - * very fragmented so we're unlikely to be able to satisfy the - * hints anyway. - */ - if (ap->length <= orig_length) - ap->offset = orig_offset; - else if (ap->offset + ap->length < orig_offset + orig_length) - ap->offset = orig_offset + orig_length - ap->length; - xfs_bmap_btalloc_accounting(ap, &args); + xfs_bmap_process_allocated_extent(ap, &args, orig_offset, + orig_length); } else { ap->blkno = NULLFSBLOCK; ap->length = 0; From patchwork Thu Feb 18 16:44:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB3B8C433DB for ; Thu, 18 Feb 2021 18:46:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7668C64EB8 for ; Thu, 18 Feb 2021 18:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbhBRSqS (ORCPT ); Thu, 18 Feb 2021 13:46:18 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:44186 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232658AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUNEx180452 for ; Thu, 18 Feb 2021 16:45:42 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-type : mime-version; s=corp-2020-01-29; bh=KXWgDusG8RQtQBjveJi1uK3rx0ccdLVbk4hSImrcpyY=; b=YdUPJy4jO+MLSrXSnTboD3tkt2klPBTFgTph4pSFShosTX+LFLsxVYL+1bZh5JKdXN2J R1D1krJ3oWoV4WE34T9O91p/25c722Gl7wFvdu0C22Hpeqc9MEyVnL/U7jmGxXbWfJF1 ggy48+7B/V78cqYaNX+BXVaDPJnE8Mv8BwfWZR2sEtpkQghsdkwzFRExF3synGAt3acw MFNvB6A3iqhWZbBcWLzpnMgiCA1Fy0iMhZArB7HO4kuq8LtgvIVJvbMfRlotc4NgAfIS C8uJzqPJtx48sa5cesH7cpHxCLw4Wru6JjUfr3rfVirOdOddUdswQmtIQ/ENFfQmyXlJ xw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnph1m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:42 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCaE032333 for ; Thu, 18 Feb 2021 16:45:42 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DIeNpqc3xVo2rTeWFAtzcKGCoNMorbjZQmJSaPuMMqxrquyjfNJX2E/sqJ5cXOI1T83ilOAXESQCdFLruCv6Le3VG2weM+zn3hEcc8i+6cJgUBa+So9m7Nfp7mUWa5bbNREK/a4MfrJuooS5k1n1w3FUq+7TCHcqFIjFNOhQNwDUt8nJ6Fg4fl0fTRAIhys/14G00uhKjc9vDS8l+JAP8dIV8XF5Ik8I9/Vr2g4IPZDahuMCVPKHEvbx7U4+md/Na+8JMJpizjCUaUmcn5TduorWmJ2ldV1HSqGcroYuLrReQwHyFgcO41uutm5RDyqx8ZkGs6M0jkRW5D5kHeoNOQ== 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-SenderADCheck; bh=KXWgDusG8RQtQBjveJi1uK3rx0ccdLVbk4hSImrcpyY=; b=Z7ylDhLahqYPG8xPRNQJwzLk6lPqVzzXRvjuWKP4xxhoUMjLuxM1ck7eIleTwlJnx6g56G9ZE/uDsvkMusXCIPyDCl7OpBoNYKc0ROMPNDsQ46BPb0/WgENnyAKdtbNan1eEtzRpcvptieb+8LoCTxNbt7eKBrOu2meDknzl/2qc00SSiMZCrcGVm3gWhBUfjHNV/gttPale0TtFbuu+sdus6Um1U5UOyjT2VRmEGstTXoRuQX3QKwJcr3Hs1jEw+IBDttndfxmq/o7vbGjndKhfFB7ZfQNO8mQRxx9eifiCzQxJ5pO3y9tqP6Gzq9WhbM/eNzT/+BcmHmit4Y2esQ== 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=KXWgDusG8RQtQBjveJi1uK3rx0ccdLVbk4hSImrcpyY=; b=yQrEwYL05kGItWqcihL0IScyVWB/CHP2XlX9gQXl1D1eK0JgAzy7ma3vplBnPmQ9IfuANOyyfY4g+vUXMebvQ8NRCPfQ64jXuWIfe5JNQ/DRxhvc6Hvs4KGNaAnRcpKYzt8y7PAZ5N3zzSz40IhIPeVISeBVxqbVXE4CWR1jbi0= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:38 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:38 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 16/37] xfsprogs: Introduce error injection to allocate only minlen size extents for files Date: Thu, 18 Feb 2021 09:44:51 -0700 Message-Id: <20210218164512.4659-17-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3099928f-7ecf-48cd-26c7-08d8d42c9ef3 X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BdbvQ8oOS0T0TBgaBUQj8AbUjDyf1EV4gcXc4yT/7abbrNshWajRsLzpKkxyqPKFXspjT2nI9b16jriIZQi1J6hl0vffGTdhdz8w8MVJzZLD7dcJiNOmdxUMA/Yarc9GuqV16Btiq0TSWoYn+k23XLX/vEO8dsx91rawf3AxBe3ZKSKJkGaNoMDppuPzcgqnVMMJZnPr5Fbyb5FGW2ob8JMiTdHP74m74llXsIWa1VEKfwY+CYUJKdvIpWFemSibXrZH22Ups7na7RJYrZISM5edttdMxuLvN2Q3d29O7eFvNviQUwysT+281NjYh3r1uhA08rJNDnDeMm82n5IAhJrD7aNAVp8w5D+dtJ1clzCtz8vENZ5mVDl5KEoHLZSCnyHlzny66BR9/zDWpMYHQUXfTYOS8Q0uGxkyjWqOonDruswJI4Bb10cz5WA/gDvk3xRYzdF0VagC0dn/8ldyHFLUW+ZVfN1/JmUK5CMGu+NUEqNa8tbuKsRYxx61oIZvaxnt4v3uqG5JDmRGZooiChLkpmH6/fzQg2H3LGdBjZ5KqM5e2Qm+XVML4XKb1RHLNDz0HQvSsfHizNlk12YTiA== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: mYI81y3EPNIA1LHldRJiJwrvIlfsGv+fNUKVNbIbKI0MJCsY8zvixasMHZ7EmaygHV0Y/SuJ69fyd2ik/iEnb9Ff7O3hpjG7SLQsOkoVLl5Rmsxh3xuJGlBpt0b65EoLGyqH0nP8ulqSWAeDQWh3tRZG95l7VaiNe1+tyoTLJmtjYKCdOWanKVPsTgjKBFjtO+JuTi9xhkk/DTRBcs2sNMkuVwzjd1JxEYWaoPB//Srf5IM+xCLzrCbv8LiL7mpw1xbjS8tuy8ZJOiwuPi3yAVNCgzimvA30xXeQxNDQY9MGD7nzDVEyAf8+1tw9uoUM7lvVrEPCywmHMt8Rvb+qWn8OGp9CH0KidSUFCwc65Hc1Suhm7rKKRxDV5lIYQBVXPoEHJmXn8mxG8uleTug2EDd2jcdDVOyYYbLyw5gszlVELTTixoRTRJki2gk+Im7ThzjHyN7FHRU3MerG+GLwKlXTvhCPVWU60YXqJLKRfXCn+5ivtvsSMSy4FPAb1zKt6rQZA6pSb3BuFM3qgZd+BjKlL5W58LU936zPandkKOvF2+WVxCfL+qmx4Ug3hHXsl8O7p5mi4OVOLC1vJK5bYGYw3DH+3Nyi0GLA6d8GxNRENmLzreHS9UfBqEKWKIb+wNgURvreNfRL85JZE4GyTeyBThe9J5ayLE02QZfuRa7w44HIbSTaVM0/sNagtIdMAB1ryEo4Sue2XUOOuPY3OPIJE1/mypfBcupzuv4Cfj6Of5qna3/NIv7qf1TtuL5D3x+1v4ETBxJdp8cYovtmmEQSeitqgoPL8ZWjAQPicDGy+1Nksntiq6HuKdm4boKDK5fNQSpujYx/tyw8sr63aB1wSE2JM3V0ruwhuZuYKudi+aRTBi7MuBluS+K296UdgdaO5ArIMJTEJlf4pac5b9Y8rsJJsoLv0BXaCRk8dgZO2epECn8+vEG9FttiKU0zWOns829Q7M1LVeX6QaUkwzAqBBuBHnRSCXzuF/gi6njo0WmX8WVKR1WYDZqSIFHVp8UphxVEwi3sFLrMdqJKL1kgMbzZaDczd2vTxbymZqxjTawR4I6boL4ATrB3r9cTuJcx/MLABdd3+ovDorWQ4qRzHZE3I2K5Xt+5sQpucpfnUbi3Hq3/pMkF9cjSEzimpUw0pSYOLj65O2Xv1wUpOcCNEdT5HerDQeyQO8Hkrw0q6E2SAsVLOmlDbWRvCe8SnQR1J4mfggwchNWKaA42MfghigjCIonu04dBXS55vZpmMPx+r6PbAG44DmcfT+mB56cydfFqc7XcB3Cs4FfNKETT5Kio3c7kxcki+m3LwZaqSX3HSmSR9BA9AySV4t8Y X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3099928f-7ecf-48cd-26c7-08d8d42c9ef3 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:38.5291 (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: 5U/exBJg6mxPKAA2Aup+ULqbahECCmAG00Zo4sCrISgAv0Tb6elDa+F6MLRrXQS4sUeh+T+YNW1cf4WaX5r4zyr2uiTpqR//Y7DhgREdrk0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Chandan Babu R Source kernel commit: 301519674699aa9b80a15b2b2165e08532b176e6 This commit adds XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag which helps userspace test programs to get xfs_bmap_btalloc() to always allocate minlen sized extents. This is required for test programs which need a guarantee that minlen extents allocated for a file do not get merged with their existing neighbours in the inode's BMBT. "Inode fork extent overflow check" for Directories, Xattrs and extension of realtime inodes need this since the file offset at which the extents are being allocated cannot be explicitly controlled from userspace. One way to use this error tag is to, 1. Consume all of the free space by sequentially writing to a file. 2. Punch alternate blocks of the file. This causes CNTBT to contain sufficient number of one block sized extent records. 3. Inject XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT error tag. After step 3, xfs_bmap_btalloc() will issue space allocation requests for minlen sized extents only. ENOSPC error code is returned to userspace when there aren't any "one block sized" extents left in any of the AGs. Reviewed-by: Darrick J. Wong Signed-off-by: Chandan Babu R Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson achender: Amended io/inject.c with error tag name to avoid compiler errors Signed-off-by: Allison Henderson --- io/inject.c | 1 + libxfs/xfs_alloc.c | 50 ++++++++++++++++++++ libxfs/xfs_alloc.h | 3 ++ libxfs/xfs_bmap.c | 124 ++++++++++++++++++++++++++++++++++++++++---------- libxfs/xfs_errortag.h | 4 +- 5 files changed, 157 insertions(+), 25 deletions(-) diff --git a/io/inject.c b/io/inject.c index ff66b41..4bd4138 100644 --- a/io/inject.c +++ b/io/inject.c @@ -56,6 +56,7 @@ error_tag(char *name) { XFS_ERRTAG_IUNLINK_FALLBACK, "iunlink_fallback" }, { XFS_ERRTAG_BUF_IOERROR, "buf_ioerror" }, { XFS_ERRTAG_REDUCE_MAX_IEXTENTS, "reduce_max_iextents"}, + { XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT, "bmap_min_extent"}, { XFS_ERRTAG_MAX, NULL } }; int count; diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 0bef9f0..63e15bb 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -2470,6 +2470,47 @@ xfs_defer_agfl_block( xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_AGFL_FREE, &new->xefi_list); } +#ifdef DEBUG +/* + * Check if an AGF has a free extent record whose length is equal to + * args->minlen. + */ +STATIC int +xfs_exact_minlen_extent_available( + struct xfs_alloc_arg *args, + struct xfs_buf *agbp, + int *stat) +{ + struct xfs_btree_cur *cnt_cur; + xfs_agblock_t fbno; + xfs_extlen_t flen; + int error = 0; + + cnt_cur = xfs_allocbt_init_cursor(args->mp, args->tp, agbp, + args->agno, XFS_BTNUM_CNT); + error = xfs_alloc_lookup_ge(cnt_cur, 0, args->minlen, stat); + if (error) + goto out; + + if (*stat == 0) { + error = -EFSCORRUPTED; + goto out; + } + + error = xfs_alloc_get_rec(cnt_cur, &fbno, &flen, stat); + if (error) + goto out; + + if (*stat == 1 && flen != args->minlen) + *stat = 0; + +out: + xfs_btree_del_cursor(cnt_cur, error); + + return error; +} +#endif + /* * Decide whether to use this allocation group for this allocation. * If so, fix up the btree freelist's size. @@ -2541,6 +2582,15 @@ xfs_alloc_fix_freelist( if (!xfs_alloc_space_available(args, need, flags)) goto out_agbp_relse; +#ifdef DEBUG + if (args->alloc_minlen_only) { + int stat; + + error = xfs_exact_minlen_extent_available(args, agbp, &stat); + if (error || !stat) + goto out_agbp_relse; + } +#endif /* * Make the freelist shorter if it's too long. * diff --git a/libxfs/xfs_alloc.h b/libxfs/xfs_alloc.h index 6c22b12..a4427c5 100644 --- a/libxfs/xfs_alloc.h +++ b/libxfs/xfs_alloc.h @@ -75,6 +75,9 @@ typedef struct xfs_alloc_arg { char wasfromfl; /* set if allocation is from freelist */ struct xfs_owner_info oinfo; /* owner of blocks being allocated */ enum xfs_ag_resv_type resv; /* block reservation to use */ +#ifdef DEBUG + bool alloc_minlen_only; /* allocate exact minlen extent */ +#endif } xfs_alloc_arg_t; /* diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 6a9485a..9209e4f 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -3545,34 +3545,101 @@ xfs_bmap_process_allocated_extent( xfs_bmap_btalloc_accounting(ap, args); } -STATIC int -xfs_bmap_btalloc( - struct xfs_bmalloca *ap) /* bmap alloc argument struct */ +#ifdef DEBUG +static int +xfs_bmap_exact_minlen_extent_alloc( + struct xfs_bmalloca *ap) { - xfs_mount_t *mp; /* mount point structure */ - xfs_alloctype_t atype = 0; /* type for allocation routines */ - xfs_agnumber_t fb_agno; /* ag number of ap->firstblock */ - xfs_agnumber_t ag; - xfs_alloc_arg_t args; - xfs_fileoff_t orig_offset; - xfs_extlen_t orig_length; - xfs_extlen_t blen; - xfs_extlen_t nextminlen = 0; - int nullfb; /* true if ap->firstblock isn't set */ - int isaligned; - int tryagain; - int error; - int stripe_align; + struct xfs_mount *mp = ap->ip->i_mount; + struct xfs_alloc_arg args = { .tp = ap->tp, .mp = mp }; + xfs_fileoff_t orig_offset; + xfs_extlen_t orig_length; + int error; ASSERT(ap->length); + + if (ap->minlen != 1) { + ap->blkno = NULLFSBLOCK; + ap->length = 0; + return 0; + } + orig_offset = ap->offset; orig_length = ap->length; - mp = ap->ip->i_mount; + args.alloc_minlen_only = 1; - memset(&args, 0, sizeof(args)); - args.tp = ap->tp; - args.mp = mp; + xfs_bmap_compute_alignments(ap, &args); + + if (ap->tp->t_firstblock == NULLFSBLOCK) { + /* + * Unlike the longest extent available in an AG, we don't track + * the length of an AG's shortest extent. + * XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT is a debug only knob and + * hence we can afford to start traversing from the 0th AG since + * we need not be concerned about a drop in performance in + * "debug only" code paths. + */ + ap->blkno = XFS_AGB_TO_FSB(mp, 0, 0); + } else { + ap->blkno = ap->tp->t_firstblock; + } + + args.fsbno = ap->blkno; + args.oinfo = XFS_RMAP_OINFO_SKIP_UPDATE; + args.type = XFS_ALLOCTYPE_FIRST_AG; + args.total = args.minlen = args.maxlen = ap->minlen; + + args.alignment = 1; + args.minalignslop = 0; + + args.minleft = ap->minleft; + args.wasdel = ap->wasdel; + args.resv = XFS_AG_RESV_NONE; + args.datatype = ap->datatype; + + error = xfs_alloc_vextent(&args); + if (error) + return error; + + if (args.fsbno != NULLFSBLOCK) { + xfs_bmap_process_allocated_extent(ap, &args, orig_offset, + orig_length); + } else { + ap->blkno = NULLFSBLOCK; + ap->length = 0; + } + + return 0; +} +#else + +#define xfs_bmap_exact_minlen_extent_alloc(bma) (-EFSCORRUPTED) + +#endif + +STATIC int +xfs_bmap_btalloc( + struct xfs_bmalloca *ap) +{ + struct xfs_mount *mp = ap->ip->i_mount; + struct xfs_alloc_arg args = { .tp = ap->tp, .mp = mp }; + xfs_alloctype_t atype = 0; + xfs_agnumber_t fb_agno; /* ag number of ap->firstblock */ + xfs_agnumber_t ag; + xfs_fileoff_t orig_offset; + xfs_extlen_t orig_length; + xfs_extlen_t blen; + xfs_extlen_t nextminlen = 0; + int nullfb; /* true if ap->firstblock isn't set */ + int isaligned; + int tryagain; + int error; + int stripe_align; + + ASSERT(ap->length); + orig_offset = ap->offset; + orig_length = ap->length; stripe_align = xfs_bmap_compute_alignments(ap, &args); @@ -4106,6 +4173,10 @@ xfs_bmap_alloc_userdata( return xfs_bmap_rtalloc(bma); } + if (unlikely(XFS_TEST_ERROR(false, mp, + XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT))) + return xfs_bmap_exact_minlen_extent_alloc(bma); + return xfs_bmap_btalloc(bma); } @@ -4142,10 +4213,15 @@ xfs_bmapi_allocate( else bma->minlen = 1; - if (bma->flags & XFS_BMAPI_METADATA) - error = xfs_bmap_btalloc(bma); - else + if (bma->flags & XFS_BMAPI_METADATA) { + if (unlikely(XFS_TEST_ERROR(false, mp, + XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT))) + error = xfs_bmap_exact_minlen_extent_alloc(bma); + else + error = xfs_bmap_btalloc(bma); + } else { error = xfs_bmap_alloc_userdata(bma); + } if (error || bma->blkno == NULLFSBLOCK) return error; diff --git a/libxfs/xfs_errortag.h b/libxfs/xfs_errortag.h index 1c56fcc..6ca9084 100644 --- a/libxfs/xfs_errortag.h +++ b/libxfs/xfs_errortag.h @@ -57,7 +57,8 @@ #define XFS_ERRTAG_IUNLINK_FALLBACK 34 #define XFS_ERRTAG_BUF_IOERROR 35 #define XFS_ERRTAG_REDUCE_MAX_IEXTENTS 36 -#define XFS_ERRTAG_MAX 37 +#define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT 37 +#define XFS_ERRTAG_MAX 38 /* * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. @@ -99,5 +100,6 @@ #define XFS_RANDOM_IUNLINK_FALLBACK (XFS_RANDOM_DEFAULT/10) #define XFS_RANDOM_BUF_IOERROR XFS_RANDOM_DEFAULT #define XFS_RANDOM_REDUCE_MAX_IEXTENTS 1 +#define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT 1 #endif /* __XFS_ERRORTAG_H_ */ From patchwork Thu Feb 18 16:44:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6C80C4332D for ; Thu, 18 Feb 2021 18:45:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8712C64EC0 for ; Thu, 18 Feb 2021 18:45:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbhBRSpI (ORCPT ); Thu, 18 Feb 2021 13:45:08 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35654 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232729AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTiDf040357 for ; Thu, 18 Feb 2021 16:45:43 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-type : mime-version; s=corp-2020-01-29; bh=7iRM33BsY/NjjvjomNMIp1CjUrXUdg14KDJF+JczEBg=; b=X32/mp/o4GVby8BTxZTd5JhWJtSZUs0Vq3YrrPQFw5RMCk+f6Jx74Fks3SKR85K8ZBmB loe9NqWcH1yQjnS/xLz540F0ECUrkRE8tveLliuR+vG9Mrip+oBmJmsbTdMQBs4aRCe4 IrxOHPST6CHcfCF6Ki+/UE+j/UQSF+gaZDNWciEzoCdUSC2RGy1Fu/gJ82g0OfxeuTUA 4xPP7asgkuqWt137AsTSkMJdrzIWsFaJFS4Qnw1oMnON0l2NCVIqD4RKoT+FMjoPPSTf xgSDRhMPh2iNNUZWnwrGw8mFnSK1y7cQpNihf/m9kwijRhmK7XTBRUGveEcToY1BMara iQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36pd9ae3hm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:43 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCaG032333 for ; Thu, 18 Feb 2021 16:45:42 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-10 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iKz3FIfbnaSxQNblGOjbBL42BQGQcKmEKuEyJc+JjDxFFwM6hfunsvdsV6DTHfknVVi8vKJ2NZ65g/25oEgoOO9Z31SJRM2JU+1VyTMhJ77B/tpkxmfw0vJFO5c2l7M/jDYJJ8vUvZfbxTc0DVwbxjhb3wZbUgbhSXboVKpIAves3UuD5g7+YrS/CDq+FQyZqG6RfI8eDGMM99wqxA/jSJDvA+bAG8D/1oxC/d2BD1ErWpZNXkALvR9w/Tr5nNhX1XDPPcQjTH1eOMMfomZ0UpT03McD+k7P7s6dDU3ZkuY60hnQn6/xgsJEXBUWKVtIuDP3HA7N9Ss68lrVFIy7gw== 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-SenderADCheck; bh=7iRM33BsY/NjjvjomNMIp1CjUrXUdg14KDJF+JczEBg=; b=mKMwRkv2ioCVh+a4AN56DsmijcOkGyOPHccpuK8huLErQcms93FnYDlUxP7OPdon4YWU+UNLLuSY1bMmxPN+LhYp1fTbsELlM0zyFyCsFhpOTiK3KO4WIY13GkVI4LIoBQ3H+/rbLP0MMVXkZE8N0B6Yo7lEp9FQE9n9tZuRuziarjbzwo+BAylBggXNX3uB7yXzDBo5e6JWxdh4bsWLoVH06v9iL0yEeO8vyCtB6pARl3nNDVOfpXmN11VkR+uhKlW6hu3OyJlFs8CZEuUoW2W4DgYQ3CNda1PbcvHQNxF5tcL/Jug5snti8FNJYf8bHMJOtU+R/QHqbjtEcKiuvg== 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=7iRM33BsY/NjjvjomNMIp1CjUrXUdg14KDJF+JczEBg=; b=mpIVLX083CCx3uyH8CsDjaMVrryUHNYdxK6/6FRknk3lBa3ZNj+fgIpemkZjogcflg9NEmj9w/O2eBuKDKwIWg5h1UCXUHiAdhTRklpchykZbVhUZeEcAjJ2ifpy6eOJFJKnCV0cu2zml2PPszAzybxm0Ey521hC1P2SmxwxRmY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:39 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:39 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 17/37] libxfs: expose inobtcount in xfs geometry Date: Thu, 18 Feb 2021 09:44:52 -0700 Message-Id: <20210218164512.4659-18-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16ff7c0e-73cd-4d41-f5dc-08d8d42c9f3e X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:534; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MMWzmCOSdRMchdPSRc/8Vk47EecXBWaemJnr2HqIOooL2Xm0gwettOi6ahArKOTUZqs7zoz1oc0sfl4RWm5CSNbC2ZHZTp9WEcrPgr50lYluVb8rI8ykJHqoOi9pA2hgc9Qok4Y9ZKXY1y/AP6KZDnZzNAuSMp2b/CcBUAi+EHQNabPSpV8uxVUKEWTMvjRb4+ZgCuiwhdXS/LZhuJCXA+RrWUztO4m2rNCVMB2OsD+dS+4fjvNkTOCe/QHFZTIB4Eh4VbiLmINJTmqo8O/E5UMEoeUPI2Xrdy/Qw6TmwvFm3i8mtROUov4ESHaNJU0BvZyonbjtdwIqB5ygOzJ0G0W/5DXZxQ/4vbMf1yiR/q4J9keVamxVMzgTNCvEIp0FiEsAjr44Wb84+IWd4A/iGK4++d/8xUe40dJ0LdeGG7/0xSLK2Hda6A2C3OWKJLLJYxgIxZnpnwsvk69Eu861xwua5t/DM8pxY3J5dDz5UqNRyoXd68I+W3WRNtomrwvRn7nNby/c0UHAVOSlcNnZmCmSI9/fj4P0CrC4LCBX3hVo3WENR/q94ZHzMZ+s/iX38KZnRnWaINanODxCreqkFg== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FM4BPqxsmDK1xaTvacYgGJZVVaIcmcw20YeslDYE43rhGp1ZlMgw1RzszMMhV4gFRdvGaTdb3Xt5n/q7242ZPoVLG2mLrb3Tyd+V0rX4O3eTsdFKFJPeRVS2B6llwRq+8v5YAPivDwIbtauqX2YUN6KHy8iE+fgJa5ly/KRItQx6bUlvJvnYj7Ra3blpVTTxghVvNPWtYxU7WoV645258hQ+id4yH6LOQfFv9+x9sWcpr9syabfUDoI2eNycbtr9UZu2wT7P8XJn6XoDugIVmmEFSR6B5UFEtZ0gfCcRUtm0EnZWL05cHItN2giEVv2LzWUYPC2M+W6KQr+iU+E6C1O15CfBKYtNKcn+wO+Hw4nuz+lVKaYFr8AcjEpfgDHjCEPTMc3j9LLwiX1mk6DcER2wgfAT5H2Hfd9UZ419GfVIxT5AZ7lhxWDLifBsAMXcbUjYwYm951GRHlWm7NzzcJ69ZRWGB+/bueLSM9a9Lz7wpRnWvC4KHqfPtO/hxQgh09s8c6a2mTLHhXRzcw2cNyfCCc4jlypJy9TavZP/hfrW9HVBje532IXp4a4eh6xaOn6bE9V+yRzdr9BvYADcGXsPVBkcrEdnS0vrDjvzP3W8FzQQz8LSa9B1k4udbLRUjMBDDVkbFAnDaLuPzM78CJsqLQ7N2E9EKAhJS+PJ9NhfDYeBH/6xX9LXZl0NOLnnMHXKjw438bzTYbAKIH0Fv3JdetJONGsQBME8Cvdo2preaFtHblMLAjodrUy0RK9nxwpE2vOH0kGVwEyMF5NW6VIOhCIH/mBlcZyqOAWDiW+70NXk8mXYKQ+zEpgV/7+TddMaqRew8A84/MyjoobVusMlhpiZHyvKrJcZsHnyTWKuHRPAXPQDiHuTDvPjHxbefeC0kHKIrW0n62OW93BDcfeQWkQFkssE+MX0p8iWwFvZ/ck549GvSIngM2wbCTML1WwS766hLh6xXM9D0GZ2so/iHvB7B5F9zgf2zXrOJzGtXLqPK3i5clCukNP+buJ0g9l2jyX8AXhoOOy9b4PycOZH7k+VPC8vSwD9gHdaLlcM4UqE46i8eTr5tJLqOJrI0lJoM1JaoSZToUuQHdzd16S36MWPa83jVDwWEysjq43+AltpKYMW7M9/NX2e6grnUEQYjamvKmN521U/uHcSPGZLqCLbr7+5x8FaSI5KaPVdRFW0ZdAVhKSNr+AFwXKNkaKYDBq2RxIO2gMysaHvWLmZw9uejwjY1o6ljzRj5+WxozxPxtrSH5Z9evZp3gOFLWlY3n4+FHm5HP+VOyRc9aBXkSycVPLdE4S/rQukB1orp/5rkszeAmoB6g9lgNI0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16ff7c0e-73cd-4d41-f5dc-08d8d42c9f3e X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:38.9801 (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: 20WzsUiS5NAuC4OEDwJKiphuX1DZZQIu3HYhIPsFsb5M6P2Zp1Tou6kFmRZdtnZA9jcRK/0QMtK4cWLLQbPXOQDMwtIVtx7RoaNhEOTFP7w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Zorro Lang Source kernel commit: bc41fa5321f93ecbabec177f888451cfc17ad66d As xfs supports the feature of inode btree block counters now, expose this feature flag in xfs geometry, for userspace can check if the inobtcnt is enabled or not. Signed-off-by: Zorro Lang Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Allison Henderson --- libxfs/xfs_fs.h | 1 + libxfs/xfs_sb.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h index 2a2e3cf..6fad140 100644 --- a/libxfs/xfs_fs.h +++ b/libxfs/xfs_fs.h @@ -250,6 +250,7 @@ typedef struct xfs_fsop_resblks { #define XFS_FSOP_GEOM_FLAGS_RMAPBT (1 << 19) /* reverse mapping btree */ #define XFS_FSOP_GEOM_FLAGS_REFLINK (1 << 20) /* files can share blocks */ #define XFS_FSOP_GEOM_FLAGS_BIGTIME (1 << 21) /* 64-bit nsec timestamps */ +#define XFS_FSOP_GEOM_FLAGS_INOBTCNT (1 << 22) /* inobt btree counter */ /* * Minimum and maximum sizes need for growth checks. diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c index f105d2e..8037b36 100644 --- a/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c @@ -1135,6 +1135,8 @@ xfs_fs_geometry( geo->flags |= XFS_FSOP_GEOM_FLAGS_REFLINK; if (xfs_sb_version_hasbigtime(sbp)) geo->flags |= XFS_FSOP_GEOM_FLAGS_BIGTIME; + if (xfs_sb_version_hasinobtcounts(sbp)) + geo->flags |= XFS_FSOP_GEOM_FLAGS_INOBTCNT; if (xfs_sb_version_hassector(sbp)) geo->logsectsize = sbp->sb_logsectsize; else From patchwork Thu Feb 18 16:44:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F15FC433E9 for ; Thu, 18 Feb 2021 18:46:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E04B61606 for ; Thu, 18 Feb 2021 18:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231487AbhBRSpy (ORCPT ); Thu, 18 Feb 2021 13:45:54 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41034 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232829AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTAG9155835 for ; Thu, 18 Feb 2021 16:45:44 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-type : mime-version; s=corp-2020-01-29; bh=Hz8QgiQIfc7DpwjA2jhB4veFUU5HCGuu1viIPYVhSNI=; b=cm7w11UPZ6+4VluivxS9NiLO7a0L3SkDCfPU3OlbyOMgHz167qUJ+URAYB5yoo6iKGH3 nVIyC5L0h/JRQiAmDv+DwM1OQvzPoESpsux+i6vQBPGxP8ODysfT4XKZhQCNPW+z2AmC KRyVXN7YtqtNPn546muUpq7p5apGAJ9GT2ZZmQ0BIK1yOnwT5XQJWCAygoOdhwM1xUi4 9XrMhg6N0jHeL277jQCOJnT2RIX7lzfRm22PdCAuzb1+SlVVyNx5TH1KDc/dZNoUJuST GnHsfDGtz4lEYqrGIdH4Ibt5ZTWgJUJ9rBATLyhHp36NL8O378ODO8PXzsBBePkFhdP5 Ew== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r6m4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:44 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCaH032333 for ; Thu, 18 Feb 2021 16:45:44 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by userp3030.oracle.com with ESMTP id 36prq0q51j-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VPydcWnMUvFzQ3OcBmbYONarTSUAQRjz5Apx5AK1nA5YxLLPMFFyDPGIHf/T0uHd3zWIWvwIQ3MaO2eFrDFkYL745dCcz3eLIIjL7dF53Df8iRn5hK4LyPdunp0uEnUqJDukVxvQapjUfOmIIUJqUi+q5rHz7cu7vfjncwKu4psqFraFmfdFak1jRRYp4X715bpLpCZhVN73hJCYm5FQaICHWuDrV81OvH+EtaeRwCc2LdCnLrEi1nSF964Pms7b5zwBZutGsRqNizU9pB2wzxvHOT75jR6FEbCTbVKyULrMl+NGXtxwHeS81mGrlaAjH+RKpzlwFH2EBejF3AGy5Q== 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-SenderADCheck; bh=Hz8QgiQIfc7DpwjA2jhB4veFUU5HCGuu1viIPYVhSNI=; b=Q+cwjYYpVmih7XyUaSdaQE3yzT/XAZHQIHTNM+haThvGLFbzLWlUvvnN4hpELGeUdeJ6A4Pf/U0N8HmQhsVvTUi/vwPOwQgF74hsLlK/n/oAgrjhAxGzp4ZRcE6Qfz5JnqHwYOx9bxRNd5Q1baAQoEplQGWtG5tZVAt5GkATcqH9WXyRVRuSFX+D4xt0PV6o3ymun3+5jzkW1Xzv3Opv0T1ef7HvE3ZgONy0q1+4/zMRRJU9HMvAH2zBt1fdZs0CAtmS/aYqJwLsh9YPWjGbMBVC9L4xEcAGZRGNFuP4sP26ZAzmtynYYcG3yDSYCn5qgD7/HPjNt92R7sjdrlpCaQ== 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=Hz8QgiQIfc7DpwjA2jhB4veFUU5HCGuu1viIPYVhSNI=; b=v74QIAslCoCD8SlYInyf//Tc701jaLTzLwKd33mHxe3pvGiBhde7dtMcwiMYOTFs9bQP/DHweJ9PCyQN5yyv4B9VCzYPRlm8B8I0QVwIbMn6o/91BGnbgYsMf1wriFbWsRlfxcgaKKIVCuNuYfwEgKX2Wr65hy54LgdsAMfYn4c= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BY5PR10MB4290.namprd10.prod.outlook.com (2603:10b6:a03:203::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:45:39 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:39 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 18/37] xfsprogs: Add helper xfs_attr_node_remove_step Date: Thu, 18 Feb 2021 09:44:53 -0700 Message-Id: <20210218164512.4659-19-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a0863a0-99b4-45e1-2c41-08d8d42c9f83 X-MS-TrafficTypeDiagnostic: BY5PR10MB4290: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:233; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dv2c2VVLkpl2wBXmZ5x0nfd/GcW+4nrd2YhZWgPY0YASzALwdzsAgKQl1Rfx3juVIS1SdKiT6r4K35VIpMu7R7l6qxgQTlf/CqNvR1PYPAEoJzL/DsSnT3WnMc4t6gbUOkgzq4BHZEuhfgCT65Ht6L9wFU9Ll5M9I9/tVxx6JNKp1dkfHFKZMEwdH+7u8WJMwkaUGhYibG3JBPJPX5YFcrC1IVeye0uhKx5NcMlmsBD8qcHiUn1cbYbjdCXd4SyZ97pkNIMde8svtyFhHy9MFeYWvGjY/89/po0ZkhF2AXPgAsFu9p7JG7R2u+0x1u14yk15+ZTI/qfEY/BrynaQ+1TwspAj2a0Qqkf2oxeWyYJKzfBm0lyzVHBS+ryJwI9YkqGZTSriSXwQ9yxVdAg8/lgWWvEU7g17ygfZ9KRmmmTl8x937r/0JhqkuNscefJJmXiwag5UQzhhEfM6JObEftTQZryKcwkfHEJ2kyssS9G6LT8XGpiO9ZPo1fk57GO6PrDoYbpB2jvXUDtZLFY9HyjIQ+eiexVFTAZqRyFjJJC3u/Mz4Zd5kqISOvPax4fAmBOiBvrZEkUegYApBrpf8g== 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:(396003)(346002)(136003)(376002)(39860400002)(366004)(6512007)(52116002)(6916009)(1076003)(2906002)(316002)(26005)(6666004)(86362001)(8936002)(478600001)(8676002)(44832011)(6506007)(36756003)(66946007)(66476007)(186003)(66556008)(69590400012)(2616005)(5660300002)(83380400001)(956004)(16526019)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ZHWIKANiuZcHMkKljh9UInJ4rCbROFV/C/Y7NaEl0DAXW1H0Y+SHPf5ASAC0ra9WaroTSODFi2fCMwMSqbUOKIlX3YFiCXc1agz0bexMDxfbuY2yuMXL27oaq/ltfgO01xLt0rP4weIkQD5PGDV8hEWnJUFOr2w7/Gmamc9eDXZVNsPSZKdykcwBYo723xPIbh19rS0Q0tbgtaOuLud88+Rt+crhkSvslYRYaW1AXkXCce+kNSXt2Ka6yaRHiuiwNKtqYJzo+HOQcJcNUDHneMFAtNgxolg3U0vWKqxpHqEBW1qbht+joMyEiaTnrQivRJnAFqb3LA/Ki/mjdE2VaPdywWJghAk7gB8CEa+bscxNSMSkDvOzClmzgc7MiRa4dH1kw3/MqbZGigVwqSF1v7KV67HDJIlbKCpeiKW6HvMqfoIuifVCwrdgER5hNp30LU4BZAUDYkApbQi3AEiWL8WgJAzzM5+K76zM0QzpfQMKnfvoLH8WeV1tTL3nfoNzMMJ4yyDYD3iaca8UnFISRI4Tv45PKRpNuCIoywX+TNJu+oMi6zld82pgEM27UOAaeC+uBSwA0U3Xl2uG1cYqiGZ85qazMVSjVs9nK74i4P5LDIz3CDH2S6U1eUTwmMYoiciUDWtGTRQoHIiYrBgpP41NY8wPjy2riJIBjRbaTAcSW4yVisUr4G2QtOAMQ8o8qWcPkIb79ZG4gzyhv1vvT++g0oljiL2hJp2D1rwYuJ/U8Dak7+76ux65DT2AhJa8IAT3BMPQhWhjNcmM1SppdfBSivHiBSDiXtfqrSTtxAy2SrH3k5JHaPPrmwCSe6RUDQ848dEbxeBCiXLm7l9OE2cJoec1OZ8zdFSvK7ByPdVThSuC3n9K2hgTtMHPyRvvHMEz1meRKk+ffEuoNtIbVJLvpkUhtyf953FxD4CFkEYn7hXXA26+cxZp9dtirAj8JpmP4PJ6EQs50QUZTrBjYJpX/V8GgS4D9RMyu/e1nnVZmN2DrRk1Ysev4QfmbQ3EK2vFBMXpy6fhcRS0/Hr3MxDC/oBYoAj9peuPtIY8EHZqLrWZUEbUf3qhP2XvYdqx3rBrjqiVrKGDiv2MExtX4MQri8N7dxcK4G0atctHpK3pVKNCrb8CKBcZoj6g+kO3cQQezHgDN6yE9PblAN/cnZMiaqVhuRq8ma9vHrjLkPxIcZwy82kCZ98pH97HBK6PLP3scNtmEpE0rh1KSwkZ+7BtqkpY9zXWWXDT+/6ZESDldxLorVk76F4EtNyJqsT1jiFUddFYIK12A3JJU1hNZGmR4L+UlILLMqQsaiRK0e7DYYPR9v2z6aNb57XiZLsk X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a0863a0-99b4-45e1-2c41-08d8d42c9f83 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:39.5078 (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: QSLCbr7pn1W505mB6Zcc4oVKQlXj1xsx9oWgCoJsl42lPI3vxiAPN7X9anmL/Fm8wARXpnikzBHiG/DhxbvQyIQONUTfBvWYU9nU9HHADiY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4290 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Allison Collins Source kernel commit: 5e2aff99f8f0b7ff511b7bbd1213743f59806878 This patch adds a new helper function xfs_attr_node_remove_step. This will help simplify and modularize the calling function xfs_attr_node_removename. Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- libxfs/xfs_attr.c | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 237f36b..bb3d2ed 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -1241,19 +1241,14 @@ xfs_attr_node_remove_rmt( * the root node (a special case of an intermediate node). */ STATIC int -xfs_attr_node_removename( - struct xfs_da_args *args) +xfs_attr_node_remove_step( + struct xfs_da_args *args, + struct xfs_da_state *state) { - struct xfs_da_state *state; struct xfs_da_state_blk *blk; int retval, error; struct xfs_inode *dp = args->dp; - trace_xfs_attr_node_removename(args); - - error = xfs_attr_node_removename_setup(args, &state); - if (error) - goto out; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1263,7 +1258,7 @@ xfs_attr_node_removename( if (args->rmtblkno > 0) { error = xfs_attr_node_remove_rmt(args, state); if (error) - goto out; + return error; } /* @@ -1280,18 +1275,45 @@ xfs_attr_node_removename( if (retval && (state->path.active > 1)) { error = xfs_da3_join(state); if (error) - goto out; + return error; error = xfs_defer_finish(&args->trans); if (error) - goto out; + return error; /* * Commit the Btree join operation and start a new trans. */ error = xfs_trans_roll_inode(&args->trans, dp); if (error) - goto out; + return error; } + return error; +} + +/* + * Remove a name from a B-tree attribute list. + * + * This routine will find the blocks of the name to remove, remove them and + * shrink the tree if needed. + */ +STATIC int +xfs_attr_node_removename( + struct xfs_da_args *args) +{ + struct xfs_da_state *state = NULL; + int error; + struct xfs_inode *dp = args->dp; + + trace_xfs_attr_node_removename(args); + + error = xfs_attr_node_removename_setup(args, &state); + if (error) + goto out; + + error = xfs_attr_node_remove_step(args, state); + if (error) + goto out; + /* * If the result is small enough, push it all into the inode. */ From patchwork Thu Feb 18 16:44:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 046A8C433E0 for ; Thu, 18 Feb 2021 18:46:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B143864EB8 for ; Thu, 18 Feb 2021 18:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231754AbhBRSqa (ORCPT ); Thu, 18 Feb 2021 13:46:30 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35632 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232665AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTiDe040357 for ; Thu, 18 Feb 2021 16:45:43 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-type : mime-version; s=corp-2020-01-29; bh=i3yKMhImNEyFq32P2qdDjQAFlZYT9YDd3rqPl998lcw=; b=EToOrzCUF19bjprP6J3EqFq9G/nuDLeq8PSeWaVTteJIqV5ZT20g1FgYtn2l06FtNDGi Do4CxtqMDm9FEpvmWA9VYtPxpTCl7ZflZqG+O+RB1I0l8g10Jcg66LebY9rDEXOtSRvX HII/MAQyAOQJ7NcgwPie4nqP9EPojJT/ImneniUEecOjVeaIONGdTdSYKvytcl9GDVaV Izl/I9/xmrNYwDfBREAe5CXGIKclSrP99gHF0yUiCH0rqghhhXurUrmkd3jCJ1sDBsPG m6nh5PzxKGh1xic695baIVMF368W5FX+lRCq1Mh8alhQMPa2fDaqMRqp7xsfvzthk4nw /A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ae3hh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:42 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTffn074752 for ; Thu, 18 Feb 2021 16:45:42 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 36prhuf43k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F2K4r/THdoDNXBg3laG34kkmcZUFR78fnFQY3/Y0WuACpi84zgbkNN2s8Nm0+9+lCw/r1C9sP/rVfzZtmJxJZks8ay1YZYDYZyGwZ024G+uOlKl9OjDqYzVrWUwH2RBxN3d0GrR2npMB2JnBGgTgqcvrR/49LatgfG7/I2b/5HMHdopjeB0VUCSQ7iyW3+3TYz784l4Oimpp23TXepIsAQc6R9w/GeepJImCnvx4/xwJICa9VH0MBvIgmdH3F+7UVVIJHkvGRjXlvAZbgNRv9cG39Q0wrTIeX50qObpjNwpJlURgeqpvU5Pr1lB0k9uZDv7N+Wt9xDprC4VhNPdmEw== 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-SenderADCheck; bh=i3yKMhImNEyFq32P2qdDjQAFlZYT9YDd3rqPl998lcw=; b=FCwRKWnrAZLQ9XG5JB8pO5m8y5VcKrmwlE9dy1Vo5ydbzK3RleXXON7Q8i7GHYh42iR1QnD19PpahJxmCBvYMnY0Ck49I6aOoYhcG0c67azGE6M0DzUYTZ+kQWmERdLRh0rrTxE0FmKNPnOslomUSMhaNMl6WDVk8O2fwZ4sRrmvSFJ83sd2v9xP/LkS+HpxcBA+I+ooZeKU326pTjkz8Pk6Y4nq0g04Z9b6BDL5na7NmrvG2LvmbznFNGtfbWvcXDuG9ZoiIU/S9NE6ahLqLIZXbrsfH8QcDmRqnK5tI38nlBw57us0YaCIQ9y1O2vMNF83p+jnKf8ilAGTtuknmA== 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=i3yKMhImNEyFq32P2qdDjQAFlZYT9YDd3rqPl998lcw=; b=eF3ga1r1D4pR7XLOx46kRcz5FC1o2CK9wGMK76VQ4QSgb051cAEctiFOoH5ei5TQCzMH8dmT7Qow6Hm7mfkp4/mEdf8lzC5F3Z2krTKtKExDkwCyhpZdIJMxk9FFL3UB0A/3AXbHBpgg4PVSgu4MFPgNTpzJMMUvr2TjZLF7lPw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:40 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:40 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 19/37] xfsprogs: Add xfs_attr_node_remove_cleanup Date: Thu, 18 Feb 2021 09:44:54 -0700 Message-Id: <20210218164512.4659-20-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3806f70-595c-4935-c130-08d8d42c9fd4 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:854; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W7QibpZR1Su/MgQwGNxC9W7KqedoyucgrgNqCn6DHpDrzFhtYws74g7VdS6fzJJ8jS2Et41KgHd2k1UdOGWuVglHNnCLHIs2n4HgxDFK7+sNeFFHPp21Y9e0DuZK4y/p7O8GNFu5dVdLY3AXpVHNjuX2DPzrqWcguoRM08HY+hWIMhULN8Kp2WjM6O9opi/+PTC+x8t0F48Q64QlpnMUd9OIHNEj4uYQ8rwr550yH3kD/E6Y+dOPVwu5UeeyfOyq16GvuFUnjkFBX9nD8HiiNBYv0jDtpSQ4NImmraccnICN9Q5zS8Mq1U23eYNC4LQJshfW4b/UZt1n0jvFfOq1nIx+o+25nUmCYtoAKYhfZE5RsRpe7aBqdiDoZROYmnqyge/ped3B2zhIhs5AmrAAW+PGAp5uY4UPOe4WPminmAvV5evMOzu3FrBnBNlNEbElZD95BFn4I8h6dKYIk1waG+m7qew6tCRamboPcaLPGetOtLz39muJ2rY0zChzECPhGa31Scx1J3JLYkZSwuFqcjZCridU3LJz/0/Qq71Y9tiiwHP7eOByQOA9lHeDPuCKYrZ+zEtfC7wYAerROlvzCw== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(83380400001)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: H8od8oksTbvIFaKfMHsQoVeksGG/zPUU5UzIJlKChpCVyzrAF3EsGluJ9evOLUnExYaQ+v/3c0ODnCm1d+A6jT5MC63wu2nGWuXjmAe9Tah/+XTXu/foiXU3DdqeLV+MuyQwaycaCsYmmMwfpXjkMOI/htgfdEGNFV5ltniIfAshNAApn6ho+e7H6NsmN9MPDqNradE2avXCA9iHeYkQR/1QEiYitktar+OAhzJvW4ThLjuBPMFJMXmemeqiv2C2709t27vprEnF6XbIF7oYGJURUN11kWvJ1RGNUHPa9T/sy5vMVdVp9xXSbRgwzpiSLZpQ2uzwNYvM/oqWwdXwucjOxmn39C/4vUEnzNwock4sQGIcBWoQ2vAKDULeBugZJAuUg9xEkChowNEwEMBDWwDxw52nJgZk+Vd7c3ad6qs6eLqiNAkycOlk/gIPMXA38tzsSb7dFd/NylyEACDW21+CciOJu9s71YD9vg+RX+UaTkuCGpNhDFxlCT1QJr1YjnL9eNQFG8Rih/pjwc7ZcWYy5Btq2IvJTlsSHuDu6WgVlXetW66tlLW5DYjXAveYw0wBHFPeutrFvdjG2PZfPUC62YocjFvm+N2Lezbm62yAg24IwIQWhMxfwhlZBC5dDzQa7ni6vS+PfLMXrITm8HhqlqfExt6lfxVG01/R90HV5r+4raf9K1TnevK0Jlyr3P6Rh4oa1L7DjvqZXtaf2S8Yyy2wwzvjY2mistnqsTPQS1dAj3ujcJWoL1374xOI84Unxb8Vevm6bm7K3aAu4oMvISKs75hk+kmfTklKPRg9R5HUtbT/+QvfDyOV61r5Fn06yGGYxkc1jslkssTb1FjuH+W2QJV9+RT6OwTJLRBqBnvruitF7cj6lJYe2bmjIfnH1pT3NCtf0l6MQWljvzUlgdvmgnzOLQ08uC89f2APOyjPQi8BMB/BZQP9fwkHefer58pUl+kZegdq8mdio4ltF/5sWs6UVa1kbNk1l8NQyB2SAxgHlOXFwbbVc0fyBQvPfeYrr8sz4RsBdPpE5D3CgXzK3bwr74SxTYCpRT93SGjhvTrKOnDZaurKxRfPpftCUSOxodjxKBrHjSmbBrU11AQna/i+sPmqf1OEXUt/VYWlQQ2T8HwU+1VIZkyx97IKCkY5uEjrU61qRr3YdXDAmMQDrvTu8PaOAHT2eC5W6Zegt19LNVRhJCPqtEn5wK6/Xyp8YPkm+mDhkBoJzhse2XoQIHb4tRt0ZF/AtZej1wEPKKxfJOE0pFH+8/TWy+Y1lhSgniuzxluoUpb8X1I+dESxveAmVzenBLPATnqHLA4qD15KprUgJ/wCKQgJ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3806f70-595c-4935-c130-08d8d42c9fd4 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:39.9608 (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: 1GQTutIi4Z/gQdK1uOznkCLuE3+zg59LooZN/mvIH4LoHJvhH67VJL1a10Mp1qlUsDNIk/xHs1RYCV/rWOupLOYXUvVVYRdKt1nadWe5NHY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 4078af18570ef0f89fce18e9ed9c1fa0c827f37b This patch pulls a new helper function xfs_attr_node_remove_cleanup out of xfs_attr_node_remove_step. This helps to modularize xfs_attr_node_remove_step which will help make the delayed attribute code easier to follow Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R --- libxfs/xfs_attr.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index bb3d2ed..663c04f 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -1233,6 +1233,25 @@ xfs_attr_node_remove_rmt( return xfs_attr_refillstate(state); } +STATIC int +xfs_attr_node_remove_cleanup( + struct xfs_da_args *args, + struct xfs_da_state *state) +{ + struct xfs_da_state_blk *blk; + int retval; + + /* + * Remove the name and update the hashvals in the tree. + */ + blk = &state->path.blk[state->path.active-1]; + ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); + retval = xfs_attr3_leaf_remove(blk->bp, args); + xfs_da3_fixhashpath(state, &state->path); + + return retval; +} + /* * Remove a name from a B-tree attribute list. * @@ -1245,7 +1264,6 @@ xfs_attr_node_remove_step( struct xfs_da_args *args, struct xfs_da_state *state) { - struct xfs_da_state_blk *blk; int retval, error; struct xfs_inode *dp = args->dp; @@ -1260,14 +1278,7 @@ xfs_attr_node_remove_step( if (error) return error; } - - /* - * Remove the name and update the hashvals in the tree. - */ - blk = &state->path.blk[ state->path.active-1 ]; - ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); - retval = xfs_attr3_leaf_remove(blk->bp, args); - xfs_da3_fixhashpath(state, &state->path); + retval = xfs_attr_node_remove_cleanup(args, state); /* * Check to see if the tree needs to be collapsed. From patchwork Thu Feb 18 16:44:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093889 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19217C433E0 for ; Thu, 18 Feb 2021 18:46:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC67A64EB4 for ; Thu, 18 Feb 2021 18:46:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232643AbhBRSpb (ORCPT ); Thu, 18 Feb 2021 13:45:31 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:44188 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232701AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUCLS180360 for ; Thu, 18 Feb 2021 16:45:43 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-type : mime-version; s=corp-2020-01-29; bh=jU5Ga5F63wRugoRoimbZ27iH1yPfBvtaeoZy4kWlvHI=; b=QeENqvp58r+NrjChAkySjYIjjdZvlfqbCfwnLNtpJbplw8UBcrRlg27V1hrYJiKx0Cir XWy8lrVdeBh25o10csoi1KYakDrJCG5n5ZiDCQFuNta/wT17PW1ZD2ofY6nxSHDdCsFF Djukwapnh3Z2z7HPjhnoQfGl/Sab6xbe7/qJuopktYY2LJ4liFk/DWEGfsW7hfkGulCH E4lPRopSvbUF/4qjcPB1VWvmvURRgnMrkluskpDdY4oi7qAyoJ3Z8AxB6uJTXRkSuDGL jD8qplj4FzXS3IruGVY61boUIaBQukx98+EYBh3IKhmdoITrCHuKvhy3J2YBL+7T2tXf 3Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36p7dnph1p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:43 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTffo074752 for ; Thu, 18 Feb 2021 16:45:42 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 36prhuf43k-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fsjKg4/JLVkGdqacZWmpksrNP5qEZFRzIodQ6lx71k1zaHF+umT7Tn4i6IRDEZf00A+A0caxbv+KhPPqQWK789qZJF1yMe1k3YRliKL9Lm1I0CYONdPkjuG7pDzcd+ht4KSTz6l06a9A115CJkzTaVfhatSLNzC8+oQpI0jPRDt/D+nBCxdXaYIOmVhJWB+wT3lrCXWjV0d7xxkMnsfWJcJSiF1mAqw//GJ6tUzgGkfCDKxZ9nfR6KY0VP5VHy7+ip9liBfIiv3w8/Nd6TyNPk9UF6Vpf8mjKTC3pVb0PjQpTVNCUtHpmyZj7hnF0fV/wKo7jinc7iTTaIggx9wIWQ== 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-SenderADCheck; bh=jU5Ga5F63wRugoRoimbZ27iH1yPfBvtaeoZy4kWlvHI=; b=V7coM5qj4QI2F2Q8XtrhFzgAb4l3XeS6GPdDHM6Y3AztG13fzFHU6BHllnRryo/pzyMXj1LiXrPJD9wcgnYV6O9Uz0raTtodlC0+VXvPzHooeFXL36hL0nev0Ev8u0Gpo0Ag733fCitoI+wKmxw85n8ZEfUbpwjAoF3sQbjwRh4c53lP42xuWEH28EHiYgvhmhiDWIcHofUm1m/q5+5ropLPK6Ws2klc/5P8I8Jap6hQ9YPclCzRsn/0/WIOmtI2UGAwhzwkGFSA1tXcW8Smw/dgwKFbA4V4d5hJC8Ax2OhuToE7CsuW1FMBGgONKcRx1bJ5DDwAozgusjDof6IHdA== 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=jU5Ga5F63wRugoRoimbZ27iH1yPfBvtaeoZy4kWlvHI=; b=n1s1Kxg5u52zWyc15x1BHY8VkFrYSUTkAr3u+AKeTRZe1Ks/eJv+qde5iMGWSEibb/njQDEqfIVsZQ6IHXlaMjzu5dfBvSEjoL4Ui3PZx4CsNSxul2u7vqfn3mIND3txvgKTzjpW0Z5SODnV9emFPvaOcI4BLmgUphOSQ7m053U= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:40 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:40 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 20/37] xfsprogs: Hoist transaction handling in xfs_attr_node_remove_step Date: Thu, 18 Feb 2021 09:44:55 -0700 Message-Id: <20210218164512.4659-21-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7abfcd3-047d-418f-0e52-08d8d42ca018 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZJg7fbUu3Z8OYaVDhqYEt/fZredf8193I1zY6vzYWzlWS636yvofv4KOxLnRSgKceyjZSNjUC8JJ7X0XBtBzZJ8d5htJ4cOazpHl3tOnLhCMNHr/h3rl4hKFx2YnpuSUTyy2O+JWAYuSqroVY3+66fuuwpCJzvuR/eNWjzxqU2vrWYlz4NFnBym/PCnSzNbPXq+N0LD+tpzFkwFgJIpUHA5q0z/Ly8GfWqK7Z4Y2hYx3kswR6nwZVAQTso/BCRWTfFKEYrsRg7CGFXJ3cyISCRozTk/Va5u2rOKWOpQbeKIdyr/Xq0Z+rfZXm4IFVtMi7umZwe0EHbMyKPlq2bioH0b6Bk7ItlmLVYWm2dDNrMi4DMJNBbSGZw0JYL/jQeTJMGp64eH/MidcZQI+075CPJKUSPk1P9Bl2LoPXIHVbiBHX+vHSAo+tuKOapO8x9TOgBYbYocZWVFnyxsYNgjLHKvgJzL64hB10BCWH8nO5JIEFmHp7Q35VUImIE0qao3eO1j6bxEjXviCJ2SFSSjwvf5nx+SqiDkbZ9QRws6NzzMAMHCUPo0D9sQbm7U9mBDp2hPkoeXA6e6NjdHmhtPdQg== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(83380400001)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Bx3nudDCdqS6yxsRAR+i+xSY5jzIeYJxhXUMixtJQSehVUBgwRS5PG2R0Ao1IwjnyRiyRZDJ3V+Mtkmbyp+ZVz1qYi5mtVoRvwwq2ocs8REnOfw0nZK4qM7j8g3JTkOqchpa3t8aUaQYwNzqnahuBNODRWQBFpccjfBHoCRRkRT2hRPqRj6jhhYkOZoFf0QSSTV3/9A8gw0AtlDj5Z+Kga8AU1i7VJBePhC8iKzbpjMwJ9wYRl2ZPFYKOVTBMh+2Ko+40LQNaiGyH/qnHZoswxxDXBIvXMTQVpYWwenHCEDQgik16fZFZ6riMvdBVkkWvZ10fV+hdNAYrqWzO+g8mWVthboG4PsNy4S+CzQXz6hiB3SVoWNPXcLrkANw1hMoaVfpxujrD5Qp0pP0gOJHBUlaF5Whhvade5trq88aOBzmQnbMJJuGSG9RJG34lwdMHuPH4+c54x5x+KGIxLgT4/0J51IUy//xJtzReBDxlkPtQq7Bw5r6x2zf1TTfFlXsEjoAyVBIEI/uwCLM/7Qqx2+3w5J6e82gdbfKGUT6PHd60eTJlUfASnWIxKQNvTQVWHkyfAr7R8ZXbYKwDK9Bjz5XAFWp1VgUDyZycTW1UBswLtrLKSY/sqG+vi8XGndGSaPyd03vZ79NOlc5HoByX7Qg4arKjlPMk1Q89lUy0FqJ6CwK/DlsHUEOKDRTxke1pBHqA8UyMCzyGj7EA91DQLaU4H7Xm+wloomI2M7KGsUBPMWMI29fOeEHoO9xko3G/IKXZc0JXH5DsWs0yvWpFdDfA8037docKq5053B9wDG8xHjveVw0LqJmGCRELkfRe6kNUE1PZqOyksfIgMP8MN2Q2JZMf5wFwYsv6uO6AdYe88flkFRrYcL/dxPvA+rDV3x3ONqRbvS3zvx9+5jQIOw3obQjsKcQFl8oBKtbc21hUA41kZevCMzlEH38gASbxf4H6qDi176+SpNbCGNomZA8m3hq46ZKIZ9v0+LQ59TIdnOXF2mYJuvjR/JKM+xHMXby6a5QphxwHrL1SVL3Sejju5RBXAZw2MA0Ir+aNORi1shepSK4/cowRqsknqY41lDdUptRuPh3MqltRBEAHnwKHHFQqKieZ+L8dqyqOJgQtIlmvqH5xS2lHlWychIAWXauwIvR0IiBjfxg0EKV5x7CjxTouv+t+I35/DvEAt//Kl0jEb3iex0Leoh063PYzQNw5aMOdsVE9wIGKcnyHb5Qz1RMp2eCQzqmLUwnBWwoG/5to87vkieRuaAbD5jbCOn781gTIa3iB1pa+RP6nsHWL5wphBzgWmR+WSKKlRWLILDm5UmIdV/ljotqPNjz X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7abfcd3-047d-418f-0e52-08d8d42ca018 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:40.4457 (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: 6KC4kpO/dU29WoyruCThsk0Jppkg0pquPD5hSk2PquoqraQvuoxOwhaeoynkbzv7y0HO3sCZQQz0qws0rOxGilx1gQXQPabmiX0WsrnLTq8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: b091f22a5de672a88865e451545b447d139a9be7 This patch hoists transaction handling in xfs_attr_node_removename to xfs_attr_node_remove_step. This will help keep transaction handling in higher level functions instead of buried in subfunctions when we introduce delay attributes Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 663c04f..1ee5074 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -1264,9 +1264,7 @@ xfs_attr_node_remove_step( struct xfs_da_args *args, struct xfs_da_state *state) { - int retval, error; - struct xfs_inode *dp = args->dp; - + int error = 0; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1278,25 +1276,6 @@ xfs_attr_node_remove_step( if (error) return error; } - retval = xfs_attr_node_remove_cleanup(args, state); - - /* - * Check to see if the tree needs to be collapsed. - */ - if (retval && (state->path.active > 1)) { - error = xfs_da3_join(state); - if (error) - return error; - error = xfs_defer_finish(&args->trans); - if (error) - return error; - /* - * Commit the Btree join operation and start a new trans. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; - } return error; } @@ -1312,7 +1291,7 @@ xfs_attr_node_removename( struct xfs_da_args *args) { struct xfs_da_state *state = NULL; - int error; + int retval, error; struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); @@ -1325,6 +1304,26 @@ xfs_attr_node_removename( if (error) goto out; + retval = xfs_attr_node_remove_cleanup(args, state); + + /* + * Check to see if the tree needs to be collapsed. + */ + if (retval && (state->path.active > 1)) { + error = xfs_da3_join(state); + if (error) + goto out; + error = xfs_defer_finish(&args->trans); + if (error) + goto out; + /* + * Commit the Btree join operation and start a new trans. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + goto out; + } + /* * If the result is small enough, push it all into the inode. */ From patchwork Thu Feb 18 16:44:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093881 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C57C433DB for ; Thu, 18 Feb 2021 18:45:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 075FC64EB7 for ; Thu, 18 Feb 2021 18:45:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232715AbhBRSpP (ORCPT ); Thu, 18 Feb 2021 13:45:15 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35658 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTrbp040610 for ; Thu, 18 Feb 2021 16:45:44 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-type : mime-version; s=corp-2020-01-29; bh=tquYq95B4F3dQNABa4M+L1zagXWFvourHas/BCRrN8o=; b=cnRrJpX9yE1t49ZMC0nF6xqY3wc9+tRaWrVILN1OouWtRpnxfiG24h+ZnBPkgmNn0Fja 9r0ADSBOrWEkZOf/A0guJ49oVuh7KvVftRJu1hn+WhqoAvz6XzqQTVhONom7UfibdL7k kc8I25z1b3BH9sTYNv7i5ao/FHYSbpYLqSsusFtbkmzLgDR1TQAeUysxkF5oN2TxCWhL ZS40X3WRMNn9kUvup6KWvVyqrJpDirPAV2A2Naq7p+x5AsbgDMpJdEKca8I8jmbfb5tP lv/RSIUj+CD66s9x7T3C9fl4klKCMWUM5Kki7FvOkmQ9Nw8ugQvmbcKc2hlp6rxQEJac Fg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ae3hn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:44 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTffq074752 for ; Thu, 18 Feb 2021 16:45:43 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 36prhuf43k-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZPXpSac/hKShQOp8wE0WQrjSBIbNkbSFZZbeyH/Lz3W7RS7YaB1pEQP0SubuOtFfk7grzwXIqI/5o5ZeKgql8k3At9xQV23aLAbIBX9hELB+bXSlXY5jfDlcDJKUX4avESF2WhmG60HtimYOTFQPcf9IduxaRopAPGPI22zQymL3W6Phi8FT1iEVXwQ9HIiy6FBphIYtjDTQkQ3FimtGwHAHmkkPV6adOBCGKvBtKtJVuF69EimpzjGRoHbzriQxFJhxjdeSawMo98YDptqowo4KqY4UubqvDjUM1zvkdmF+RcJWOLmXnajpVG1YDxHr19g4pksX76Pbtfcbs9ok2Q== 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-SenderADCheck; bh=tquYq95B4F3dQNABa4M+L1zagXWFvourHas/BCRrN8o=; b=dI9OhanC/ALzN2K5t/GwK3aBlILJHREU9XD3aTfb3R0E3mTnAP0/YEGl6I0xwm8Ajb5hrmyCC7u17PLNeiP9+AloDO1SKVZ7ate3X36ivtAtwp87LEszywAh1vOhqTe9F8it6POObyPx6FBlW/SCk591Lxzu6ssUVz+vFIZ8HThWlQ0EJullHYi08dwJe0U0qoQm5SI9z2eyE+72cnwY+pjAMoLZxiaXS0JrSXnxuU80ogCdaPk8yBcS6P5e1ZSv0s2VIQj3tkV8MazD6y87qmsqT4PJYQbHGaIdAEqbNwx1W+q4a0xwwCqi++gN9rcbR91VbUQpZE44qp5TmLOVbA== 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=tquYq95B4F3dQNABa4M+L1zagXWFvourHas/BCRrN8o=; b=I7R9RJRKb19Vct1Gu7eVEZjt7QRiL5BJLP6hhc5GmRsTONDsEfYxQjQ3IaZUekzQJNIgceX3YrTzkALF8hqpdkqYmKin6xCyuMM/YR3AWrcvoyDzryyq8hoXW+5oo0kqQe1hsNVNoP2VF2WxYlgMEc/61cDM0qXPhWiW7sAZXZ8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:41 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:41 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 21/37] xfsprogs: Hoist xfs_attr_set_shortform Date: Thu, 18 Feb 2021 09:44:56 -0700 Message-Id: <20210218164512.4659-22-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9928b377-cc5f-486e-2152-08d8d42ca061 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B7J4kHyeJHAeRT8G//OQnn+rMgjTUiBu1lbS6NZIqZAWfZPFkucikso/B9g4H0zA3vy/LwmQaCtpMPgBIZZSYUKi5eNxJs2aoVXsHe1uj0dlssOUZlOIwHxOX7WSWmixyEmEV6Jj7Pr97MuQ+nsSjevTjVPaySiJvNZ0QjKSDn3V2dnXg7DPL1CySacdHN+O3C/7WppW44aOTntGYP//o+mOgBuIEZKjmYHkug99VYtSRMOMKIIPcXR9LopEFR4Q8fLQktlEHgeyJehveM5RgTVmPQqaqeKDDahYMlHMpibuZ0LmtulUjV0P0zjAbMUUZwVdgWHcFo4zBcr/OmwVxn2k7qTW6g9B1oM7gEMeq0qymBoajhpySwPM3EZyEP0ok7cFuUImJMsS3BlN/01YXVhTQko6Kfe7iWT/Kl7fBDoSx4I/SZ3rRTOFvKwO7QYO3lFA33lfgTqe9aLlFLaJ6P6rRa0lmAPfO5s3Dj1PF2U6W+9xpN+8HszXQO1hc97NWJkmFgjuZIL8Q8ESTvRnRHdYWeQ/sNYkdu/AfH2WX2npNcu+P6/YcMmXgAsSTi8oGaG7agzdG7xYN04q1HHIeA== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(83380400001)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: W4edNVD5DpmP4oMz3qKGHHnaTF45bux9QtojM8tD6nsiH0xyTNXVBOGFSiXReyk0SDZE+rXhwItvsMJddysU4qssGFbfEejrbgmUdwKK0rHWiL2eli/l57i6MmYapCmwnkmFFEocOytu/mgrydWqGGnAxDsLypEgAs8hbTwKPmnzyXxDnbTvJIDCaqnLdnzIjjYb9XswqRURDDvrM2Uu0ND0ixuaAZG+ygVOD3noM8prt/OVxWB6Rm6MgACNnvpbLs04/7NBXlsq4HbRPbFzsRkA1/NiMc0FFQb/6mBmgQfnbm2jyyMYEef4yRtz/g1fxkckttbCBBmboA6cQCyFKrmtgqFMcn2rayL3gDQJpcZ3klWpu1ADdml9yv7F82ABcxXF2YejUU0rZ+ryFUF241kMhXKRtVRc98wzsB74yjucD+Hu/BBlFFsUee9tOJV/0crV6h0EyK6cXCQJHa4exiR+v3SqunEMv/HfzDS/pfyB23OfATzpWr4+/HVZIBh2gFlCwIewlbRRVUTokbCvVeWVF0jd64JQI5gHbELOd/WA0fxs0v1L9c48k+fEKGIQMdc/cszM5jjYiW59Dgb4d+aADTDrbjJvEFmZZP6frn40rm4HDmDVtt44n878SQ968/WeSyGpUoAX+mOaDsjcRGUEEBUUuy+p3c3ULoA+5Ex6A1/PF2SD9QdjeS1I5py43R4ItBOAdiNdK3Tu9Jn7j9UqHaoy5u/1jbLsH7YdCnNavxbssI+fR74wQLE3qgOXB49Nm9aMsYUz3hdQm1rDnj8d/0e+FAo7dNd+o+yRJ+Qru1m0DUubaBB6RQlJK/uJ6CLOOBhWTe8Gu5kGr8AwnFXDvwMytscBW59ES2U44bzjR19GKOtEQcAtX8/0xVORsnT5FplRTIHV25nZEXdIhOg4q2zkdiAaOs1jbUQuwkUGdBBmyIKOdObz4oRGndCKcfbXiiZMdZxKQyBdI9utCJst8pBBFveOzMpWjL0dO0VUFjUz3JDGUitCmSq7CHvtPqnS878nWguuDMA9e0ncaMIcUhMft+p7J1mIqXntxGQKo4VGUMJGQpuPoM77VWcU+ANE75PThRH5qCfa33CbX9dCt9KvWVb+2DoICx2KCA7r/P8RsYFtnRh2pGcJxhzVQ3AVc3OT1se45Xr5W3cDSnhIC4a9yXxJDKPRDtR6fVI4wyV4MNv10ObFlINt0AEhxyfGLI+KT2eBxl0mXssqZHinG8Cz/TaE/4YNK+PXKfl001go2VPhhcB/1R0hX8mzkL7A37j0aCuKDyY4lt8Kh90+PHaG5aSmm8Vb9PYpchyYVSZp0cajikuksopPi6QU X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9928b377-cc5f-486e-2152-08d8d42ca061 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:40.9116 (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: PuqZfFMrLi+wb64e95SPR35n/gQk2MtvACkj1sRb6IqXUzXLKVrrTUoiaESIIB8eBkVVwcVWu+eSLWTY69ZqEuLwEiMpFVR0NzygcjD7ku0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch hoists xfs_attr_set_shortform into the calling function. This will help keep all state management code in the same scope. Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 81 +++++++++++++++++++------------------------------------ 1 file changed, 27 insertions(+), 54 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 1ee5074..92eb8fa 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -217,53 +217,6 @@ xfs_attr_is_shortform( } /* - * Attempts to set an attr in shortform, or converts short form to leaf form if - * there is not enough room. If the attr is set, the transaction is committed - * and set to NULL. - */ -STATIC int -xfs_attr_set_shortform( - struct xfs_da_args *args, - struct xfs_buf **leaf_bp) -{ - struct xfs_inode *dp = args->dp; - int error, error2 = 0; - - /* - * Try to add the attr to the attribute list in the inode. - */ - error = xfs_attr_try_sf_addname(dp, args); - if (error != -ENOSPC) { - error2 = xfs_trans_commit(args->trans); - args->trans = NULL; - return error ? error : error2; - } - /* - * 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); - if (error) - return error; - - /* - * Prevent the leaf buffer from being unlocked so that a concurrent AIL - * push cannot grab the half-baked leaf buffer and run into problems - * with the write verifier. Once we're done rolling the transaction we - * can release the hold and add the attr to the leaf. - */ - xfs_trans_bhold(args->trans, *leaf_bp); - error = xfs_defer_finish(&args->trans); - xfs_trans_bhold_release(args->trans, *leaf_bp); - if (error) { - xfs_trans_brelse(args->trans, *leaf_bp); - return error; - } - - return 0; -} - -/* * Set the attribute specified in @args. */ int @@ -272,7 +225,7 @@ xfs_attr_set_args( { struct xfs_inode *dp = args->dp; struct xfs_buf *leaf_bp = NULL; - int error = 0; + int error2, error = 0; /* * If the attribute list is already in leaf format, jump straight to @@ -281,16 +234,36 @@ xfs_attr_set_args( * again. */ if (xfs_attr_is_shortform(dp)) { + /* + * Try to add the attr to the attribute list in the inode. + */ + error = xfs_attr_try_sf_addname(dp, args); + if (error != -ENOSPC) { + error2 = xfs_trans_commit(args->trans); + args->trans = NULL; + return error ? error : error2; + } + + /* + * 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); + if (error) + return error; /* - * If the attr was successfully set in shortform, the - * transaction is committed and set to NULL. Otherwise, is it - * converted from shortform to leaf, and the transaction is - * retained. + * Prevent the leaf buffer from being unlocked so that a + * concurrent AIL push cannot grab the half-baked leaf buffer + * and run into problems with the write verifier. */ - error = xfs_attr_set_shortform(args, &leaf_bp); - if (error || !args->trans) + xfs_trans_bhold(args->trans, leaf_bp); + error = xfs_defer_finish(&args->trans); + xfs_trans_bhold_release(args->trans, leaf_bp); + if (error) { + xfs_trans_brelse(args->trans, leaf_bp); return error; + } } if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { From patchwork Thu Feb 18 16:44:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D25CDC433DB for ; Thu, 18 Feb 2021 18:46:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8395F64EB8 for ; Thu, 18 Feb 2021 18:46:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232663AbhBRSqQ (ORCPT ); Thu, 18 Feb 2021 13:46:16 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41038 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232847AbhBRQrB (ORCPT ); Thu, 18 Feb 2021 11:47:01 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGT1iB155656 for ; Thu, 18 Feb 2021 16:45:45 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-type : mime-version; s=corp-2020-01-29; bh=CmuggLDTPcWwH+SAzOLZFOqPvKdE22xP1sMEYp2vRYo=; b=MFF/LzE0mgs8rgOwsMVpF40a0eoWy2K3eLeXsaSrdNUr6spPqovdHihU7mTZ9B4ALwLc mDJXehAlXhCQmxadxHrhCDG3JUudaP9XFDHK6fyobtOl3lBj1xWdfBucBx5F1974yQND J5kEG3C71Y+ce3jp25ol40QUycSwkjyYpA+FTGNyigA2HVHzUDf0Dus3qh16uhZIUDAO kRkcsNi+GDEm0LdMaMaR2382rLo41bW6ZPWoT+g7r0wVdV8d9am/Ta+JRL8xc/0z8fNR XECMYisGBdRL+hLXup60IEDArKOAJCfdHQziZw8AKwSsPs/uEF13UAL2gG6Ll17DZo1K ew== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36p66r6m4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:44 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTffr074752 for ; Thu, 18 Feb 2021 16:45:44 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 36prhuf43k-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lfvZYkWC27gcJwp63O5ehbrWTQMFMRttf0B+MjR/Gc+W29d/WcxvvHRCVaPIF36tL3/wmFwlN5seZZRF1KoDd/COBBRg5LHoWAdcNM+xjSICZkGzRr7SMeCBusRRCllECysQplA1/KU0wJ5ZIhdmQCBHA7nwqlCq9MexlD9graEK3hnxxyUcfC62veluhqNCRt1HDPAUEuCh7F5sARP3lDmYZ3pq+ag3CdjqwdTBCwL9TwQJFO2CON5yezaZOwKZKcfEraItbNu92e0ejUULYl6Y3n0Ws2oVxu9dsYczaTj37MLZ584C8HazpRvsJJH11M7iLKMhH+ljlaCgzL2psA== 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-SenderADCheck; bh=CmuggLDTPcWwH+SAzOLZFOqPvKdE22xP1sMEYp2vRYo=; b=Z9ZIc5h5ppMBlqsUFUOF2CZoSjiu+eGIkcin9p4RczogodvoEZRwWRkM3biPiNTC1VpVjhRTvK0gK2qvwjJX9jbI39rPgkujxI9Xb7OHm7POiFXEr7w+GxuS1qg1jmuonYCzGaPWcKIG5JthwHiRAn2V1wTHMWIXmOaTo7YrQY+MH0zwLclP4IX+3dUiL2lA3kn/MWhmQK28XLsX6aaoEng6az1K0q2+slbwcYVyig6inhQ/0N8o15RMpG1zuHeqx3wZ176h9SXw19OtgJmBAzE3pjHlUVvGf2d8mYKrnErnS9meAtbXmYU4i5dZ0kThYp7lGQWpdS3qvJJ3wDpwlQ== 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=CmuggLDTPcWwH+SAzOLZFOqPvKdE22xP1sMEYp2vRYo=; b=Lc/8lewVTs2DKFsc8XpifY2IUWSHwzG8BapJN8VUjBSnnp6obu3OQn5+QvKks4mPaC/6Jx/vhsb6llL0U77UC9vhw7PuYDP1dzLYRpM9Foy39Cp1C5v2w8d+neMoVUKzDbfURqVaYK53xfe4R30+1z3DyEQEWY3WY6PVou3q9UE= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:41 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:41 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 22/37] xfsprogs: Add helper xfs_attr_set_fmt Date: Thu, 18 Feb 2021 09:44:57 -0700 Message-Id: <20210218164512.4659-23-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9db9ec64-f84a-41bd-bf9d-08d8d42ca0a9 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:586; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: neCjIj5gu/wFmAlJloVpzTkbzMee8azEj2z/yVGuz4W4wLJUvupNaag9zBbvfcF7y5TJ219acHVHjT+gYX7ORCwF/KQ5Xs8N69tFWboq/8dg9TBFJ8tOsl4siFN0r3RmEtqyl2i8gIQiQMOxSgTND5f2T54btRZVkucedLkKyXQz6yL3BeKQEZjU1aAtJK+ks76evApnGddWq4D9lHe4iv/FffijTpkWjuFx2eWx77m7sv15j0E7qKIdWXzNXJSY2nkDb6a3bkxcRoMy75wLrSYEVsTC4ItC5xsXdXUHR1GSAamzfCxz6oX/HIJAdglcNdRy6kRd0jXElVA68z/SHbq+wgDfSIk8m4ELCvHOufm/fQ+brvgSp4MAbS50J3ww0ZndIcuhGGrjQGx1uTnpqshy8i5butGfdmubTFtoRXbBrvLA+8u4eac7NjcwVq86HWAqnQda0ZfVRXCSkiReJA32Bt3ji4SNk2Z/PLAm3vxXYMbr+VXzsHs9LcCNZKk4/PDWMKO1fOJ6rD7HLarb3ZEFRwB0uyrp0qg8w+6d/QzGm5fJ6iCoPkiuhcjTjNg022bDCLkBsgSjdWqg/cpLhw== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(83380400001)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yyyuCFjEH4F23iwVaVnAs+vrU87ijf27D3Nd4KowZ3OQhSBumRdiems1WWWq8cDIdQIwdNzpkTn5f2P8mS52Nx7+aFwQG6Hpb+Tx2/qgPOUF4upCDVDLYGwD7Kx0wROWSCD/ZOPYEtg/nTbWLzFTSbqA0BQ1BEGLVyNe9ziOwdLiHSTMgV1Y0wkaSunyc9J4qv9tDLIxd4QgqUuYsC3F4G+PMFkEQPt8jvCcBTwARQXMb1GD+LMI8VkAMST7EY9YXvQJZ0TevzA9a6vMQt69QgRuJbIuwMROSoWvW3z2quevgZRY6e77380fOto9pQRKymyw3SCa8XVkqbg1iB+PDk69djQRzKagdCk9Dlqypf6dJPALI1IYsllWwbkOXvDWwNcWI4NwVsbvxgaftX48DfRZxhNhgfUzacIElLjLv8MNVsuVZ+wd8o2n1As/h5EGRrXDOjIVGVEEQ2By6mKb1DM8+rqaPZ3FNou8jUB+bpGOl15jDQZ4NqR3w4bKt16Q9suA/OlezuSiu7AWcVErNmtaq6Cb1icQLx8rnXXWF89r4xflWVO3nMRH1bke3zpgOqXlkQgpTMtvwQRD8Gx3+DoxkxXfVq3DqAOrS2OZATvmqLW8qObZCpDsLPts5yV/UwZHm0+mORMXKsoVAZ8CmGlIsnwiZIY1XpxPC/fMCNGvEkZmzjO41GIiTMWQwaYQzPMQ9t4WaYuphXCUbRqg8SN1lDAmjCADNgxh5/KIauuhoODVkLt3SlNlX4WyXR/gwoo0dAMCIWUYnGJOKgEZAxKzO4MKYLn6SRWhAlebzeEfCBvjMgjdWWXgXBMWPEo6zoKCdO2RxHkApNES59+YSzy8uKX90IadaMbErReEXUUeiFh+Da8MlVrjboVhXn5Spl+Vsbb2IFaEVpvVzMCkxG+1/G8JHWf14y73m+AoDL6I8p8W7YEE49QeuqdT39gqL3Mbo3HFimtD07J8q3F90S5h18N40UH1pj5l9KkR9TEbJIX8WP7O2+8mpAFLzFt0X9tLgBAOF7Hpo4S7Z0+oTk+QrgBwSv6zMk0z+G9JE5rl+cauq9VgHTwb92QTP3WxH8JTm9Dv0x5lnnGqz3z8mcJjQsYWabnlggtlNUmvloGfIgmqAk4URRTA5S3nP7Dbe3IsGcIwQ8FUm+oOs3FO29SSevqP7v90jtTX8x6jstORuzSr1SSLlXfTl/GCiiBJtZfO+4KJy4SlPmo24OOedXZD/CQeBOA8KuOOiK0Vx3W9TTPA+gEloaEFxzTbFQF5fmFjJbE+78BHhcBzZ6rhxpI0XEfttyegDnzpro3D+nLsjc4Nh3ItfxHviAJNxbef X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9db9ec64-f84a-41bd-bf9d-08d8d42ca0a9 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:41.3527 (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: S/0I5H/1ZH+Drxbdti7HZDY/6GdN2no50ucr/idUAfg0VPHHzgc6k7p6L2XlFkiv6J11wVISb8QGBLp1ckB4brMA0OO6QaxqUjPoS1BmHHk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 45b71a4f3fd8bc8d47adcbdfd859ed736a54e66b This patch adds a helper function xfs_attr_set_fmt. This will help isolate the code that will require state management from the portions that do not. xfs_attr_set_fmt returns 0 when the attr has been set and no further action is needed. It returns -EAGAIN when shortform has been transformed to leaf, and the calling function should proceed the set the attr in leaf form. Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 77 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 92eb8fa..cf19c44 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -216,6 +216,46 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } +STATIC int +xfs_attr_set_fmt( + struct xfs_da_args *args) +{ + struct xfs_buf *leaf_bp = NULL; + struct xfs_inode *dp = args->dp; + int error2, error = 0; + + /* + * Try to add the attr to the attribute list in the inode. + */ + error = xfs_attr_try_sf_addname(dp, args); + if (error != -ENOSPC) { + error2 = xfs_trans_commit(args->trans); + args->trans = NULL; + return error ? error : error2; + } + + /* + * 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); + if (error) + return error; + + /* + * Prevent the leaf buffer from being unlocked so that a + * concurrent AIL push cannot grab the half-baked leaf buffer + * and run into problems with the write verifier. + */ + xfs_trans_bhold(args->trans, leaf_bp); + error = xfs_defer_finish(&args->trans); + xfs_trans_bhold_release(args->trans, leaf_bp); + if (error) + xfs_trans_brelse(args->trans, leaf_bp); + + return -EAGAIN; +} + /* * Set the attribute specified in @args. */ @@ -224,8 +264,7 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; - struct xfs_buf *leaf_bp = NULL; - int error2, error = 0; + int error; /* * If the attribute list is already in leaf format, jump straight to @@ -234,36 +273,9 @@ xfs_attr_set_args( * again. */ if (xfs_attr_is_shortform(dp)) { - /* - * Try to add the attr to the attribute list in the inode. - */ - error = xfs_attr_try_sf_addname(dp, args); - if (error != -ENOSPC) { - error2 = xfs_trans_commit(args->trans); - args->trans = NULL; - return error ? error : error2; - } - - /* - * 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); - if (error) + error = xfs_attr_set_fmt(args); + if (error != -EAGAIN) return error; - - /* - * Prevent the leaf buffer from being unlocked so that a - * concurrent AIL push cannot grab the half-baked leaf buffer - * and run into problems with the write verifier. - */ - xfs_trans_bhold(args->trans, leaf_bp); - error = xfs_defer_finish(&args->trans); - xfs_trans_bhold_release(args->trans, leaf_bp); - if (error) { - xfs_trans_brelse(args->trans, leaf_bp); - return error; - } } if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { @@ -297,8 +309,7 @@ xfs_attr_set_args( return error; } - error = xfs_attr_node_addname(args); - return error; + return xfs_attr_node_addname(args); } /* From patchwork Thu Feb 18 16:44:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC605C433E9 for ; Thu, 18 Feb 2021 18:45:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6897364EB8 for ; Thu, 18 Feb 2021 18:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232859AbhBRSp0 (ORCPT ); Thu, 18 Feb 2021 13:45:26 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35686 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232876AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTiDg040357 for ; Thu, 18 Feb 2021 16:45:45 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-type : mime-version; s=corp-2020-01-29; bh=GuR0+TcHv2SCwg0AvzlO95XeHRUEtDEYGs+SB+yRIas=; b=awYNfwxjT0uq69vApjQdg1ib+PI0jv2NNqKad3GBSNIb5QyJe0O03ZeYlla/c+XIqICO DtTY/lq+fOWqfrvKAsvngWwQxhl8fHXH3nlJaDEksBGa5SdsVkS5Xu0tx0ugK3T5uooO rujyrvgEvscUhM1ZUTRL9w2IpAISTVLBch9VzdVtlvstW5thyDTenhEq+Z8cD+kj00wd olzF22TY+5mQwoq+REhg6XVf6V4GDZ9Dfv8pofAskbgAklgr3i1pmgFO8MzCXbmDPZz2 /zkmqdWOpj6xQ8IIVfUOQ/4v1TXQGqIa3Z7pK3x6T81EcPjsnflKH8UcONqCmSPaqPKG Lg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ae3hv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:45 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTfft074752 for ; Thu, 18 Feb 2021 16:45:44 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 36prhuf43k-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mmyDGJTc/BxElvKHdsnK08+bpUqFMhiuulchteraRaUSkMbeu7QrDiQXPOCGykEFyohEPJZ85SZIAjgjFk1H8DGzZ3XtjJrZdPaJ3Gx4IwXJ02dapx0Lp6Om00PrqWbMZ4iHOaVaU7kqTPQsHv12EKoXdf8Y2h7LFjiYAHchhcVTdN798a0BN2jRIepoKBAOlZMYhXdxpgQUDjlZ3MjZyyj39HdLuPW9D2tuk5j6rX+pbkS0TRJcJNypdD3rf4hQJp8Tjl76PlwwlP1ZmR+D54DeBFUvtG5RNwMxhwFDuFNF/0SEKTja3+bn881LeplWDDizb7lGnhmgttvd750qSA== 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-SenderADCheck; bh=GuR0+TcHv2SCwg0AvzlO95XeHRUEtDEYGs+SB+yRIas=; b=VAimDP84JtNUCYHSKDMwH4gs7lbUWRb3dcHujBD2wbZzFNtWMtx4EhEE2fqsfTEIa2dt9nii4d67SjokzqHoeaCtZLay2gP1t6te/1iylmfBvqllcqmF5yYnP+3sBnZqxv6ZOBos+do0ws9A1Iw4RmOBsxi6WnGFnNQZ4dK4ihYV3SI3X4SQ/L7Q8iA2AGNlcYHaC6boaM2FWz8TwuxQwAncyA6CBe0XNX2qynXqHknaVgvDHlt+bgCKLyilx5oaWglqtJSMbM2f3z9b5cCbnFeKU33nvE9ADiaRplUVNUi/+BZcnut8oY5l8F8pVLgiIjEQwOwMQfOY0TPOyPnchg== 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=GuR0+TcHv2SCwg0AvzlO95XeHRUEtDEYGs+SB+yRIas=; b=rC24LmpcgASpZuwTZGYeUjjgasaKv1NGcnvkC5ZI27jERoQbYixXwKF+ub1wn5tGAwMBiOGPkPVSkiBkVPQPCgwNnC0s5lFedkGw3zsb+DbmP7p0EhLLKwW0LzqBftJ3cHyX/bJBU6APlbv8CsbL4XTOBUvJS/ri+9T+XO8Y+2A= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:42 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:42 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 23/37] xfsprogs: Separate xfs_attr_node_addname and xfs_attr_node_addname_work Date: Thu, 18 Feb 2021 09:44:58 -0700 Message-Id: <20210218164512.4659-24-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc1a353c-c46a-409d-c8ca-08d8d42ca0ef X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:330; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n8b2IuIyplD5UN1hWaRWcZRPAMkrqO5+MDm5E0rkpDJrAQ6VApwJgP3UHuJwZezl7UhK03c7T4FH5DASz/N2kzKaqex8gF6ZpE1s+j+vsLD/2a5nJsUADzgsjgQrJvhLmphIpQFUAt8QIeEumeAzlXAfJgOwP5QFvCWnKzf+iSA0THRADW23oKeukvb92OhzStdEFAnghsTfRdgw+VtIxmkda9u5BRVblASu0LDZ+MBhvuwIkfjtw+J5rjkF0ApfgnjRysQPTlkpyje1+axhcG6sRnlxwLTujsox+h7lBRA5RzBzdjq36dYWeMClFsBzgluA7QYBQrzt5jUaGkKEUbRh4rPGEwaFpJmZDRmjb6ZEvWy4lFMxJXEh/Rnj3uR8LrG8mteVxb8WrcIdes5YakvgDLU4rLh0z+mh1jDJFW0VP8OrTiJpbDGEQ2l1QVK60+j+BEmBp5EV0KEU9CfdqSvF4rtjWl1UePAC6bxQtZqxFalQcaa6NaWBTV1zJkhoLo5qfzw6cvZ3E/VXUgViezh/YVLyzoXuROePI1/y8lWWoYCOl0A6req+BfZfb3JNXvy9rA5Qz+kLlxFw24bikA== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yMzdKBUcf/uMqkWNt59xNWboA5sk/JAmplI/PRsN5wayYG41yt6xf0hAMerI2o2krH/jt2Fb0DHJl/+/QykrxZ/HZ3KTZhke8tlbQFuWYILz3BR0/HTAiBif8Y3PJc6P/VirL3XBN1So2mb7q8BSKokKBP4NLuxhRslTVctZRMjRm6imxk5HmuLkVl6+M/R+FllE/yQsv2BJQMoP/8HnFl/orwJR7spNZtIIydJLX4PzjIv7Gmd/Y1SJ4fE1EzTPuaVY5xsnZE8x1VNn5q4S/scYfKs1UYKUALxLUuQE0bMnxAwf+o3wU58AqOgYbRdK9x56dJKAmofocYoD/M6xIXJxaSj4nAwIY1YeNkJQ+654t23W1yCK+xOQLgb55Dsuu/NMkUgjDO00RmsucnGLvIj4w5ODTaEfqf01GKd6Trpp3O+vfwV8y7WEOzLPPJk4jwsXSXvxCLnUq/A77wYm14Hx1CQMUZn5Mfmym6gTa5+N+CUV17Nc8EMf5BuRoZiOzOiDc2S/MzSk4gO0m/LRUe9k8AlbGwWLOvtnBzQIXS3ILLS2Qqlf7gaoPL7mg/nZqs3TA56KSPgTnmc0HvWwLiWc//3axS55ZgfR3owmUK00nstJViHVbdQEkBjmEneZ3HcQn+zhvIvpu9z5bcxhgiT3bdUKyl8uhREzk63x9k2Bv/8cY2Lmq6jpt8vgDnX0O6w4jvRwwQCjcoEOrpPdqPZagWkeAXvGstG+c7Beeyq7c9HAwN0Om3I0ievLGgX2R4b/uNLXr7Rmjs6qcxlqIe+kMahlCtDwlJWOxVbn3sLvJmnpmE3L2RPInlS4QmjrM8jGaWTdrgSILob0h9T9gnMGaHqh4QWRjHtWdH8W44MkdbCYRpU5q4v8WxOevhtgjWpRZ0Vo/jhX4fUv7UJ78/r8KbH92Cq072fSOkGZsmuPHZEUe+ZNh3aPSAAF2BN2ZS+x+Ffo0JGIIJYRA+1OZDpur2P37a5WjWpCNRPG53R9mJA5n8wrLVahsDoZ3DaElEnBzE+iZP/CmaiWNrGQpgxm1Ztqqka07h/3dVVYIwvuVWlY7NUcnmmjWPXyy7MXh6gykzCvlUdrEWF0hN/cmUkQXiGwyxX+aL3BIYm7LL4wi4/vVpqmBT8VC5NO3is9gizk4almoo60kYsSrauUp/VlNFI6qLa5BzDnuMzcrFJMqY2pil58GjPyUILCbORl6kS9Q9e8pXqGoo59QpPUTjAJN+hdFYnSDRe9ZatkNbJ4muRseL7D3h90an8qiza5lMf6iaIS3/6eq3PZISImq3E8CGBztKKjQY3/1ZxIbymPzbEKdJsIMC8ENb0OdeuV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc1a353c-c46a-409d-c8ca-08d8d42ca0ef X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:41.8555 (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: po01pPh1NUupTmhFh9DSIJAxGesHlYMNSuoQgUlEbi8tGFdiF9SNaij8Uw0DIPfnp7nrbpOUxHkKpbtZOBjbl2lWVrLfqcAVfTddDsLMQeE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 392a7ea8080e3753aa179d4daaa2ad413d0ff441 This patch separate xfs_attr_node_addname into two functions. This will help to make it easier to hoist parts of xfs_attr_node_addname that need state management Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index cf19c44..d9d7a22 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -54,6 +54,7 @@ STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp); STATIC int xfs_attr_node_get(xfs_da_args_t *args); STATIC int xfs_attr_node_addname(xfs_da_args_t *args); STATIC int xfs_attr_node_removename(xfs_da_args_t *args); +STATIC int xfs_attr_node_addname_work(struct xfs_da_args *args); 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); @@ -1072,6 +1073,25 @@ restart: return error; } + error = xfs_attr_node_addname_work(args); +out: + if (state) + xfs_da_state_free(state); + if (error) + return error; + return retval; +} + + +STATIC +int xfs_attr_node_addname_work( + struct xfs_da_args *args) +{ + struct xfs_da_state *state = NULL; + struct xfs_da_state_blk *blk; + int retval = 0; + int error = 0; + /* * 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. From patchwork Thu Feb 18 16:44:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093877 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B6C2C433DB for ; Thu, 18 Feb 2021 18:45:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECAD064EB3 for ; Thu, 18 Feb 2021 18:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232576AbhBRSpJ (ORCPT ); Thu, 18 Feb 2021 13:45:09 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60504 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232894AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUVW5059561 for ; Thu, 18 Feb 2021 16:45:46 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-type : mime-version; s=corp-2020-01-29; bh=gjicCUJPSW39Nbaop/rqxCOoWcwctNqFkPTnPq4/M3Y=; b=twyeXe0yFC5iejTxAvXJeufe9QgxRMUmN0jMrZVKPq/IfPa5VQ4hX4OdlI1wHcbG6Rc1 KnS5zu4pX2Il7NR131Q+Vn9el3kkaWy3mDPAsdf7WOFeV16Loe3nS2uufIjsVGRVToTo ffAQAnRqz+KFqDSLY7MlwVFRnJcL3WAGqvajCLIrzgJHrfrIkDZzqHRPwAZtlmwHwnoW U45WS3M+qoWI08RHGpsCBrUaI+1ERWodFCUaZvxDqko8n2qZHZKsWiAM44uaq18V6YBH pQuPJPykXFJG7LYK2VxXJUs/0fvSGmru2u3/MckTVFGOx8yTKkluW7TrPooWrSFERwBs ew== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36p49bersy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:46 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTffu074752 for ; Thu, 18 Feb 2021 16:45:45 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 36prhuf43k-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nii/s9H2gLP8IwlP2/5z+mLZc/McjJ3OWAsAIdHfpA8HqCFnXiysxbjsMvGLjNpSrEIpvpFZKzwpTqgG97ZfXAzD/zK7mmAYrkaSLYeh//xnwbZlipj423B1BrBSZDNMkJmaZyoSXFQ9CTHf/avjDVVjYB4JkTBmeVCM0k3UMx++05VCfCBAIhrakc4AfdnhMiZo5Etttn081Zy35rqSetdKWKYPewWYdCKIgUXLgQ8fL8xLrKehHOX6KrPBT0yE4aXbdrMx1SLBYho3n89pd2wHZG+hoq2ebFFT5kl7r7X4s+5d3WmbnuFISN+7aFu0qenveQ4jxgeED5+B1EJy8A== 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-SenderADCheck; bh=gjicCUJPSW39Nbaop/rqxCOoWcwctNqFkPTnPq4/M3Y=; b=E2vl7hqRLlB6TqgB1myWLAs9N/UG6OkERswF5Mp0OZQyek9U5CZyVYS+PQpvhcmUvbhhDf+OTL6KjONgXeaW4FgR6bg+9kln19LThzAxtczMThIY0Lb5iLEeCbv/Q9a6qUrqq3U0lzrNXeUPMfm3w0FWV3S2WhXwuVOAATigsliJDJUi42Ud1yq0DWtRSPXyKL/EJdBaHwmhEu5lx/lmvMxnUDMWKOmWu1AI9233tnvh3X7J/ENI1f6di+Rzghrlsr72ZXPs+hSry6sDPySnriPs+nafjQpXJhQBLY4IpMoOmCGRWThsD+UdBEA0LKTnjumWYfcc0VTumd+IU9bLng== 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=gjicCUJPSW39Nbaop/rqxCOoWcwctNqFkPTnPq4/M3Y=; b=e96FNL4JpJud7NncCD8/qB9ycSr6xrcXVp/i2lT6m7ZR1WqAZUmFbm/ZGBq1B5U4yXZqYbGzRrbP9nZx0STJK20jUuZfuYdebHf8Q3OAG6Mg8OFBKDOQuzRRNG4K1oVqnE8KgrtCimnz82Q/aHvKUE2OrW5Yun/Xg7IScjQ+8rg= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4495.namprd10.prod.outlook.com (2603:10b6:a03:2d6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:45:42 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:42 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 24/37] xfsprogs: Add helper xfs_attr_node_addname_find_attr Date: Thu, 18 Feb 2021 09:44:59 -0700 Message-Id: <20210218164512.4659-25-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 569d3908-2497-40f9-f26e-08d8d42ca137 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4495: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8pD6n0G0d4JKvjWiGWENubDj7zIDMwV8NtbTheLFLRNii4wbBQ2c1oUZbe1N7D2l/O1eQtR8/8P4p02/aFpFWaK0LMl0VdMo4VJAu2hhzsK0GkZVfRSf7ub30R534N7GXMjOCZq3+PYGKyUhRh+XTpgUgHnPrcge9308J2KbGIVovwBpcaDSkDqeuKjiaR80eJPoUMl2v20FkqiVfhZVvwmvTC5VQZrY8XC2hYpc1l+8cFskegBasxjKglhWOc2K4ORjfmBMy3wbvOZ/gXrr4Kjj4hv11phlP3cIhc5r653ca06PZiJN1xw+5WmXvwiAjRhDRPYBmoSFD5PWl4IKg0jiI6+IP5w+TWEUpPR0CP1sqioKnh27gvNqBkiFzFs65NWlTf4ij0/+/Va/T7v5cmyMrFRlrbEPPw8UL/9SoctpciAuiBClF32HgrA5BG150FJMDYkiReQxjfrbzWuNOLNy3DzEwvMkIHfhT1DIRHw45Vcn+FQ1P0OZ4QufypIUXYfBqyZVBpUxwgItxvQX34bNmaU6gS+EAppj3HTCVqMYjwVSiWsZRJn821fnBDvdsbYETUyO++NK4avpGkBj6A== 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:(366004)(376002)(39860400002)(346002)(396003)(136003)(478600001)(86362001)(6506007)(44832011)(2616005)(956004)(83380400001)(16526019)(52116002)(26005)(6916009)(186003)(2906002)(6486002)(8676002)(6666004)(316002)(6512007)(1076003)(36756003)(8936002)(5660300002)(69590400012)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: MVWfFHYcLGc/zeYuo3oq0ZBVQWxTLqz9TEP1eazuj+4pl1RatZHv39hzo0/iciHcqTeXkD1RTjIMaHQK3rffxF7BIu3uqXNrs3tLYB68oLShQvuchk6I9mUBF/XharAxjpfZ3vwUfSTdFtqpDdFOxgmAEK9gxQ1c51yQNNb4llmFhQmDi43wxqwArA9L/N76noTj7+byAfNUdAE293zAZUyCGsMfl8q2CONvVwgonqlmu4pszjZU1TcpNFb/8rYrCHR57G3Q7oaoaGFKNfnPMRKJA8pHOjxep+hK0PqLL/vfkjv20FiuZVLxL8EUkYwRb6fN+qt30s+rmabkX0zyQUsHXPAgltT9NaIVf8hf3hSeA+wqBjAMdP+i2FUMy0gYmbhZWg7uVa55pbg1ChS4rvn6VlmMOo0rk57LW2KvAmTBfwRwuTartO7k9DgO9m5Y789GCXxOGwU8JzlGPDqA8ziogZki2c8v4qEFlwcKBB70LuTejHFC3/2Q5I4e0MRd1MwLNuDz63mRNYhVAzfT/3EDDaV9xT2MQbvFD3FFw2V+hGdNVXvXjSNE11u1jdzCBpIjKzax+9VuYXPwUbn3e+GzgjyBpSIyCx49wRjtFRYYhMGNB0eUqCkxbBU4dp820hWxzmZzhpQuqypEkFTY4qXsV9DHrIaugod0n1sAJQGghKRGvDaMBVnduuJdnUIAKmwDCoG58ZnsclmA4cA7IgS5lA+awQ1nD0xRGJqC2PVbNSiVQco58JLPZbizbvOXWzprWTBQS6311a1t/MEee+iCuQ7YxsN+0XjOuYDuJRL9ng5mxuAppu7/+bfvelzmbH1rD/UGrTQJicdEx5W8Vfy+THuizaBADt4/lbpPtc98IRxsNJTPiZU4ZNexlJRrZZqsiAqttH+Nemoa+S5W1WRIG+fTPdXWng1luSpiZTBbqykA/BufrCAQ7TCzReOErTN1wSsRRcGu0ifPHOipDxeRC+7JNE29c2KHDDy8fG00sJy2d9QyK7UjBuY7PIESC93d/DB1kb3CSSsYKlKuN3Y/kTWkp6lQb/Qlrp//je9SV44ELrSPwJI0mJSgABftMqED5PTuZXYsovLnwkN3C35PWy7bCUYv4Ly30cFkdXXJ16DwViTZ9Jrht5rNnCqejzv+Qof+whQA+H7OCLpiEkxpkqcIZP+vP8l+cjgiR0nPOVRfH9/w2saXFq4Sq+KjYnbRWzWkZsgeWe7BtKYDi+fqkM72mqUGRh8Gny3QvFSrSoIDW4UZQF5Ii4LgttrF1kTQwX6czVQaCSF3P/F8FKETAvmAcQd7ug40sMye4d5TF/z0nFVFvRTSQVSkHjMn X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 569d3908-2497-40f9-f26e-08d8d42ca137 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:42.2687 (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: s3YiltU32qckUvWBliUaJOgGU8fQkytN0MuDAM8HIbgOB2s9ZhAZWDQELFkOCYh3FBrC2wmIUhnz8n4hycevyWAvAPoYTUbU2I2I69rMc7c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4495 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 1aeec98c3f70bff14cc0e65ef898e91c2c554d41 This patch separates the first half of xfs_attr_node_addname into a helper function xfs_attr_node_addname_find_attr. It also replaces the restart goto with with an EAGAIN return code driven by a loop in the calling function. This looks odd now, but will clean up nicly once we introduce the state machine. It will also enable hoisting the last state out of xfs_attr_node_addname with out having to plumb in a "done" parameter to know if we need to move to the next state or not. Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 80 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index d9d7a22..b1a099d 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -52,7 +52,10 @@ STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp); * Internal routines when attribute list is more than one block. */ STATIC int xfs_attr_node_get(xfs_da_args_t *args); -STATIC int xfs_attr_node_addname(xfs_da_args_t *args); +STATIC int xfs_attr_node_addname(struct xfs_da_args *args, + struct xfs_da_state *state); +STATIC int xfs_attr_node_addname_find_attr(struct xfs_da_args *args, + struct xfs_da_state **state); STATIC int xfs_attr_node_removename(xfs_da_args_t *args); STATIC int xfs_attr_node_addname_work(struct xfs_da_args *args); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, @@ -265,6 +268,7 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; + struct xfs_da_state *state; int error; /* @@ -310,7 +314,14 @@ xfs_attr_set_args( return error; } - return xfs_attr_node_addname(args); + do { + error = xfs_attr_node_addname_find_attr(args, &state); + if (error) + return error; + error = xfs_attr_node_addname(args, state); + } while (error == -EAGAIN); + + return error; } /* @@ -896,42 +907,21 @@ xfs_attr_node_hasname( * External routines when attribute list size > geo->blksize *========================================================================*/ -/* - * Add a name to a Btree-format attribute list. - * - * This will involve walking down the Btree, and may involve splitting - * leaf nodes and even splitting intermediate nodes up to and including - * the root node (a special case of an intermediate node). - * - * "Remote" attribute values confuse the issue and atomic rename operations - * add a whole extra layer of confusion on top of that. - */ STATIC int -xfs_attr_node_addname( - struct xfs_da_args *args) +xfs_attr_node_addname_find_attr( + struct xfs_da_args *args, + struct xfs_da_state **state) { - struct xfs_da_state *state; - struct xfs_da_state_blk *blk; - struct xfs_inode *dp; - int retval, error; - - trace_xfs_attr_node_addname(args); + int retval; /* - * Fill in bucket of arguments/results/context to carry around. - */ - dp = args->dp; -restart: - /* * Search to see if name already exists, and get back a pointer * to where it should go. */ - retval = xfs_attr_node_hasname(args, &state); + retval = xfs_attr_node_hasname(args, state); if (retval != -ENOATTR && retval != -EEXIST) goto out; - blk = &state->path.blk[ state->path.active-1 ]; - ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) goto out; if (retval == -EEXIST) { @@ -954,6 +944,38 @@ restart: args->rmtvaluelen = 0; } + return 0; +out: + if (*state) + xfs_da_state_free(*state); + return retval; +} + +/* + * Add a name to a Btree-format attribute list. + * + * This will involve walking down the Btree, and may involve splitting + * leaf nodes and even splitting intermediate nodes up to and including + * the root node (a special case of an intermediate node). + * + * "Remote" attribute values confuse the issue and atomic rename operations + * add a whole extra layer of confusion on top of that. + */ +STATIC int +xfs_attr_node_addname( + struct xfs_da_args *args, + struct xfs_da_state *state) +{ + struct xfs_da_state_blk *blk; + struct xfs_inode *dp; + int retval, error; + + trace_xfs_attr_node_addname(args); + + dp = args->dp; + blk = &state->path.blk[state->path.active-1]; + ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); + retval = xfs_attr3_leaf_add(blk->bp, state->args); if (retval == -ENOSPC) { if (state->path.active == 1) { @@ -979,7 +1001,7 @@ restart: if (error) goto out; - goto restart; + return -EAGAIN; } /* From patchwork Thu Feb 18 16:45:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093883 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BADEC433E0 for ; Thu, 18 Feb 2021 18:45:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DF7E61606 for ; Thu, 18 Feb 2021 18:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbhBRSpT (ORCPT ); Thu, 18 Feb 2021 13:45:19 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:35694 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232917AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTtRJ040624 for ; Thu, 18 Feb 2021 16:45:46 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-type : mime-version; s=corp-2020-01-29; bh=z6LBey5O7R6UxzX0oSM7X12h34GxmHx1LVxVpT+GL/w=; b=PJo5u14LQlLM3IyBwlEoKC51KO0jb1MQPVKzwgQN0BphZsNAzxZ15WdkVfAgUMrzuC8z DRqlw5+NOUuIP3q3CsJuwLOU0rKs1GssqDpY00W4jN5PN54On1dPcKoUju+6Or3t3ICS kglO0EEfPpeDk56hdEaSKndpUe5uNFwXtIY3JcE3FJducvhwos6LNZYOyzdx+CBAu3tg 3mmwy5LcZjM6WEtl5AZGZM8HNMt3YzpMO2ijY7Evpu4qgPrg4yTTQ5P8mkM0rpm535m/ SrVJbx975WuswI0S2nYd2PWiP9G/Mu1nS9E5GB2usfObjNMlrsGRZTyNItzAYlT422Y6 Eg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36pd9ae3hw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:45 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUBLm032269 for ; Thu, 18 Feb 2021 16:45:45 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by userp3030.oracle.com with ESMTP id 36prq0q55k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nDcOLs/3rQ8cPS3EXROyslTxlwq9xkuEdxrd7y7lU3GjaXuiz1i7eMmcaqWeLdTU50YCJU8HPnYmoOQbWNfGzfFCPeCD5DbmuN7HiwAPcS+lg3aNGTBYhslulDP09E+PGFXuxo5KEJEz+dcWPK1M9JOKaE7gUnPxCRMp7edMOEXZ/6j3xZWvM72ChhRfQLOf3lV7xJbEueFwAJtTEuSRSYI/Ye5jhwN9x3zLuelSgSgbnTmLbn41M7XADRzp5mPbbNQjV900VVH3jSe6xQ5liwSd2gkJqr1fLpwwAQsMmQ5Bw2qUWtFagePtEQJxHSfZDfxHIe1S+rk5/JZx+afKXQ== 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-SenderADCheck; bh=z6LBey5O7R6UxzX0oSM7X12h34GxmHx1LVxVpT+GL/w=; b=TU2Z7K/oYPzFMVweyTczWleJ6pCimUrh/ufD3LAeg0aKtnDxF5k/A4DzJTwMgDuxBR1FmSeGrQTkOqAVvbitYU1IQ3Nk8FUq4re27NpGP2+ozUBSdkn3QTIyVi+phul/cxBO2JhtdLTC+Z8UoiJRSmnd5JpCJLkxobFuZGxO/NKsz5MU5O4Ed/jKGO2rXpHqVlqdjFvZW0czykYmH6D2L7IXjVyLWBCXeUW9PYs43cmkYf5dQzgnjQOHWfS2d2RsYn7I2haXNW4KYnJVgWSDBaLJgcUUr31TMmQqIhEJgR5egrHejgC2fb59dh/G7f+vjP+cQBrrwp4Ox6mZbAo8lw== 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=z6LBey5O7R6UxzX0oSM7X12h34GxmHx1LVxVpT+GL/w=; b=wGrye9S8TaD8p2cvJS3knsQ7E7stP1r5WcVPJY0IkvY2avnAMxCBavZ28A16b/j6iddhqC/2KzMnsL1S7XyRQzUSFxmN4rHus1nx2XK6ggJ49wOt3Lz5dyA1syJDPWdBv60SiZpoHtZf9be/f5BvsH7yyOykkAxmf70owOLNqqw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:45:42 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:42 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 25/37] xfsprogs: Hoist xfs_attr_node_addname Date: Thu, 18 Feb 2021 09:45:00 -0700 Message-Id: <20210218164512.4659-26-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e0d1837-7497-461e-086a-08d8d42ca17a X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oscgz9atJEoaxe4TFPxztOYX1srQhRrSXBEeJbU+sTb+vtIJTAc2hwJgn1gqOtSFTo3cVsft06EW0ACr0YQlJELP+wm6fcMQ9QubMbD6JPAtPedZD2LAcr0HFQCN3i2GgDis8ltKiHUjK6z8UhR631EQMYHo7kP15EVNo2afdRXXVXYetok+X3jl+9FagCpzoKlwTGDF9JpNvTw6TqnBHBV0JMu0pZe/s7SOnVt77KHryR2idzhqBhdvKbJp3kt+K7UJ3NwXvr0KVj7dT0Vg0alg5+t77FOwLys9ifpqX1TMxmKaDuxdu1m3FMgj/DZdv+MvsQcuAYT+7/dUrQnh1h8HLFsxG7jlbyPCHr+BqvKr/C+WQnT8Bw6SVN0Uts7uF/LTAHuqPczCWfLqKmF2iKXIIk1M0gM9ynCSqLAbM5dctfIOIHst98WpvoCDaA29LEHjLK65ACdN7R/6hgQ/EfdR6nLXwC1i6k7jslvUxsyUvi7qSuVyRfYNYiKkL3Pt0tvKozAVCJSYrwaI+8+Olp69AnSWIVmlIKVvdlqw/uX0IP+LJJXZyG7BgRpuD+FNApwDrh5UJlfdS9mwFOyvaw== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: H6/CrmXAvkyfWTpJ07ebjzMwwl6OMP1kT4Q1JfLspt4Uttzf44zrMpS9J7KYpjZaSQKIWojNHY/5EdHvPd7f76xje1BbtepA5koeM+rdY1sGKzGZkGpVOe4IpGqkEtPlTCMZeDQY1g5IjDdLNO/oV/3bJ/IOv37v9PBEC9IaJSnNvMSaYQR26kLLokpLaTEz852Pw21jJtwjPHK1cZAQollEpMSSKCdFJzVUIJ2yh1KloDdj/qAwDrcpqgd2O8a/iY109FCW0i/wIgIMe5/+VpB6sTbH3HtFwDTs8ubyUnM1ILsKx+NJLpT9UVudOW3XVZ+RmIdsl7GIeGp6wI+7a6rkUI6AITlGAgHzwzG5VOmEFybQmV7FI4byXbDtZ793DoGrbvs16/gqsxxNGpxErshu0i1sVs7QC1sSFxU7qBGxI46iKvR05QRK0JSVCr+A8wTJQFpplxM6w+qt3w0jiHODdjbKaM5VIKtSJ0klTs0mxt6CDYWEsCLAAdvOo6iGosZA17Q2fy31egmlX03J2twK5X50FV2EkNMf962l9VndEIsvOwFVMqhD9PMP+1XdWCBi+HVKu2lUjvWr84wGeSZRx4nCUpVJSwdLz//+lTCgFAgXXlTOZcaVLeTXJb5gfs5CoZmVzrZIyiwkg0rLOTF5Yoqoisg+H71W6ATq38n2DS0ol3595Noxf3yf/um1aiGi++2J+HZqnV41QAhxraOHn+E4+XKkmQ7L2aSWdonfBe1muq0MahATNUoN/JYXC9Ed0dVFYI/KJGqDptjPgpEtAafXFhB6ungF4EKARArmWLF9cNdjgehSNbW9GywrqyUIDWFDn8V+LlyirFIxlf4qro0v7UsSNBBBSdrtoMyVVmydzURJT7ZKrBReREHnyUhp5h5t1/zJWupmawyGEmoa/NWwn1PAKbaxf+Pyx0YLU0PWkvw6Yo2cwARqVguP+EvVs9RL0FZ0P6QkD5tktp4hYy7TVqSw71ROaVzvvVFLI40t5oD45BeBgrZGHyZcEtQDpMUk0Pr4QpgdW0eURstzy1jIvZhmvaJxF9XEveepT5gsJSnEVSx23foA+PaKCSksub3AAHIBvEB8v71EyNVV5DvFNTfz2silkPXewzcHa3s+ieTJAG2QMPU8crwK2zPElZ2+Bbe4FpLzxHs0MF+eANd1kZuLnILctdzlYqJP+2cjdL/aGLiPuYnRtWRklgqj9HV8bWe588MJWxvvVBJZH8DtluzOw/s2R/Teqy4ozKbXT7R02kOh8OW16j7/nK9TMyRtvByakXN83avDSVb03RPWzK4XS8UHtq7Ibtt2vh57r8B4JhM8j8JtizI6 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e0d1837-7497-461e-086a-08d8d42ca17a X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:42.7526 (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: vlwIRIEZ6DJ4HGI+8WYsMlG5o7xWxjNhotbE27L2STfKgcZGusczqvW6ttHuGIfIzJfP5mgHPY17GrU5tWomdH40LGC8l+4Qc5+to7hC+4Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 8e7db2a154cf8889319a4d6e5f987998ed21fa1b This patch hoists the later half of xfs_attr_node_addname into the calling function. We do this because it is this area that will need the most state management, and we want to keep such code in the same scope as much as possible Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 165 +++++++++++++++++++++++++++--------------------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index b1a099d..5fadb06 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -52,6 +52,7 @@ STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp); * Internal routines when attribute list is more than one block. */ 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_da_args *args, struct xfs_da_state *state); STATIC int xfs_attr_node_addname_find_attr(struct xfs_da_args *args, @@ -268,8 +269,9 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; - struct xfs_da_state *state; - int error; + struct xfs_da_state *state = NULL; + int error = 0; + int retval = 0; /* * If the attribute list is already in leaf format, jump straight to @@ -320,8 +322,82 @@ xfs_attr_set_args( return error; error = xfs_attr_node_addname(args, state); } while (error == -EAGAIN); + if (error) + return error; + + /* + * Commit the leaf addition or btree split and start the next + * trans in the chain. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + goto out; + + /* + * If there was an out-of-line value, allocate the blocks we + * identified for its storage and copy the value. This is done + * after we create the attribute so that we don't overflow the + * maximum size of a transaction and/or hit a deadlock. + */ + if (args->rmtblkno > 0) { + error = xfs_attr_rmtval_set(args); + if (error) + return error; + } + + if (!(args->op_flags & XFS_DA_OP_RENAME)) { + /* + * Added a "remote" value, just clear the incomplete flag. + */ + if (args->rmtblkno > 0) + error = xfs_attr3_leaf_clearflag(args); + retval = error; + goto out; + } + + /* + * If this is an atomic rename operation, we must "flip" the incomplete + * flags on the "new" and "old" attribute/value pairs so that one + * disappears and one appears atomically. Then we must remove the "old" + * attribute/value pair. + * + * 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 + */ + error = xfs_trans_roll_inode(&args->trans, args->dp); + if (error) + goto out; + + /* + * Dismantle the "old" attribute/value pair by removing a "remote" value + * (if it exists). + */ + xfs_attr_restore_rmt_blk(args); + + if (args->rmtblkno) { + error = xfs_attr_rmtval_invalidate(args); + if (error) + return error; + + error = xfs_attr_rmtval_remove(args); + if (error) + return error; + } + + error = xfs_attr_node_addname_work(args); +out: + if (state) + xfs_da_state_free(state); + if (error) + return error; + return retval; - return error; } /* @@ -968,7 +1044,7 @@ xfs_attr_node_addname( { struct xfs_da_state_blk *blk; struct xfs_inode *dp; - int retval, error; + int error; trace_xfs_attr_node_addname(args); @@ -976,8 +1052,8 @@ xfs_attr_node_addname( blk = &state->path.blk[state->path.active-1]; ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); - retval = xfs_attr3_leaf_add(blk->bp, state->args); - if (retval == -ENOSPC) { + error = xfs_attr3_leaf_add(blk->bp, state->args); + if (error == -ENOSPC) { if (state->path.active == 1) { /* * Its really a single leaf node, but it had @@ -1023,85 +1099,10 @@ xfs_attr_node_addname( xfs_da3_fixhashpath(state, &state->path); } - /* - * Kill the state structure, we're done with it and need to - * allow the buffers to come back later. - */ - xfs_da_state_free(state); - state = NULL; - - /* - * Commit the leaf addition or btree split and start the next - * trans in the chain. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - goto out; - - /* - * If there was an out-of-line value, allocate the blocks we - * identified for its storage and copy the value. This is done - * after we create the attribute so that we don't overflow the - * maximum size of a transaction and/or hit a deadlock. - */ - if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_set(args); - if (error) - return error; - } - - if (!(args->op_flags & XFS_DA_OP_RENAME)) { - /* - * Added a "remote" value, just clear the incomplete flag. - */ - if (args->rmtblkno > 0) - error = xfs_attr3_leaf_clearflag(args); - retval = error; - goto out; - } - - /* - * If this is an atomic rename operation, we must "flip" the incomplete - * flags on the "new" and "old" attribute/value pairs so that one - * disappears and one appears atomically. Then we must remove the "old" - * attribute/value pair. - * - * 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 - */ - error = xfs_trans_roll_inode(&args->trans, args->dp); - if (error) - goto out; - - /* - * Dismantle the "old" attribute/value pair by removing a "remote" value - * (if it exists). - */ - xfs_attr_restore_rmt_blk(args); - - if (args->rmtblkno) { - error = xfs_attr_rmtval_invalidate(args); - if (error) - return error; - - error = xfs_attr_rmtval_remove(args); - if (error) - return error; - } - - error = xfs_attr_node_addname_work(args); out: if (state) xfs_da_state_free(state); - if (error) - return error; - return retval; + return error; } From patchwork Thu Feb 18 16:45:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC60DC433E0 for ; Thu, 18 Feb 2021 18:47:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E43764EB7 for ; Thu, 18 Feb 2021 18:47:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229763AbhBRSqt (ORCPT ); Thu, 18 Feb 2021 13:46:49 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41058 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232877AbhBRQrD (ORCPT ); Thu, 18 Feb 2021 11:47:03 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTioP156524 for ; Thu, 18 Feb 2021 16:45:46 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-type : mime-version; s=corp-2020-01-29; bh=ZNrVGw7iduRAPh/77UhKHpJ/qrevrAoJS9oLQdgBDM4=; b=MyOf4hvpHDxUpEXe4lrmuQkgb6NUDM6IfAN6X9a69RGW1ySVogr3an2fr+mEOVwY36Qu 6wgmKHq+7enMkmiIcvlarrdlEaF/SQHHWqtPyGwuuDKCZLWHjt26xlGX0VHwRNpG57EH hWA+8ODU3kL6QEqDK89sCZP9S+eCikSO7GfS3woQJHGH/6cz9G8biyqh501wtjUroGRV U1ttnyhJh1V8L62jNAdmd9QOo365Ev9NVgTB5EFWkhUXEqgVXdVl25jeo09VcwdV2W3W 6ojDoJI6u6fhD03NPEs0myz/tYCdJxAz4cj+M/sRpK92KJwR1SqZWRXWpc/4/3UVjcsB kw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r6m51-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:45 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUBLn032269 for ; Thu, 18 Feb 2021 16:45:45 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by userp3030.oracle.com with ESMTP id 36prq0q55k-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=apLWjys4O+RAHnOQcu4Pv8jQT/x9EqsKGeOw2SA1AAOwOspOsReeuggEvLf5pQRe2JHCJSNm9tYa6zTKOmXeTNy502RTiFFP1dlmPUTch/PVX5YDrPab89r+AMDfuZZV97pglih0QEPlkQfXREqq90XFJJIdc10I+WIO7zSHRGTfMM0d7kkWaKTKaWu8ccPD+XAnbiux2TzcK0/nl8X/UAqNT7rhWYandJlqBZ/ll1OGoEST14ohwyh922OLoJD7ym9qrtFBTBCW5FZ1BLvrLbfP0uZzCpZZyJFfIxE1Nz7xbsN2y9bO1XCHvMKC+Dx7l/XtlIuXBvThOD3YgIS3Hw== 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-SenderADCheck; bh=ZNrVGw7iduRAPh/77UhKHpJ/qrevrAoJS9oLQdgBDM4=; b=cTTwM492A02UfMjPUpGfBetb82vkATXBnlXIun6C6n4/pXrKSxDbvE7/MDtCZqMtKCKDbi7VF9eQfzUxJiON4pan8cUxhB5AyPWfABHaBkp2x2LSWiiRbXVbzPAH9trTHqRzsjD6NQhtTCrCYRD0GISieIWoygroZe9f5XEVgt8JKVO56XTFeq4nTk3kxLN0XOVOg9x+8K/ulhuJ9YjTVLm+aepCAAad37mmw6933h9tP6rPdVOnbSzF8cyPCCLXx78IdTx+EKhLbHFbFr2NY3lGTbLX56gycaZn1a6EYGuEdg0p3+ZsrHg+Hkj+n34/PS09vBHuayWh6yLQvL0CcQ== 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=ZNrVGw7iduRAPh/77UhKHpJ/qrevrAoJS9oLQdgBDM4=; b=aSBnee2xePnLx6tzp6FUqr7n0TKP3Yu2p9mY/KdR8Hvno4H/3jiEXi09OB2vm9Oph4PZT0aAue35RYLpKLVZv/7QLlfOWJMXn7kQwbFQPFqjhs3ElTPzfLLt9JbINStPPkToTMZe3YuF4kNwhLOMHP+v1Gl57c79dBD8ALXsBhw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:45:43 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:43 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 26/37] xfsprogs: Hoist xfs_attr_leaf_addname Date: Thu, 18 Feb 2021 09:45:01 -0700 Message-Id: <20210218164512.4659-27-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd7ea577-053e-41f2-b087-08d8d42ca1c5 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cyqnuOOGfp8cAFe/OvNveW3V3gnwUCZosvRkuOYDndT7CwiOLrlyaJ87QbRWYaNmXvRi5FmSMnsmFyuJJkQi8MDo/r3XJdJRnMfXyBrzk1+8OGrw805aiidXrx/7LPS7iTRHnOdm5W69g3/tT7q0xTbAdiMFTTjz4fjTbHvu443CgIRbmbv/IAvr73nI7NmbsbswrOX5OCFL8cu7jFKH++eVSNPajDgw4qyKpFn3OX3kGOVGVupU0WLVSMf0vY3hw9EzHd/l/RbrAit1Ffnmsv8Dfpg1iHnEp20V7PB4jp3/e614xolZcq+HGl7iuXwMwM2kqcxc2Oa1FwQ2e/q6SFb9ryasrINW/yGXf/aBGPD8EY8rzTZZ3J4BIcXqafJ/RuWCKuKt5MibCb1AH3HI3ZxL2SUgUHlAMdaw28OU/APPqihAbDtnjqwB0JqXh9s+G+TfEaOZHiUfhAZZ+ZsHv3rU4sqDSW1bCjNBsB7g3N81ww1zAuIT7USZX7tol4QGlviZsxJQa4GedSvuo91mfe0JaZFOv41I34RO3vN8pH53vTuJvX8QdM4Lk3eXhxS5 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ng7Xzpl9uIGVr9P0JuNNr2JEQs43bUSCQgWpTn9ZsB6fOTWrGYd8eWaWQX6BqOQ8kL93rd7Yrb5rJ5xHRsVXZTuVHqc/Vb0R58ZrR8g1YM62/AA7BGJvMj8Y4OHaXuo79uP1j6X7tF0UaG3lTeXjVssp0HhX0fLKKveXGmhF4rywcfNSnVQmuaPgdrNQNXdODUHl6mApQjBq7vupY1z/D5fBdVevnFS5fm4mMbuh/Be4JTpeKpUB0C8crLKciV94vG+6DlJs/6zcVc5UtOq4GG359ImyAwIKaTcvYJVIgPnbe4UrtrRtcfMAkUrYuBLYhqYY+Xhsae4u35a9sLUpRhvn3n5wzjfjSBpqBu00KOqKi2DLGA0LVocvTkv5ghZR0LNPOW6wS7ra6l7c8odQLpLeBiJlAey6daZM3vBNgfGZXIhMX5HwKaBG9WhJSNSqN7QsHDky4WcBxJJd5q2SJzG5sDuTJiXf/R7QTmVQxq3X/fxftXdRyrkumwXlgG7Zjv81Juz1grLuJXvQ+2s/WXTEroBTE3jcEF342dHs/k1eQIGDTFeTH1aXv+p81+rSXfYWmyU4SmmZ0mWnAtBI0gw4tlpF4sDh0ZPo/NFX/x/UwDwldvOtlTuWGzpSECyDqXQ8yWdofjlEcPXY3Z7JJik7DkQ14xIH/rYXjizlf3Fpu4EXHHuSQQuJCtmDcgSMwCsLsf1ktVu1sEOA3g9h+jBrevuAccg+QtIg4D8ks2wu9T0oPdqP2GL0lxElSk2X+5l6FSxcbiH9ye9emGYaKd9Ct8rl2rBmygfN2Xj4X/SmLXwBdnxacUCuwVhQC7omcPAfGfh1uqoHkNqqI2JguOY145rTNp6rU5hnldyFCN1iYiSdVE2dJSa8kftRssmLpG4NQOqoRLG1JYhgIx4cGnVob7/n//B9+wwmEaSTo3gUb5lFIoAMuqj2+gEg0qZATo+7rN66m6vaVMJvvnGxZBRF5YwsSgo/MQMfpVSiw+SKmP5gGl5t07Pl94k2QDnDipG77Q03F4OZX0zqe0/+D0sd6qTb5ku17RV0Q3qFpEpw20of4E9aqrDflN+ADdOjMKTi9qAO2vNergBJtUHd8w3WQHE8OtXwUCQnRYgguEYLl8CmoUvpqNWrijd8SFhM6FAX3YrCgAiUgGQhcJuceo5SCtB3XAeDvjeUYi5Wdr3vZOF0gVYxsw4J8bi/p+zZ65ZhqNMPLSun7tT3QQ43ht+AxhwP4u1ajKtu6xEwMMYyUmUs4m4s7eTPmFbqkDUBfFmOa8859edDh3XnNcPbo81xW0aO2EsgWbRNhA+yyq1oZ8nfEE90Ev/cCmKd6x63 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd7ea577-053e-41f2-b087-08d8d42ca1c5 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:43.2096 (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: K5IR0vIzdSQF7DIaxU8Wocme73VO4oNhia/59ZFzJlmL2zwXQQiAootnGViz7/gWS5fcPY2kaER35cniDfuYQFrw43Lm9Ju8gqiq3gg+ngM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 45adc55591f5d91b9b6c7752fa4253bf3de33886 This patch hoists xfs_attr_leaf_addname into the calling function. The goal being to get all the code that will require state management into the same scope. This isn't particuarly asetheic right away, but it is a preliminary step to to manageing the state machine code. Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 209 +++++++++++++++++++++++++----------------------------- 1 file changed, 96 insertions(+), 113 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 5fadb06..6a9d9f2 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -44,9 +44,9 @@ STATIC int xfs_attr_shortform_addname(xfs_da_args_t *args); * Internal routines when attribute list is one block. */ STATIC int xfs_attr_leaf_get(xfs_da_args_t *args); -STATIC int xfs_attr_leaf_addname(xfs_da_args_t *args); STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args); STATIC int xfs_attr_leaf_hasname(struct xfs_da_args *args, struct xfs_buf **bp); +STATIC int xfs_attr_leaf_try_add(struct xfs_da_args *args, struct xfs_buf *bp); /* * Internal routines when attribute list is more than one block. @@ -269,8 +269,9 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; + struct xfs_buf *bp = NULL; struct xfs_da_state *state = NULL; - int error = 0; + int forkoff, error = 0; int retval = 0; /* @@ -286,10 +287,101 @@ xfs_attr_set_args( } if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { - error = xfs_attr_leaf_addname(args); - if (error != -ENOSPC) + error = xfs_attr_leaf_try_add(args, bp); + if (error == -ENOSPC) + goto node; + else if (error) + return error; + + /* + * Commit the transaction that added the attr name so that + * later routines can manage their own transactions. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + return error; + + /* + * If there was an out-of-line value, allocate the blocks we + * identified for its storage and copy the value. This is done + * after we create the attribute so that we don't overflow the + * maximum size of a transaction and/or hit a deadlock. + */ + if (args->rmtblkno > 0) { + error = xfs_attr_rmtval_set(args); + if (error) + return error; + } + + if (!(args->op_flags & XFS_DA_OP_RENAME)) { + /* + * Added a "remote" value, just clear the incomplete + *flag. + */ + if (args->rmtblkno > 0) + error = xfs_attr3_leaf_clearflag(args); + + return error; + } + + /* + * If this is an atomic rename operation, we must "flip" the + * incomplete flags on the "new" and "old" attribute/value pairs + * so that one disappears and one appears atomically. Then we + * must remove the "old" attribute/value pair. + * + * 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. + */ + error = xfs_trans_roll_inode(&args->trans, args->dp); + if (error) + return error; + + /* + * Dismantle the "old" attribute/value pair by removing a + * "remote" value (if it exists). + */ + xfs_attr_restore_rmt_blk(args); + + if (args->rmtblkno) { + error = xfs_attr_rmtval_invalidate(args); + if (error) + return error; + + error = xfs_attr_rmtval_remove(args); + if (error) + return error; + } + + /* + * Read in the block containing the "old" attr, then remove the + * "old" attr from that block (neat, huh!) + */ + error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, + &bp); + if (error) return error; + xfs_attr3_leaf_remove(bp, args); + + /* + * If the result is small enough, shrink it all into the inode. + */ + forkoff = xfs_attr_shortform_allfit(bp, dp); + if (forkoff) + error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); + /* bp is gone due to xfs_da_shrink_inode */ + + return error; +node: /* * Promote the attribute list to the Btree format. */ @@ -744,115 +836,6 @@ out_brelse: return retval; } - -/* - * Add a name to the leaf attribute list structure - * - * This leaf block cannot have a "remote" value, we only call this routine - * if bmap_one_block() says there is only one block (ie: no remote blks). - */ -STATIC int -xfs_attr_leaf_addname( - struct xfs_da_args *args) -{ - int error, forkoff; - struct xfs_buf *bp = NULL; - struct xfs_inode *dp = args->dp; - - trace_xfs_attr_leaf_addname(args); - - error = xfs_attr_leaf_try_add(args, bp); - if (error) - return error; - - /* - * Commit the transaction that added the attr name so that - * later routines can manage their own transactions. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; - - /* - * If there was an out-of-line value, allocate the blocks we - * identified for its storage and copy the value. This is done - * after we create the attribute so that we don't overflow the - * maximum size of a transaction and/or hit a deadlock. - */ - if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_set(args); - if (error) - return error; - } - - if (!(args->op_flags & XFS_DA_OP_RENAME)) { - /* - * Added a "remote" value, just clear the incomplete flag. - */ - if (args->rmtblkno > 0) - error = xfs_attr3_leaf_clearflag(args); - - return error; - } - - /* - * If this is an atomic rename operation, we must "flip" the incomplete - * flags on the "new" and "old" attribute/value pairs so that one - * disappears and one appears atomically. Then we must remove the "old" - * attribute/value pair. - * - * 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. - */ - error = xfs_trans_roll_inode(&args->trans, args->dp); - if (error) - return error; - - /* - * Dismantle the "old" attribute/value pair by removing a "remote" value - * (if it exists). - */ - xfs_attr_restore_rmt_blk(args); - - if (args->rmtblkno) { - error = xfs_attr_rmtval_invalidate(args); - if (error) - return error; - - error = xfs_attr_rmtval_remove(args); - if (error) - return error; - } - - /* - * Read in the block containing the "old" attr, then remove the "old" - * attr from that block (neat, huh!) - */ - error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, - &bp); - if (error) - return error; - - xfs_attr3_leaf_remove(bp, args); - - /* - * If the result is small enough, shrink it all into the inode. - */ - forkoff = xfs_attr_shortform_allfit(bp, dp); - if (forkoff) - error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); - /* bp is gone due to xfs_da_shrink_inode */ - - return error; -} - /* * Return EEXIST if attr is found, or ENOATTR if not */ From patchwork Thu Feb 18 16:45:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F1BC433DB for ; Thu, 18 Feb 2021 18:45:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65F8561606 for ; Thu, 18 Feb 2021 18:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232691AbhBRSpM (ORCPT ); Thu, 18 Feb 2021 13:45:12 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:44220 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232882AbhBRQrA (ORCPT ); Thu, 18 Feb 2021 11:47:00 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUDuX180370 for ; Thu, 18 Feb 2021 16:45:46 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-type : mime-version; s=corp-2020-01-29; bh=29IGMbuAuuDJGBDVu+2bt5pNwENewRu+e+BiBAV2QG8=; b=QDlSgd3xg4BjIQU+CLY3sYO9U0hB6k9vZu7ny3poLeU1wmbGsjogTlftXwWOoSUx6SEn 9W4UZEJftmALS74vaqnfSqLeJM5fESvKbradn4CZJ9FR2bTvjMHaWsqiO7vx005ft3Xp Hn7wBxch3rcBZ4phwHmlA4Z7Jaj+2OObdoTc0QSOYseBeR2GqemCWk9XdoCWwnpvmneg VdX8LXjrC1TLwnhYfvfID03S/XOJrsw6wU3956c2HzWNZoe3Hifx5wzug9rkyPSd6AiQ 3UOtRDDW1vrpIDW4NA3/r5hMILGlcF0rtLbOOMYwng0XBiRpFI33maeSHG6p3UkZ9CCh tA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnph1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:46 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUBLo032269 for ; Thu, 18 Feb 2021 16:45:46 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by userp3030.oracle.com with ESMTP id 36prq0q55k-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qh0ItKCTlsTrLzsR8BBPdTMb+7HPfQBrmDJ3ypJYOUxiEgtyEcaFMh486H2ZK2bra3BVCpJxWCCa5SNw2ITZA29soSrZ0nk40LmTiHOZeP9XdNQIs5mQ369laK81a5lsKmfqcLCFkfIgk6CAPiFqLTPl2CvMrnyxvECChY1zsPn9z6IULhWUYPSjWYVCrp4D4mAHhcfWWZi34nWIm8SPSSYw0wQYzpHGc0jL4s74pImjG7czzSz8gmMMnAgVx/en93E/Ima1oaZeE+UCFztTfOsAimV+4QBcbtob6TkjUtLRThOcuagKqW8lh3OWth6YFHIhNa29BQYVh1k4q/5x2A== 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-SenderADCheck; bh=29IGMbuAuuDJGBDVu+2bt5pNwENewRu+e+BiBAV2QG8=; b=iSd90+L2mF4Y2LeIZrypc3k1BAQSk+otyY1Q62Q0/iNOylkE3v0CeFKxz/brre1kLs7jRweDX/cHqYCuReQDrVOo9cCyAvOcT9/7MBGfQrNkQe6sSk07TwlHo+GGltQFeWQSaVyTcjTozZge2QWztKORIU70qEhPK6Yoa5n/cY07nLAfeHmRzj/5dBU2IJcuKdF3MreJdXBDXwuRpSZT/g2wvDV+pMaXixcuyupKvtY7CzcC1LsJGJWcfEfhlH9xmDN/YQfiC3O4JioKwRQaxmigHW7MTI8zl3errz0eKCgEJvYUyUcFGHFmoNGUR4uZk73upxqpqmJPpyPOxWYMXw== 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=29IGMbuAuuDJGBDVu+2bt5pNwENewRu+e+BiBAV2QG8=; b=vATPS6VhqzC5cd/YIdb/jKR6d/aPROxYtA2/tNLarra782gOJc9KTwO7hqEfK8t298VVu+gcIRy7ub/kbAfnbNJjUkB100WXaFYbkfLDBHIzedMCeQfdLquhgbR+xjQ/tmV13vDLHJfEbRRN8zTOPYdIZKmUMwy8JK3yi6q90h4= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:45:43 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:43 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 27/37] xfsprogs: Hoist node transaction handling Date: Thu, 18 Feb 2021 09:45:02 -0700 Message-Id: <20210218164512.4659-28-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de05e290-67e9-489d-1e29-08d8d42ca20b X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:883; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VB1r9cIxPj+nMDmqPNvcFimz0JGRKVQjdEOG5G3SJ/h9qMMGlOhCoViAkJNwiRQsBed9/45ulGfiFUQojA9vh1IrEnGj66sffwV7o6XWImTMgEiPenjKva2tJfx2/hYL9eokbORTTpQkXsDXPFDyRtw1acW1U+tUd+t2c/OuIcfMJp9FGLqvoMJ/4B20mcqMzEV+hzuDlh+QIJiIkqTIi2dVDBF2ag8EvoTeYpdXk5tkPif6V+GtFhL8GFDqGIrtNrVYIm+HAPyH+fI1cOGSZkvZn2aT9PD4oqv3iSxRjABv8gNoBNruEykQlvQwtzLMvhgNw3uFEZ9nTW8TvExSRIlDRPHgZg1uF8YnU/1deYglFXEvZlmlXMvdHxZnYUI2/d2u9C+M/lU6MJt2MAdYSiBEHe1HDHmwA9BsXND7BCqS2dEeMmH3skK89cDpJUCPQHzpLbekb+Q8UjszX/oLyU5OFVCdoPM1VCCVZLTVBNryMq14F0OqNIHE5iRnocCf60141kBIVJ3f2ZrTHkw02zr5nkR6fuCKltZ1r6z2KfzFtwUX4ZFNuZrUUaoAvXCfKpVWVi0H3xNuJdyHOulrZg== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IbAxev15hzKwss0U/YNVlv2UKAz/XAE2OJzt5lguxVWcAkzrQfuVu6o5TKhXuSXf6KHq3AagNRjQoUCn85mq44o558BM9v7jqYhs7EeEBboRoAQHC/j/0vdbbvnDHHHqSSrffEuYW9gn3yTIOnEHTNppRk9YhccbBiUAZhsF/KVuywXuoxfTt0kuw/RZagYTUCRo+JA4I4Qo6ee3OM1IRtijcYJWuJy7n54SazSkkZW+teyvXb0SHOmSEiiTi/iCLIDTvPLayQTbWOrTuMphYfT0vRGoteyYdkKAnWC5skI2R86lmNaCGy3ATb7ETW+yXo6wZPyUd11mHr2Kula3/mG6tVf0J2WtPKR8ZlOvyzA3DVcdjF9s1h2TsqH3wfEKc6RTXl9T3WX3yOiOq/a0xdszelt2nVA/iPILG+161HQ+H4jf/XMnhXKt5SElEslY/79qqvXdScZESM8RuS9THpM5jK7WhudtSgxkn5GBU1oD4CwN/usJbrwPJPrxK1OF1o9mME953PZbi9SBKDH2PYb9bMO1ojz18uAMbToX1BVkUoufGq8wgVsf2udfdV9hsy5csyF19hHJsXWQVLx1uiIbtGAvE3ukiX2VlDHuynPqpKLZ8ZcDdzAxGUd684CXe555Dr3K9bdsRPWe8MYiSg5YovMJ8wQSUhuGuXtx986InTQjqUeSeUie1EAcutannqZG1uInTYt7j5BCWJT5uiLgltTLlPq9Ey49tV2qEqbE2+tPCDLstAV8MWb8/YyCj4HnM0SryUkTVElGW9bw1teFssYR7+e3xzkEPgt0WDzjoXQ6m5BN4o96vFj2lfzvlwmCrfFVj0fkTDGM3lPctkdPyYyX2AdoiXdcqThst8uJc7DhW7hxiWKBj8cTTB9t1RZ12tF16twE66Q1V9q0CjJHZkmpN88uFdx6HGxX2CH6Qv8aSZ37u8gpZ5+Vz2YL9ewG03VSL97Wo4xT3h0zb+e8eKcf6cZQ3MLzZrzc5dKfmwKWXudYyqMaGpD2W1WGAYpk2e+4gkgqetnJVu0NjOERLn4qVZyMkxz6FL8FEHZL5dxqYZBcPADYDHEqTNg9eJcZbe6oGyTCKanlLSP5TlVE2xhMjv+hJwrxHbOMaD3qlRbjPUXug0kE6VV1dFhnAQcDLoWmamlUJ6GbaL9NHXezWz3+HUh1BtuT5r6lB1N+efv90pf5LCKiaiQIKE8SAeVLB6pT4hX42KW1GLEoPv6ACQpavnHMTa8Bbg15VSfuwKPgjEWknUmEsBwgW9DCbArA9qJ6L9CSE65It6+Vwv7w4GqDRFFsdjSlG6pVuB4axp22pPB3sA0qbXqfd9+D X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: de05e290-67e9-489d-1e29-08d8d42ca20b X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:43.6456 (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: NE6XD4J+Kq1KbyXuA16Z8GENOD4ZGMAXONvyuaCjawPR8rcfSXcI8sSkcxvWLWHAAUBmPwd25rlLuHfcLGGsw8BWQQb7/rRMHnP0zWkXaCs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: cb9e8e1fb89d84c77c8035b2391359f9cbf209e6 This patch basically hoists the node transaction handling around the leaf code we just hoisted. This will helps setup this area for the state machine since the goto is easily replaced with a state since it ends with a transaction roll. Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 6a9d9f2..82dc851 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -288,8 +288,34 @@ xfs_attr_set_args( if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { error = xfs_attr_leaf_try_add(args, bp); - if (error == -ENOSPC) + if (error == -ENOSPC) { + /* + * Promote the attribute list to the Btree format. + */ + 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. + */ + error = xfs_defer_finish(&args->trans); + if (error) + return error; + + /* + * Commit the current trans (including the inode) and + * start a new one. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + return error; + goto node; + } else if (error) return error; @@ -381,32 +407,9 @@ xfs_attr_set_args( /* bp is gone due to xfs_da_shrink_inode */ return error; + } node: - /* - * Promote the attribute list to the Btree format. - */ - 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. - */ - error = xfs_defer_finish(&args->trans); - if (error) - return error; - /* - * Commit the current trans (including the inode) and - * start a new one. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; - } do { error = xfs_attr_node_addname_find_attr(args, &state); From patchwork Thu Feb 18 16:45:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CA37C433DB for ; Thu, 18 Feb 2021 18:47:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3A6D61606 for ; Thu, 18 Feb 2021 18:47:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230145AbhBRSqv (ORCPT ); Thu, 18 Feb 2021 13:46:51 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60516 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233015AbhBRQr2 (ORCPT ); Thu, 18 Feb 2021 11:47:28 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGURpI059508 for ; Thu, 18 Feb 2021 16:45:47 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-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=B8DJloQGpsk0JcsBjqIv1cL5a8Le1oyBPVp5eRsxtLw=; b=hEgBUDkIjbZTjrsJ2LvNehABDDYBSYrnAf8fQ1mcFuz2A0T+UR3xBJ4EIMzX3OVmCNcy yV4gHJPtAaGz8Brf9g+Ek3svqPS4C7nB2p7Q732NyM2ZAbIP6m3ZY3sODuxV4Qa4ixoA 8NH5wF21b6DCfOGeAam5LJXqMv3gkb9WEKru0OmyAA1KJF6dpReLzflHzMISr4dOqqxJ 9fQeofJ8Qp0X6Ux+Kcf9+62wOUZEMPZQFEN3vlJZDlKTNDS1sN3mszDmILcZRDBf2i37 zGtMJC1XL03R6HundOSXYScJaG+7jVrK5mCMn9r02oZKJkWG0XxxL0ZygSDK+M7CT2M3 Vw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36p49bert4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:47 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUBLp032269 for ; Thu, 18 Feb 2021 16:45:46 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by userp3030.oracle.com with ESMTP id 36prq0q55k-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nb1wz0I4h4bbTuEEf3MXZJrBXBF+8145afOR/sMAd7kiewkGutSNbUSv71Jt928mh9HU6X3+5aWUFkWXqy9TohNJR5KaY6gIzlFsHai8dVC5ivv6XZdRcoO4rbk/qzVsKsJWmT1M6bGFEuj0vkSmo/5KoWQVVxtLTAXunwi6L6syKM5FXfMfQH/uSiZUHnPqVcud2hq5CFcxNISP3MwzVmWx5peiCx+udzsLF2jRFtLzwd34FPnzvXiU2yEDlRemK50t6c38rgca5tweAPTTwtLUyQV1kTqTVe2R3UlI7dsiqaiUoCRiHAx2kyAMDO/LPq3zKNvsji/Tdu87lj8vEQ== 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-SenderADCheck; bh=B8DJloQGpsk0JcsBjqIv1cL5a8Le1oyBPVp5eRsxtLw=; b=YUMecANDcDc7KOLkELmI1ndnvPuGl98NXtXIHtPemdGmF75F32c4HjSIj8GbSX7E6afnHsuvbjrvkkg1beiMd9ea8QUbC5Cfure6SuyusNSb0MYzWUtXvgOy9U7ZLo2YftBg9jhJSFeY5yapni+wu8eVEOUl95apWOVwstQXJubYAStr1h47E/3ftwRlHgkmzDdmy1kghL5Q7d3C176rHL4sEy8Yy7pgM/bNJ8GpgBgMkaPsTvrRoLFUSDRZ18KUb7LD4XDxXD5rEHAt61W0cV8NiV+7iNMo/NCNlNw04bZh4Jay4Fs7z2+DRBMdbZAMkNFepBgRmnie0Myvymgmqg== 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=B8DJloQGpsk0JcsBjqIv1cL5a8Le1oyBPVp5eRsxtLw=; b=qwygpI0c1LXEak/vt805Tr+ZEIh2FqrTLzLaT5bOySkISPSIO5eRn02N6V7bWsgp/KA6+7CoEDeKabWaVS4iqg6LgyNnFtW6DRCOr+YPCvlnRqsHjRI4cS/cdyLh1Oep45xDTM/bJEFV6AgFooOcok3jJKGsDNPH0/JaaKAyd+M= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:45:44 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:44 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 28/37] xfsprogs: Add delay ready attr remove routines Date: Thu, 18 Feb 2021 09:45:03 -0700 Message-Id: <20210218164512.4659-29-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ce69c1c-f075-47d5-67d4-08d8d42ca249 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H48Ka+uVgxNxGX71WScSaZmWVYTsKuy21ddZXmI3lOmlCg+WtZlbFFLxPaQ11H42/kankV/BDaGQF3bhdsox3Fp3TWYLn9a4tolxz6CvdIfQfR07UbBbRZy/5Xeei5Bxh1rG39IxVjVOv1WddTVDi1IvuKmMqI4d8BlAo2mKKOqZPonjy7YIp52dSWUVQ8JPNJq1shhn2jUhUAX1M81dQgt2d1Jv4tXu9FwYNfXNUZKpBjrJCwxaG+N3/PkHjHWLjxa64qRZNLxAb0R4S9TwqV5qHsLU6UR0QwnQA3PNvr+/gCnCrntb0zYbTWe9CaI4bAWRrbq60pRpPHIASVyw/X/rB8cbBUNPMB0gjRH3vF5C0REiuoDiVOElZMKowf/0/XI097szA1Ccz6PoV8hc6SQP9e6ni7MU7nq3hgE3Yv9v0qikkbrNi8vHtiW4cEQFXeQZl2Ejv+Tbo1JZJY33cjXuJKCnDVKS6rfY6rusBjAGsqREbU7FId88dwdtW7GZSuzOwgHUz/ZTNapNhN675g== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(30864003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: H79d+8Url9IUE1Uj8isLvqA0L/KUXjc16deF3M4KFQDeRaLxaIo7XTdUGz0KJ+W3YGqHiEfJtKXc08VIVkdyJCjMSEtglxyoCfniLhYltfThE5nuBOltp3oIMa2/PyQa7nV3pCsPu10OqBy9EUY/N1jRGhxPGlytYIn+Fp93TOeVhocTIS8IpSzijWW+amVqUmpDsAXgVWC77c0c7BTTKjtAAZfxQ17chXCGaI9ywqiAswRhT3U+xMkMV+naKCYmVy0ZQ4+fIUca2+21lNl5cEJl08Dg3Ty2S0DznXsw0rHKcb0ZHKupyBO3pOng12fggxWI2wTB6V8JO8lKWgDK54ULEBe9DDeFCvSyqOr3S18oMzpJBv0TCA+9N+aNdJQlyQBQMe5G6RVIDOipnzdeAeg8SPuAtzt4wj/eZMTNvd0OOvA8L8meppl4IZAk/tMP+XwtUSMiXAnyPgllz61XBItJvX0+ycL2ktT2iBqxpyhiGHZkNx9irw4FVWlu8z168Bq+wJ2sezEb3hARSYLrjczT7gKRwqzov8Q8J6ee23cenQ04iXeor4qJkSNm+VXGnV5HOj72Vc3HZCP0HDxkBJCMCw38gigD3iKE0FyiyG/WJN39qTM+LOdSoNT8BaLBju5NyFvfcVd2IUY3GLZnjCO93DFpCidk/KfAKY3mtmF1xNcDQZ3SjUV/0Da46dcUAIMNCAvxQEIpjc7zYYhYSgGniCJrQwF3XmGRoGVxD6Qaau0YP45C9ysVkXI/dMBCFCUPo2KL6OLceBp6mt9hDoy9c10VwO6ZOIQi8ga17kHELJHU/Rt/8NblUQgKQfO5FeZJbzSdvOqP2y27I/91iIEqQc7NOybhY7BQ6OcnK/TbpCSHtUz3U+Z73S0bO6f+jbgD5tLNJ6zZYSb5yql3k/GXb1BPziZkCwxwAVcd1llyMhYmxgo28apggV8UL8p4IiqDWPRt0gYdW31UDS2OoY9TlcQA5JLj9qyIh9FZizaaR1KaMIFL4VUImxTMRT1fBhqQvS+ozlU3WyeMlhNHqzBtveunWQNB5T859EUCcNc5I16waho66IVI0tM10L6992A+xdM96HKz5zBZdhQYthOjosHMQ0PBemQgldOCPmc9nErN8vfSq/NwZD87mE5EbfYpSDeVdLCKYbJlR9DlcNxuAhkbRFc9mpADAG61Ujks9AQtkXkuush9Hqb5D8neY742Pv/bjQTzRuoE9SSfoC7iofvxx2vVn3fLWDcVH8f+A2bIw50aDjAIS7Xs047fr/V77YZjyracxJ+KDb7VSOzwt9BGrxmzr6KRKoq5urQhREiUIZDpTim72Nn2Dy9M X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ce69c1c-f075-47d5-67d4-08d8d42ca249 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:44.1464 (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: gGbD4wB9sy/1vkT1RCl6nfTMlwXX4zbynfcW02qy9MYkywb6swrP/0le2h0ae19ofxf+vBhQ0cLSLgSOB3QeVQMcGmTDQRaYaB17oSEveNE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch modifies the attr remove routines to be delay ready. This means they no longer roll or commit transactions, but instead return -EAGAIN to have the calling routine roll and refresh the transaction. In this series, xfs_attr_remove_args has become xfs_attr_remove_iter, which uses a sort of state machine like switch to keep track of where it was when EAGAIN was returned. xfs_attr_node_removename has also been modified to use the switch, and a new version of xfs_attr_remove_args consists of a simple loop to refresh the transaction until the operation is completed. A new XFS_DAC_DEFER_FINISH flag is used to finish the transaction where ever the existing code used to. Calls to xfs_attr_rmtval_remove are replaced with the delay ready version __xfs_attr_rmtval_remove. We will rename __xfs_attr_rmtval_remove back to xfs_attr_rmtval_remove when we are done. xfs_attr_rmtval_remove itself is still in use by the set routines (used during a rename). For reasons of preserving existing function, we modify xfs_attr_rmtval_remove to call xfs_defer_finish when the flag is set. Similar to how xfs_attr_remove_args does here. Once we transition the set routines to be delay ready, xfs_attr_rmtval_remove is no longer used and will be removed. This patch also adds a new struct xfs_delattr_context, which we will use to keep track of the current state of an attribute operation. The new xfs_delattr_state enum is used to track various operations that are in progress so that we know not to repeat them, and resume where we left off before EAGAIN was returned to cycle out the transaction. Other members take the place of local variables that need to retain their values across multiple function recalls. See xfs_attr.h for a more detailed diagram of the states. Signed-off-by: Allison Henderson --- include/libxfs.h | 1 + libxfs/xfs_attr.c | 223 ++++++++++++++++++++++++++++++++++------------- libxfs/xfs_attr.h | 100 +++++++++++++++++++++ libxfs/xfs_attr_leaf.c | 2 +- libxfs/xfs_attr_remote.c | 48 +++++----- libxfs/xfs_attr_remote.h | 2 +- 6 files changed, 294 insertions(+), 82 deletions(-) diff --git a/include/libxfs.h b/include/libxfs.h index bc07655..02d97c1 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -168,6 +168,7 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; #include "xfs_ialloc.h" #include "xfs_attr_leaf.h" +#include "xfs_attr.h" #include "xfs_attr_remote.h" #include "xfs_trans_space.h" diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 82dc851..27c0939 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -57,8 +57,8 @@ STATIC int xfs_attr_node_addname(struct xfs_da_args *args, struct xfs_da_state *state); STATIC int xfs_attr_node_addname_find_attr(struct xfs_da_args *args, struct xfs_da_state **state); -STATIC int xfs_attr_node_removename(xfs_da_args_t *args); STATIC int xfs_attr_node_addname_work(struct xfs_da_args *args); +STATIC int xfs_attr_node_removename_iter(struct xfs_delattr_context *dac); 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); @@ -221,6 +221,34 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } +/* + * Checks to see if a delayed attribute transaction should be rolled. If so, + * also checks for a defer finish. Transaction is finished and rolled as + * needed, and returns true of false if the delayed operation should continue. + */ +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); + if (error) + return error; + } else + error = xfs_trans_roll_inode(&args->trans, args->dp); + + return error; +} + STATIC int xfs_attr_set_fmt( struct xfs_da_args *args) @@ -531,23 +559,58 @@ xfs_has_attr( */ int xfs_attr_remove_args( - struct xfs_da_args *args) + struct xfs_da_args *args) { - struct xfs_inode *dp = args->dp; - int error; + 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; +} + +/* + * Remove the attribute specified in @args. + * + * This function may return -EAGAIN to signal that the transaction needs to be + * rolled. Callers should continue calling this function until they receive a + * return value other than -EAGAIN. + */ +int +xfs_attr_remove_iter( + struct xfs_delattr_context *dac) +{ + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; - if (!xfs_inode_hasattr(dp)) { - error = -ENOATTR; - } else if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) { + /* If we are shrinking a node, resume shrink */ + if (dac->dela_state == XFS_DAS_RM_SHRINK) + goto node; + + if (!xfs_inode_hasattr(dp)) + return -ENOATTR; + + if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) { ASSERT(dp->i_afp->if_flags & XFS_IFINLINE); - error = xfs_attr_shortform_remove(args); - } else if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { - error = xfs_attr_leaf_removename(args); - } else { - error = xfs_attr_node_removename(args); + return xfs_attr_shortform_remove(args); } - return error; + if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) + return xfs_attr_leaf_removename(args); +node: + /* If we are not short form or leaf, then proceed to remove node */ + return xfs_attr_node_removename_iter(dac); } /* @@ -1204,14 +1267,16 @@ xfs_attr_leaf_mark_incomplete( */ STATIC int xfs_attr_node_removename_setup( - struct xfs_da_args *args, - struct xfs_da_state **state) + struct xfs_delattr_context *dac) { - int error; + struct xfs_da_args *args = dac->da_args; + struct xfs_da_state **state = &dac->da_state; + int error; error = xfs_attr_node_hasname(args, state); if (error != -EEXIST) return error; + error = 0; ASSERT((*state)->path.blk[(*state)->path.active - 1].bp != NULL); ASSERT((*state)->path.blk[(*state)->path.active - 1].magic == @@ -1220,22 +1285,28 @@ int xfs_attr_node_removename_setup( if (args->rmtblkno > 0) { error = xfs_attr_leaf_mark_incomplete(args, *state); if (error) - return error; + goto out; - return xfs_attr_rmtval_invalidate(args); + error = xfs_attr_rmtval_invalidate(args); } +out: + if (error) + xfs_da_state_free(*state); return 0; } STATIC int -xfs_attr_node_remove_rmt( - struct xfs_da_args *args, - struct xfs_da_state *state) +xfs_attr_node_remove_rmt ( + struct xfs_delattr_context *dac, + struct xfs_da_state *state) { - int error = 0; + int error = 0; - error = xfs_attr_rmtval_remove(args); + /* + * May return -EAGAIN to request that the caller recall this function + */ + error = __xfs_attr_rmtval_remove(dac); if (error) return error; @@ -1266,18 +1337,24 @@ xfs_attr_node_remove_cleanup( } /* - * Remove a name from a B-tree attribute list. + * Step through removeing a name from a B-tree attribute list. * * This will involve walking down the Btree, and may involve joining * leaf nodes and even joining intermediate nodes up to and including * the root node (a special case of an intermediate node). + * + * This routine is meant to function as either an inline or delayed operation, + * and may return -EAGAIN when the transaction needs to be rolled. Calling + * functions will need to handle this, and recall the function until a + * successful error code is returned. */ STATIC int xfs_attr_node_remove_step( - struct xfs_da_args *args, - struct xfs_da_state *state) + struct xfs_delattr_context *dac) { - int error = 0; + struct xfs_da_args *args = dac->da_args; + struct xfs_da_state *state = dac->da_state; + int error = 0; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1285,7 +1362,10 @@ xfs_attr_node_remove_step( * overflow the maximum size of a transaction and/or hit a deadlock. */ if (args->rmtblkno > 0) { - error = xfs_attr_node_remove_rmt(args, state); + /* + * May return -EAGAIN. Remove blocks until args->rmtblkno == 0 + */ + error = xfs_attr_node_remove_rmt(dac, state); if (error) return error; } @@ -1298,51 +1378,74 @@ xfs_attr_node_remove_step( * * This routine will find the blocks of the name to remove, remove them and * shrink the tree if needed. + * + * This routine is meant to function as either an inline or delayed operation, + * and may return -EAGAIN when the transaction needs to be rolled. Calling + * functions will need to handle this, and recall the function until a + * successful error code is returned. */ STATIC int -xfs_attr_node_removename( - struct xfs_da_args *args) +xfs_attr_node_removename_iter( + struct xfs_delattr_context *dac) { - struct xfs_da_state *state = NULL; - int retval, error; - struct xfs_inode *dp = args->dp; + struct xfs_da_args *args = dac->da_args; + struct xfs_da_state *state = NULL; + int retval, error; + struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); - error = xfs_attr_node_removename_setup(args, &state); - if (error) - goto out; - - error = xfs_attr_node_remove_step(args, state); - if (error) - goto out; - - retval = xfs_attr_node_remove_cleanup(args, state); - - /* - * Check to see if the tree needs to be collapsed. - */ - if (retval && (state->path.active > 1)) { - error = xfs_da3_join(state); - if (error) - goto out; - error = xfs_defer_finish(&args->trans); + if (!dac->da_state) { + error = xfs_attr_node_removename_setup(dac); if (error) goto out; + } + state = dac->da_state; + + switch (dac->dela_state) { + case XFS_DAS_UNINIT: /* - * Commit the Btree join operation and start a new trans. + * repeatedly remove remote blocks, remove the entry and join. + * returns -EAGAIN or 0 for completion of the step. */ - error = xfs_trans_roll_inode(&args->trans, dp); + error = xfs_attr_node_remove_step(dac); if (error) - goto out; - } + break; - /* - * If the result is small enough, push it all into the inode. - */ - if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) - error = xfs_attr_node_shrink(args, state); + retval = xfs_attr_node_remove_cleanup(args, state); + /* + * Check to see if the tree needs to be collapsed. Set the flag + * to indicate that the calling function needs to move the + * shrink operation + */ + if (retval && (state->path.active > 1)) { + error = xfs_da3_join(state); + if (error) + goto out; + + dac->flags |= XFS_DAC_DEFER_FINISH; + dac->dela_state = XFS_DAS_RM_SHRINK; + return -EAGAIN; + } + + /* fallthrough */ + case XFS_DAS_RM_SHRINK: + /* + * If the result is small enough, push it all into the inode. + */ + if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) + error = xfs_attr_node_shrink(args, state); + + break; + default: + ASSERT(0); + error = -EINVAL; + goto out; + } + + if (error == -EAGAIN) + return error; out: if (state) xfs_da_state_free(state); diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index 3e97a93..3154ef4 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -74,6 +74,102 @@ struct xfs_attr_list_context { }; +/* + * ======================================================================== + * Structure used to pass context around among the delayed routines. + * ======================================================================== + */ + +/* + * Below is a state machine diagram for attr remove operations. The XFS_DAS_* + * states indicate places where the function would return -EAGAIN, and then + * immediately resume from after being recalled by the calling function. States + * marked as a "subroutine state" indicate that they belong to a subroutine, and + * so the calling function needs to pass them back to that subroutine to allow + * it to finish where it left off. But they otherwise do not have a role in the + * calling function other than just passing through. + * + * xfs_attr_remove_iter() + * │ + * v + * found attr blks? ───n──┐ + * │ v + * │ find and invalidate + * y the blocks. mark + * │ attr incomplete + * ├────────────────┘ + * │ + * v + * remove a block with + * xfs_attr_node_remove_step <────┐ + * │ │ + * v │ + * still have blks ──y──> return -EAGAIN. + * to remove? re-enter with one + * │ less blk to remove + * n + * │ + * v + * remove leaf and + * update hash with + * xfs_attr_node_remove_cleanup + * │ + * v + * need to + * shrink tree? ─n─┐ + * │ │ + * y │ + * │ │ + * v │ + * join leaf │ + * │ │ + * v │ + * XFS_DAS_RM_SHRINK │ + * │ │ + * v │ + * do the shrink │ + * │ │ + * v │ + * free state <──┘ + * │ + * v + * done + * + */ + +/* + * Enum values for xfs_delattr_context.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 + * calling function to roll the transaction, and then recall the subroutine to + * finish the operation. The enum is then used by the subroutine to jump back + * to where it was and resume executing where it left off. + */ +enum xfs_delattr_state { + XFS_DAS_UNINIT = 0, /* No state has been set yet */ + XFS_DAS_RM_SHRINK, /* We are shrinking the tree */ +}; + +/* + * Defines for xfs_delattr_context.flags + */ +#define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */ + +/* + * Context used for keeping track of delayed attribute operations + */ +struct xfs_delattr_context { + struct xfs_da_args *da_args; + + /* Used in xfs_attr_node_removename to roll through removing blocks */ + struct xfs_da_state *da_state; + + /* Used to keep track of current state of delayed operation */ + unsigned int flags; + enum xfs_delattr_state dela_state; +}; + /*======================================================================== * Function prototypes for the kernel. *========================================================================*/ @@ -91,6 +187,10 @@ int xfs_attr_set(struct xfs_da_args *args); int xfs_attr_set_args(struct xfs_da_args *args); int xfs_has_attr(struct xfs_da_args *args); int xfs_attr_remove_args(struct xfs_da_args *args); +int xfs_attr_remove_iter(struct xfs_delattr_context *dac); +int xfs_attr_trans_roll(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); #endif /* __XFS_ATTR_H__ */ diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index a59660f..2c7aa6b 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -19,8 +19,8 @@ #include "xfs_bmap_btree.h" #include "xfs_bmap.h" #include "xfs_attr_sf.h" -#include "xfs_attr_remote.h" #include "xfs_attr.h" +#include "xfs_attr_remote.h" #include "xfs_attr_leaf.h" #include "xfs_trace.h" #include "xfs_dir2.h" diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index 3807cd3..dd4f244 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -673,10 +673,12 @@ xfs_attr_rmtval_invalidate( */ int xfs_attr_rmtval_remove( - struct xfs_da_args *args) + struct xfs_da_args *args) { - int error; - int retval; + int error; + struct xfs_delattr_context dac = { + .da_args = args, + }; trace_xfs_attr_rmtval_remove(args); @@ -684,31 +686,29 @@ xfs_attr_rmtval_remove( * Keep de-allocating extents until the remote-value region is gone. */ do { - retval = __xfs_attr_rmtval_remove(args); - if (retval && retval != -EAGAIN) - return retval; + error = __xfs_attr_rmtval_remove(&dac); + if (error != -EAGAIN) + break; - /* - * Close out trans and start the next one in the chain. - */ - error = xfs_trans_roll_inode(&args->trans, args->dp); + error = xfs_attr_trans_roll(&dac); if (error) return error; - } while (retval == -EAGAIN); + } while (true); - return 0; + return error; } /* * Remove the value associated with an attribute by deleting the out-of-line - * buffer that it is stored on. Returns EAGAIN for the caller to refresh the + * buffer that it is stored on. Returns -EAGAIN for the caller to refresh the * transaction and re-call the function */ int __xfs_attr_rmtval_remove( - struct xfs_da_args *args) + struct xfs_delattr_context *dac) { - int error, done; + struct xfs_da_args *args = dac->da_args; + int error, done; /* * Unmap value blocks for this attr. @@ -718,12 +718,20 @@ __xfs_attr_rmtval_remove( if (error) return error; - error = xfs_defer_finish(&args->trans); - if (error) - return error; - - if (!done) + /* + * We dont need an explicit state here to pick up where we left off. We + * can figure it out using the !done return code. Calling function only + * needs to keep recalling this routine until we indicate to stop by + * returning anything other than -EAGAIN. The actual value of + * attr->xattri_dela_state may be some value reminicent of the calling + * function, but it's value is irrelevant with in the context of this + * function. Once we are done here, the next state is set as needed + * by the parent + */ + if (!done) { + dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; + } return error; } diff --git a/libxfs/xfs_attr_remote.h b/libxfs/xfs_attr_remote.h index 9eee615..002fd30 100644 --- a/libxfs/xfs_attr_remote.h +++ b/libxfs/xfs_attr_remote.h @@ -14,5 +14,5 @@ int xfs_attr_rmtval_remove(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_da_args *args); +int __xfs_attr_rmtval_remove(struct xfs_delattr_context *dac); #endif /* __XFS_ATTR_REMOTE_H__ */ From patchwork Thu Feb 18 16:45:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12094107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D94FC433DB for ; Thu, 18 Feb 2021 19:30:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB53264EAD for ; Thu, 18 Feb 2021 19:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232241AbhBRTaf (ORCPT ); Thu, 18 Feb 2021 14:30:35 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49886 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbhBRTJM (ORCPT ); Thu, 18 Feb 2021 14:09:12 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUIT5180403 for ; Thu, 18 Feb 2021 16:45:47 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-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=tiIUF2AxMmcvwigG1rTN4NhMBXcuIwWONLAb6l+Z6Wo=; b=CdVdLV/O1qloxuINib8PW2AkM4l7r1ekGgPXJPUIb1I7OHyMw/tA6ynONBfoy30t8+Dl n+5XcJTxFX5bTyS1agUyPkhCm7at3b+J98Gsq2uz2s6a4yiXd14SA6dLeOKm79oTWN8Q A5E06+Jgsu1QxX2E0yjS0vD3efUQvVq485z57sDzf2BmlJSQvcN4k0wGjgMbDYXQTR2I C6ZtsCIElDo09/8AuzcPxR4x9flQ0QDhuq8uPZHtkZlBz4zU4GZyL6iywsKwXdFjvnjr 8py6DVRIAnTsFo2StN6dXGJt/xq3ZapHeNNsuFWl7JbNpko0N4FW55gWXT9rjSVWPI2u ZQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnph1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:47 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUBLq032269 for ; Thu, 18 Feb 2021 16:45:47 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by userp3030.oracle.com with ESMTP id 36prq0q55k-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:45:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OBABtVSpPXlopmkqmJ9wQWISOm/Xc0a3j6sdVD0uZ3AK1n0FUMC0O/L7cisEtKqVinHUwb0WLwr4rOcUAL0HW7fzcWpq7tj6Sw/5LZlg3hui9tJ35v5P+XYzOdBrcrZn+kqIM0Z8TprXYVk3TuLwiklUfZwgpCRYN32H/SKHmBcnLy5jYe64+WAluAIlFutCy2g/xVE19/clg9157QHy3KIzxFmPZUaOhewz+EA369riH6nKXo6HyWUmj/ytS1uHr6XOpouQsnyhCSqGnoHDvcHyLqy13Z9riF3jwchdYQsfFOXOIC4qWazZG8pNsKthqwREHw/Dup+ZaDB8jkJL1g== 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-SenderADCheck; bh=tiIUF2AxMmcvwigG1rTN4NhMBXcuIwWONLAb6l+Z6Wo=; b=Gg42prdsaeCz2tg1Iyaz+n87edX3C2bDaxKGnB0hOdLgHjY/eqFVxTOG4mi3ZmsgoipzRmOTqVNaXo8vgJFJch7xSafSiM2HoG0+8MJFTEZKZw/5SpvnooPJerCB41j86A9xbGI4pM+z6KJwa7M7Y95lud0tr8TQ21Ld2qRQLnOfODqvMIeK65DCyrCssBCLrfK7X0FZZVxi1G0VEv55QhL/kkm7ZU4/UOS/c+iSGsN7So13xvG6oH3z/Z11eoew5htHiPbqgvRNqKANQS6maZlZXAab9fegW+1oL7Gp6wNOk8Rbfc5GOcuiFCu73wMqbhxr/+l5L1eIK2WerESK1g== 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=tiIUF2AxMmcvwigG1rTN4NhMBXcuIwWONLAb6l+Z6Wo=; b=fR5vAAxwpBhJ1+kT3RVsiFcRDw+ECWnnGDOaCQGF1JqXuAB2XtBq2id/5bAxZ8eh2ejM++z9NaHzRmhauEtUWmcm6SrMO9usi/rFQjQIxK72e/kUk4/njktogV2zp1MatXhRH9z6hpBXviKDno1RDDj/0VLaIazs8SLhPC2/SlA= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:45:44 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:45:44 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 29/37] xfsprogs: Add delay ready attr set routines Date: Thu, 18 Feb 2021 09:45:04 -0700 Message-Id: <20210218164512.4659-30-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5392e59-cb56-4dcc-ec7c-08d8d42ca299 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RjHSNCNrH23B4rYiqXE0OTUhYHPpXaTCHMSz6o2IyieCXH2V5lXW60o4PZcC5cpncnXibEfH38ptWUm2i6gb1McyPCTaiJrA97tlCFcqZ2deerLOfNw8OZgcBBm1q3vUGGYDR/lgCalo4+2IPBC/pOusYtJcLcQagaWnm2yEKBmp3/V07QrnJ1da3h78iSC+w2c0NHwlu4IshcdmVxsVR2LzZsB0jfo+4/l/qbABxs1oG4vcRcpfKrytxO+nLi8kQaDFzJHS2C4B/0i/57iIwz26OiM32L8e9g2Iz5AOAT2vorK8EDm/w939w1eyx2i8isxtXDG1MkpnGUfz6hwrmBV53WxNA9ctqAmdQxESA8nJNp3QafUHkN+knRcRCRpttVN40BeP+sxLqTPmaxrcCLs6yCWy7bk+kCCznntMVCLUgawPSyW9zH57Q6n5/MCHVO9A8PDjqvMRGc/crWhVLXzeTPdB8p1QOu2ZrRhnS/ACNh4EMAEPRkT+2ef4E8+2jFcQB45HW/8gU3pF/Y0Uhg== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(30864003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: y0K+91Wvrg2/JSAgQSXoKcpzBrAfSiiN5GXtHX1z22YoIcUNv2wilpANKLdoIHVNGJr9m59mUqvUOiBv26lUYm+cPeHazWZs3Z4K5EDXSlwf3M84ehJn4ojoEehP3FoUhC8TuShpQVpHxJbu5j/xckeqprDF+UetQKfX5d3eJMCL0AtcTFrAZxbbdZt/lXx1ivI/3PfuKjUHlvPk1ilvIfbpucH7JEBl+4hvZVDHnt3BGE5Hj0PPyWa92EHebvKuDmFXS0ueWvRtFLfEp8k+50WuuCnKKguMpXQ3+MoKRjb3PBMnQgYFqLs5ek0yDXt4EWnP16MponinBHDRDZhZ2U7KTyRWvy2YvgohATGkD1TrRqKuynN44jAmJYvA6ZTHZAXqnZz8j/XMFTidd1ZMJUD+AGQLvxGcw31Nhyijo4LwCHODGcBQhYtOca8yaN2Lhv/tpcjnybhCr4NCm4rZRW2sds6p0KmM4C/EQrYgqSPcgOBj2e0BnDO59LsDtaRbAykyhgdzLDVMaa5NLWoBwTRinWtA85809uBSq5nhbcJfeLsWDWz7QllKNX3Sd8VyJ0rkHxT5ms03MgeFUb3lj4DZJQiHsaO+dhWh4rvzuTWS2o9RrBcJ/fJhPTUoO6orgIZSTnfY19AAXnfbfUMnE2h9VPriy5UehXRcgXYHKHqgKeOO/U0Bh8MUNUqBEsiWM8bOeQ2hpw2nqfJk4YDUr1oNTZuG1HoYSQYTMydo8Luwm183entuu2UfR3bnwBNxlczeqbHBMRC1vF7X0pOxtfPRwx61hqCpf+WMhgX1aYgXqQ4cAcQfVZ+BJp9H3WOt1zCd+gPMTKblTU0G8CthvotfmBhVIZ0rDwotHUmMWsqygEIfl+NPc3QPI9eJSGZa/3q4s9qxWcqKk7DbaLksBF59Q21nEPrith+F7grZb/EENwSxmGaxVOQZJEJ0o6XxJN4DROzoEJhwobdSoOUC1deoUer4rdjheXHhLb5H5MpB+K8TL0xg5QH6myAxMDCZCoGC9fKpnBdFgQ4cv02QtnyUrUcWo+p6UTwxQOPWK33szn5Bx5echBJmRi+lh+hlDtn3Y9YXZs8x/49YBwDevbjp2crMtc2EcSDsbizAqSkxe79r98zx6uVoQPJ+dXb2g2slnim1gijx5yjsLnqoiRvI8Slt2QWbvClhlkVKyB1oVfS0Fhvw687MhN/X6lYiDKrf90D7aCTBaZ5ag9urvlqBvvrxvYwnk/7BB3zagZgnAWn58vkAAwm99Vf1weV1rBR9gpR6c/85VKMd3sy01gVnKAJEXkOBsD3+hs2yUo4kZYg3TlaPLr6e1hV8AcYu X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5392e59-cb56-4dcc-ec7c-08d8d42ca299 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:44.6263 (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: BDXxLO2oskMo46nYIfvj/ycUx/HLMW9RhfmZWFm5/VsCB4+1YI+Z3AJ9TlOeF9+XbqTceIczEN45AlLBIPfKfrQax7xXTtjXKYE8xXa0LYQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 45e46c998cd75749f6975ffdeeb9a59768e4fcd3 This patch modifies the attr set routines to be delay ready. This means they no longer roll or commit transactions, but instead return -EAGAIN to have the calling routine roll and refresh the transaction. In this series, xfs_attr_set_args has become xfs_attr_set_iter, which uses a state machine like switch to keep track of where it was when EAGAIN was returned. See xfs_attr.h for a more detailed diagram of the states. Two new helper functions have been added: xfs_attr_rmtval_find_space and xfs_attr_rmtval_set_blk. They provide a subset of logic similar to xfs_attr_rmtval_set, but they store the current block in the delay attr context to allow the caller to roll the transaction between allocations. This helps to simplify and consolidate code used by xfs_attr_leaf_addname and xfs_attr_node_addname. xfs_attr_set_args has now become a simple loop to refresh the transaction until the operation is completed. Lastly, xfs_attr_rmtval_remove is no longer used, and is removed. Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R Signed-off-by: Allison Henderson --- libxfs/xfs_attr.c | 448 +++++++++++++++++++++++++++++------------------ libxfs/xfs_attr.h | 241 ++++++++++++++++++++++++- libxfs/xfs_attr_remote.c | 98 +++++++---- libxfs/xfs_attr_remote.h | 5 +- 4 files changed, 583 insertions(+), 209 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 27c0939..e4c6268 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -53,16 +53,16 @@ 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_da_args *args, - struct xfs_da_state *state); -STATIC int xfs_attr_node_addname_find_attr(struct xfs_da_args *args, - struct xfs_da_state **state); -STATIC int xfs_attr_node_addname_work(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_work(struct xfs_delattr_context *dac); STATIC int xfs_attr_node_removename_iter(struct xfs_delattr_context *dac); 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); int xfs_inode_hasattr( @@ -226,7 +226,7 @@ xfs_attr_is_shortform( * also checks for a defer finish. Transaction is finished and rolled as * needed, and returns true of false if the delayed operation should continue. */ -int +STATIC int xfs_attr_trans_roll( struct xfs_delattr_context *dac) { @@ -249,29 +249,55 @@ xfs_attr_trans_roll( 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) + return error; + } while (true); + + return error; +} + STATIC int xfs_attr_set_fmt( - struct xfs_da_args *args) + struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp) { - struct xfs_buf *leaf_bp = NULL; - struct xfs_inode *dp = args->dp; - int error2, error = 0; + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; + int error = 0; /* * Try to add the attr to the attribute list in the inode. */ error = xfs_attr_try_sf_addname(dp, args); - if (error != -ENOSPC) { - error2 = xfs_trans_commit(args->trans); - args->trans = NULL; - return error ? error : error2; - } + + /* Should only be 0, -EEXIST or -ENOSPC */ + if (error != -ENOSPC) + return error; /* * 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, leaf_bp); if (error) return error; @@ -280,93 +306,140 @@ xfs_attr_set_fmt( * concurrent AIL push cannot grab the half-baked leaf buffer * and run into problems with the write verifier. */ - xfs_trans_bhold(args->trans, leaf_bp); - error = xfs_defer_finish(&args->trans); - xfs_trans_bhold_release(args->trans, leaf_bp); - if (error) - xfs_trans_brelse(args->trans, leaf_bp); + xfs_trans_bhold(args->trans, *leaf_bp); + /* + * We're still in XFS_DAS_UNINIT state here. We've converted + * the attr fork to leaf format and will restart with the leaf + * add. + */ + dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } /* * Set the attribute specified in @args. + * This routine is meant to function as a delayed operation, and may return + * -EAGAIN when the transaction needs to be rolled. Calling functions will need + * to handle this, and recall the function until a successful error code is + * returned. */ int -xfs_attr_set_args( - struct xfs_da_args *args) +xfs_attr_set_iter( + struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp) { - struct xfs_inode *dp = args->dp; - struct xfs_buf *bp = NULL; - struct xfs_da_state *state = NULL; - int forkoff, error = 0; - int retval = 0; + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; + struct xfs_buf *bp = NULL; + struct xfs_da_state *state = NULL; + int forkoff, error = 0; + int retval = 0; - /* - * If the attribute list is already in leaf format, jump straight to - * leaf handling. Otherwise, try to add the attribute to the shortform - * list; if there's no room then convert the list to leaf format and try - * again. - */ - if (xfs_attr_is_shortform(dp)) { - error = xfs_attr_set_fmt(args); - if (error != -EAGAIN) - return error; - } + /* State machine switch */ + switch (dac->dela_state) { + case XFS_DAS_UNINIT: + if (xfs_attr_is_shortform(dp)) + return xfs_attr_set_fmt(dac, leaf_bp); - if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { - error = xfs_attr_leaf_try_add(args, bp); - if (error == -ENOSPC) { - /* - * Promote the attribute list to the Btree format. - */ - error = xfs_attr3_leaf_to_node(args); + /* + * After a shortform to leaf conversion, we need to hold the + * leaf and cycle out the transaction. When we get back, + * we need to release the leaf to release the hold on the leaf + * buffer. + */ + if (*leaf_bp != NULL) { + xfs_trans_bhold_release(args->trans, *leaf_bp); + *leaf_bp = NULL; + } + + if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { + error = xfs_attr_leaf_try_add(args, *leaf_bp); + if (error == -ENOSPC) { + /* + * Promote the attribute list to the Btree + * format. + */ + 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 + */ + dac->flags |= XFS_DAC_DEFER_FINISH; + return -EAGAIN; + } + else if (error) + return error; + } + else { + error = xfs_attr_node_addname_find_attr(dac); 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. - */ - error = xfs_defer_finish(&args->trans); + error = xfs_attr_node_addname(dac); if (error) return error; /* - * Commit the current trans (including the inode) and - * start a new one. + * If addname was sucesfull, and we dont need to alloc + * anymore blks, we're done. */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) + if (!args->rmtblkno && !args->rmtblkno2) return error; - goto node; + dac->dela_state = XFS_DAS_FOUND_NBLK; + return -EAGAIN; } - else if (error) - return error; - /* - * Commit the transaction that added the attr name so that - * later routines can manage their own transactions. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; + dac->dela_state = XFS_DAS_FOUND_LBLK; + return -EAGAIN; + case XFS_DAS_FOUND_LBLK: /* * If there was an out-of-line value, allocate the blocks we * identified for its storage and copy the value. This is done * after we create the attribute so that we don't overflow the * maximum size of a transaction and/or hit a deadlock. */ - if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_set(args); + + /* 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 (args->rmtblkno > 0) { + error = xfs_attr_rmtval_find_space(dac); + if (error) + return error; + } + } + + /* + * Roll through the "value", allocating blocks on disk as + * required. + */ + if (dac->blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(dac); if (error) return error; + + return -EAGAIN; } + error = xfs_attr_rmtval_set_value(args); + if (error) + return error; + if (!(args->op_flags & XFS_DA_OP_RENAME)) { /* * Added a "remote" value, just clear the incomplete @@ -395,22 +468,26 @@ xfs_attr_set_args( * Commit the flag value change and start the next trans in * series. */ - error = xfs_trans_roll_inode(&args->trans, args->dp); - if (error) - return error; - + dac->dela_state = XFS_DAS_FLIP_LFLAG; + return -EAGAIN; + case XFS_DAS_FLIP_LFLAG: /* * Dismantle the "old" attribute/value pair by removing a * "remote" value (if it exists). */ xfs_attr_restore_rmt_blk(args); - if (args->rmtblkno) { - error = xfs_attr_rmtval_invalidate(args); - if (error) - return error; + error = xfs_attr_rmtval_invalidate(args); + if (error) + return error; - error = xfs_attr_rmtval_remove(args); + /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ + dac->dela_state = XFS_DAS_RM_LBLK; + + /* fallthrough */ + case XFS_DAS_RM_LBLK: + if (args->rmtblkno) { + error = __xfs_attr_rmtval_remove(dac); if (error) return error; } @@ -435,94 +512,117 @@ xfs_attr_set_args( /* bp is gone due to xfs_da_shrink_inode */ return error; - } -node: + case XFS_DAS_FOUND_NBLK: + /* + * If there was an out-of-line value, allocate the blocks we + * identified for its storage and copy the value. This is done + * after we create the attribute so that we don't overflow the + * maximum size of a transaction and/or hit a deadlock. + */ + if (args->rmtblkno > 0) { + /* + * Open coded xfs_attr_rmtval_set without trans + * handling + */ + error = xfs_attr_rmtval_find_space(dac); + if (error) + return error; - do { - error = xfs_attr_node_addname_find_attr(args, &state); - if (error) - return error; - error = xfs_attr_node_addname(args, state); - } while (error == -EAGAIN); - if (error) - return error; + /* + * Roll through the "value", allocating blocks on disk + * as required. Set the state in case of -EAGAIN return + * code + */ + dac->dela_state = XFS_DAS_ALLOC_NODE; + } - /* - * Commit the leaf addition or btree split and start the next - * trans in the chain. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - goto out; + /* fallthrough */ + case XFS_DAS_ALLOC_NODE: + if (args->rmtblkno > 0) { + if (dac->blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(dac); + if (error) + return error; - /* - * If there was an out-of-line value, allocate the blocks we - * identified for its storage and copy the value. This is done - * after we create the attribute so that we don't overflow the - * maximum size of a transaction and/or hit a deadlock. - */ - if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_set(args); - if (error) - return error; - } + return -EAGAIN; + } + + error = xfs_attr_rmtval_set_value(args); + if (error) + return error; + } + + if (!(args->op_flags & XFS_DA_OP_RENAME)) { + /* + * Added a "remote" value, just clear the incomplete + * flag. + */ + if (args->rmtblkno > 0) + error = xfs_attr3_leaf_clearflag(args); + retval = error; + goto out; + } - if (!(args->op_flags & XFS_DA_OP_RENAME)) { /* - * Added a "remote" value, just clear the incomplete flag. + * If this is an atomic rename operation, we must "flip" the + * incomplete flags on the "new" and "old" attribute/value pairs + * so that one disappears and one appears atomically. Then we + * must remove the "old" attribute/value pair. + * + * In a separate transaction, set the incomplete flag on the + * "old" attr and clear the incomplete flag on the "new" attr. */ - if (args->rmtblkno > 0) - error = xfs_attr3_leaf_clearflag(args); - retval = error; - goto out; - } - - /* - * If this is an atomic rename operation, we must "flip" the incomplete - * flags on the "new" and "old" attribute/value pairs so that one - * disappears and one appears atomically. Then we must remove the "old" - * attribute/value pair. - * - * 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 - */ - error = xfs_trans_roll_inode(&args->trans, args->dp); - if (error) - goto out; + 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; + return -EAGAIN; - /* - * Dismantle the "old" attribute/value pair by removing a "remote" value - * (if it exists). - */ - xfs_attr_restore_rmt_blk(args); + case XFS_DAS_FLIP_NFLAG: + /* + * Dismantle the "old" attribute/value pair by removing a + * "remote" value (if it exists). + */ + xfs_attr_restore_rmt_blk(args); - if (args->rmtblkno) { error = xfs_attr_rmtval_invalidate(args); if (error) return error; - error = xfs_attr_rmtval_remove(args); + /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ + dac->dela_state = XFS_DAS_RM_NBLK; + + /* fallthrough */ + case XFS_DAS_RM_NBLK: + if (args->rmtblkno) { + error = __xfs_attr_rmtval_remove(dac); + if (error) + return error; + } + + error = xfs_attr_node_addname_work(dac); + +out: + if (state) + xfs_da_state_free(state); if (error) return error; - } + return retval; - error = xfs_attr_node_addname_work(args); -out: - if (state) - xfs_da_state_free(state); - if (error) - return error; - return retval; + default: + ASSERT(dac->dela_state != XFS_DAS_RM_SHRINK); + break; + } + return error; } + /* * Return EEXIST if attr is found, or ENOATTR if not */ @@ -1034,18 +1134,18 @@ xfs_attr_node_hasname( STATIC int xfs_attr_node_addname_find_attr( - struct xfs_da_args *args, - struct xfs_da_state **state) + struct xfs_delattr_context *dac) { - int retval; + struct xfs_da_args *args = dac->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, state); + retval = xfs_attr_node_hasname(args, &dac->da_state); if (retval != -ENOATTR && retval != -EEXIST) - goto out; + return retval; if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) goto out; @@ -1071,8 +1171,8 @@ xfs_attr_node_addname_find_attr( return 0; out: - if (*state) - xfs_da_state_free(*state); + if (dac->da_state) + xfs_da_state_free(dac->da_state); return retval; } @@ -1085,20 +1185,24 @@ out: * * "Remote" attribute values confuse the issue and atomic rename operations * add a whole extra layer of confusion on top of that. + * + * This routine is meant to function as a delayed operation, and may return + * -EAGAIN when the transaction needs to be rolled. Calling functions will need + * to handle this, and recall the function until a successful error code is + *returned. */ STATIC int xfs_attr_node_addname( - struct xfs_da_args *args, - struct xfs_da_state *state) + struct xfs_delattr_context *dac) { - struct xfs_da_state_blk *blk; - struct xfs_inode *dp; - int error; + struct xfs_da_args *args = dac->da_args; + struct xfs_da_state *state = dac->da_state; + struct xfs_da_state_blk *blk; + int error; trace_xfs_attr_node_addname(args); - dp = args->dp; - blk = &state->path.blk[state->path.active-1]; + blk = &state->path.blk[ state->path.active-1 ]; ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); error = xfs_attr3_leaf_add(blk->bp, state->args); @@ -1114,18 +1218,15 @@ xfs_attr_node_addname( error = xfs_attr3_leaf_to_node(args); if (error) goto out; - error = xfs_defer_finish(&args->trans); - if (error) - goto out; /* - * Commit the node conversion and start the next - * trans in the chain. + * Now that we have converted the leaf to a node, we can + * roll the transaction, and try xfs_attr3_leaf_add + * again on re-entry. No need to set dela_state to do + * this. dela_state is still unset by this function at + * this point. */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - goto out; - + dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } @@ -1138,9 +1239,7 @@ xfs_attr_node_addname( error = xfs_da3_split(state); if (error) goto out; - error = xfs_defer_finish(&args->trans); - if (error) - goto out; + dac->flags |= XFS_DAC_DEFER_FINISH; } else { /* * Addition succeeded, update Btree hashvals. @@ -1157,8 +1256,9 @@ out: STATIC int xfs_attr_node_addname_work( - struct xfs_da_args *args) + struct xfs_delattr_context *dac) { + struct xfs_da_args *args = dac->da_args; struct xfs_da_state *state = NULL; struct xfs_da_state_blk *blk; int retval = 0; diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index 3154ef4..603887e 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -135,6 +135,233 @@ struct xfs_attr_list_context { * v * done * + * + * Below is a state machine diagram for attr set operations. + * + * It seems the challenge with undertanding this system comes from trying to + * absorb the state machine all at once, when really one should only be looking + * at it with in the context of a single function. Once a state sensitive + * function is called, the idea is that it "takes ownership" of the + * statemachine. It isn't concerned with the states that may have belonged to + * it's calling parent. Only the states relevant to itself or any other + * subroutines there in. Once a calling function hands off the statemachine to + * a subroutine, it needs to respect the simple rule that it doesn't "own" the + * statemachine anymore, and it's the responsibility of that calling function to + * propagate the -EAGAIN back up the call stack. Upon reentry, it is committed + * to re-calling that subroutine until it returns something other than -EAGAIN. + * Once that subroutine signals completion (by returning anything other than + * -EAGAIN), the calling function can resume using the statemachine. + * + * xfs_attr_set_iter() + * │ + * v + * ┌─y─ has an attr fork? + * │ | + * │ n + * │ | + * │ V + * │ add a fork + * │ │ + * └──────────┤ + * │ + * V + * ┌─y─ is shortform? + * │ │ + * │ V + * │ xfs_attr_set_fmt + * │ | + * │ V + * │ xfs_attr_try_sf_addname + * │ │ + * │ V + * │ had enough ──y──> done + * │ space? + * n │ + * │ n + * │ │ + * │ V + * │ transform to leaf + * │ │ + * │ V + * │ hold the leaf buffer + * │ │ + * │ V + * │ return -EAGAIN + * │ Re-enter in + * │ leaf form + * │ + * └─> release leaf buffer + * if needed + * │ + * V + * ┌───n── fork has + * │ only 1 blk? + * │ │ + * │ y + * │ │ + * │ v + * │ xfs_attr_leaf_try_add() + * │ │ + * │ v + * │ had enough ──────────────y───────────────┐ + * │ space? │ + * │ │ │ + * │ n │ + * │ │ │ + * │ v │ + * │ return -EAGAIN │ + * │ re-enter in │ + * │ node form │ + * │ │ │ + * └──────────┤ │ + * │ │ + * V │ + * xfs_attr_node_addname_find_attr │ + * determines if this │ + * is create or rename │ + * find space to store attr │ + * │ │ + * v │ + * xfs_attr_node_addname │ + * │ │ + * v │ + * fits in a node leaf? ────n─────┐ │ + * │ ^ v │ + * │ │ single leaf node? │ + * │ │ │ │ │ + * y │ y n │ + * │ │ │ │ │ + * v │ v v │ + * update │ grow the leaf split if │ + * hashvals └─── return -EAGAIN needed │ + * │ retry leaf add │ │ + * │ on reentry │ │ + * ├─────────────────────────────┘ │ + * │ │ + * v │ + * need to alloc │ + * ┌─y── or flip flag? │ + * │ │ │ + * │ n │ + * │ │ │ + * │ v │ + * │ done │ + * │ │ + * │ │ + * │ XFS_DAS_FOUND_LBLK <──────────────────┘ + * │ │ + * │ V + * │ xfs_attr_leaf_addname() + * │ │ + * │ v + * │ ┌──first time through? + * │ │ │ + * │ │ y + * │ │ │ + * │ n v + * │ │ if we have rmt blks + * │ │ find space for them + * │ │ │ + * │ └──────────┤ + * │ │ + * │ v + * │ still have + * │ ┌─n─ blks to alloc? <──┐ + * │ │ │ │ + * │ │ y │ + * │ │ │ │ + * │ │ v │ + * │ │ alloc one blk │ + * │ │ return -EAGAIN ──┘ + * │ │ re-enter with one + * │ │ less blk to alloc + * │ │ + * │ │ + * │ └───> set the rmt + * │ value + * │ │ + * │ v + * │ was this + * │ a rename? ──n─┐ + * │ │ │ + * │ y │ + * │ │ │ + * │ v │ + * │ flip incomplete │ + * │ flag │ + * │ │ │ + * │ v │ + * │ XFS_DAS_FLIP_LFLAG │ + * │ │ │ + * │ v │ + * │ remove │ + * │ ┌───> old name │ + * │ │ │ │ + * │ XFS_DAS_RM_LBLK │ │ + * │ ^ │ │ + * │ │ v │ + * │ └──y── more to │ + * │ remove │ + * │ │ │ + * │ n │ + * │ │ │ + * │ v │ + * │ done <──────┘ + * │ + * └──────> XFS_DAS_FOUND_NBLK + * │ + * v + * ┌─────n── need to + * │ alloc blks? + * │ │ + * │ y + * │ │ + * │ v + * │ find space + * │ │ + * │ v + * │ ┌─>XFS_DAS_ALLOC_NODE + * │ │ │ + * │ │ v + * │ │ alloc blk + * │ │ │ + * │ │ v + * │ └──y── need to alloc + * │ more blocks? + * │ │ + * │ n + * │ │ + * │ v + * │ set the rmt value + * │ │ + * │ v + * │ was this + * └────────> a rename? ──n─┐ + * │ │ + * y │ + * │ │ + * v │ + * flip incomplete │ + * flag │ + * │ │ + * v │ + * XFS_DAS_FLIP_NFLAG │ + * │ │ + * v │ + * remove │ + * ┌────────> old name │ + * │ │ │ + * XFS_DAS_RM_NBLK │ │ + * ^ │ │ + * │ v │ + * └──────y── more to │ + * remove │ + * │ │ + * n │ + * │ │ + * v │ + * done <──────┘ + * */ /* @@ -149,12 +376,20 @@ struct xfs_attr_list_context { enum xfs_delattr_state { XFS_DAS_UNINIT = 0, /* No state has been set yet */ XFS_DAS_RM_SHRINK, /* We are shrinking the tree */ + XFS_DAS_FOUND_LBLK, /* We found leaf blk for attr */ + XFS_DAS_FOUND_NBLK, /* We found node blk for attr */ + XFS_DAS_FLIP_LFLAG, /* Flipped leaf INCOMPLETE attr flag */ + XFS_DAS_RM_LBLK, /* A rename is removing leaf blocks */ + XFS_DAS_ALLOC_NODE, /* We are allocating node blocks */ + XFS_DAS_FLIP_NFLAG, /* Flipped node INCOMPLETE attr flag */ + XFS_DAS_RM_NBLK, /* A rename is removing node blocks */ }; /* * 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*/ /* * Context used for keeping track of delayed attribute operations @@ -162,6 +397,11 @@ enum xfs_delattr_state { struct xfs_delattr_context { struct xfs_da_args *da_args; + /* Used in xfs_attr_rmtval_set_blk to roll through allocating blocks */ + struct xfs_bmbt_irec map; + xfs_dablk_t lblkno; + int blkcnt; + /* Used in xfs_attr_node_removename to roll through removing blocks */ struct xfs_da_state *da_state; @@ -188,7 +428,6 @@ int xfs_attr_set_args(struct xfs_da_args *args); int xfs_has_attr(struct xfs_da_args *args); int xfs_attr_remove_args(struct xfs_da_args *args); int xfs_attr_remove_iter(struct xfs_delattr_context *dac); -int xfs_attr_trans_roll(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); diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index dd4f244..628ab42 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -440,7 +440,7 @@ xfs_attr_rmtval_get( * Find a "hole" in the attribute address space large enough for us to drop the * new attribute's value into */ -STATIC int +int xfs_attr_rmt_find_hole( struct xfs_da_args *args) { @@ -467,7 +467,7 @@ xfs_attr_rmt_find_hole( return 0; } -STATIC int +int xfs_attr_rmtval_set_value( struct xfs_da_args *args) { @@ -627,6 +627,69 @@ xfs_attr_rmtval_set( } /* + * Find a hole for the attr and store it in the delayed attr context. This + * initializes the context to roll through allocating an attr extent for a + * delayed attr operation + */ +int +xfs_attr_rmtval_find_space( + struct xfs_delattr_context *dac) +{ + struct xfs_da_args *args = dac->da_args; + struct xfs_bmbt_irec *map = &dac->map; + int error; + + dac->lblkno = 0; + dac->blkcnt = 0; + args->rmtblkcnt = 0; + args->rmtblkno = 0; + memset(map, 0, sizeof(struct xfs_bmbt_irec)); + + error = xfs_attr_rmt_find_hole(args); + if (error) + return error; + + dac->blkcnt = args->rmtblkcnt; + dac->lblkno = args->rmtblkno; + + return 0; +} + +/* + * Write one block of the value associated with an attribute into the + * out-of-line buffer that we have defined for it. This is similar to a subset + * of xfs_attr_rmtval_set, but records the current block to the delayed attr + * context, and leaves transaction handling to the caller. + */ +int +xfs_attr_rmtval_set_blk( + struct xfs_delattr_context *dac) +{ + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; + struct xfs_bmbt_irec *map = &dac->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, + map, &nmap); + if (error) + return error; + + ASSERT(nmap == 1); + ASSERT((map->br_startblock != DELAYSTARTBLOCK) && + (map->br_startblock != HOLESTARTBLOCK)); + + /* roll attribute extent map forwards */ + dac->lblkno += map->br_blockcount; + dac->blkcnt -= map->br_blockcount; + + return 0; +} + +/* * Remove the value associated with an attribute by deleting the * out-of-line buffer that it is stored on. */ @@ -668,37 +731,6 @@ xfs_attr_rmtval_invalidate( } /* - * Remove the value associated with an attribute by deleting the - * out-of-line buffer that it is stored on. - */ -int -xfs_attr_rmtval_remove( - struct xfs_da_args *args) -{ - int error; - struct xfs_delattr_context dac = { - .da_args = args, - }; - - trace_xfs_attr_rmtval_remove(args); - - /* - * Keep de-allocating extents until the remote-value region is gone. - */ - do { - error = __xfs_attr_rmtval_remove(&dac); - if (error != -EAGAIN) - break; - - error = xfs_attr_trans_roll(&dac); - if (error) - return error; - } while (true); - - return error; -} - -/* * Remove the value associated with an attribute by deleting the out-of-line * buffer that it is stored on. Returns -EAGAIN for the caller to refresh the * transaction and re-call the function diff --git a/libxfs/xfs_attr_remote.h b/libxfs/xfs_attr_remote.h index 002fd30..8ad68d5 100644 --- a/libxfs/xfs_attr_remote.h +++ b/libxfs/xfs_attr_remote.h @@ -10,9 +10,12 @@ int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen); int xfs_attr_rmtval_get(struct xfs_da_args *args); int xfs_attr_rmtval_set(struct xfs_da_args *args); -int xfs_attr_rmtval_remove(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_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); #endif /* __XFS_ATTR_REMOTE_H__ */ From patchwork Thu Feb 18 16:45:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF807C433E9 for ; Thu, 18 Feb 2021 18:47:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88EF864ED2 for ; Thu, 18 Feb 2021 18:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232905AbhBRSrZ (ORCPT ); Thu, 18 Feb 2021 13:47:25 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36054 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233355AbhBRQrm (ORCPT ); Thu, 18 Feb 2021 11:47:42 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGU5H8040952 for ; Thu, 18 Feb 2021 16:46:17 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-type : mime-version; s=corp-2020-01-29; bh=7U9lInub3rHv2j79ris2E9htjChPcfas/rDl+FXYeSw=; b=ypNFwvyAeZVPy9YRhr9mqKt6GAVzsqy748DJ41CcR/kIMWiWnYF345LlQGoBECrOxxLm eiPbdco0LFOEFIYymmyTZ9B1mZNqNI1j83M5sYoA+X5R9KVWvlwFsFbYJjx78q2av5lx GPScwq+Fox5x0GGzvI8gD4LidQLeDjIj9Ak9bgdRdn/LG09CFL+noxWALdrZOp/PrV1v KOQWwqHEMjYBac1VQymQo/US5qBpR51cQppZ+bGXclQyqgRKlCbqArOYXcKqbqK+/yj+ 6VWgyOQ8Cgz8OWy4RbBCN+pKi1vmwCVDE3I7ugKyJwFkRdFm0ThgVE9+M6SZfWa3Wm0A Ng== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae3kv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:17 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUJtF067880 for ; Thu, 18 Feb 2021 16:46:17 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by aserp3020.oracle.com with ESMTP id 36prp1rkmw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kU49W6v2qpUYNPZgXj0Xf1lJQI/r+vc+BOB5Mdiac31xS+o4PpUWax98H2FUZ77VvQ9qtKEEp0nFT4M6+O1iUDZfPZ/+cFimJzuREJljMlm3cqGP6R89GpXatDi7DpqUZYcnQ4J1FtSfJuratBdyah4BEAxtHagscc5yGEShDne4dEkrhejlaXBHEpnc0S04RD3f50+wXE9WI+xzyDBmRnWnZSdjLqKT4Gg3l0YTdBkrRdDkiXRmFy8t8pTqBeStqE7t9y0fY+d3KC5Gx71F3R1SUgiEkfyGYPNS0P1UwfaHjPVprl4AGdL5Gxm/ofiHFaiPy+2CqoMUalEN2DZlkg== 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-SenderADCheck; bh=7U9lInub3rHv2j79ris2E9htjChPcfas/rDl+FXYeSw=; b=M2nPk/BKR+1ufMZYMeXBkIcQvBsKdFlIhnuvUL4ShGEndPED9x/fn39xsQxs/LvfqmYGTy7WB4eEfA6FgIGlitrENUn+hi4e5PIf+VKYdXB+snVX5WWYwt6bkpBOBgyxUkPX2GE1vzRzS4Paj1UCBRs7kG7s8WL/QcexWW2yhVGpdeHC7keUZtA81gqtfgVbO5qwQKH4dGFJmQw4sUkhvwfNV5fYgHypBssHZgA4utN6axs8IiTbLHxqI439TbnC2adFXYb+8VJwH8fZKqB2g4HvM79HSkdrkiQpxSvybXLil8IM9YuSF1cHps+uQbbkvHoVSsywBAYXHOCiNSe5Jw== 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=7U9lInub3rHv2j79ris2E9htjChPcfas/rDl+FXYeSw=; b=dL6KhlSdMabNDgd91rgvodH+DyPfjN8wTym4p0U6psfBKxqDILdhCUswaHUvwGnbMfSLtJS1gxqAt0T4KFOW4A1ZPhwPs9A+dlyuJoml7Df+kcejIFPD11R/H6CyHjLFNDyawGHImb+W4gYclclKn8AFD+m2Jl1rM56bpkXuVFc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:15 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:15 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 30/37] xfsprogs: Add state machine tracepoints Date: Thu, 18 Feb 2021 09:45:05 -0700 Message-Id: <20210218164512.4659-31-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c7b93d0-cc9b-4154-05e5-08d8d42ca2e1 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:221; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ut2lv5mJ28ZRLgyXigcaYROjnGmblqYWU603UGNQ/xDmwRoVjztCHu7r2La093ixib9oW8ZwQmqynZ64nWsnb6LzwjKj64cb7sSx6HhYZ/7TI6mAf8PUhoD5dShEce5R/p/tZXASr5EBjvVxPq3Ex/Psm70WAxgOE3dH8c1Uuvtpfr04ekB8Okql9fVw8ItNcVPDYnv6FAWuSfEFSufexHNeE84ZVt1+YTTXos7WvOx6XpxzBHIN4QhN5XkebOEF2JojgXIMgh9m2wV522ZaTab3hxoD9Xdq1g0VBYBqL67cr+x4fx4Jo4pkghbhkJVTlL4Znkacvda0U//yrYxNB1Y6PUB7s1s2neBHWd4lsXxLd6dHJyiSb/K1Q3FrPzeGYqjBIByJx3hEWfB2XhqpHRXLAtvNuJJJVusKDjOBSz55ZaRoJdB/NA2PvupmVKf/0wNd99/uEmOgQZaez5lB0mTYhdlnzSVQKlhFOXNegrvbPiLdwz3P9tUQPB5C6b06Q5a/+qD+RMLUcHyajbdrdxfpVbYtZ8hRX6KjlKOoAsQ29vQfCCVskTVenvrida6lF8+qw+53/kgpXrigLMOkCQ== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OIK/7Fw0i65Q31s/QF1vQKm7J3Z+FcPU7/pMKTwhMt7ZL3MuW2tVj1NijhrF7NkhZksf9M8KY43dMjuewK3sCtTew01wmzfMTcd7ZovV6v4mx1eyTotLNVSNLy7DTx6kc7k8gZal/oTTpUcGTygLZYqD+7dbyaOPlF7t9VCdI1aMUlEom64z5YHfihy13wGijg9VqrO0lKGNoht2zfrWo4/4Sk2ccyRd4u8eawNxZ3HHxB2vBbCf9ogc9Twz319TAzmB/C3yoxXiTF3Bbe53Ch0faynPVJq8UG5pg5ZAF3Pv7C5RnKtARBTal8eT1J9FysPy3NVuStON4gl15FPeSU3wxAmNpL9Czcf7cBYektlcjWHbX1fpDeI4M8cwoEKo3WDondu6r8EprQcQYoJ9c2UBjMlKzDdA1rj1LZawaIf0aG91Hg5f8XYZAueTwAJtYOfZwaRVMH3RFrCwtEvF8Pq5yn00caZ6y5TLKPCGIjki3EtD4+boOaI4HulgOCOHBxmBS7X3ntxGrNEtvu59P00PXItkVtW2CjznRGFmxU+5WE7ZUvxRrTMPqlFMiT8+51yEw2Y96zVglAqN70kDHRi2k1ptxoPF8pmDl5HB4VUqWiaipOvrf+r7LtkrODdvqqRZkrupmEU/l1jk5iq+4HVAWq1jfx8bg4iqAQViMaLyGT6FkumgsfpDRMt3+Nf8G27I1skCq8U88cYmyOKdgr14PCO6lN6tXHZu0FggQyKcHDu4UkdLTJgJFxhTWAunFw0RFo+/eJb7fvpQR5c6fe0hDjcl69CnuneOeGqPYg54t/X0rVsGUxtqOk+VRk1x5fjgC3C1lM6ENyN8XIaso1ayGrt6UkrS9sVd579tyml/tNo17+a2TrjasPW0YuZ6qOUVgANmGcr5JBfQbNd8a/T4GbUYJzsLPYZovpw1K0Poi+EPjyXMZoIZPvyEzdfUfY0nPcdWREzId4Sutgb9NaOH23+HXEbpDlQaSQ7y67cZsjEeoxW3VGq7gywSbkijBNmI90xt/5L+L27nTwbr1H2gNFE9hgpjI6oFNcXzViUmRLTPOck7o2s1P+prw6fnpCqkDjP16GDQ7ru7GLfhzV5bRtOgeS3HvwwEIFQ+f2BJp0rWffrcr9lshQ57UsvB5jeHsGXI7H5udz+lFUATmdgRqAkFYhgy8UKltmU9oogPvY6xkVvXway2Sh7iK7fiYWIt/0Jp2gp/1yeNUqtVS0FJqmwKX728JIbdM9DWyvaUFfJ0MDkidjp+VuMZfWmNFS5fqPKz6KPYRq1Y8lgxA+U5tUFQihinzpI5bVq2FVf/YUIz7DHnzqYRl6cThsyq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c7b93d0-cc9b-4154-05e5-08d8d42ca2e1 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:45.0535 (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: DPjRH3itCBwtnMvRtyoSKmc2AU7oVcvvvp0uJZGE9S9OsOFv03kEQaW8/uFIDu+TwkdClVhSm1zkUJVRB73s98g9tIogZv94gUXuzvydAYg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: fbc8d6bb875915e0afd8ff6cd4364b368a6f894f This is a quick patch to add a new tracepoint: xfs_das_state_return. We use this to track when ever a new state is set or -EAGAIN is returned Signed-off-by: Allison Henderson --- include/xfs_trace.h | 7 +++++++ libxfs/xfs_attr.c | 31 ++++++++++++++++++++++++++++++- libxfs/xfs_attr_remote.c | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/include/xfs_trace.h b/include/xfs_trace.h index a100263..cc3e8b3 100644 --- a/include/xfs_trace.h +++ b/include/xfs_trace.h @@ -314,4 +314,11 @@ #define trace_xfs_perag_get_tag(a,b,c,d) ((c) = (c)) #define trace_xfs_perag_put(a,b,c,d) ((c) = (c)) +#define trace_xfs_attr_set_fmt_return(a,b) ((void) 0) +#define trace_xfs_attr_set_iter_return(a,b) ((void) 0) +#define trace_xfs_attr_node_addname_return(a,b) ((void) 0) +#define trace_xfs_attr_node_remove_rmt_return(a,b) ((void) 0) +#define trace_xfs_attr_node_removename_iter_return(a,b) ((void) 0) +#define trace_xfs_attr_rmtval_remove_return(a,b) ((void) 0) + #endif /* __TRACE_H__ */ diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index e4c6268..4aad38d 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -313,6 +313,7 @@ xfs_attr_set_fmt( * the attr fork to leaf format and will restart with the leaf * add. */ + trace_xfs_attr_set_fmt_return(XFS_DAS_UNINIT, args->dp); dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } @@ -378,6 +379,8 @@ xfs_attr_set_iter( * handling code below */ dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } else if (error) @@ -400,10 +403,13 @@ xfs_attr_set_iter( return error; dac->dela_state = XFS_DAS_FOUND_NBLK; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); return -EAGAIN; } dac->dela_state = XFS_DAS_FOUND_LBLK; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FOUND_LBLK: @@ -433,6 +439,8 @@ xfs_attr_set_iter( if (error) return error; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); return -EAGAIN; } @@ -469,6 +477,7 @@ xfs_attr_set_iter( * series. */ dac->dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FLIP_LFLAG: /* @@ -488,6 +497,9 @@ xfs_attr_set_iter( case XFS_DAS_RM_LBLK: if (args->rmtblkno) { error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); if (error) return error; } @@ -545,6 +557,8 @@ xfs_attr_set_iter( if (error) return error; + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -581,6 +595,7 @@ xfs_attr_set_iter( * series */ dac->dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FLIP_NFLAG: @@ -601,6 +616,10 @@ xfs_attr_set_iter( case XFS_DAS_RM_NBLK: if (args->rmtblkno) { error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); + if (error) return error; } @@ -1227,6 +1246,8 @@ xfs_attr_node_addname( * this point. */ dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_node_addname_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -1407,6 +1428,9 @@ xfs_attr_node_remove_rmt ( * May return -EAGAIN to request that the caller recall this function */ error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_node_remove_rmt_return(dac->dela_state, + dac->da_args->dp); if (error) return error; @@ -1526,6 +1550,8 @@ xfs_attr_node_removename_iter( dac->flags |= XFS_DAC_DEFER_FINISH; dac->dela_state = XFS_DAS_RM_SHRINK; + trace_xfs_attr_node_removename_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -1544,8 +1570,11 @@ xfs_attr_node_removename_iter( goto out; } - if (error == -EAGAIN) + if (error == -EAGAIN) { + trace_xfs_attr_node_removename_iter_return( + dac->dela_state, args->dp); return error; + } out: if (state) xfs_da_state_free(state); diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index 628ab42..a1c9864e 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -762,6 +762,7 @@ __xfs_attr_rmtval_remove( */ if (!done) { dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); return -EAGAIN; } From patchwork Thu Feb 18 16:45:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20009C433E6 for ; Thu, 18 Feb 2021 18:47:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4F3964EB8 for ; Thu, 18 Feb 2021 18:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231990AbhBRSrC (ORCPT ); Thu, 18 Feb 2021 13:47:02 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36060 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233133AbhBRQrl (ORCPT ); Thu, 18 Feb 2021 11:47:41 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTgkj040328 for ; Thu, 18 Feb 2021 16:46:18 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-type : mime-version; s=corp-2020-01-29; bh=WeZG1GapVtLMuRouhhk3mz7KKd+tcqo0EBoi9+gUa4s=; b=ACLqjQXK0X6JaYKH3ATK4ti7/1FijQ42PYzNUeUmAX0ZZcLt1TKEmnjF+kz6038vXjjH 174rtBkhhSqzN7omnIe2cwgKjKTwZWvOul60WhutQPqKI6RzDXCZnX7AlwGfhJ4nN2qb gQJmF5eu+zEqo42rOF39vN1oZ3xf0a/22EdAoh059p9lxfpotgrOJ8LoGQsl0jGRLeRh gyCdMTVD17peJU2LxSZCVLegdSol8stjt0x/cZlR4HKIq1TrY2BYm3ggXCGexGY1sNKc onYQ6Rk+5jgqIeFtIqQGcG1KolqGMUjY1t36RjryWPaTivJZGGI4dGYa2T09IWWzH1F5 dw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae3ky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:18 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUJtG067880 for ; Thu, 18 Feb 2021 16:46:17 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by aserp3020.oracle.com with ESMTP id 36prp1rkmw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNCFsPqlUaxd1RtOWqWdyZlSBz4BK5ZnsKKxERVTpfsrmKnPdjkakltWmSO2IpAVrwlpq/pJKUeiUVEDt7REHyejOy/JpLQWzhqBSEON2AEP/YoEQpUU2g/ZW5yCl3OY00BfojpJJdB/heGqexz6tzAmHm3kgqncusZ/Fl6ZnaicBU3g6+QBUvulsNo1EcyG/2oHYM4tymYB3zpYAOT8l1xT3W90e1LyBwIlt/gSZhImj7rmJww/hQX1w61EnnWMIM9M00Oj4NiSL1+Ib/sYDqJyjoKb9Z6DLz59lVLNgWKye+g9Ol3FeDr57DWfey08I1CAg8wdKrZslkqZ4eEbNg== 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-SenderADCheck; bh=WeZG1GapVtLMuRouhhk3mz7KKd+tcqo0EBoi9+gUa4s=; b=V/vDkwooeAwjDjqqJdzG7Zhyp+72Tro3O+/9gIRJFCG61gtj4oopmi9xsr9jdLvFHlRBgXFuo6JUC5GA4OHvYUoCzOzCNpDzDu3gHS9NufUKbzArMMgQEaJaupjBK3xTpOYmM2ezPqNhs6FezoGTG2vgQ11hG7O9ScYJcOEoxghQnSuAST7BjwNnu/UUi+2CPvGLolYeeJ8ig0eTK4JeZm89JcLZ3cMMSFq2ePGTazEb9FSDvPKu3JWJWNHr+2KO46YRrwpxICdtSkrMWsKw23WgMFsiT+rSu0zKNsdsvHgTe4L65AXlSWFAt15oXDeFVlnmn4FwZ3sxfduTq1xgDg== 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=WeZG1GapVtLMuRouhhk3mz7KKd+tcqo0EBoi9+gUa4s=; b=gqPjkImSXFfmZ/Tqi3nlMn+ulx+fFQD7UzRGjxKDwsPaZWEhmFGil6ExBawIHbIFMkQWkkBlogl11UIyD1qVb1um45l6JiK75R1W2BC+AqP8bdWR98r5C8ySV9OB1U+jNcySXG76CTQ5fsDj+el6VTL5eyYT+xzPVU2paJKlRuw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:15 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:15 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 31/37] xfsprogs: Rename __xfs_attr_rmtval_remove Date: Thu, 18 Feb 2021 09:45:06 -0700 Message-Id: <20210218164512.4659-32-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81e32cab-ba8d-4143-fb6d-08d8d42ca320 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WYJ1nqxMHoVC0tY5dzr56qB4WLdoKC7EE1g2+WxXWo/3ObgnnBl2bdkSDFiapOjJXwXRhftigsYHnlrsjVbxCUYbZpyWpFiwIkV7WA50XWA4c8t0Vb6OnEOJtonvHQ/YnKDtJhw4cqLC5QgESe4DXbn8STspGMXNKpPOxrUYRg29BactuZLEmm94BTRLNjDsbfvVTH7mWh8B9ozf+C3+ixR3UWeYt/kYp0Gh1AGOjGjOK+TEVcZKltWlcJzN0BGtwTAjAHyH62SBrfGbHi++CJbJO5mkTiuqPHHJ1ZMgR/knp3rcL1iz7BhQOMIOVnwp8hPa2u6GisJyBJlkSQo6r1UwU7gpxQgao8R8BQPepGIUAxaxTmjfD58m+3delz/Dr9b8lO7lWdvDZ5qHnM7wFH8PaWHDEkzgxQoQl7uhbbZ9eNLtmnqIGidLHxkGmD+Ak3qlCAy944dtOC7AOiivqH6ob4eHF7RH12fg9wJHzGmnKvjpz0Rgznn2zfls1ibQVBlCOCRywT8LOqgFfBiloIiwEQsdRPnOhDSDnyzHE7nBUAT3hJkSUvYVQEBKNT7nFZKdAVWtdyEJlrn7G8ERSw== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UsQDsXswvnA9Bou6b2TqE4d1DC3EJyNU6MTw9gjaSCu6oH38YTixL89nRfGycBL2X3ebFv5kjlKAUyXO/4uZnbwWUYeGHYRQZvcPgUzJLngE1E9HkPjiK+OGBZcDW9LtkR/0todVxXUVfkX3NBcfGKeiYPZeE/OXe8FxRp7Ms3p2K1dfifjvcB23yVama30LI4EvkSZz0oroPljE0W0kAypq+47j5hQGMhPMLfkR4doDbMRzpngzLNlN8kTYnx83n6s91/UVOv9Ij7col14Cxc52BGtjO4Fy1GwZM233OZ4Z3sRZAJDAIsDxfKhrrw3Y9FTTVgkSe9vz9bTwD1zv4s/w6Kyc2ixuGwQvDbXc/zHuem/j0B4t/B/73QmloOeJDn9iU1MS8r6uLbjZQ6XwSvC69r0bERP4bBj1Ka1dvjRF1a/NB4ef5R+dHHr+D4D6vJVbPBVSYpDDsUPnQoMJLgIBInuyW71PbnevYAroN99PwmYux6FKrzKW0pCaIdZ6Z+2v2GKUVRkhkDgaw4Knf2hujhTKCgcxwPubUEYGB1tYuhZzv8l6skNp3tVz/TF5/rz4gx+pQqM2BU860QYawcLRpM6j8vZyEdGM3UXCs8Ye4oXfkJsqV+kNn1u/ctPHEs43mX/5Wii6xXzZlt4BNAypiI/HbFkZn/yELkKamrurSVqpYaXr+6AfqWcAHjgQGFp1uq4w5JiGV3dmaOqu0qI3LiVvxjmAvSnZGDBUMrdgfhLsqwKUfgTdAZvXAJtVwJlwHImzcqVBJOVM4q+cKKRdJ7k+tkZdLKrD2ikJClaEI4B0Udkoj9z7VTsCuTayjYukBH9IAwPihQ/zu7ZScW5rZCSlB/Zx3XB7JaHv7KXNuCnYejhbmFNAsO8hDQfQ0L//iBgGrdnF9Umny09HhWIQZcpBoTmXjsqgO6ReflIqtB9oRqDs+s2s5Xxg2tzxir8lTd1mVRtRoqUEqSGu5VfFiejvRk3ymORXOXLV6p5c9YNflsgSHvTp4ErD/YDTPdlVc1exPNXwZ0YGSWL249SVL/icfU1Ohvyro6/fmDGhJ/pahQRH2kXv7deT79LW2IYx268u+CJJT4piOR0Yux0bT09sXZqSNFy3/x4EprAcrTiSQ1+ebiEWw5Z9GKosVds3aGbtJAa/fW+pTKMeVkEIVODOEdnTbD+edGvAOyVAf3uvI5iUg+P1hPNmTmmEEsoVUYzKM9VezbUha5qxgK6VA86BaEJmBIuP6h5+kRPCmOZBY43bwkkm61e1EdHLr/wYukmBwFn58rGNc3JW4DP3CxZ3sFcEikldQ9+8eguljLlHaEFEt9MvCP0z9Ucx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81e32cab-ba8d-4143-fb6d-08d8d42ca320 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:45.4776 (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: qY/NJbx+nI/0+GJ1djmsI2Qaadix/TLzOsEAiFGo+MglnXQoFM5T6H7pJ3c39jMaLmiubFmgUrzwR7AwrlYTlwmt95wFOwr+1IjmtxnpP4I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Now that xfs_attr_rmtval_remove is gone, rename __xfs_attr_rmtval_remove to xfs_attr_rmtval_remove Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- libxfs/xfs_attr.c | 6 +++--- libxfs/xfs_attr_remote.c | 2 +- libxfs/xfs_attr_remote.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 4aad38d..b960340 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -496,7 +496,7 @@ xfs_attr_set_iter( /* fallthrough */ case XFS_DAS_RM_LBLK: if (args->rmtblkno) { - error = __xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(dac); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( dac->dela_state, args->dp); @@ -615,7 +615,7 @@ xfs_attr_set_iter( /* fallthrough */ case XFS_DAS_RM_NBLK: if (args->rmtblkno) { - error = __xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(dac); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( dac->dela_state, args->dp); @@ -1427,7 +1427,7 @@ xfs_attr_node_remove_rmt ( /* * May return -EAGAIN to request that the caller recall this function */ - error = __xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(dac); if (error == -EAGAIN) trace_xfs_attr_node_remove_rmt_return(dac->dela_state, dac->da_args->dp); diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index a1c9864e..b56de36 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -736,7 +736,7 @@ xfs_attr_rmtval_invalidate( * transaction and re-call the function */ int -__xfs_attr_rmtval_remove( +xfs_attr_rmtval_remove( struct xfs_delattr_context *dac) { struct xfs_da_args *args = dac->da_args; diff --git a/libxfs/xfs_attr_remote.h b/libxfs/xfs_attr_remote.h index 8ad68d5..6ae91af 100644 --- a/libxfs/xfs_attr_remote.h +++ b/libxfs/xfs_attr_remote.h @@ -13,7 +13,7 @@ int xfs_attr_rmtval_set(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_delattr_context *dac); 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); From patchwork Thu Feb 18 16:45:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65B6FC43381 for ; Thu, 18 Feb 2021 18:47:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A0E264ED0 for ; Thu, 18 Feb 2021 18:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232588AbhBRSrR (ORCPT ); Thu, 18 Feb 2021 13:47:17 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36072 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233252AbhBRQrm (ORCPT ); Thu, 18 Feb 2021 11:47:42 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTokt040528 for ; Thu, 18 Feb 2021 16:46:18 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-type : mime-version; s=corp-2020-01-29; bh=RkzCi8OZfI/c9FnKZi31CDw7K0ag4CKTz3kKt0PjB9g=; b=VZvohHdwlWfVYrPuTvklbnlNiy/xW3t+ZkFaGd2E7SVVHn7IBVMTgDo1beTwTuv/7QhH ku2JOPTt+6i+wPHHgc7an1YRoebzMzblsDoDYb0dNSDbsFn3ildE8yhfr9BhWH0wUETT ZNPHqNyO8VoCRKrWQRieNOqmbkL7XQ9hE5l9S70kSjTGAqGnnztQ3kwC+ck60wn5GJ6f t40I7amGril++fBBl0Bc37n3z2mAO+88ULMQX0Oq92S9gekGPqE3+lAdf36wRLCBNo5t 126i4WUSwECaM0duvEJl20NgZuPbRKHgpFM0DogfBgFqFOsVfVeRGHr4/P/0UQn3pxAw sQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae3m1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:18 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUJtH067880 for ; Thu, 18 Feb 2021 16:46:18 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by aserp3020.oracle.com with ESMTP id 36prp1rkmw-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D0AAsLvcvPxdHZELdXKx7/6W1YTGROa6mgYZBqTMciU/2QD1n80zpsplLGLvvPuhWHQR6vZrOkq4ANVfP9aiS5Gkq0TmemqDI2cJnnsjOe0jbl16SXVS+DLrXoTz+wvRcqwG9eVxnjih4LSz4ufXDsI5KWne9MPisyx1Jz7la/4w+J2Ph0dZdoxTTTFHVYLOlvpKVfEypsMJ2zP2RW9NK7ct5rn+k7NxJ9y018A3F74pagXzRFzIBm0rxCZZ8TO+kmZvwzch+GoQrQPaVuYk9mD9Tk8kEoxCfoUkPkPNqqwcSY3Zdn5qGwE6dTkkTwJB8B2yVnCOUP2ajQeXf7GzIg== 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-SenderADCheck; bh=RkzCi8OZfI/c9FnKZi31CDw7K0ag4CKTz3kKt0PjB9g=; b=RxxphXjSt5Raqg/ckPSLgE/8XgLfGdy6PE7kb67+c3ZKgaeN3SKTUr/85P7y4GZl69VPwVBVce5HE/6oCHpb1wFuqVdXCxf8ug1+EBXKrtq3zgCXYQYCJ0aOImOncmSFKTvAcyrz/sIIWFd/JVJKgE0j/RtogqMMfOA3vKShlhM/M5FMRFXfpI1q4xVhMW5afbUaZQxCtqD/c2RJ7VRkWRFUY0ie8LDySnt+8uI6QzlRhRf8bnOc7u4cCFi1p+zoWsLF9vou4T5/S1YNdWc2DZmZtWuWvt5ymvIn5JzpNtfpKty+jZqfC3cxrO9f2SRIZb8PD1dAIVs2xmTod4/u3A== 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=RkzCi8OZfI/c9FnKZi31CDw7K0ag4CKTz3kKt0PjB9g=; b=p78XxCfoEl0DXw9xUzWU21v0m9M8pY1+LzuXGRcgL2YTA8UjRNCR15v54hhD0+XqhRs+MhKkV7DuVQrWazULi8K9iwuGBxPMQgx2/JNEs60OAZvH9nybebD6JhKUy9ZSkr18fCx1axYpUfSsdrQ03qP/9E+zXvOoxDpYizT/lE0= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:16 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:16 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 32/37] xfsprogs: Set up infastructure for deferred attribute operations Date: Thu, 18 Feb 2021 09:45:07 -0700 Message-Id: <20210218164512.4659-33-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c23573e-fa64-42fd-6591-08d8d42ca361 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:194; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CNnRG6XEH3tQoLeTH1UC01icFbiKewswPygeM5xT3MuuIf71OXSkv1px09ds8EawygKYkRpRX1mqeHLtrIMKjI8ntJHJRYR3wmh8V9jldm0VzvoTVMAQB4O6z2627eHJ+KjJkkOaxTZ1/71Y7Z2qBFZteIjwjC1hULGjGdaarbXHQQacaJFq4GSiOvzmBTlbarUCC8k+14p14uPkK3u2Pp9bgc7oclUoQ0wOgg1iVrb5uQKsL0pTOBNqblHAcQUGSQZV8hhmNjAh7oa3tB5XmQZfYT2KBNrJWIesiOsaJAInl5rgwk3mWklNVpbozDP+ggrfocGJR+0cBFDv0VmIW2icVkdYWwbSPwWFcOVR8Eqaq2+xmi+fFiTEbqTrMeTnpQw7pErqeSJYV6ypk9nszYt79DUzdv16liPKPxK/CkNHfKXN9wNozM5sVx3csHA5fl+eKygPuDpXPasWCQhrDPLCQLcKLCj7xbrHNjAPa2mPvTEWsRhIu4GgXxqkLOD57vAOjNxeGOaiDGjRY9KgYFvTWLZZUQ6uM0F35QcC47uZ9fzEDcsynqTAYcLUS2ospClZG6f6DSAP6uM6AwVaTg== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(30864003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ZdrQQ0//4Mf8FSAsuc7E7tlUF9uJSSLdZA4QtgP2PtrNqSB9DRlWuPJSw1JbCUs4Lr6wZMgL61EoH+hn9Qh018b4nbRG7umOE3GK8l2ugOs3R2GcEtCI30wSe+fYQUGt+dpvQ1x3r+mUHA/UgEzmNHGrvPBu1SQ4wfVAm4TTSizZ8J9tRzs3kU6hlk/vLtj5Yjec2Hej8Xz1J4GTEf3UwZtVGQN3MbSvoZoFtxHtdUbwpFn2kYmZjlFwsksLgXc5+DUq7+urzz4JVXKKAte3jEjrjPwRbNifdhOfNV5YWUe1kR3gPvX3uZ/svkxmTMeZ/tO08EzbDBfLscyvjmkBLo/ofOrgAWUunoy39aGp4JtGtV2G8ZDQal+lwUX/khsIkK/J0DOndq/YrJBuPdLEtDzf2C6VZgeBZu7v5+NzTd0IogxqBub1s46aYgxcWpOtFtmfJlmP0nc1Sa3Bjd/vTCYdoBr7HwynKRM/cIaPs9iwc020EjcAb7jzmD4yGm9p9cfjg+493UjsKWtikkawEn7jOBnWyyAmkX1AmlZAwbcdhlc+m5httIdIA2Rzl2Z2mJ24KJajGMUue1rk1Ee0a2BR/6lGWvkG74rgttpPmYVsktgcVprQH9bVUCQvlqWAdx22lVrSUT1NXMGv6PbYP2GbUvIYw7DptXMfdYN0NFEu0siDJgch/aRzyIQikhwxVtavxmO4tBIUAkEE49hgHK98z1G+yFAiCkFJLanbDfnAHkb4gsS2tu5VPrx5IgPl/WS75XA8P/6WpvC8dzRJwFQiNH18blGceTDQbjp1SxKTP/k2YLUNxP3urQZSeWhcpQmNAbIgpuAfg/ndgA/rj5T/E35k+oGzPes18E2MXxqLQoZEPpcy+RxWfvSuNFg5VgLF7lQQLChtQqvIxT/m3xSTvGTD9QQItITwtuII2e+TfGa4GjVvm7C3uxDKlykuY182Vo+Yxee9I67LZf4HdoZynLvBJ9JfUNeG9KchTC+DDQDQXm+y6LvXncZOZV6YBipIkBWjZ5UGwMvNfP09rjj/us/k8tglLh5T2ol5NETWlLCNI8p0KYuGfcxpyArpMl0cP/bz8N9oH7NYXWPCRTQMSqULFqN60YLP0D7f1Ud8DQhzV0JnIOtjjUOIRbmzcG5pY7hx6UxHoda7ilagZzK3d0ZvrH+tXhxBeZUJ++C5V+8gZy3jLBOSAhr6R5y0p6Bmn3nWeU3jv4oFWEk/o1rZp0348k3QtB1X5iHivkZHVJxK0KE1Q9LandmghZCCHACswbFwVFbje2y0NtKuR5sy/yuEF8rRfflX9NqECiuqZw7Ppl1MDZFjLDtddTHy X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c23573e-fa64-42fd-6591-08d8d42ca361 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:45.8928 (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: lKz1FfETWtOTMlSFEsInrinyYuhqphN5ouO7AKhsRzEuDr1X+W0CeXgsvKIKAIW2n//32+ZtxsOx3R3R80I5Gf9ZblA/l36bWcyzvzamNgA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 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 delayed attributes 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 logs 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 --- libxfs/defer_item.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++ libxfs/libxfs_priv.h | 1 + libxfs/xfs_attr.c | 7 +-- libxfs/xfs_attr.h | 31 ++++++++++++ libxfs/xfs_defer.c | 1 + libxfs/xfs_defer.h | 2 + libxfs/xfs_log_format.h | 43 +++++++++++++++- 7 files changed, 212 insertions(+), 5 deletions(-) diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index b18182e..ab21173 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -16,10 +16,14 @@ #include "xfs_trans.h" #include "xfs_bmap.h" #include "xfs_alloc.h" +#include "xfs_attr_item.h" #include "xfs_rmap.h" #include "xfs_refcount.h" #include "xfs_bmap.h" #include "xfs_inode.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" /* Dummy defer item ops, since we don't do logging. */ @@ -112,6 +116,134 @@ const struct xfs_defer_op_type xfs_extent_free_defer_type = { .cancel_item = xfs_extent_free_cancel_item, }; +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); +} + +/* + * Log an ATTRI it to the ATTRD when the attr op is done. 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. + */ +int +xfs_trans_attr( + 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; + int error; + + error = xfs_qm_dqattach_locked(args->dp, 0); + if (error) + return error; + + switch (op_flags) { + case XFS_ATTR_OP_FLAGS_SET: + args->op_flags |= XFS_DA_OP_ADDNAME; + 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; + + return error; +} + +/* 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) +{ + return NULL; +} + +/* Abort all pending ATTRs. */ +STATIC void +xfs_attr_abort_intent( + struct xfs_log_item *intent) +{ +} + +/* 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) +{ + return NULL; +} + +/* 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; + int error; + struct xfs_delattr_context *dac; + + attr = container_of(item, struct xfs_attr_item, xattri_list); + dac = &attr->xattri_dac; + + /* + * Always reset trans after EAGAIN cycle + * since the transaction is new + */ + dac->da_args->trans = tp; + + error = xfs_trans_attr(dac, ATTRD_ITEM(done), &dac->leaf_bp, + attr->xattri_op_flags); + if (error != -EAGAIN) + kmem_free(attr); + + return error; +} + +/* 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); +} + +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, +}; + /* * AGFL blocks are accounted differently in the reserve pools and are not * inserted into the busy extent list. diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index f1b1ca10..e40a02e 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -497,6 +497,7 @@ void __xfs_buf_mark_corrupt(struct xfs_buf *bp, xfs_failaddr_t fa); #define xfs_trans_reserve_quota_nblks(t,i,b,n,f) (0) #define xfs_trans_unreserve_quota_nblks(t,i,b,n,f) ((void) 0) #define xfs_qm_dqattach(i) (0) +#define xfs_qm_dqattach_locked(i,b) (0) #define uuid_copy(s,d) platform_uuid_copy((s),(d)) #define uuid_equal(s,d) (platform_uuid_compare((s),(d)) == 0) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index b960340..28212da 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -24,6 +24,7 @@ #include "xfs_quota_defs.h" #include "xfs_trans_space.h" #include "xfs_trace.h" +#include "xfs_attr_item.h" /* * xfs_attr.c @@ -61,8 +62,8 @@ 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); +int xfs_attr_set_iter(struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp); int xfs_inode_hasattr( @@ -144,7 +145,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) diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index 603887e..ee79763 100644 --- a/libxfs/xfs_attr.h +++ b/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_hasdelattr(struct xfs_mount *mp) +{ + return false; +} + /* * Kernel-internal version of the attrlist cursor. */ @@ -390,6 +395,7 @@ enum xfs_delattr_state { */ #define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */ #define XFS_DAC_LEAF_ADDNAME_INIT 0x02 /* xfs_attr_leaf_addname init*/ +#define XFS_DAC_DELAYED_OP_INIT 0x04 /* delayed operations init*/ /* * Context used for keeping track of delayed attribute operations @@ -397,6 +403,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; @@ -410,6 +421,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} + */ + uint32_t xattri_op_flags; + + /* used to log this item to an intent */ + struct list_head xattri_list; +}; + + /*======================================================================== * Function prototypes for the kernel. *========================================================================*/ @@ -425,11 +453,14 @@ 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_has_attr(struct xfs_da_args *args); 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); #endif /* __XFS_ATTR_H__ */ diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c index 1fdf6c7..06df7ea 100644 --- a/libxfs/xfs_defer.c +++ b/libxfs/xfs_defer.c @@ -174,6 +174,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/libxfs/xfs_defer.h b/libxfs/xfs_defer.h index 05472f7..58cf4e2 100644 --- a/libxfs/xfs_defer.h +++ b/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, }; @@ -63,6 +64,7 @@ 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; /* * This structure enables a dfops user to detach the chain of deferred diff --git a/libxfs/xfs_log_format.h b/libxfs/xfs_log_format.h index 8bd00da..59c2807 100644 --- a/libxfs/xfs_log_format.h +++ b/libxfs/xfs_log_format.h @@ -117,7 +117,11 @@ 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 @@ -240,6 +244,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" }, \ @@ -255,7 +261,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. @@ -863,4 +871,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 0x0FF /* 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__ */ From patchwork Thu Feb 18 16:45:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5694BC433E0 for ; Thu, 18 Feb 2021 18:47:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1C0F64EB7 for ; Thu, 18 Feb 2021 18:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232930AbhBRSra (ORCPT ); Thu, 18 Feb 2021 13:47:30 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:60800 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233322AbhBRQrm (ORCPT ); Thu, 18 Feb 2021 11:47:42 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUQA8059500 for ; Thu, 18 Feb 2021 16:46:19 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-type : mime-version; s=corp-2020-01-29; bh=p8JLMAV21ypQ+fbUrM1aNJ2npqqowBD3v+LopmbHjjQ=; b=oAJSBLrtsXIxjVxnDE3KdGer2QubhjMB9qIalS06TerPqhfh+iG3DPSIEri8Q3+ynuN/ FNzUdoD3sq0xwijaW5Mq9eYTR3MCN9AL9apL+x6RnyNDlduXFpox7DCPoz3X9cRTK70g rcOUS045yNbQKTM+94BonQnqyDNr7MfECwVP0LGqm//udirxUqF2DCk8+2LeInkJIxZh kB0r6TAjeHcqEipVkDqViojPVELWz9cAEMrRQOJyKYu7YMSyYfrIhmncKK+Ozduq0gt8 xBGcO0F70f7dJuN4WjO2N9PM247ljkZnV5pEEDHTwVvKhmeCoHenu+ic+IGMBWBf9IjT dQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 36p49beruq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:19 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUJtI067880 for ; Thu, 18 Feb 2021 16:46:18 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by aserp3020.oracle.com with ESMTP id 36prp1rkmw-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GbxeT0bqkK1gVbs3RtfspYvOf6zi50xKl6UMmjX7HM2HKXcAVnVuWZRBwYxWaV7cCE0fl9vZj9OtEbQD9hLopcvzWM0ZhrLm4+nZGfCymBWYDwv+n/SIJP5rm7GrMzX6WXubRLT4ZIvqcW5X1iDf3Yy9KR3ZsveS01GeYG88RfR7r7/Ap2v9eWZX1/p+nILXO9+exaue3EsI14lfcgwVwkKUx1aOu4Ccq3tLFPCF8HlAwbZ1kWexXfNMBNHPk1jJb1wqKS3WyDxbYxp1fYuAMSt42Dq0DnaCnTNO/0tOfjRDNaNgcObTOmJl0lSohh0+cxSJnu3DoiIMY9I3sA40mw== 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-SenderADCheck; bh=p8JLMAV21ypQ+fbUrM1aNJ2npqqowBD3v+LopmbHjjQ=; b=EDVidDmpAyMX9kYoN+Oi8nGaNYd7Qx7IRjfKJNklVL2jwiskqEuI014ocujsUBPC/yuLUOTEyin1Q8NYbuoC5eCl/smyAKHmsNHhtI/EqK/9+Be82adfa+yt3AEVBoANRw6urh9DQQZLcVumwNtzw7kqSFmhYzf8+DlyjeJYUSw29Ph4uvtkZwgoYqTQokL3GKNMAojAZl+BZm1CXBE9f68RrflrxzZCklR1WTz5iyOa4n2l+eDGI9+1lEVu10NqN/VDEM6SG2nYdbV+EMKN2K/l+1SPl1pwCCPYhSntGPTevoIZLj3Un8VjcQZ68TqDl5h/ebJQCmK9wEK+LDxPAQ== 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=p8JLMAV21ypQ+fbUrM1aNJ2npqqowBD3v+LopmbHjjQ=; b=leK7yFjNZdJGQg4A1u8dxL4yelBbFH6bfOg4ZvT7qeqlWwEpLhpKfXQMUBvNylpeEN5NUFpENQpIs6+Q5P95ufOG5Ll5fEvAn3dl1jent0mdLtB36BYH5zDMbkA/8Z4bbdpnOVLZ40/r5Ny/zRqlKLqNtoEJAkDr7OxEzEfPbD4= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:16 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:16 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 33/37] xfsprogs: Skip flip flags for delayed attrs Date: Thu, 18 Feb 2021 09:45:08 -0700 Message-Id: <20210218164512.4659-34-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28a00ada-4177-41e1-06d5-08d8d42ca3a3 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:792; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2StMEf2z3rV4vLyED8ARi7FXSQsFRPOJD68KQ4SON4stB4ZwfDuXPhXD3u81XQmHTimZsmYaJNc2bvbsbdPhj/Bz7yVM4QFqKU8lwbfuJ8Rn7bNQsNqKEH31IcBXrlpBSz/KLAvzKYqDy+60qJH0uNUH+5NSQ2s0nyDEU5mRoIrC1gfR4UQ3g0jMfF/dcvai5RDzf7vlCsL3mH1JBpNzltI8asMyqpscV2D5GLMr71EBshGoVMcmfpttjOpeADDk+KcaFut3Ge4ntRu1Ejt/UWG9Y91Awo4RJuYASku44aq4u1/PAfkYOptkQWxYWKBxHCn+wcgcUVHvsBXxUmB030PQ8EheDjdCupF/xWBVrx2Ri0zqrIAxkWrZrcrIMTi8ZbhzGkZsWPAcoY4NxDPbdCtOw4Jftwst/uFod8f+QTLHbRp7qyGzfPqmS0tMk8tPO2cgppT4cVI7EXD3xjq0ss24bm6RvyanVr0iwX6BFc4y+y6tjqmdmbKfm1E74VkiF0Rx50biN1JM5/7+3wKBKXBidKG7zkXRZi4x1cwuuWWPwI7B0aOa/DqEMJND+hFjK0rpcvQMumDNGWWNM3xnfA== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /IJpvU+eZ/Idn02TLIJHT1Aw90WrR6yVJjdtlqnOWppSP27V8j0ABoV+3YI+u+3ZNAwafb0hFemt4hRKAyB7ZqeHM+0tgamAxw3PwNguiXnCyr1PItmfBCyXL5wP5UECHHj8ydGjusyfkGKkgsOLsqTkvrgvv3vBzXyz+nk43BRYMaWR33foDWGaf8+mH0KvWlct06oP6Ek+GecQqQn74QHsi0UgN1+UXU9ksuxQbb7YMMXmNGrEd7yILja1OQGZgzMInJF5aJUzoLaxJAwosDRcDUZEda4/WmSzxJZe9gnTFwi9CLA8cf55IpuDktkBTlidYVx/I/bGKue3Xbgh1igW/UvbOuo+5zc/lIWtMtRG/3K89TjVGKrTfIPnmLPqyGSsj3VATvL8bfs8dtRXY24uEWmb6k1dD7265vh6HiYO/X09pn6HI9/yrvSCaJEm/qp5DajJI844OC20lyAFwX391GSXpnhwTfVsemYg4QEnfYVguPxY7MEIBG4pAaBYOHGjzPL0GY+dQKfapago1FjbelLZr8ETjPiFI5HidP7cxa1o6isUt0jgJdRYSjeuyb3b3RzLA+umZYR8JzhWmXcgv6PEp6VtEilQpw3SllTPcxHeLpJOQgFf63d9Ebqy6rMBbyzR6QYK3RCntb9U25Sxf9QDf4p0aLMP6evZ8SSMCaYxz2F9pch5/afE/YFjz98FXvmLhJRVawNJ+gCtRHIEuCEWCk2E/35UHhvQ5WXwTfuL7aZ7MKKNwOhS0GUz43+S+7rIPagfRZWct0TPBakDvraqJzCzynoQnzQ/unAZAAEF6pSvxq1g+/cequY/m7GqECOLuGzCGIlGL6yxQwpFgcbj47q20hl+lNFbajhhVkfb3iHcca7Y0e2zbaFe/rSDxo+LrV042SYvvMUbVeme5gYQqe/8pwnnvxoNeva6a0DyeXpR4HunfAffQNcQk4/f6/mPte4tpetXUSGEmOGwWzDi3yMmZZedhEDmnrXBUDxEqBcPHC7cwkzzeX2XO3zAOWoQzDnRxGEznMCTuLg0xgImpf5RNd+nNaOVY235hcgzpCudTOrHsyNzzguf5cGkh2GcvOc4WtwjqVIwd7DmlCvzWjJ55NhmYmuM+xRXy0GgHu1nu7iwnV/SeurGc8Fvkb+GBC+HnKewyQ4mGFI4vinnMWAzxQQfKB6QeXebZPcH96AcnFzM+yEbxQNG1FyRusNOceVcYZeYAmaszxoHFwGnM5MoFbrOCd0FE7ZpXwy5C9lBuyItIs8rudIpWDCJaO8YG7Cso1JCFWTPzQzb9ov2qx3n/NOtSValWT8xPL5QmnjR48vB8g/9zh84 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28a00ada-4177-41e1-06d5-08d8d42ca3a3 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:46.3099 (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: ojwPM8A32QMr7i0uUVCgiNVmLESYhOO2RqoL6qGkUK8DZgocW7uEolsIYHB3iZ7QEN8Duvx8oUqG/l+6nshV/x9AD3Dk9YswCuQg3zTZcPg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: 2b1c81a8c3f453ba16b6db8dae256723bf53c051 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 --- libxfs/xfs_attr.c | 51 +++++++++++++++++++++++++++++--------------------- libxfs/xfs_attr_leaf.c | 3 ++- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 28212da..3f81b3e 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -337,6 +337,7 @@ xfs_attr_set_iter( struct xfs_da_state *state = NULL; int forkoff, error = 0; int retval = 0; + struct xfs_mount *mp = args->dp->i_mount; /* State machine switch */ switch (dac->dela_state) { @@ -470,16 +471,21 @@ xfs_attr_set_iter( * "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_hasdelattr(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 @@ -588,17 +594,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_hasdelattr(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 @@ -1290,7 +1300,6 @@ int xfs_attr_node_addname_work( * 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; state = xfs_da_state_alloc(args); state->inleaf = 0; error = xfs_da3_node_lookup_int(state, &retval); diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 2c7aa6b..9837bd5 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -1483,7 +1483,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_hasdelattr(mp)) + entry->flags |= XFS_ATTR_INCOMPLETE; if ((args->blkno2 == args->blkno) && (args->index2 <= args->index)) { args->index2++; From patchwork Thu Feb 18 16:45:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C9A2C433E6 for ; Thu, 18 Feb 2021 18:47:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF8FC61606 for ; Thu, 18 Feb 2021 18:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232918AbhBRSr2 (ORCPT ); Thu, 18 Feb 2021 13:47:28 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:36112 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233141AbhBRQrm (ORCPT ); Thu, 18 Feb 2021 11:47:42 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGU1dx040639 for ; Thu, 18 Feb 2021 16:46:21 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-type : mime-version; s=corp-2020-01-29; bh=9Url4ta9tfuxit+eSD2Pa8w3hRRVBAcMc52wH5vavT4=; b=Xvnt3OMLGLZuP+ZTIWkqAEkf5eqNxAz82V6oX99/NgQwMKNjavkZX2A6hzsmFIFRZ9hb LJl5byFQM9PINMpG2ppUIhibowZjjQ7f9cP1Dju/v/AcF1ufeIZmQYhVpPoaSSTYNuI1 y6jnZ9MYpQZ2R6bE+LsKMiqxboYo5NqwGWwarvdNIh5LMzRLPLbJ/QYE9UMkaqGRHKz9 4SJ7hR7wi9CM2jvTboJ+lp3b+ATYxtuMbLi2JX4rm44yD/5j6lhtZp4botQRwNn07DwN FODsCzgjmOVy42Xhi902nrnCv87BaVLE3s14BULoifYCl4X396teVKGSwNdy/qhAFGQz zg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae3m7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:21 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUHUI067709 for ; Thu, 18 Feb 2021 16:46:21 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by aserp3020.oracle.com with ESMTP id 36prp1rkps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i+JOzDxozQP46qPtDDqVXj/fq2UZIfc1uJagp7daI7+3gisam9kNDSAybjJo2v3bjxskaOrGO8+RoDkAiCHKgPBerjTMM/o66mCUzIuX/S0cYamOghgFLKEyh54VhCNHOn7eAop/RBftLDRFfFkSaCbJhbv8LmJF35+sdDUgPXg2CklsV5k/XjPzbE2oo3AFaEbBkjkNn9z9Z98Ym2aqytU24lU47+sl3gUCRTmDnX9VfMSmdIORtM5hudQTc2TAJc9HC0EkP8yICnBVYHw1YzePdHwvFZHKsZLhTpzgxd9zN0BCLjljw8G1EljLiR7HmvXIFi7BFbt1ZMcCuGxSHA== 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-SenderADCheck; bh=9Url4ta9tfuxit+eSD2Pa8w3hRRVBAcMc52wH5vavT4=; b=L5onZFCI7DFfGzsyBxIHskoiJXTbJ2a2sgRs+u4B8gGSvd7rQov0CQRfQCJJHKsiQ//SRWTajERa2qXndJpLPIcODVQs27qTWl1REyO+Y4zx2dQwOMYeDhvzBHBTq793wEf66dIDMOmt6Stsdvhm/MWZTwcId52dQot2bCiaLLAB5GRPjcKhSZJOD3boDXoB2SQukaDJEw7qX/ePTUmmSAy8Odw8DD9Tx+Bu8gSMfozqfRV7FeKmLRSxS+SQ/w6bimPdyxuEf3H5MbJFSQuLnD9ewyS+Jhr9Uxg5yDB7Ou1/CQ/Kb1zi1Vw80VIQ77qirhcxXzP+Hn+2JMSfwx+Llw== 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=9Url4ta9tfuxit+eSD2Pa8w3hRRVBAcMc52wH5vavT4=; b=SIU6xcRthZ9ehqLhVFWWL7fkgLpJKjFcKhktQKh7OsGIgFdx8+6tYsb5BEr8NtCDTzIgYvBXFnDVpKbihxxZlMHT9CdSSEn5+PdQBeuIvTaWU+pSbhMX/3HvDrmzkhx6TKnfRR2/so1ManvwhvoipgK/LpCcN21ZFWdG6u7KTdg= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by BYAPR10MB2965.namprd10.prod.outlook.com (2603:10b6:a03:90::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:16 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:16 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 34/37] xfsprogs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Date: Thu, 18 Feb 2021 09:45:09 -0700 Message-Id: <20210218164512.4659-35-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 32df4500-a3ee-4889-cf05-08d8d42ca3e4 X-MS-TrafficTypeDiagnostic: BYAPR10MB2965: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: csfolz3QI2+22M8lPiDK21Sp945PV1Xc53q1pBLNNVObhH+p2EkDN1PzfLkYYb/fc94+qiEnd4A/HztX0baeQGBhNIrku4VskZUe1l6WTCFYtv05YxsKQhE5hVvvOI1QZ6eVmhgXYN0OxN5LbkSWBqhQtnqCjEalSIHuOuBHoS+ptuOIXDqfwQFEsIpN+MfXXuThv3HXCoMP2COAKfY5l+jiVwBnu7zx42A4cGv5Bv6WHhDbYWuKVCqFZpDadSMKazHYjHSU2nK+5a5qRJmX1TH9ccGEXRkvSrowMih2IFJOTHXLC7x8/i+VsBo7a/rOHXFU1BlEyrtRseUzQj2cDbDlk+tCt4BvMnDyzIIACNwvC/ge30DTVzqAKsDwv4PHuMTff1jvSbw1gpLL8NYkwJ5J+jZLPsn4Uhf0f1od4pIISXK1dGSPy12UYi0hp09WFemHLj885fL1b7u4D0xaUIqTWa/URd9a10bFrOlCizj6v6vtSkvCW3d9Kczulp1U0aTL79vkEStYuiqlInqX6E1wJimleGm6THLEP343oHBX+DeaYNnz/4XZPLs6HzJ+JXjpBAEsbXqx33DezWI7RA== 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:(376002)(346002)(396003)(136003)(39860400002)(366004)(6512007)(86362001)(69590400012)(36756003)(83380400001)(6916009)(66556008)(8936002)(66476007)(66946007)(478600001)(52116002)(6666004)(6506007)(316002)(44832011)(16526019)(6486002)(1076003)(5660300002)(26005)(2906002)(186003)(2616005)(956004)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zdKrQInsGvc3FbXtos63TtI3Bw8ZdDELYzZz28XTsX/TXjtDealkyr6pBhcFcxEsArUt81BzrgYN4XnWPumKTBNuFEwRNd1911wqu6N7W4/zf1gRBUiPh5PwEr1zy2xyKmSFpMoSDQkwW+HHRM7z60AkEJD4fCJkvjAFbbIbH9b84hiNhTREJy+M7hYWFJBnDA4XK/E3aQS/d9IbTP4DIXo4fB0gglThFyN58Ybi1ZgUwHHGdj74UGZrY/n9QE9PJjEXFOTVfgzcobtyAxC5TZrWq/jh39u/okqNob7xkqwGMm+pxSiWAZCz2t4fgZr9r1O3oX3GYCz0TdfWfWZUZo5nArNlONsXJz3hKuhv/Amh6pX8hCfL87xT+dQrKsaPYV4mL5yokxWr7dPW7uqddzE75otQMRORHNDB3zmO5E2QqJnPuBMGG7T3fR1jLnwXuTD5/uLLG3pNshWfWmDCRPie7ZZDh79cF8MKGEPbS/xASo8LGOpvS85ZpmHXdC1xNziaGbyuco0sXN7yK+/yuN2TRMn3Xu7XWMpOW49IqNTknGnrXo4va2SDXxMVNTPRSKtUbMYXE4XyH4Lhyc/BGkZcaqbWUImQ3KnGl/CxBDIysdJqmpZe75eKM5Q7F0lwOskM+1GZZ1C0mHc8//Fp8SVJZcPRl/TY67BOHQRodSXDvR2AoQAks9r+CU6i60VyPVHbHaHR++gWn2ICIeGAgpI5m+Wk++DheOjTpuOGR40iBwsoFSIi8Cn1lAeWbczvNNaQBiaPeWC83Nf0YIfdweEQD5dxLa4BoNEkQGB0/QnfYpUYG+vWwuJvcim/E7tJYqrhzXY38DGLvTjCyF6XG2ZlRufaPJUiOKskX1xeooagn+ha2fL+40KgDWq5Kkm3FSnE30QFnImn3Y808czS6vsud1rglyjzLoi1CK8xwiOOFVLiTjuXLgDz0evvNy/+dUR4lHjKAzOy4/tGuYltpN7Pom+ePad1fMVIGT7TLb0EnLw3HdB6txw4sYChRQz9J7Z4VSVW4RuCK0phU5BEpa3zTHy5vkgnsK1z1HAf+gnUcu33seTiHH7M2TsDhfV0QexI63ZCM8uwp5elS1H21/OJAkN2+W4zy+go1Ia6qXKOWy0n+wov++Meq/fvjJWRIgXp0v98uKphj9e4DDAxJ2irEzYrKdTVBewM85xSt7Ci/ssYG147al8MPxY4aqdSmiaPwqgeILn9wKJQhKZy97dLVndM/n+y/WBUElB0BTN2ff63dCz9t+eDFHRDJz7rim9IISNvrFvIvdAxXfwGxSQ+m6phSlghVT2QeO2QddnXNdoxfoi4Q6vfFQJniu30 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32df4500-a3ee-4889-cf05-08d8d42ca3e4 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:46.7450 (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: 8A1jPO9VAQn05YHLMMdbybVYxCJFFcwlPzJnec/e9RlDx3yktRYWD0NGX1ijMt3AvlsyX1ZYyjL2JQkds6pdOKq1p/pWD7xvn4h74TUW2HE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2965 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Allison Collins These routines to set up and start 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 --- libxfs/xfs_attr.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- libxfs/xfs_attr.h | 2 ++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 3f81b3e..e01ed6f 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -851,9 +851,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; @@ -862,7 +863,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; } @@ -892,6 +893,58 @@ out_trans_cancel: goto out_unlock; } +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/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index ee79763..4abf02c 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -462,5 +462,7 @@ 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); #endif /* __XFS_ATTR_H__ */ From patchwork Thu Feb 18 16:45:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093937 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21143C433E0 for ; Thu, 18 Feb 2021 18:47:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CCA6764EB7 for ; Thu, 18 Feb 2021 18:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230434AbhBRSrb (ORCPT ); Thu, 18 Feb 2021 13:47:31 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41590 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233109AbhBRQrm (ORCPT ); Thu, 18 Feb 2021 11:47:42 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGT7rK155810 for ; Thu, 18 Feb 2021 16:46:22 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-type : mime-version; s=corp-2020-01-29; bh=ZM22k/FCdVeZUKgbhlHuLG3cskqLz6ux9x5ACiicHZs=; b=QBz7ipUimZ+gFjZuqbTgYgLdm49FOUC3bEThKPPhTJQLHPaGg6QTpz16fvjVRu0HcW5e B2BmSiItwryuJAD69eTCtiieQhXOa/W/G4PZiIPdHqkBuZPb/qlO/OBA3VP6HAXlfmmU vHhMAX+hkDcja1UKj2m+I03mUa3WfxLbNDcQnjer7bW+nWy5S+FK2oQPs1eLQezE1lz+ bRiiOdCfYB528amzjoJfl3g2Zi4gWeIfUeYSgVEO1kLwd5TRTrzJ7p8gpNKNhyjZc5a4 5lxwxCNHSaJumMfyftcfs6zIa4eBW6jxRJzTQmEepTx0LWkGZB2Stl24FFPHSgYrH2Mi 2Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36p66r6m7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:21 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUJtE067888 for ; Thu, 18 Feb 2021 16:46:21 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by aserp3020.oracle.com with ESMTP id 36prp1rkpw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CLVPSSG71D+BOnuDMJz8HnX0ozs2Mp76f5dQS38r7HTOqCoxKVKOyRkgED/WXEeOFyEtT5JzzFhOT9tme9kuAxaK/0kOppU4UCCGkeF16SnynBbH+xh0PI7OL2h6Be+1U196Sh6ATK7q6E8QP0+XCks0qqPd9gz7bfsnBE4GaF9EviyB+vVENETaOs3JnDi6T+xP7DpzD4TMuX56J14XnpS+J0DCEsbhtyvRUkV8uGPUUgZoQzXTd5D9k/NzK24+pLOsUz/ptt5ApQ8FcNVLv3goj8W3s2ndVNKEmvEhQtNqNv8baHJkN2Zx6zHgq37f0YZlQLoqVzvsvSu4lAcSsg== 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-SenderADCheck; bh=ZM22k/FCdVeZUKgbhlHuLG3cskqLz6ux9x5ACiicHZs=; b=mHZC2TBYtgrDeM3jA6BSvbhsc7qU09uJg0p2CvLJwBJU1AEUGVbaR6xj9gG+4l86XIO/SgpOXba9AaOHGDxZrb56r+HC4vhOlqaN0hHKVL1Zcl5c2q/faFrng/TgCMHZllYlhAzK3UYrVcwA5Zbg+QNOw5il7eieAfLjDfletJO84itdNUo9Tjj336MpmnKh79C2iVCLxXKUiyfYCZif7rMjrh9TiLpPeuYEitz+uAHprb3G/wsevRrkFaetniLE++PULVwfpxM0i00Wbiig8Qoz6Zb6Uzmdhu8s1V5ybkHhjKqznXPQ5YdDoIiBf8JFzAhHbLLw/IfMO6C6lChIMg== 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=ZM22k/FCdVeZUKgbhlHuLG3cskqLz6ux9x5ACiicHZs=; b=e6DB7xMrQJt7N2zpbLKCJbU+rYBDQkPbM2nYkNJ0V9G3VD7YH1JC9AtmUMJLN/mUYHT1gsjMbE0lwSDZCyKKfU9sTK/CSGZO/EGYsrli7X1sFnPJCPOWPZbsmi3HUhpsWIvHYL+Tmgzg3y54+y3WWga0sl3IOB4rbOEZqY9sIbU= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4813.namprd10.prod.outlook.com (2603:10b6:a03:2d2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:19 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:19 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 35/37] xfsprogs: Remove unused xfs_attr_*_args Date: Thu, 18 Feb 2021 09:45:10 -0700 Message-Id: <20210218164512.4659-36-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07dc3506-affd-4cc2-e503-08d8d42ca426 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4NlIWmXPX6sGUroUC5owPz6KL0CKZUtYHUiyWDKr0yu2BV0v95kxaQCY0uRk1Exbu0uwp76DTcTe5QTpg87dLl1yM7uZjI5aWuK8iR88Yu8nYn8iIfluH4y6nX5ZU2z8OVf68Gi29hYBTVWA1Dpr72PwnbQnYJ0xYpeR/eK8Qzbjh5R1E6cD+3Qn8usSIufyTE78uR685SeepLl5Bb9bIPh/nDRqB7q6Vatyytb+crIk9jHyQuSTkQefFy7XSTzhtAaDsFWa7X/XragWpPnc98CeMuE+ZwE4kSbLldDjDfxjSVFUn6eC8FKW+baE0Rpnjo0rfqomjAo+Sxa9Lyt1TDVaeFTG9k2oMv+ZoMDZsgmigJj6UnJOIVVsdJYNT9r6I2XmOSKRqVZT2aw+YPwg8/az1rHhphaAd4FPC42K+bhzcxehMIZihzFC93OO+c3R9UuR8QuU2/BtQd26ClFBJrdh1jFvsi21N2xWpJmGzXa8J34M80lr0HQjrj+/MM5cg3KoDWchbKUDYLYKawo1TXh3FS+pCu78ogHsvvJX7Mz4j3DpyeKqks3chnio75Ezwr3GfaJg/iV0rXnRZee3vg== 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:(346002)(376002)(136003)(396003)(366004)(39860400002)(6506007)(83380400001)(478600001)(2616005)(2906002)(66946007)(66556008)(16526019)(956004)(8676002)(86362001)(26005)(1076003)(52116002)(6916009)(66476007)(8936002)(6486002)(6666004)(316002)(6512007)(5660300002)(186003)(44832011)(36756003)(69590400012);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OdNBH8LkiqFzfm1hrxi6vf9R1i6gMkMVT074bxNc+20gUxCu5fKcKWUYyH23K1U4GsVvxjDXuXn1ZbAY2nPcCPfssTSEyDuuZvA3ikNBkdeYRyqjyS3O1M8TEjwaMEzU9yyR9PcRVfk33S5NKc5LYc2IaLWGC8ekthiGEL28pya3H4IDPx6UqE/bLgNXYcNkE/btStxMiDR/ZOn3d/ciA2jII/+zlkp11YUO0+4IuOjEHuCc0J/+pYmDF5XjeyBSazozXsPbkQQeV+y4fqRmxBjuzIIpt+thuBWddw7GTxzlXV2dAmGlytkQPbE6brClKObzqxxXI/2tyXafH2rKIVeyC3E4icF0E+Ckd1buZZGylXAhCSKPFzy0COV8bGkpvyzR5xRjX+8jlComF6NAVzCh3z9hFsNHb4n62aMk6eYMQ1kALlCGKagubXomzqCHP8hGsLDjNDxlnrZ2s3OxkGw2IoGUInmjwk3Ovp6XKM7yCnLzknrTcHr8IvkdBZRhZo7MpflUhQGHW8BgurC35XoKHA60W0kow57XlO3uc7u6fziA+VomyZkmVulW4eFz3u3cbuIU0Ek36u9ZbckNpy3Y2E2dXEr+rLBh9mi/KGWPSxdqjRsSnOucDvBPUx8GcVo9mmx6eLS+uVpFKB7ETCYYfIN+f8pU8TOdcHbxahyoqoXgCyrLVZDF3cbKhRdTibbLv0Ed+uf5ht30sarZHbiSdJQ0DeAQKAXzlYtCXAL2pckvbjFChNVMLsmr1BdkpD5t/ifJ1mk9i9G/9davGG35QALKe5RfvhLxLXGcXeTJYEafIRE7nHuibpFzUHAnIz8oAUcxJdHpeirWP2NsxMlT/97Bbfc2MJOKj23ccO2KcxPM2CUEEdD8NBdaK9vvWZ8ApZbcfJOJlwduKlo8VoHkm+KGd5G8ZJ6n933ZCMkL6XtUfuZ97h1ONVK/nD7TH0fgxExKu4tu3m5NfxlGMjmQui4Q+lmtv2HY+zc8sLWgbpohaQdIp9e3oU2yrjlqM6eHnfYsWFkpt/nq/uIyGH94KlDh8yyzJWFTviBu9vhTfH4/2dOaiNhxu/ZwPqiujbykYBcxdznuoyjrefp2dyUcC52PunC+6lLKWcHV12pE34Yo+SNdPFnvRMPMJOH/m27HSsAiVTSVpj4UIqKYrkIUylJt50eQS2WavoIx7I4acfCN1jxocWtdlZh5IhEAIni1jZZC3qfR1GppgFlJVdIOCVtsqWxYNRpor5h8MOtNglc7qIyt36mFWIDwkj1IFWOhIjWQWhHmacEgWTvhes1bzgSU9bCGMWPDEyinez/884gbQzqj5nfI5fjc2RL2 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07dc3506-affd-4cc2-e503-08d8d42ca426 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:47.2329 (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: LP2Nk5jqmB3yeGMWGJmIEiurwSEfiGiBamPPkpMJ8uvQcBqIgcrvwtj7HhFG/ppLJKX1+gG6s0+dHCdtQe0vOGoIm5cptVS2LYPf1dTgxQ8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4813 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 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 --- libxfs/defer_item.c | 6 +-- libxfs/xfs_attr.c | 97 +++--------------------------------------------- libxfs/xfs_attr.h | 10 ++--- libxfs/xfs_attr_remote.c | 1 - 4 files changed, 10 insertions(+), 104 deletions(-) diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index ab21173..054d158 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -131,7 +131,6 @@ int xfs_trans_attr( 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; @@ -144,7 +143,7 @@ xfs_trans_attr( switch (op_flags) { case XFS_ATTR_OP_FLAGS_SET: args->op_flags |= XFS_DA_OP_ADDNAME; - 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))); @@ -216,8 +215,7 @@ xfs_attr_finish_item( */ dac->da_args->trans = tp; - error = xfs_trans_attr(dac, ATTRD_ITEM(done), &dac->leaf_bp, - attr->xattri_op_flags); + error = xfs_trans_attr(dac, ATTRD_ITEM(done), attr->xattri_op_flags); if (error != -EAGAIN) kmem_free(attr); diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index e01ed6f..8f638ee 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -62,8 +62,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); -int xfs_attr_set_iter(struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp); int xfs_inode_hasattr( @@ -222,67 +220,13 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } -/* - * Checks to see if a delayed attribute transaction should be rolled. If so, - * also checks for a defer finish. Transaction is finished and rolled as - * needed, and returns true of false if the delayed operation should continue. - */ -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); - if (error) - return error; - } 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) - return error; - } while (true); - - return error; -} - STATIC int xfs_attr_set_fmt( - 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; + struct xfs_buf **leaf_bp = &dac->leaf_bp; int error = 0; /* @@ -315,7 +259,6 @@ xfs_attr_set_fmt( * add. */ trace_xfs_attr_set_fmt_return(XFS_DAS_UNINIT, args->dp); - dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } @@ -328,10 +271,10 @@ xfs_attr_set_fmt( */ 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_buf **leaf_bp = &dac->leaf_bp; struct xfs_inode *dp = args->dp; struct xfs_buf *bp = NULL; struct xfs_da_state *state = NULL; @@ -343,7 +286,7 @@ xfs_attr_set_iter( switch (dac->dela_state) { case XFS_DAS_UNINIT: if (xfs_attr_is_shortform(dp)) - return xfs_attr_set_fmt(dac, leaf_bp); + return xfs_attr_set_fmt(dac); /* * After a shortform to leaf conversion, we need to hold the @@ -380,7 +323,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; @@ -686,32 +628,6 @@ xfs_has_attr( /* * 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; -} - -/* - * Remove the attribute specified in @args. * * This function may return -EAGAIN to signal that the transaction needs to be * rolled. Callers should continue calling this function until they receive a @@ -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. @@ -1611,7 +1525,6 @@ xfs_attr_node_removename_iter( if (error) goto out; - dac->flags |= XFS_DAC_DEFER_FINISH; dac->dela_state = XFS_DAS_RM_SHRINK; trace_xfs_attr_node_removename_iter_return( dac->dela_state, args->dp); diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index 4abf02c..f82c0b1 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -393,9 +393,8 @@ 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_DELAYED_OP_INIT 0x04 /* delayed operations init*/ +#define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/ +#define XFS_DAC_DELAYED_OP_INIT 0x02 /* delayed operations init*/ /* * Context used for keeping track of delayed attribute operations @@ -452,11 +451,8 @@ int xfs_inode_hasattr(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_set_iter(struct xfs_delattr_context *dac); int xfs_has_attr(struct xfs_da_args *args); -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, diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index b56de36..d5c2ce7 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -761,7 +761,6 @@ xfs_attr_rmtval_remove( * by the parent */ if (!done) { - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); return -EAGAIN; } From patchwork Thu Feb 18 16:45:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54747C433DB for ; Thu, 18 Feb 2021 18:47:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07E5B64EB7 for ; Thu, 18 Feb 2021 18:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbhBRSrH (ORCPT ); Thu, 18 Feb 2021 13:47:07 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41604 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233368AbhBRQrl (ORCPT ); Thu, 18 Feb 2021 11:47:41 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTHxI155892 for ; Thu, 18 Feb 2021 16:46:22 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-type : mime-version; s=corp-2020-01-29; bh=lGYBoDBmpKjTzN8PgK/eWkvN4S2Y4sIwPgNIZB3NL3o=; b=HZB4USXeIkNzemmgaDFpiWLivnIUu2DbjNd2DRzQYWut4P4CHcCQPvP0FgtNfGerQiJc r/rb5maYT+Dhy7aUsZna2PRwe8Y/0wfZhM6vx6iz/rV9B5WmENZ8srBqHQpPQrbVjEFu cO8XbNIx7nHOjRZV2QovYzZXoJQR5elpLvk7hGf2ixouZRjIjxkU4xEC22YGcOuf0gBj nstG4Obis9fZu57YNiiHmH0eSrX1fi3D6s3JesljiKTSAm/5+0vRxYn2Oebg3nejEkRH l2PX9Y7YKxwyzqys8Ho2C9LeFcp1BHpZgZk++zvgcnRkhxHjem8guOXokZAnX7Tmtb4b cA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36p66r6m7b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:22 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUJtF067888 for ; Thu, 18 Feb 2021 16:46:21 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by aserp3020.oracle.com with ESMTP id 36prp1rkpw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f1MNQhBDPP/Tzj8NpAk30dLmP6pC/VtUOQgElhv/aYA1K8B94LBC91c2POrRm+9mo+YdZYExmU2BatzVO2C+sRzqtUrZ+FywUIai3J2i2f1cx/Hjz1ujkUDTbeCqUpYTTNGj4GQy301rcuQwwKfDSCZlL41Liv29FtcXTEOXCuYYITzt+WW0xsaDh7vAwIHMEONTqnr/j96fFaHZxNvbthCU5F6rzmCbzyWYTAErCC30nc+htkEmEBW46yarKbcAn9A1Apjb/LYjOaTvajNagWw73/YLdCG75SuTSexWsdwu1UYVinvaCkoOPZM0F4QQvYuXWSYt77PfnX5SCxwiug== 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-SenderADCheck; bh=lGYBoDBmpKjTzN8PgK/eWkvN4S2Y4sIwPgNIZB3NL3o=; b=TbM/f4RLu7Udv73UCCTOMK3hre+E4Y3l7ZYB6fmdGy6PX8rNjbDbss/ClDzo22wJPfJ66GSUgiLU78qkf4d6hoJn8W6eXU9Np5tYvE+nA/kbKAn4btUcLXJsKQWPbpjzcVEuEhxPdCzFWZDce4z+01BZUyB4gqRHj4fHY+RMH6XyK7ZevQo0tJM0zoJQquDitxHsBvMcZcpiIJg5r9B4uDWDopIWuC70eqgQ4t32ElgxaOnMJjW4gJ/hhe66NQB8MwMmhCfR20ObuS6Q+J5ilbitSJJUZRZXS37SatRw5ej7TIbhbv7G3A2jQG1JTPF2HREMD4+mvSQ9ZUCgit8mZA== 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=lGYBoDBmpKjTzN8PgK/eWkvN4S2Y4sIwPgNIZB3NL3o=; b=Ffq3eYCLHoMRKDt3IBYdStMutAA0owzw4cu3Tqi0o/GW4BeuItZ7pacjj+OwmwKBt1Lqkb1LHq+xJjVRFZG69ZRgFvKspR99y2560ZaFU1uQ9WvZhUijRP5s/9BGRTa76nLxqNvJozvKT0VgAXN+kNurY0imw43ZaWMD3seEryg= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4813.namprd10.prod.outlook.com (2603:10b6:a03:2d2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:19 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:19 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 36/37] xfsprogs: Add delayed attributes error tag Date: Thu, 18 Feb 2021 09:45:11 -0700 Message-Id: <20210218164512.4659-37-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 22901117-8743-4628-2c23-08d8d42ca478 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N6aubQSZaFqGzfKCIDjZ4F/SJ0DHikdJdvrJk1LTFYcXnit4B3sIczzOZheYLKYmWpTmsjbNTPmv2xy7dpVi4QGyy9ASU47sKPizMzVzNsAJSSFk7NEKvIZFbmEvbuFbeRbId73goC1/z1E4JzSn4iRoIzQERecVC3fxormHDP8n8fJOXGwHkIbX0pEnTTyhHhjK3VbeMnzNpk3ySYH9nl05+TkTAva1Ju+ZYlrpElleXs+QVrVNnhVhD7ibzeaS1+R/1PjFh6RJczkb15DgNNLfxfaEajxwx3ghbP1j3Wu84SUtL6wHiLS4EX/A09k1y5x9f0V9InbCRB96bPPkEQ6eK55lfXkIBUX+FsPnl6TARWHVcA4FmCs43O4/MTgKttW9ej9ZJnJC1dJEUWNj6grBNGOCz5Ers929Q3AE7t4QTPEEjtC49gDXM6vZcZR42lrfhJs8OE+5AJp0qQYDNkKGHCpdck1kotZwITcFSXYXoODsXzmWLKtnWXSRAToEt5coZbak+u2ccizxtcT0A23S0QXapVLmi1Jj+uMIlllKKsmrkQhUJBnioQ0NyHthpqv5bgykeMA4DyqZ2ObeKg== 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:(346002)(376002)(136003)(396003)(366004)(39860400002)(6506007)(83380400001)(478600001)(2616005)(2906002)(66946007)(66556008)(16526019)(956004)(8676002)(86362001)(26005)(1076003)(52116002)(6916009)(66476007)(8936002)(6486002)(6666004)(316002)(6512007)(5660300002)(186003)(44832011)(36756003)(69590400012);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sTNHCuDeWZfQP1ijqLe4uXTZlgYY4fstIZBalfQbKOXsMaIJJ32NmQADvwqBrEB51TutE3ERI1ns7CAYjejVNWdY+1MJ/DCshxE7pcdpgHAEyy3hTlg4tnGoGbckPeF3rsi9eP59KTbAUin4Ps3DczdFMZQmRvYxvGw9HjY2IVgNkL2sXQrF+dTCpdksE0mmRJlCLvu4Hkc2oJG5zKXePeB2KMH6n3m+sg8wOF6OxQOk37BxiyZO5D3wje0njtFs8ohfMXT6fjS+y4I31Lfp1lIs0iq+KAPesvXGwOjjXJakghhxmi7UYTUKqsWIaiLkMW2a7p3HIqrOhjJdartJTD0esLKVmWFA754GYcu/n+YdAgTsA3Qdme5jOQ5IffiWw2oNdJhYjmmu7dVrcvfgNp50jWEp2W0aJm2UavlioQQ5ihUhTxVA6PNBHzRmg8LwnIdI4N0wVhPTxmsmlI7oS9i+rS2NCsbATeKjv9hc5gUtyodn8YUcBMs9q6QA9UZCW+zbAt/4ZyffqSujf8RaNH7WtlUSGXyzyKwpNXBUcZ1yrk/KiwLMaAx+AhDLSudZ+gUMZLURYZWPYqgBaJq4K6IpYj6E4BzeGQKEsAUjnE7NMCPqNifFc5oylg56AqfjdRAaylltqiOYMOApJfBut3DDF41NYuGTjb43u8mEPxT37RZ0yh+F5FdTgd9QhSN+zr0H+PdFY1fKKioOgxQZUN2B1gzvGFeWbHQXfhrTVWFR/GLfxzkm0pG4HA3H+glLpJNnBHqJXX1gtgnJEFFnkL055Sq4wCKUjkZn+XWA4z8iWbJH7t5DXcCHR4bznzbuBxCnBn+3ZNpd264iijWQXkpZ+S39xRDG2f9iDzBBOBoezhayUqeCduKHQwQd5R0ZRPQV37lFhoe1H3fdyxV3KCG8dRED+bLEHLmz05K++tVq1CCjTwrwqv6RgBE68az1Msm9EPgePnBXwxJ7scatTiPYxHnYTcJVkHpqGfkvIa7r1ws5yMJE2Hl4doWB35rU6ANgEqFc238WB0RuOJn4qEmmahqG7D29nzFd33bR1a9lsRvIMd0aBj+NNPWkTQasxEQXqhagkDbsFnDrUppYryZQKxDRX2jyKYk9/E1cZ2ufBn/9IBK7IpWnk60l8GnxFbTDp6J63N7Uuq5ULE6kwtjirkK3SDwY6mD1e86oyjtMvkZoHCzvwyiG8HLV0isoSAY3LrBNpeqTGoA34xHHmhzLt+PEfW8UNPSpj83cM0zD+KsX4GOt23mSmEPYd2eAl+cjDQRFmhEFRPD+imSOwn65CEQ31SVaEH/uJUcgXpNBbvqBCOjV4v4iRmKXueSi X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22901117-8743-4628-2c23-08d8d42ca478 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:47.6919 (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: doRouZPCtUU4nnKNiYAwD+A2o3n7hmLTZpN3HgjMg8U9KFNVocwG1xPsSaMMBPXziyr6FqGPFeR6Q6ldD4HXpraXMzocbva41JGU/uZbmIc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4813 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds an error tag that we can use to test delayed attribute recovery and replay Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- io/inject.c | 1 + libxfs/xfs_errortag.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/io/inject.c b/io/inject.c index 4bd4138..7fef1c6 100644 --- a/io/inject.c +++ b/io/inject.c @@ -57,6 +57,7 @@ error_tag(char *name) { XFS_ERRTAG_BUF_IOERROR, "buf_ioerror" }, { XFS_ERRTAG_REDUCE_MAX_IEXTENTS, "reduce_max_iextents"}, { XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT, "bmap_min_extent"}, + { XFS_ERRTAG_DELAYED_ATTR, "delayed_attr" }, { XFS_ERRTAG_MAX, NULL } }; int count; diff --git a/libxfs/xfs_errortag.h b/libxfs/xfs_errortag.h index 6ca9084..72ad14b 100644 --- a/libxfs/xfs_errortag.h +++ b/libxfs/xfs_errortag.h @@ -58,7 +58,8 @@ #define XFS_ERRTAG_BUF_IOERROR 35 #define XFS_ERRTAG_REDUCE_MAX_IEXTENTS 36 #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT 37 -#define XFS_ERRTAG_MAX 38 +#define XFS_ERRTAG_DELAYED_ATTR 38 +#define XFS_ERRTAG_MAX 39 /* * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. @@ -101,5 +102,6 @@ #define XFS_RANDOM_BUF_IOERROR XFS_RANDOM_DEFAULT #define XFS_RANDOM_REDUCE_MAX_IEXTENTS 1 #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT 1 +#define XFS_RANDOM_DELAYED_ATTR 1 #endif /* __XFS_ERRORTAG_H_ */ From patchwork Thu Feb 18 16:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093939 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D77DC433DB for ; Thu, 18 Feb 2021 18:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D3BE61606 for ; Thu, 18 Feb 2021 18:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232402AbhBRSrf (ORCPT ); Thu, 18 Feb 2021 13:47:35 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41626 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233369AbhBRQrp (ORCPT ); Thu, 18 Feb 2021 11:47:45 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGTBFZ155845 for ; Thu, 18 Feb 2021 16:46:23 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-type : mime-version; s=corp-2020-01-29; bh=pyPkGsE9LtCNd1wGUmUWCFc+X/Od/eso9pjU6a4Mfd4=; b=iaRp2R2kP3sbmHfEsuZrzgM74mhYQcWAX8W0OqhKfTN6atyZXbiAIxhONTGO+3SCFZVs owOGqVyYwpsiVoROSVh2RQ41HBKiIQgU63ZRTN81ozINTVJ4kdoQxWBpkfHRd0VXBkn+ fnqjepMoA+Uhz0jXAUfFzu8oc4lkJv8NwOjYyGfRtblVf9pv4fnUUvgbuClWfmZ0ishy giZfO57V6MzcgCGCubjFQwzo/jRk7ridlgon3VD5jNC6Wvs9RdlACX9bOvXPdAmQG7dd u3GOkMzH9/dD8fjCC1wCPhiIMFg9/REfv2U6hi3LYdkkGvJQwP3d2bbxm075FgegORYn vw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36p66r6m7c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:22 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGUJtG067888 for ; Thu, 18 Feb 2021 16:46:22 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by aserp3020.oracle.com with ESMTP id 36prp1rkpw-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:46:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJ4w8hWhDFIKZdU0HnOWaNpoBm8MAP6IeyvC5jqDLyNTTfgB5mIZlrtIeAQLY8vLu/zUY32zY8Io03bFIM5kqMzTvxQ6M7Em0dQvJCNrwZy5X8bs9lrOvlMIskF2cxviWtQGukdLYwZbt6UWQ0q2ozEyT6rqzNPMvZjW+gPBttsVJoukG9prTUBPCO0wn1lVTVrHj95BvnuySyHK9je+hHtwmckEJUeemwCJZMTexwoiVM4ePfJRPO05kYUEH2T2Rc8LAP+GJuHjjsf9L0nRxbQAuQrpYGRXLhCeXkR+UfmQVpgCAIwWLAWNPgqEIjsExLAb2OFG4T9W8wNfgZGEww== 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-SenderADCheck; bh=pyPkGsE9LtCNd1wGUmUWCFc+X/Od/eso9pjU6a4Mfd4=; b=dy1sCq7x6MAu69Mz779g92lm5FfvS62lnbTnft3NR0INGnXA3Fth5el0wzXJ8Pve//9C+i996ZybBD1ooJWS7tohmOvBeRjc9518a2rk9pU3sjSwRJuMNta68O3EmysUCzNinr51x1lkfmc+SQk3tqN8RBAekbMw/dc+aP5TDZw/rmAE2zCdjuIscUBZg5IfzMubWBt48v4Tua72z1CBXOsBR7bgq5vXTVjbP36mvGoPYtv62Vs1dzaL2w8UcKsI4ufI+/vua98RTWi1I6+V4Kpz++plVbuc+yFcATChzUEPejQA+PMJgCxcJlToJ0JYzpMbB8xxoOsje3aCXkz2+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=pyPkGsE9LtCNd1wGUmUWCFc+X/Od/eso9pjU6a4Mfd4=; b=cTZeoTJ13GmEQGjG+1HPxDCgLz2/oZfeWaLEhh+MEhaVztYR+3SX34WXOYFWfu7k6E2EyX++XiP4LG+3EjsbZcqsuBVzq3qcfh6yYm2yUBRzgDpAE+DjjssdT1WZ2Qw77QgLKSRsi/eNyPDrFTzbkzQNDt9aaaehNntcCYuHIxc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by SJ0PR10MB4813.namprd10.prod.outlook.com (2603:10b6:a03:2d2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:46:20 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:46:20 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 37/37] xfsprogs: Merge xfs_delattr_context into xfs_attr_item Date: Thu, 18 Feb 2021 09:45:12 -0700 Message-Id: <20210218164512.4659-38-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218164512.4659-1-allison.henderson@oracle.com> References: <20210218164512.4659-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:45:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e6d4640-5c4c-40e8-793c-08d8d42ca4bb X-MS-TrafficTypeDiagnostic: SJ0PR10MB4813: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:561; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KeyV1CdCPDx7e0ekYIJ63MGLm3Gkw6mqlDO8xMgRL6qQD/FjgqOX92aCl8RZnz9L3EpCq6dQ266m4+9sDCsONUSRbORwIqAhkqoG4M+523vaKmc8vLILWUjj4xpnv0UKceR2ODIN1MwcP09NiBT4ymcydcZ57ABikOK8B627ZIl87j0cXEGM3PzPbaLv9lrry/AUE1SpfCIXDgRJHoanJromPA7GUf/aJZj2FMxkIDDTi+8fAa/Rgo0Y6RYUKAWzDMo2RqzaevZhceZJdaEGj590OYqE+rHGyr/uGAHQdVMe4tD/AwuMs04QdeFwt6aBPRziLxvfRduB/INZBBzpiIuWKBb3D8sgO8B0vg+Sgt2BdWmr6cOeOfZLfwnS51Q4SCDI3E+8wfpWKgCA7t9XWiakBMqFp02jhOJGaiQEQC2CNp/dbPih2++TIp2e74NoZ0ms075xjyoIwMJercm3ZXlYu9cRT6uFB4auN8373LbO37jyU2pDmoiM+hQtns2VYvFsIvkxZC+4zppSUTbrmHBLBUihrKLSzR7XcauPPbwZ0gV4skk9qG1ufKSWAWen30E9wchEnb2VSyAZNWBnf1lB6c76TVYQpKUHyjvLgnc= 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:(346002)(376002)(136003)(396003)(366004)(39860400002)(6506007)(83380400001)(478600001)(2616005)(2906002)(66946007)(66556008)(16526019)(956004)(8676002)(86362001)(26005)(1076003)(52116002)(6916009)(30864003)(66476007)(8936002)(6486002)(6666004)(316002)(6512007)(5660300002)(186003)(44832011)(36756003)(69590400012)(334744004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: EUnuuO4O18S0dyHum4KsWSQN+OiSZKwCRv3lypDU2ShA0lIK2Qv5DQACiLwaMQDnjnAL8KntCXDL4r/0RD5x29YBY4O5W7tORFbY3MZyvNQfnaTdMDaF/q1VVRNgoU0Np5Uv6Ja9LUUWij8x+vTuPG4GNiJVrNaeYmXgJgUGFgBQs3IknJpvN6+V6X3fZNa5RbHTmM9K/XY2ps+FAHjbX7JDVULT3LKVtFbpjqlwVV76K/hzS2cY1XsTH5TzEqmP3t6Wd7L74bSPsDJrBVxHgpn7x1f8YBiv1onnJx2q9t5xs944ZbgHzSIAh6ffNXl3lSdhIIb/VrsbO1TDHslB0BJyLh7h4I8cX3ZgbutL0Y9aM7gLEaoCKeJ4Fm5DTYXwlWunbBhbl797C+pRf1Eo68nhgn8HHOBjPafZRqaoHuRG7h7/qNMgaC9DLFkJHeuY04TRLewg5a9TCrS5yFKObs+UPPPTZLtZuKRRruxZJx1wuBQOqU5sGQ8LB2ewzIRld9PfVEf7fjeQfLYmCKuYH94qXED0VuKkJPNrFi9AAGIaYs9bXc37ozrFEAQ7SvXe0PUDbyPcZtz/n/ABqKGu8l2tj4KQ56sYdicjo+M3j2gnskIqVlg+k2VjL5JMu4bMO9/IZjVjs0k0TiN/RK4CK9aKflwEuRJDe3Ysj1snWQq6mkCogXetQ3De6BcaRte/ft8CMce46DzvmJQCvVnYU0uxVt0hHO7jo2m3JiwdwICFKbj8WAyDaLmX3jBn+Kl05BYZyU4B7/LNqpyQ0zt9jKiwgQT8PkOOKJSERSnfdkwaRo2thGl3as+glASaGw9ApZEn2L002zmRKAf58jOdIRqS+R3V/m1VNY/+rk1jKfpKmges0qX63P0239Zs0WKY35Q5zDW5OGBb6DfmPu4Y8jbCzfWPgkzofNjlbEQG6UWxpfHI6o4Biuclgv20xdA07/0DHiU/y307iAxvzURLjKENTGzPFzJb0Njv/Ag/jA7blUlgPbw/9HAscuX0D4sH66Bys99schff9DY4Zel/Nqnth+WDBPOPHf9IvAII0Bze0TdmI5s6a0KfYX/SrlFB7HDIipKpeos2zVQQ8g0bz3/PcZ3mljf4b1R/9Z8im5slWP7rHZPF5RHxpHR0p57+fgKpbdMuNctfo4ZE3B9biYmlCW6tzNYj8k2s1PXtPqscJfhZzMO85Hh7+XdNUq32Y93wUoVRJQdotai+37TjQj8e4wqW83h6VUosWpEXKZehKImeaVxSi1jr8/lwnGGdgCScPgzdus860WqBfrulZ6p2bbldPJ7lW1hB0Ftqz06LYvyRkJV5kk875HCUPIL0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e6d4640-5c4c-40e8-793c-08d8d42ca4bb X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:45:48.2544 (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: 6fjg+Ah41oQMB84TVwnnZo8pIGGfMU7EmG5kFgrHEGGpdSwLOetVGPNxkPmWs4gpBAJsVR+fOr2pOH3jjtv5obIKSkpRFy8zvy95QY0idhg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4813 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180141 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 infastructure is in place, we can combine these to eliminate the extra struct Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- libxfs/defer_item.c | 14 ++--- libxfs/xfs_attr.c | 159 ++++++++++++++++++++++++----------------------- libxfs/xfs_attr.h | 40 +++++------- libxfs/xfs_attr_remote.c | 35 ++++++----- libxfs/xfs_attr_remote.h | 6 +- 5 files changed, 124 insertions(+), 130 deletions(-) diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index 054d158..04a7534 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -129,11 +129,11 @@ static inline struct xfs_attrd_log_item *ATTRD_ITEM(struct xfs_log_item *lip) */ int xfs_trans_attr( - 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; int error; error = xfs_qm_dqattach_locked(args->dp, 0); @@ -143,11 +143,11 @@ xfs_trans_attr( switch (op_flags) { case XFS_ATTR_OP_FLAGS_SET: args->op_flags |= XFS_DA_OP_ADDNAME; - 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; @@ -204,18 +204,16 @@ xfs_attr_finish_item( { struct xfs_attr_item *attr; int error; - struct xfs_delattr_context *dac; attr = container_of(item, struct xfs_attr_item, xattri_list); - dac = &attr->xattri_dac; /* * Always reset trans after EAGAIN cycle * since the transaction is new */ - dac->da_args->trans = tp; + attr->xattri_da_args->trans = tp; - error = xfs_trans_attr(dac, ATTRD_ITEM(done), attr->xattri_op_flags); + error = xfs_trans_attr(attr, ATTRD_ITEM(done), attr->xattri_op_flags); if (error != -EAGAIN) kmem_free(attr); diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 8f638ee..91d5107 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -54,10 +54,10 @@ 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_work(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_removename_iter(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_work(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_removename_iter(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); @@ -222,11 +222,11 @@ xfs_attr_is_shortform( STATIC int xfs_attr_set_fmt( - 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 **leaf_bp = &dac->leaf_bp; + struct xfs_buf **leaf_bp = &attr->xattri_leaf_bp; int error = 0; /* @@ -271,10 +271,10 @@ xfs_attr_set_fmt( */ 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_buf **leaf_bp = &dac->leaf_bp; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_buf **leaf_bp = &attr->xattri_leaf_bp; struct xfs_inode *dp = args->dp; struct xfs_buf *bp = NULL; struct xfs_da_state *state = NULL; @@ -283,10 +283,10 @@ xfs_attr_set_iter( 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 (xfs_attr_is_shortform(dp)) - return xfs_attr_set_fmt(dac); + return xfs_attr_set_fmt(attr); /* * After a shortform to leaf conversion, we need to hold the @@ -324,18 +324,18 @@ 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; } 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; @@ -346,14 +346,15 @@ xfs_attr_set_iter( if (!args->rmtblkno && !args->rmtblkno2) return error; - dac->dela_state = XFS_DAS_FOUND_NBLK; - trace_xfs_attr_set_iter_return(dac->dela_state, + attr->xattri_dela_state = XFS_DAS_FOUND_NBLK; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } - dac->dela_state = XFS_DAS_FOUND_LBLK; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + attr->xattri_dela_state = XFS_DAS_FOUND_LBLK; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; case XFS_DAS_FOUND_LBLK: @@ -365,10 +366,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; } @@ -378,12 +379,12 @@ xfs_attr_set_iter( * Roll through the "value", allocating blocks on disk as * required. */ - 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; } @@ -421,8 +422,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; } @@ -440,15 +441,15 @@ xfs_attr_set_iter( return error; /* 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; /* fallthrough */ case 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; } @@ -486,7 +487,7 @@ xfs_attr_set_iter( * Open coded xfs_attr_rmtval_set without trans * handling */ - error = xfs_attr_rmtval_find_space(dac); + error = xfs_attr_rmtval_find_space(attr); if (error) return error; @@ -495,19 +496,19 @@ xfs_attr_set_iter( * as required. Set the state in case of -EAGAIN return * code */ - dac->dela_state = XFS_DAS_ALLOC_NODE; + attr->xattri_dela_state = XFS_DAS_ALLOC_NODE; } /* fallthrough */ case 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; } @@ -544,8 +545,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; } @@ -563,21 +564,21 @@ xfs_attr_set_iter( return error; /* 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; /* fallthrough */ case 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; } - error = xfs_attr_node_addname_work(dac); + error = xfs_attr_node_addname_work(attr); out: if (state) @@ -587,7 +588,7 @@ out: return retval; default: - ASSERT(dac->dela_state != XFS_DAS_RM_SHRINK); + ASSERT(attr->xattri_dela_state != XFS_DAS_RM_SHRINK); break; } @@ -635,13 +636,13 @@ xfs_has_attr( */ 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_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; /* If we are shrinking a node, resume shrink */ - if (dac->dela_state == XFS_DAS_RM_SHRINK) + if (attr->xattri_dela_state == XFS_DAS_RM_SHRINK) goto node; if (!xfs_inode_hasattr(dp)) @@ -656,7 +657,7 @@ xfs_attr_remove_iter( return xfs_attr_leaf_removename(args); node: /* If we are not short form or leaf, then proceed to remove node */ - return xfs_attr_node_removename_iter(dac); + return xfs_attr_node_removename_iter(attr); } /* @@ -820,7 +821,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 +1134,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) return retval; @@ -1170,8 +1171,8 @@ xfs_attr_node_addname_find_attr( return 0; out: - 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 +1193,10 @@ out: */ 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 +1227,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 +1256,9 @@ out: STATIC int xfs_attr_node_addname_work( - 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_da_state_blk *blk; int retval = 0; @@ -1365,10 +1366,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); @@ -1396,7 +1397,7 @@ out: STATIC int xfs_attr_node_remove_rmt ( - struct xfs_delattr_context *dac, + struct xfs_attr_item *attr, struct xfs_da_state *state) { int error = 0; @@ -1404,10 +1405,10 @@ xfs_attr_node_remove_rmt ( /* * May return -EAGAIN to request that the caller recall this function */ - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) - trace_xfs_attr_node_remove_rmt_return(dac->dela_state, - dac->da_args->dp); + trace_xfs_attr_node_remove_rmt_return(attr->xattri_dela_state, + attr->xattri_da_args->dp); if (error) return error; @@ -1451,10 +1452,10 @@ xfs_attr_node_remove_cleanup( */ STATIC int xfs_attr_node_remove_step( - 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 = 0; /* @@ -1466,7 +1467,7 @@ xfs_attr_node_remove_step( /* * May return -EAGAIN. Remove blocks until args->rmtblkno == 0 */ - error = xfs_attr_node_remove_rmt(dac, state); + error = xfs_attr_node_remove_rmt(attr, state); if (error) return error; } @@ -1487,29 +1488,29 @@ xfs_attr_node_remove_step( */ STATIC int xfs_attr_node_removename_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_da_state *state = NULL; int retval, error; struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); - 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) goto out; } - state = dac->da_state; + state = attr->xattri_da_state; - switch (dac->dela_state) { + switch (attr->xattri_dela_state) { case XFS_DAS_UNINIT: /* * repeatedly remove remote blocks, remove the entry and join. * returns -EAGAIN or 0 for completion of the step. */ - error = xfs_attr_node_remove_step(dac); + error = xfs_attr_node_remove_step(attr); if (error) break; @@ -1525,9 +1526,9 @@ xfs_attr_node_removename_iter( if (error) goto out; - dac->dela_state = XFS_DAS_RM_SHRINK; + attr->xattri_dela_state = XFS_DAS_RM_SHRINK; trace_xfs_attr_node_removename_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -1548,7 +1549,7 @@ xfs_attr_node_removename_iter( if (error == -EAGAIN) { trace_xfs_attr_node_removename_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return error; } out: diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index f82c0b1..ddcbfda 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -370,7 +370,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 @@ -391,7 +391,7 @@ 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*/ #define XFS_DAC_DELAYED_OP_INIT 0x02 /* delayed operations init*/ @@ -399,32 +399,25 @@ enum xfs_delattr_state { /* * 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 @@ -432,7 +425,10 @@ struct xfs_attr_item { */ uint32_t 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; }; @@ -451,12 +447,10 @@ int xfs_inode_hasattr(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_set_iter(struct xfs_attr_item *attr); int xfs_has_attr(struct xfs_da_args *args); -int xfs_attr_remove_iter(struct xfs_delattr_context *dac); +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/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index d5c2ce7..b8f9fa7 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -633,14 +633,14 @@ xfs_attr_rmtval_set( */ 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)); @@ -649,8 +649,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; } @@ -663,17 +663,17 @@ 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; @@ -683,8 +683,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; } @@ -737,9 +737,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; /* @@ -761,7 +761,8 @@ xfs_attr_rmtval_remove( * by 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/libxfs/xfs_attr_remote.h b/libxfs/xfs_attr_remote.h index 6ae91af..d3aa27d 100644 --- a/libxfs/xfs_attr_remote.h +++ b/libxfs/xfs_attr_remote.h @@ -13,9 +13,9 @@ int xfs_attr_rmtval_set(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__ */