From patchwork Tue May 25 19:54: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: 12280019 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 A09B2C47086 for ; Tue, 25 May 2021 19:55:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87EF461279 for ; Tue, 25 May 2021 19:55:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232986AbhEYT5E (ORCPT ); Tue, 25 May 2021 15:57:04 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34176 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232988AbhEYT5A (ORCPT ); Tue, 25 May 2021 15:57:00 -0400 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 14PJnVR9184907 for ; Tue, 25 May 2021 19:55:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=gOndIPq3yL0StYVAqC9PVAU9zgGvTO1HUubFLKPYzqA=; b=zubjCR65sIqNyYz+RxdUjo6N/7N38e5IUgggaaAI/djaGh6EHBa90PceaOBsjrl3yDUf k3qd3zfEKVxNnaWB6sFddae9KxkQw+yLSv0ivWmDMJDoNOrBiHrCoHOS/bZHufrhJjNI leE8yweq3x5RA7PNGuHNOnap5xAXKXMbHWm8GDkIMEQxgIF2wSIPp/uCI/ukBKmaCYpB KO9+x8SIMKghxQLen2yqsgCnd62PgyB6oE50Tq2ZTNRYI65mG9WmIZNdv+DwTmwwu5Ke W6T1cvumLzBQ8nEClOdtzoQDzGXld1HxISla7j7S10lf4wk1kKMxFfCJs8aLzgQH/Ur4 hw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 38ptkp736g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:29 +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 14PJotnS143650 for ; Tue, 25 May 2021 19:55:28 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 38rehawt3d-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YkP4GzKQmR+PLbdclfQWXn4kysUtLJP+PFPjoJbCrwIEBipxeu+rIxB9iPPP4anm248Of/0hv3iS6st9OUKZFZGgeGJKe1oIg8ZXRgGltWZoYEOK8uMJ6j5NMjqXGZ3DBsTp2g5dN7Oqq1Gs1XmfHP3MHF2e9+eQxrXuj4iwXWaSPs/ycme+vYMoN4Y/mOoEeTP03iMAMSpGKcC5XehgzjOAVcz4rPrPSVLFOzVobMZQiFwf2pGcjuuneT71MYPGcqv8i5PnJCJ8z8/X19byzbiepnP+3Dp1bDgcRyRhKuQBsExJLqQ9snd69PzHMevOSjpHA8ifNSrBAqa6Lw9BXQ== 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=gOndIPq3yL0StYVAqC9PVAU9zgGvTO1HUubFLKPYzqA=; b=c+PlP+sLH8PDgdEy8fXd24f0zAe/m59RdkxIn2mM0qgVYzwjY1KjIjUAdQJP1JBZAGiV10i5s63vsfB/HUfYFyMx3EEcFWgH97Ls0kbrwGJVeBjcDMEWsFbdEVvTgyzaLH+N/3CiDjX7bQv2ugAcc81OkdrSjpntkIcel+uNAm5fmBJviWH9qmtCu8NnAkaZYztIq4ZBDH7zpC9vlQS+CaQ3bM7pBiacmSENh9PffWKafmK8NiaWUR8MB+taCXPXPO5u2ixGS0+1+a7VsDNn9rjVIgYj92ijZoO7edUAT5bm/O8OeYBSeCIHs/3E4l4Y/d0fQTdOm8VsDFKtf5t3MA== 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=gOndIPq3yL0StYVAqC9PVAU9zgGvTO1HUubFLKPYzqA=; b=Te3wZf1JMIJvlP+h/1djQJg25QgK1/1WWjiKz8gAVWaB8vl9FgtjWksA7Gf0ymGWR7BOLTtZdlyo1AJLxiaLMqBKKBLswsaud79514mX2aBLDE+h/tY3fGEilMZRkE+1NugUYbMMoz7HDhSfPe9KhcNIjgLDlwY4PJF8ZhVjZJo= 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 BYAPR10MB3144.namprd10.prod.outlook.com (2603:10b6:a03:15c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20; Tue, 25 May 2021 19:55:26 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:26 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 01/14] xfs: Reverse apply 72b97ea40d Date: Tue, 25 May 2021 12:54:51 -0700 Message-Id: <20210525195504.7332-2-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8a14e5c-c9af-4b51-16f1-08d91fb70a68 X-MS-TrafficTypeDiagnostic: BYAPR10MB3144: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:644; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aVsXngbIIQ+DnfDRZ1G3eVHtHlPuAQ976TwcDC8A4OMxsBwLmlDMs9uSaYufvC35DGuTPqIIZqsBYKjSah2tGPbtd2n4KHwneTvqNNE14dVlEwamQCmapEo3OPbDoiushGtyj31EneMCfQzEd2sfQAnZTq5aE8FZf2lj8QH/JhlSmVl8M8bTZj8p7psdydqZYxO7dWTW5UZ43DHmmfvuxB4eBLXzgnhECApxb5TixknQaC2QucIS9mOmyufcUHLAATOqKYJQqKInGAjZ8bF7s8MuXeuBPqT5hGpazfY9c85KKcI5CT2zG5udJYtOHbW/Wno5SbOOtpxgJ4fTgR+w81CvNmsRIARUhWp0ctuXJtvzv9uKbEHX/TpdVtq2NVtD08B4tWyxog7aYQi5zgx1FuNGfeUi7DXmMVx+k3fnY2l01S79nW96CWdY8MdHnOItHNmcMWolnUU/eKXKoJSZWJcExofbsn2Y7i5Wa4b1zfrqapFPZncloOwqeSai0+rSCZTqtncycSmzOVoBGjgkgFCd4g/IBZfQdUyn2Yud+0YfNYhexLjGqFdsvft/vyRuSreI2HaJys50jkMofGSSCi8AsrNqZgbnUJbYa6q8KpUB3mfSnfL9IXguWMTeg52lP9KKK9CS8A1UjRbZIuFbznNCIsVSga1vIsQrzM4pAipXFf315WnySHkIeErwFdSU 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:(136003)(39860400002)(366004)(346002)(396003)(376002)(8936002)(6486002)(6916009)(8676002)(2906002)(26005)(36756003)(6512007)(38350700002)(478600001)(66476007)(38100700002)(83380400001)(66556008)(6666004)(186003)(956004)(52116002)(2616005)(44832011)(86362001)(16526019)(1076003)(66946007)(5660300002)(6506007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4OhyMFHnifHg8G0Q5n5bAgdsv383ezKyJO2stfl7GeL9O0Kg1tVAaLR22O+Oy1FoIa1OcF6sAfk5kodGT+yC1uUsSDgSQmaU2XVKori5gpENyYbqhwBtEGe6ZxxjGpa1XWj5hB/vSgulPg0uyeYHuhMZ4JhIdQL+hllJvK9NNeWftt3ImDntT0uscaUIFhwXbliXbo7oJoGo6ESH1QaBjz1G6B4eUEiqvLrnryOa699JmdZhYMN0c7a3ForJLdLGkl0OHNgTNOkYMjDUMKWVn6xgxuXtfHhD1Aw05u7Fye8/moTreoyP6UMOVuSah/q0bJYdt373/zQ1zVfUjzgW3oku+4RVNe69zOHE1QRI3du8GmbVom1Wq86rIeuphWrAPS2hiV8N0XIwIVTqO0Gkns+GR0Kvvo6G2cI5Wdqfbt9GVkpF7ltdfhTsdAs0X6ER4EvolrSRbcKY1Ee1O1NSotInI6sVpeaGgzOo+FnV0n+bOEpWLQaOg+fiLepVgTe3Or1pcRiGQv3PDup4d4Jm1HTmq3DMbVeJ6a339p0BxcgMfVz7RVsZRtSWOyBk4rBIVX11D3osUHoqiNYpVgJJOmtv7JjTXeZ3TTqCzz3Co6f78tvamoRYBJFOOIec1XWa66SBmTS8+B5UQKZDt7Ove2i7L9ASSjTKydZf42jhcrtpxuhF/ExCO/XBJZks8BXcTIScrsD99TQNQr3Iy6x/cDFljxu5XH2hprDBLjBGPP11TrmRZqXKasvM6l5s3TUZ1MFzd1+JiWSHHI0fAGbGE/miFvAw5E7iinDIX6YIzrqzJHpQqOyQxQt+5MhmAnjkGEW/f9OFGoX0NoLn4nfLFS4L5qppAa3Ip34I3q/TYMjgDk0GvI8LfoCbxEKv3LneXxTgvphvdnphG/zht+4AistwCLdfSpuUxJwUj34DNY+oSc9BXmXkGaLUKPavxrMWJq41EJdhUe52Pc9MFTqwi/KBmlq6Oiabq+5aag2LV8LELspWbMMsdY0YIHq9fGXa0xWXLnC3xaRbYY+VPbofamIGPuFqQHTEOVbhaT8GRKWJI5NwtoEDWFUqQl7ngvLUMm0JJhh0saTLHnGtQfYwh6O6C2/6bRY4uoVeuoIwVxGeANQ4o5JL+97zGd68Md3xcFxeqtZjg995cpj/71PEzYm+K+2TTyeSVACz7iqwPsKNRzKshdB5m4YV36EvWHXTI7xPh9wOdpsLef8BauvLsZCzeRgjPkv3K4Zj79kPD2Ryl3FNgBJyVc8Fd6hH7Bu7qdk/mVNHnB91n+D4GZ4fUtXJ9IdqLKf6LT7lzr+wCDcsGyotZi/NMcQ1AQp+bkJL X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8a14e5c-c9af-4b51-16f1-08d91fb70a68 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:26.5512 (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: /22oJz/LL8JiUWYIZtId/bBr8xQIn+WtPy3rzL1NnF9E6FXKu36GZb8MzIItumIsFHhNnfOQg6u1VDx6nuW3hq+a8sku87A4cCPfw42hUYM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3144 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: 1cNefhABwMm2dAB6gqR9VbiZcf3xt17w X-Proofpoint-ORIG-GUID: 1cNefhABwMm2dAB6gqR9VbiZcf3xt17w X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Originally we added this patch to help modularize the attr code in preparation for delayed attributes and the state machine it requires. However, later reviews found that this slightly alters the transaction handling as the helper function is ambiguous as to whether the transaction is diry or clean. This may cause a dirty transaction to be included in the next roll, where previously it had not. To preserve the existing code flow, we reverse apply this commit. Signed-off-by: Allison Henderson Reviewed-by: Brian Foster Reviewed-by: Chandan Babu R Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 96146f4..190b46d 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1214,24 +1214,6 @@ int xfs_attr_node_removename_setup( return 0; } -STATIC int -xfs_attr_node_remove_rmt( - struct xfs_da_args *args, - struct xfs_da_state *state) -{ - int error = 0; - - error = xfs_attr_rmtval_remove(args); - if (error) - return error; - - /* - * Refill the state structure with buffers, the prior calls released our - * buffers. - */ - return xfs_attr_refillstate(state); -} - /* * Remove a name from a B-tree attribute list. * @@ -1260,7 +1242,15 @@ xfs_attr_node_removename( * overflow the maximum size of a transaction and/or hit a deadlock. */ if (args->rmtblkno > 0) { - error = xfs_attr_node_remove_rmt(args, state); + error = xfs_attr_rmtval_remove(args); + if (error) + goto out; + + /* + * Refill the state structure with buffers, the prior calls + * released our buffers. + */ + error = xfs_attr_refillstate(state); if (error) goto out; } From patchwork Tue May 25 19:54: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: 12280017 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 D4184C47087 for ; Tue, 25 May 2021 19:55:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3459610FC for ; Tue, 25 May 2021 19:55:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232894AbhEYT5D (ORCPT ); Tue, 25 May 2021 15:57:03 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:49622 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232986AbhEYT5A (ORCPT ); Tue, 25 May 2021 15:57:00 -0400 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 14PJnhV9038678 for ; Tue, 25 May 2021 19:55:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=Lsy5ghd5NCGtPxPjv0dZ32L1JJiBdQdTUN4+qBdRad0=; b=vdLBE0HkjZEsqKSriwIxflzkwInLJMEd+kMYaZCchF2gzu7DwQXOJS/V3zhJgjUblR3Y apFXlZxELlZRNsHBV7LOBMwjYtODkUEle2LvfJ2JftRAZbTw8jNk6mwQQuiQ0O0NsdWD 39Ge97ue0smKWTCXv0ALxS2EcWHfcif32Q1j9nRS7Kna04BZZOPlEpmZb3oSaU8J5zNs SOgJdFphGqp0PqbJutfXD7UfZDImBkQ+wKUxQdGRRv0MLc6w/pSV9DEvb4Xkl8mXOTC0 hqeKJgLVmXSw50dYDf0gtWdDB733K342McwxEqMvPjTA8NXpZ6SdAVkaxeKS7+QgnxX9 bQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 38pqfcf6dy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:29 +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 14PJotnT143650 for ; Tue, 25 May 2021 19:55:29 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 38rehawt3d-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JhIEV4N3XvixH0D0eYj/bJ6Fi9K/MAX3WNdMOVc0IgYsJM9j/XfRhWkpRk8GPZx5p6MZjSnN8v8vbOyPkG8gduK7kgGTdtDm4RHTNkI3VxYbAeuUupUUEArRaA9K5zLiiGKuRYWSlqPgD4SNS61fuLwguHrguEqGtRERfSD3tHd7/yNdjKTc0bn11Dt+QFNY9kjvkGkcxnGmTOIgyHIzNOnbK3rsTu2PqnTSgPRLQkdJrUT8YbJsSfyFEFQ9EuHgptA7tcbA3T9i47TdoLHFykCKzbtlpQnr4IUPi5W/A2igKfSpYsmEEsuz0OtdQ1cMmW7sazM9grOtg80QIwnDnA== 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=Lsy5ghd5NCGtPxPjv0dZ32L1JJiBdQdTUN4+qBdRad0=; b=oMxlkJVfS9jPDSjsEAnDLzc+8/PalpdaxmerDxcbtz/6Vkb0p3DauB9zjoaLFo5KjyEkvyXPlvgTd/BJhU9mQD1FNdx7gxx/XNy7rvb7TW5jiKGJlf0g9dYj2W/5MquC0TG6RTAqGaxHxS+920OGbcVQ0GX2jFCHhj0quzREmuUmGeO5V/5eJXnd2nj7wmMN8bDXqvy/9r6VG1FdyTV8F4BCGaO5Gyr+ryEXf3UP9zVT4oK3jlMVhZPKNVrCbMIHxBjUXG635F/sAG1Fad9FGkgQzzwD4VL8NzytWgW22tliSCT28PUhYAQfI9DXbe0xU2BTkH+lLlCwDeoBDDCrLw== 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=Lsy5ghd5NCGtPxPjv0dZ32L1JJiBdQdTUN4+qBdRad0=; b=noBHo/trx/ZDNsFHlf3fleqmFkY/L0XKS41sPbSk1MF3JmqSHvEuXqqqb6jQf5YOkJSfcowMl6/ImVGIVxKGSL78v/o7V/nGwMaOVFiI95o621eygkYaUqDtKHptpgraoRRcmUZy7v/TxHChftcLX6Xzp0l4ga1ZEcsUULgvXj4= 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 BYAPR10MB3144.namprd10.prod.outlook.com (2603:10b6:a03:15c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20; Tue, 25 May 2021 19:55:27 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:27 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 02/14] xfs: Add xfs_attr_node_remove_name Date: Tue, 25 May 2021 12:54:52 -0700 Message-Id: <20210525195504.7332-3-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0521cd6-6e60-4c90-4024-08d91fb70aa4 X-MS-TrafficTypeDiagnostic: BYAPR10MB3144: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F0rNMJkhPXivGoWZktnnxXHzI+gnBKbRIU8Pn0z2BhOq3+kk79VhlIRdjCNGaBOz7/aLKcmzCEQVtCAr+0Dj/7RWtVhQp71FJ/f5vL3ARPrXQkG+igR2Gv1UIt8M6ShKzlLeMCKa4tlT8cxdAkMtbw+DzvCqDLtoE/2ZrI0oSnkJmkCz0c2FJVXWgr5CYAyeLWv8ovYC0F2emHfJpdYk0wf2FvbpumPa3GMeMy8Afm9n+Z+a6eWs2qObmq6qG/Qnyb3+g5RgoC1ztfMtzhnuvyxielUbdvaS4Zh+xj3wk0BGCPVvwq6czYuhOSeSbp7LH3zQ+q/qbGF/CKnAFtncPsGkLNBOV9jq0/0dOwm8ZRpVqaLMxxV9A63ifOzjJ03cUU7Niz5xbxPLraiKm2A8+wQ7k5VRAEoRrOAjR2Ah8DvrV8fA0PZ4lcjhknTjMOkVUvTLuvHs3Ji8zNhfvibalpzTf6/k6mfwZZORce58zPi8vZ3+64RoQ8VWQVRaqH53eWrt4p+UZdJzXyN6qNi4ucl/HmrJeX70oGfq8YatJjNKULR97OAS9HbIhYhSC8C9B4BIsnnw2cLfAx+2kR2NgzwZt5DZ3GuKhfH0oUbaxlMYJfQDb7DZ68HnQZohDS7OJJKpAo6qPtGNJMgup1mgLyIVu5rfQwC4sXsRX8eXs+CmLQDKY1nOyzBKR2CMtKf9 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:(136003)(39860400002)(366004)(346002)(396003)(376002)(8936002)(6486002)(6916009)(8676002)(2906002)(26005)(36756003)(6512007)(38350700002)(478600001)(66476007)(38100700002)(83380400001)(66556008)(6666004)(186003)(956004)(52116002)(2616005)(44832011)(86362001)(16526019)(1076003)(66946007)(5660300002)(6506007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Juvjd42NkcTSiDWGBppAWjsJFxuFijO+Rww2pXW8NfafyCjfRDoZoXMw8ajkqm5aA8CGqCw6RTQYKNHYlTegQJ3CiDiHMdQvXeNZPyTRMOb7EExMwK3NTm4/wYW5sPVqTeb+wPUhWicsMlGmPyM9rSzT4FyLEfl5+xg3DNpMQHP+2wIlC5hQxmzUAoQanyi4COI1F1jwiZjBt8/LkBGxE3br6XPkyP+dL8axp+vrP1AmAShD5DHL8l3+x7urqTciBOKyn+ZML3tDiz4gK5mSOqr9gRAMJ3K0Cd/qnyv75jFLlHTgolUdXEjyaldlUoJmlN8gO1d0mtC8O9l9/Ux06WI4CvXODsUY93fgyRdMuuM3MnJuDs428edvIfgAHn0Te0EnWzkS4ydQkSoGnR7DcV7oKePhNdEnvIC7L6u6aiiMxJzM5fhcaq4PWDe+uc80R+hc4MHdY+0OeGybVW//iTzrngU3GbY8XvpRkkHNxublLMP3Okwh+VZestKTRl1Sc7Ef0Tf16Tq6KYgBl0yPwQ3QfPOhEDTfDlg0q4Zi7WvUXedDxMyTXH+m1/vn9sW3Rw89FblsEU7aC/XY8CsBpye0ThJ6v0Y2UmMagK4Key321AeXi8nKgzGsgCi8HnuqMcdyI9lOx9/of35bwJTcsPgo1Fjne3/JIHXQrtLWvwlCpmirav54xw0B5ViEe+knH88wDMnha1Ni5Vbe63TIY1g4O5DHz5EZNN7wiyQI2cFSkXV+iSx4T/ycsbw6cXe6zAz0EaBnwVIQVirRDV6wrBn9r+WLiAb7spRdmtR37eB5a0xbYSYPMvbnrMFWWFYgJCMHUnmUNm2jsBJlepLD7ggOAXDfxVvwmu7xgwATReB0iX4RHYa1UNPpE1rNYilg71EGh410UGoL2sRfNJxzTkAEEmmGbY30QZJ6SczsCmwnu9APSN5nh0kqkAMvBwZcSh3Zn4fTNocODOtFPOPP/e4BfHsQkGqz3KTH4sd8msFL4W/w8JFkaxt3n9ZDchij20m78+ktcl6rPjr2OhJHzfPJFxaz1TBzTDdSdxGIYAlmDlRU8LpjPbJibwTG83aWpPlj+WCHbSLB3La1ic3dE9dKrhEjtp0BFwLWXo0zKWH76QNPZ8DRAqHE+tIfK4tcwbixgNeFp4FGxQC0kR9hwsDcf+a/vOabyZEkxkbJ5VCGwH3F5ijKOtTLgmscsb7g+Pve2QhrpkISCCaR/ZSfo0w4Pn3C6166BD9bSt2CE5GnSb9/3hYFvToUxBML3Pb4ybRynxu+R31HCkuAmwpvGjWemKi2UWtqRtHOMb+6CWv+B2pjyTGI6qGunwTwqaQp X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0521cd6-6e60-4c90-4024-08d91fb70aa4 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:26.8987 (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: t/HP0ATXUa4Pvm6Iq1SQkv0LHktFZg0ulX4eBGH7QZOnu/8UOyT3rxuqMkSpvJo9fVztqUOYR84I1TdP9CSM07WRlEQ8lTQhNcVyN3t7Qg0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3144 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-ORIG-GUID: 1S413AUnrpVQSF6aCQAaDmSybI6nfj8K X-Proofpoint-GUID: 1S413AUnrpVQSF6aCQAaDmSybI6nfj8K X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch pulls a new helper function xfs_attr_node_remove_name 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 Reviewed-by: Darrick J. Wong Reviewed-by: Brian Foster --- fs/xfs/libxfs/xfs_attr.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 190b46d..8a08d5b 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1214,6 +1214,25 @@ int xfs_attr_node_removename_setup( return 0; } +STATIC int +xfs_attr_node_remove_name( + 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. * @@ -1226,7 +1245,6 @@ xfs_attr_node_removename( 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; @@ -1254,14 +1272,7 @@ xfs_attr_node_removename( if (error) goto out; } - - /* - * 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_name(args, state); /* * Check to see if the tree needs to be collapsed. From patchwork Tue May 25 19:54: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: 12280023 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 ED8B3C47087 for ; Tue, 25 May 2021 19:55:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2DC36101B for ; Tue, 25 May 2021 19:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232989AbhEYT5F (ORCPT ); Tue, 25 May 2021 15:57:05 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:37898 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbhEYT5B (ORCPT ); Tue, 25 May 2021 15:57:01 -0400 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 14PJnOxN034959 for ; Tue, 25 May 2021 19:55:30 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=gVd0enhwIWaYRhCmoYWj67z08taQidFZsLD19HHO84Q=; b=ICw1Y0l9weGkpuTHsow67zzjGHeEdYUM/tYtFWG2Kj5ey6bZHRiUqkf3euh7HoOTt2Qy emyGmGGzZErb3vakJNeLIFTVWjseg56HK3/DdcrTDm7Ef4NuUSwOAPXNgDrArUFRSX2x 5/NCIKCEyWeSeYCXNprpB6nhw2XYKjIIzb2wbxNsQ67N6RQANvKX9fko/ZGsDY9Hrby3 KvasJafGr7bPY90icRh9JALdv5qa3hEr38FvFpsEuYrcDvpbEfUNM3yMO2VsOocUsaQp VvcKtm5SqqlSKlAbrpAWkEX80FyQRKcNhz3w6+S6Ihgi8W/rhhjPGtp2OJaUtQnR6qtj Qg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 38q3q8xkjr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:30 +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 14PJotnU143650 for ; Tue, 25 May 2021 19:55:29 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 38rehawt3d-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O/RibRB4j0NdF7n9HriD2CoOS4/nslQOT/EHOBZyGr/kEdVSEebwd2szdqNE0MyWWUOVNRE+v+UwH95yzUN+zlBuONT+Fws0K5F5sNRA1+imFTIDZLrmzxe4mUYHvdmssk4O20oKeFoj+A03+ySoxdjaYwUKw0KH4gkURds/qtc4mBzOOexM79xFkkOHcHRwFarXOZ66WX97vIFIpRjzZtEdPmhXo+P1YK07ufudUuqykTqfHA2xUtBJIGdJZ7EBWJLbI8EgA3mr5/uXvC0PFTtmgfzq/G3PS4fqOmxEIZlrPIpxPCqLey+5WrV80rpxm/JfHYzO48q0+YHGgSXdaQ== 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=gVd0enhwIWaYRhCmoYWj67z08taQidFZsLD19HHO84Q=; b=V4AplUqZaDNlHGEnJpM4EPoXc4hxUXeRNE7azkxgCEvgiAjpVYUDRxGbGJuWt8SKqDjfTuAhW1thsvPaE2f9bH+Jb7/MONAK8ehm+acnF0vtcdoCftitpfr7ZAyF86JgvduzllMmz4a1Sr4WsVlQ9iOiSKdBHwwadm3cERCqp4CvoOqBHjLNLqUObIfcYhZ33ocHjxVZ+lIiJc0iMVRrut7CBmSBsIiBoUb8d+V4xR1BR7cBgBd0Grip8R8HcfIHX4sPuJvbPyrRkG0IK4rtwRldD2A9706r5MWNwG7tTqtIX04dTI+qKEgBQ3dM5NYxD/QEyp9NaklWEyU7wva6XA== 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=gVd0enhwIWaYRhCmoYWj67z08taQidFZsLD19HHO84Q=; b=NYd0IdMtZjgQAhA2Dr9Ekh/Y8JaZrImo/fHEmGnI8DBgJs7PRtmxuazCimtt/AoVG30hgfHKQOw/ic+Ogsj+BVcZFHHjxa4L1rPYqqe5X+nSPN2sF4KaLW662s5pFG/6zcgLNpvyORjGt0SAckqlB17RyYs4Eve4u/WicFmhhKE= 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 BYAPR10MB3144.namprd10.prod.outlook.com (2603:10b6:a03:15c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20; Tue, 25 May 2021 19:55:27 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:27 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 03/14] xfs: Refactor xfs_attr_set_shortform Date: Tue, 25 May 2021 12:54:53 -0700 Message-Id: <20210525195504.7332-4-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03c93017-0695-4813-6327-08d91fb70ae8 X-MS-TrafficTypeDiagnostic: BYAPR10MB3144: 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: WLKxpsncQYkKa98YhSEIoj0AVBqoNjMV7rjwu5/CBJs2tOyuQEvdMIiywxsEWyNWzfKleCCjasrCr591wrfAokMKx+x69FNt/I7HxdtrWz1jmU0v12tRxr/fvHWuuDJove/fRlbhA5KxFk0sdpFa5RvT2kFe2JohFohZmWkc5yCdBIxGudvqBqTYbuNlB/kISurV5jL/5Lo2VORB5bNiH2hGyY5E0N6YxJKh35oli39KqXyWUk2iqwx0+FGlKbCzHfmbQ9kmIlhkkDn4qweGBv1L6hPBv6Ig32iiMZwGA9DJgpI1aULxmfS2EaG+6kb+qceWnwF1BRhUl46HgXtNpCLzqW86lmf2vkyjrhuKcp/Ev0d3yr9RUahoxXZmnigilKuRiwRMeIJsOkguBYzT/XslP+GpI6/h4doF8MNj37FS836CcbGegJBtX+HLY91xXFvm7fsP7QAnP00Yt0tb84hcYn2DZkwmd953OOS9Fh34sztK9z850/0S2s1RF8Qz+ja5eK0N+fwYzmY3ZwwjZJv3uOIjJRVTVaumyldKLdkJSTMlES3wGCph184VIr+8YxhwAVZnwfirdjN+g+PNbIwMl33HCVnFJSfMumyaU9yugDUFzwn3CkOY7rxNq1n60PQAYeLquSfyTJ0johbksLZfhlHHix+y+t6Jx+5/kGGqZwIVF4mD62hd+mvJZgft 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:(136003)(39860400002)(366004)(346002)(396003)(376002)(8936002)(6486002)(6916009)(8676002)(2906002)(26005)(36756003)(6512007)(38350700002)(478600001)(66476007)(38100700002)(83380400001)(66556008)(6666004)(186003)(956004)(52116002)(2616005)(44832011)(86362001)(16526019)(1076003)(66946007)(5660300002)(6506007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Gm5+TJH8Thytf2o1PnnSdTbAvoybz704rtxt2r7qlJqIQN2kHNInZa5CcJ2aKhSw7GAXEgAL6B1qVjB+GpMRHEGIvbJK9kt1Yvf7d9QIZTZZ5iTpNGqHEmtWeVXq9h6mHhz/FAYkTBwXhYFO6N9RQIJbyVjYkkz6tKoaemcR8ran6mx1kD5+QI0QhQh6KP9UAiusPklAryji9b7cNcTpfIzS4U+KnIqDzToNC+9sa09VhfCTWFpL0bSHGzSP2uuotWaT5glL0B2wmKklIzfaRsES80weW6fw/JLpHGhgysbXm1gsqwbCGnkgCzNxTko5VHmHqQsVIUV2SeaxoKwQ2PJO2cPRbAtr6/auzC18Dk1Fv/B5kbMjrPpVDWwaSNtTpOC4TXxeTaBrXVI5qTzBXPtqKvgM8ryVpDLtoGTtK5q7yfDjWL8B4UghAYqawCrImgSo3e7m7LeIbMJLd7UqtliPvIHma/REXmlL+Xl4bZNq3SJ+GnwBylX96hY8IdwQfWRyULCrAURKGV0gqCk7FuJ7BWs6r91UutniuP8q12nfa6azwEQFiNwPF5NzCuXrU/+fEpzvLbypqcfLP2tKXLmqt/Mj3aKFe5ZriWOL0V/b7lclHRDfXVQE293EpVQVr4IrHPS22e1N8PpgpIZbzVr1ezxlkZs4kzzYcTCzy4IIBR4iGNfDp0XUmthCxGZXWLfQqyy21GsW9cu2InjX8gJQs+kmXvxdjsgVYFkbnYGA0zoIANP8S6rrnwebORxosF98qjRXZoTZz9BqbCVojSDCasUAbchfNstJkK0teEvTpbUax1SnKLr7YrvA6jLAhcF+ZbtuVu3zQv6gwz2uzz9aAij7Ui1ELom6+RYuoF3RHFhoXy8fyI2+2JkmAsd6ZFPlgURiOti4MkLOwzAcY06tNk1s7AgfVJVtUu/jQdyEZdxGAH6MEgCYGxXtmdapgoQrHd59xLrHrMt07FeOgU1wMitpnmfmHhSS5SfdawLVVj5EkPz+3yJoYVoFnbVDaiT+krewrL95exfFo1OnN0n2lzwbQ0NEvrq1gwN4g8uxVQxBoM0JzzZiS1e5SZDWGt4wwjZ7TdYQhhndE+OrzVHLvyRXupo7GshfkFLGG4r5g4ZgI4wumwTaiyvb+Q6iPdj2b4mRzCh9Y8PvW07sj835bYEtskYHECdhm/wv15DJTsLRTGxAGiuUFeM2kuv5ztGvXxrCYYsCiyrHc0FVcTdoNOZpH8v1TXx9thL6sOtOMtmW7BCbm6oKYdezaPyYegikLEkfrZx+rj6smLIPhxHGnT70m9XkTDNDbSfjU/im+cKPrfSR90Anegy8Deng X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03c93017-0695-4813-6327-08d91fb70ae8 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:27.3572 (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: YjrlJjLS0iWyuKuJAxybzHfKtA3LoS6q2Q2ohi9f10tLPvETa99chNo2IeSLBvOVmlMA0GqaWepkvyDupnVG7fCQhUi4zXvqsgZE/2JnIcY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3144 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: HTD8JZJRvAcHvDu-qkkpKqI3j4oN-ImK X-Proofpoint-ORIG-GUID: HTD8JZJRvAcHvDu-qkkpKqI3j4oN-ImK X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch is actually the combination of patches from the previous version (v18). Initially patch 3 hoisted xfs_attr_set_shortform, and the next added the helper xfs_attr_set_fmt. xfs_attr_set_fmt is similar the old xfs_attr_set_shortform. It 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 Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 8a08d5b..0ec1547 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -236,16 +236,11 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } -/* - * 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) +xfs_attr_set_fmt( + struct xfs_da_args *args) { + struct xfs_buf *leaf_bp = NULL; struct xfs_inode *dp = args->dp; int error, error2 = 0; @@ -258,29 +253,29 @@ xfs_attr_set_shortform( 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); + 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. + * with the write verifier. */ - xfs_trans_bhold(args->trans, *leaf_bp); + xfs_trans_bhold(args->trans, leaf_bp); error = xfs_defer_finish(&args->trans); - xfs_trans_bhold_release(args->trans, *leaf_bp); + xfs_trans_bhold_release(args->trans, leaf_bp); if (error) { - xfs_trans_brelse(args->trans, *leaf_bp); + xfs_trans_brelse(args->trans, leaf_bp); return error; } - return 0; + return -EAGAIN; } /* @@ -291,8 +286,7 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; - struct xfs_buf *leaf_bp = NULL; - int error = 0; + int error; /* * If the attribute list is already in leaf format, jump straight to @@ -301,15 +295,8 @@ xfs_attr_set_args( * again. */ if (xfs_attr_is_shortform(dp)) { - - /* - * 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. - */ - error = xfs_attr_set_shortform(args, &leaf_bp); - if (error || !args->trans) + error = xfs_attr_set_fmt(args); + if (error != -EAGAIN) return error; } @@ -344,8 +331,7 @@ xfs_attr_set_args( return error; } - error = xfs_attr_node_addname(args); - return error; + return xfs_attr_node_addname(args); } /* From patchwork Tue May 25 19:54: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: 12280021 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 05AE2C47089 for ; Tue, 25 May 2021 19:55:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDB8661358 for ; Tue, 25 May 2021 19:55:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233004AbhEYT5F (ORCPT ); Tue, 25 May 2021 15:57:05 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34180 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232989AbhEYT5B (ORCPT ); Tue, 25 May 2021 15:57:01 -0400 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 14PJnntH184984 for ; Tue, 25 May 2021 19:55:30 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=QAS76PG8gCV+t1DEcGzPORiIJl8CPTcLNTqF2xo+fyQ=; b=E41Z2L1D1wA623L8ed/Pa26DbLVxxlQsjKg6Frzdg4N7EOtGqK4fKGFJ8mZWqGzIvkrr NkJAsS5i1p+hfeNASVE9FxslyTzRu1h4vNhfNORFhPGccsEAr7q6QFC88453PjsSolAQ BzNQSrxCANPGHD9b2QOfcVTLyKk+HkyScQdNMiTJQlx2Qbw+oARKL+6b8XcQLwh/1ukS hzgVGdBfjHalkAcDgQKMkeRipsndhEjJ1A732d7OSWttQnPTDo1xfEEVCulPbeI6orFf nls9mdE0mnjzA4+MUyvAyoBnoyn+n6i6WUc1m5z0QX28rzZFRzKbcTUI7zU+XBgGUa8e Cw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 38ptkp736j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:30 +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 14PJtH9g101715 for ; Tue, 25 May 2021 19:55:30 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2109.outbound.protection.outlook.com [104.47.55.109]) by userp3030.oracle.com with ESMTP id 38pq2uhp2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i49cyQcqXJXkPrO5k4RWapL7OAhcdBNmR3A0j3mhf9f0qZ1hcME/h4d4FinunucZDqBUwaLYj5SqlUJpOU6rrR+aVMppbSpvc4BF4iWDecX5R43M7zrgPmCWK4snpHL64MU895wwS6Pyb8dk3dOv2ZIkz3YpVbJLQC1tfftSi23rHl8UryQ8Aw0Cgykang4WswAwP5sHIBxDoTLxMaJTmhP6NPxPYqXSkAY4rxBJc6c+M6LWZjRwHGPZPCqmD9B9yvoi51SVuxFFjL6hTR0e2A+yOWvqobamDDOMnKwsNXn9csijaB/dowLSEm72X3bGHtE1k8WQWtMxb5/I3TD9MQ== 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=QAS76PG8gCV+t1DEcGzPORiIJl8CPTcLNTqF2xo+fyQ=; b=nQkC/iDf8+xJp7Wb4aHvuF8w9OB3SVLoIqlafZ3zE8SjiRcOnLnj6QtMXcko41PbBfCm4BQJguboStv7pBExq3m7wOE0+y0uzO5tKGsTHidzvROmc2HC6bBRwa8Av1vgXaYQkyXnWbhm88vxFvprX9OOQSywUbRZlTOm8wVfKhFmdAGUtphwIa3O7jhXQxwzlk/tWyuQxzpZAVd1+p5KM4QEPo7RBOC/eq4lXIjfS9Fg+TN0fNbnUOvxpK5mqE34YuX3V6NfD/mYXExgEszbJFQ6a8pPgt8b2I+8OC9znnq6b3NiHxyE9nIIT8GjBgdLU0UIfNE7YtXhWVsv29jD6Q== 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=QAS76PG8gCV+t1DEcGzPORiIJl8CPTcLNTqF2xo+fyQ=; b=gYSfSLfarvGCYcjXQoAJY0uJiNsggvgVlCDfnt2ZDfTwH28BwGBQtL/xv5AeI4wnQLIce7h9uk68vhQsJQp2xDNR46PlGgH1DHtHUrzN2e921rWLk0t3YS8iK0oZ+bsWEsDeeyQt4sT7hFgAtma/CCpo70/EEpWJrfhisoBoZmM= 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 SJ0PR10MB4478.namprd10.prod.outlook.com (2603:10b6:a03:2d4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26; Tue, 25 May 2021 19:55:27 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:27 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 04/14] xfs: Separate xfs_attr_node_addname and xfs_attr_node_addname_clear_incomplete Date: Tue, 25 May 2021 12:54:54 -0700 Message-Id: <20210525195504.7332-5-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: da052f18-a572-4b7d-686d-08d91fb70b1d X-MS-TrafficTypeDiagnostic: SJ0PR10MB4478: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: obnHq31uOX+gvzAxDH5WXuioh2U+kERLJZynaGS6MZydmnYQWFGTWdERyRIqMkpkMjaRsiXVE4tNMVRcvlIaLUxMSuveX4kFwEmxJvf1KIVAxwVLAFMuoMIYXRV4UHuIzXqTy1kMbib9o6CT2/kT4i0RmrG7S3bpkophfnItla37r2/EJW0PaI0z/AKp37/MlhYYaQ4N7B8oKDezi7T7AtaT2BJal1kvxXtDeqAdyJjff5w4vG8UQD5AWn3pi2BL63wJ2YxWEL4SKZUGhrUu5xaGDmFF4kyBA0gLoY4hagx7W1Th0AFp1mxKPX4iKRQ1xgmzLm5yGx6fiArnxqPAAoP67IHCciuMEag2yyv/5SN1IzaTHW14JgiTnWP9FtrwKotqkPwdUjYMJmpFr173qNMBrfnYCOTPhuaNAwtqJpNKX5M/jvtOYIkbcuFoeCDW606A/KwaScN/1LpJd0SrImm126fPlar2Q4LdIL+/eWI0FfwNPBUXuC3LT2KZbEhqRgkmC4FayDYrNhMa/Xv6BjA80cZe67qQtwX3T6irq5vtXo7v5TTx9UhU7J3OMfGNv5Eix0QPO7W/Kde47tF81pwvxpLbDYek1/WEwrgTZT+xwZ4YbXvPNffLq5cleiddgVXmFg12sLDeaEpv3rMazPbIuBj7KwETJ/khA1yCgm4wHiHS3h6kXhijC2spQIHq 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:(39860400002)(346002)(136003)(376002)(396003)(366004)(5660300002)(66556008)(66476007)(38350700002)(38100700002)(6666004)(66946007)(6916009)(36756003)(316002)(6506007)(86362001)(52116002)(2906002)(8676002)(2616005)(6512007)(1076003)(26005)(956004)(6486002)(8936002)(478600001)(44832011)(186003)(16526019)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: C3l8XClJHKdEz1GeIxDk5K3aUpvRj0yjjf9o8A3LvunAYoz4CUlZCQiVXICGedLVmNPGyrB5tzq+3yI4qyQuAstVtf8XIcP/LBpU0Odxkxtb9xYFy52hu2TQiGjlu0vqwP4wkMGgXi4EAGLL5JOGJ8peym37SvuUqdtv0LCDhzP8hLsDbDBr4rEcMK2NhT+r/mcfTmYe5o3gOal3sw9x5Gf4eoBeT8m6x/+SqVIibRG7L+PTExT8bl8i5OveAtH8fSkNEPzXepcW+I1seHw1JKej1NBCqBt9nkiTBaJxeZBAlpaBuiL80ICjfZ11a4ORITzzf0hc88aSGCpPF1XRjdAy/8h87jM6OQPM92i7XAEDw1Zv6Wx3tOMEVpQQZPM58vQT6XM42DGJ3Yap2zzCtjmVFdDxxUGkvl5vRipEp/gNXYw7UGRl81dqGdpVdsJN5/lymyB43L2WPyCHplRrsUxAosKe+o701EyPt+uDiPIStGBkoBD240OcGlpkpjl3YAG0X0oQVCMqE8gUt9jJwHDmEoXbaZGJFCaZhFhmx9Wy2k+E4a6oa3UdaHUvtfACSQ3IbvLOmXj5iqGZPLctxf5tJfzflGH5hh6qbcA4hba/6yKeFUKtPZlnT4DVRLAS/1L56IIaYNpTLCl3egqia+bCjfHka/jL1BAOlhV27j8RwQZ94VPTd3xxZiF6prK8bn3ENROqOGomZwbzneEEz8aC1mFZ4Ljo47bzqJs4tiQPQyLDMEIXi/zmabYkqnikMHjAa7jtNZsCKJ3qV0LuROCmuZqFTM5N6KCaWfCaUJcSQmn9REK9Vbq8CjK7EhhaCvORO3aagZK6glcQGKnXqmIhBpOfEIW4T85HlJU/MHeNoSurzYlyZVfqp30FiF8KJVa+pJVWFu31bYOdIKofWrhlpMkTMfsn2nroRC829EhCv/hcp1DW5vMu80NvS1f+MhlCgcrMnna0ExBiPV40xZWXa2kfBD6o3e/danF9RvLbgelFvACyMZIxZjbIjp63FP2YYei1BiUMurilZIA9CFMZflsix5HLLcStiNTVRtNLfWh8C0MWs77cut3nI/GEp8RijBfL0jv7ec+nLYykS4XfbPxFMaKxEWhwWesfmSAUfpLEBtD4IgQTfyB0Se72YLJShKOQVo+y6C3EoHGtj2r7F4IJspzzeDvMz2KO9tvKcMcNR61rRNnIIK7h0SiOKHceKRVHXwWsdsosNPqu2PAHyYOlgvGfHJoBW0BSt99OYBZLdw/pZZVjG6+MbDHWD4JzmOWap1iA8iVxUEofTzwXudTcs/Tbz1r0AzCU0WbbjHw0P69HoArTbsetmAxL X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: da052f18-a572-4b7d-686d-08d91fb70b1d X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:27.6649 (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: sFTagAnmfhWZUOiuRcB4hF7jx3uDHZ+PSKVSlq7pvNj2QZsoFYTVyYkDf6q5NZRsuN7+OHVxhf9eJM7bQyji1spgcpg+ayn1ypmFzew/TLk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4478 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250122 X-Proofpoint-GUID: ahZIC0of8YGOBBan0T3zoduC5nk9yZdP X-Proofpoint-ORIG-GUID: ahZIC0of8YGOBBan0T3zoduC5nk9yZdP X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 Reviewed-by: Brian Foster Reviewed-by: Chandan Babu R Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 0ec1547..ad44d77 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/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_clear_incomplete(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); @@ -1073,6 +1074,28 @@ xfs_attr_node_addname( return error; } + error = xfs_attr_node_addname_clear_incomplete(args); + if (error) + goto out; + retval = 0; +out: + if (state) + xfs_da_state_free(state); + if (error) + return error; + return retval; +} + + +STATIC int +xfs_attr_node_addname_clear_incomplete( + 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 Tue May 25 19:54: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: 12280033 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 36517C47089 for ; Tue, 25 May 2021 19:55:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B3F161420 for ; Tue, 25 May 2021 19:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233003AbhEYT5J (ORCPT ); Tue, 25 May 2021 15:57:09 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:37922 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233006AbhEYT5F (ORCPT ); Tue, 25 May 2021 15:57:05 -0400 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 14PJnOWM034966 for ; Tue, 25 May 2021 19:55: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=szvJfbvwmwL0QODj5H3eGmNFZ2raelHNU9VAKOWXOIU=; b=TpSlQgrGJMsyphzsEn/UpRprKJJwLR3IU6sbC+/KFodg71EcuHif7R8ZswVgv24bE43g hDFVB9IErHRBx1t7RC/3Jqtv932in/XRlCaddc12cYC0xwlaPVI/d8mvArA3Ak/mM6e2 Btev2L6bKz2jdso27v9vNCqvGOgr21SD9YMKdKMxDULXnUMWWu3kjbijEpkuzIvbsFp3 /ybKSp0Lq8Gtcl82QymQmyXptX3TvkF6Ag0TSe3Zx31quKZozjbmDlsb5GN/u8RYdf5y HgSsgCbkyQa0NYDDhNvqbumm25roz5oRDmLOulaM/GMCxt/EQz1jDdvYl70xuAx7G4At GA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 38q3q8xkjw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:34 +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 14PJoDih188864 for ; Tue, 25 May 2021 19:55:34 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by userp3020.oracle.com with ESMTP id 38qbqsjk14-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wp8eAAhBh5/PlrBya5sIRRmQu5nZ95mRgIewEQ92b9D1jvpXbYezStL1jI1R16DXlIk2di8Lk6KhG1+N2/aQAvtswQJZxVsN1AlGbWFVH/U8fhDo+X85TT25+wuupUkVG9qmnkoIpKBVdZWDokURUgGO8iYnW2j9orrqtXXkUMBtXMEx9YQ2hKsaQ1eYm9npGIq7VAHwknNmleuYU8O2oQSgxGktDnc5ETbtLE0w41p7YTkm2P3I4qwJib1RlvGFxDhfH8embOzn1ZFrcNyQrXbPvGWY4Qz8xLJKrvY20+6RXBPxXLK0BHIGb39UOsPAXZ3z9LHigkRYm4zGv0aijg== 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=szvJfbvwmwL0QODj5H3eGmNFZ2raelHNU9VAKOWXOIU=; b=XHHHx71ChNVDjs9lgVvlg3404YEen1a3IZDDPtj2lY+EKlnTHBiYn+MLOKMsn1wX36M808fAv+PkuiJw0mo9HKWbIb2Wo08RZ3M73uHXSzfEBcE6IJ+Q1f+1TYCFdBgTZb+6dKLiIZqMaT55MJdflmJjL15g2C3V1DYQmrZpyg8XVjSE1SLIBzN8mh1DN+QL+tKENzvb82+9JoyE/OGKbhrLnlbP08bdY2h+ksoREhm9qiEf5x7TvQSa6Schem4F5C5EjYfesQupcA7Bmc28GJPlIc1vHbmeLzc+Jy56XJxsBWvkqgmMzhRk60KZoNtfaityME5nHOTkZo9EjLCm3g== 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=szvJfbvwmwL0QODj5H3eGmNFZ2raelHNU9VAKOWXOIU=; b=g3Za/MAWNI6N9hPfk+ZuPVyLKiavhf6U4hgyOxCWmuo+dhveQnXIo5EWd2dHIXJkbjy1Rb5Bavi/bKOuL1p5XiEeYmEDIlJQukKRcCkBQQLFO1aKXfggZcynCFJ/Fb6o3GEeYkdGO++POnUzOnS/eoHUXPIqJ4mQbUH3lcWm5UA= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:28 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:28 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 05/14] xfs: Add helper xfs_attr_node_addname_find_attr Date: Tue, 25 May 2021 12:54:55 -0700 Message-Id: <20210525195504.7332-6-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52de8ee4-e386-435a-193e-08d91fb70b4e X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0EPJ46sSFTRP6CLC97qmGa/oaYCoFiYtk3vVKO1wuph6vLO58qmmsBOz/tKncehjPqV6THWBdYVgu8aDTJK0ht4WWC5xweT27ispwoNAsB+G9lqh/0DmX31SmenN+MWn12hKmj+hDzphJ7AjwhMUAkmRfJwds9W9yyTHuihKUYIyNe6KFA00ReBcQeL+yrMoCsS0bBXx+1ZGyF8kh3Z7RiZRIsl6LrdHEgMqcFxcKoPuoUH4iQwfBb+hiL8LO9CeGXIB/un3CKJy3Wk/1HfDguGB/yoOpf1psbyhJqVgEuT7b2nmGwRTPWKn99N5onm+y7ZNrHLk7O8kDoJU1KSnAHwVIROVdJbDA7PxP11I1aqtim8j+XQJ2Cz27YA82CKXppUyYfdAA0lDGW05s2NS8p2IRDW94CfgiMfwkYnDJAvClKiTjPqVDE07ZyrW6hnnQ5BZNFudw4iqXJulIu3EMEG90jufWsmJe1SsR3XcTLhs5juIg4BmiQHzX5JC8xMziFHExlQOb1ue2lKgVOFjcKU5kElQKmhj27uCBRJTugCbfuICtvFETsimj1JQoMrNonpP60So9jxiWQRyUGedTr69SYy2OcVbnuP0BOghLvoHMoXq2+T9ED2G9CO86xXiACTuU7qOrEeABMvQJH/mTLm+NsF+Ub4bD9El/ag02EE8FNHe99Y1lOi0TcfFICz3 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fBCPqmTlY8bZmshjvpBcQy0DRY+lsK4wh3UJdk7l07PIMCSgvgPlR/nIWiLYGoDn8X5Icb8HhBFwlRv7FzhxuRd7E9hT2XuZh0XG9a5/znSnTgyPidzKGey7Rg2YBudJpNP5feuzRG2fDpaoKiv7Fzk6MxSXf4MAIQ8EW1VbuqdpFB6v9CQ7PsxBrJ5k4oaH3OxDgaglaLk+186PQ14D7qMvh6IO3t9JItN+ofqLvaVhdeehNrZCTqQvtBzx+K4a1k9CjfJ+jiQZGCqgB9TQZ8oqtJEnGF+dpPaSozyr4g62vp91Mlcql2Jkr7AsnzrJ9ateRNbaKUTIYohRPFZrAaJ3kykaozz05uaLqOB9d4kXkIjtHY7qAJx83+9jTx9vWtBFZ1/oBsJBZFwsVcTqKN2kgIxkpsM2iBe87c7ppxOFhBwXokuLDUJ3gfZOssBWS+mF3VyjGhxjVR9VVtUUloCp+uZGCqbwZr9ARqljBMkM9sP1H5S9GE1PGP2Evvw00jM3xVCwG1PlFZ6v6Pv3WWn+eNcVnYsxrBP/o/4jFpU6pGKjXPkQHmEQzsID+gRSjv8fv7iMbu9cpwFiFB1LQ7gODjIoqG+0r8oj2Xb41o/N0Hkl6IrOKdopjSdeddM0VqyURvdOXXw7KQQGJRoNHmePOIS9EjtIdSa4fYd05tPUaDEe3ouAy1PVYymHNGoPPU5C4dp7xscDeIk3YIIG1m0vzyy4G0cGheMG631pC0bz2fIBgV5AHZnE6+2kVjhrF9zhe9li0VWimqAHHyDBcCcQH4Dorcw3PUv1xMlwea+RHB/lOlNpiwBlE5RaDBSJ8vwIwYpyaaqokSOy/XHljWva0TBdKsoxYSU3R6wXr5Mq+XHT7/LU+lCzCp/8TT7tnf0NyIGdO5dWaGh/KqXpfGaEaiNSWzvZHV/5nI07NBkIHGB0IhmEhogr1gikIGKdoAKbmtz4MLyXPC5sSp+IA2ymwiVhG0+XM3IGy0FS+m4l+0Zr9ldLbZ+6j4V5cgauP6octLfcjjCA6V8b+c+KRt0knU3Bfyy5euB3P1uEAHENxRq2yBGJwhgZmQbVcMLdCPVkevNISYkIrsMd+MbErGF4HY2FZbSXYX2F0x/G/x3TehY2WZy5M2gUyl1WOw/M1yrBQpHdhnPOCfkpEjGlcWN7Dqc1cnVNr3yYtxhZlaaOUIjQyOsklz/QkCrYD0+r70OJ8Q+W2OBvmc5fgpI9a3WSII7gZp500USm8w9OgrqzRkGyqYgbFxDLF1eyd2D1FDUvKg3r6FQtw9QD4WiHJ26cN5wJ0PsaVynIdgDEkA23Wb/78l5yzZCbFkZ19vz+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52de8ee4-e386-435a-193e-08d91fb70b4e X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:28.0487 (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: ybtv44dUrfITg0BiHGm+lPAtdGO1MbtAeM91ijNWfoyl+OimzPdOIgCSU7OCMuMd+n+oTchRg7ZZGD9xfa0kpMAyDOkSG86ywX3m1j6pYfU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: gwhKYGoHbDazRBVlSCDaKBzMTdRgsFw- X-Proofpoint-ORIG-GUID: gwhKYGoHbDazRBVlSCDaKBzMTdRgsFw- X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 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 Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 87 ++++++++++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index ad44d77..5f56b05 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/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_clear_incomplete(struct xfs_da_args *args); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, @@ -287,6 +290,7 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; + struct xfs_da_state *state; int error; /* @@ -332,7 +336,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,48 +907,26 @@ 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. */ - error = 0; - retval = xfs_attr_node_hasname(args, &state); + retval = xfs_attr_node_hasname(args, state); if (retval != -ENOATTR && retval != -EEXIST) - goto out; + goto error; - 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; + goto error; if (retval == -EEXIST) { if (args->attr_flags & XATTR_CREATE) - goto out; + goto error; trace_xfs_attr_node_replace(args); @@ -955,6 +944,38 @@ xfs_attr_node_addname( args->rmtvaluelen = 0; } + return 0; +error: + 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) { @@ -980,7 +1001,7 @@ xfs_attr_node_addname( if (error) goto out; - goto restart; + return -EAGAIN; } /* From patchwork Tue May 25 19:54: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: 12280025 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 80620C47088 for ; Tue, 25 May 2021 19:55:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 69C4E61279 for ; Tue, 25 May 2021 19:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbhEYT5G (ORCPT ); Tue, 25 May 2021 15:57:06 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52442 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232992AbhEYT5C (ORCPT ); Tue, 25 May 2021 15:57:02 -0400 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 14PJnFUX162078 for ; Tue, 25 May 2021 19:55:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=/0kr+2CVZ0D/nnuFADMy7+oShmgC1zOjuTk0MG5Scb4=; b=Af5KxUw0W/ZlP8iFZeOc941FKm91Vwi/ZFgBMTeVzrfki0zWrrZVFdASdiszyvAnNHzW 8BLZvdNSdHUYbSVXxfuTbivRW5kaT8uF8+AKhLgduoRkx90wWKYCROuLUKHQ+y0CIDRJ PMlUNFgn0cwOBOPmglqaKxBlZwOOyJKZeZdoK39n2F+Gfg95kj8DSFXEbWR4Q8V6bgAq iwQdu7Ptan497mPpsH4Yr+MxI3AG+Use4nyLXi4YaitBCgl91cF1u4fJ0cHYg18ce+50 15egf6z6VkxtNyc9flP5VuiYBmevazR9oOzWdlJ3KYitto61KOW3LeLq4CqPnwk02GRQ RQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 38rne42qcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:31 +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 14PJtH9h101715 for ; Tue, 25 May 2021 19:55:30 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2109.outbound.protection.outlook.com [104.47.55.109]) by userp3030.oracle.com with ESMTP id 38pq2uhp2u-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RO3R1D1vjWqmoTCXL9UJ01VFAX8NDrxaL3XwnydH835tHa4w2PohWUjGRR8Fkyp6HFLpRq0vCDDT0eXRQqfvzUt5aWRd7/AxVnMIDK0cO7cSYTkMYubHshnpapnGI7oVwHkKqplgDq4EjApdO+X5K8DICpd7Tw1bjCCXDR0ioaqe5nagK1o0slEbt4+KxdXKspskEP138fLe50hR9CHDE831Bo3D84BfVQ3cN09aPC4natmBCM9NHPv7u+8ekir7NPAt6W6U/aQI4axT8wuDs+FKZjn0zJs+treLPiykBllbg4YHyUU1/o1g/lV/JC84/XCcctuUOb2UDZnQq0dvcw== 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=/0kr+2CVZ0D/nnuFADMy7+oShmgC1zOjuTk0MG5Scb4=; b=QPm7QePC95cyP7i2fEHBPuhbNF6Uc4p26AlsROMgAAoKKLyqMGXKT9U3zP2NSzITUYw7Tg20h4EAaC5K/wZ4aBAgLTGagVLINSewFAUOQ+9rgphzXIrHhqS62h5sGs+Jqf1eKRMAMfdvHNwGodqEuZ+fLu1YhWwMxqvc1z8r8nYc9q/0vjQmVZyvWFZLj693SksOdVdYEbZYz+RDFk4q7/yYrsi6fDr4FpDeGuHjr6wI3LBDN9I42Wlt+S0E/75f8MjP0pa2mCstMRjfGHCjBChx339uSLHpvSb+SU2j2OcmWUHaFiYTP9jvBQBKE7w4T1+7T4SxsuTtayj/KJoa6A== 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=/0kr+2CVZ0D/nnuFADMy7+oShmgC1zOjuTk0MG5Scb4=; b=injmqmW73Ef/sYBdWHulgqdOyC2f9mUwCO3Qvxx9Z5ji9QQQbtFRVc8yJgYEniGv/qEtjeIpUGHPre0NTsrDNqjb9JL/hqUYa8uFO3YE0y9iPQNX6wJDsL1QVYhJx4r1q2XRHt7MOR4kchGwguf7xizJyMSwghuchG3/4iH9zM8= 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 SJ0PR10MB4478.namprd10.prod.outlook.com (2603:10b6:a03:2d4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26; Tue, 25 May 2021 19:55:28 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:28 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 06/14] xfs: Hoist xfs_attr_node_addname Date: Tue, 25 May 2021 12:54:56 -0700 Message-Id: <20210525195504.7332-7-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f2e00ed-32c5-4928-42b7-08d91fb70b90 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4478: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CZIj3R5P9Uqp9wjoN1tqch6zcOzPg5UayuEIi647fLKLk0DD3MCv+mmXtraqTpk425b0WMmzgxxhYlEx1tek1uJXAkwaIykdZ9OoJtTOMvs2x3MIGNOGRS3/WBVvRL4QaOxDKxGR+Ie8Kc2ZCNs1WM5Xl2vsQZCpDILbcsvFoci+dROtBXqMteWBuDTBXAK1A0ZgjlNWRYausOS379nb9SV/sdS7FD7V8UlhCteWHb/8nH2psPF0WVME0vPT3gLjJr4wcV7pL/HeIbmBviF4oAXuzD4Ns7Pce/QgOFaeoiJo29vZMv9DkKEkbvjUUWbCGSYq6WBu4VUIBmx2UOTTvYjaRVSsPWN3OJOjzJUv2J9d/S9zP4CbW0seTseuO/5aTLieHqLeOd2oZYwl7/5blBrufiDrn6ugX93MA61oqsqYNvlh2EqSLNrlOn6e5sEkh43ogksRu0QIl4pixjs22DpWjdum9KpSXczVrHDvrcRanVrJFvVT31t1naOMmoOdSyeAIWEzJEDjvkoSzZz3sQ+666QoVqqo+Hwp0gko4Z+pEnt+yVdIYTFmFUbRumZs+pmbU86HNAeKtiBXYUDqs0iWT/Q7pBPz2wVv2StWxzTMjSHVend/SvqtmT70Cx0gqrkhAB8YwUBzQ5+RrYAu1kUx0WPdZbi/IDrIHtElct+VyOfWWtkP9MgjPOQIYEr8 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:(39860400002)(346002)(136003)(376002)(396003)(366004)(5660300002)(66556008)(66476007)(83380400001)(38350700002)(38100700002)(6666004)(66946007)(6916009)(36756003)(316002)(6506007)(86362001)(52116002)(2906002)(8676002)(2616005)(6512007)(1076003)(26005)(956004)(6486002)(8936002)(478600001)(44832011)(186003)(16526019)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: B082XEAscNkh8ib6VjriKDyteQI75Ndmrlu4jpMpaoMDPJc2vumkHkmBdI53sLN4hw3wesQzapfcvcjFV4QV3JC8Zx9n2PWO5Vn0H/iJs9vkHMbtmH3DOZU6BR3lFQuFduAcDU9u6I93+lqGrlnT3OjryHdPo8N7zPWLGXG5EjSxA8sWpqE0KsVex09VV1eiNX7etY6XBsO08qF34G0fN+m80UB1j3dzbm30qbZGhfB93XDNUBmNpx0eESkNmIyV/IeesrPQ6cqkBfmySeXi3mPMU20zxDQpaOvNvmCQHK0xCmp6d2/BQ5Fuhe/nPY7YKP3XS4U81vHrZZ6gtU08UDfhQm762977wH68fRgfVwEKnDxqGlTs2wHbT3KhXkNyR9H8Vmw4O3MhFuob45HVI3g3w4D1s5ccyzUgaETAlpNANAnxaA2c974Ra735iAiry5dLXi27LrH/m4ySe7lMbxB3FmDTwGjl0+iEO/kCxDj+tRr5cabgwKa8jWhgYUlC1MVNs45UIZQ/dURI9XisOTNGTzgCBVoa0wht7A4mUiZW/vhjg3LAh31qJJ92hSr1QrGnzLbmL0W6T0BmUKf0fD87K9hMQL2u/TsoWwHL3Z2l0bFFFTlMopu/V57HRJZR/NRBJgwRBA0oy/XdMeCXRf2sfMVXvo+sxuv+eNgBsuz4U25xLeFbTf3QoQY11cagbNJjhykkXqsxJtdysiB9vQncU1LINOREMcxhVOdTombIx4Y6O4PENn/vuyGaZifUXjdl4HyiF0pYjhodFXLNVIDLwizCFcjpwVT4tT2sXZAO1mwCIDdZd++/0uX1fexHw8lxZF3SRdCbAVLv8LBku6GlblpERwsMD8BysIjPiVgrl7sWAyz+jQJyJ8Q+r3xNAzsuV5VQantj+y8yakKj4sFvUY232o2olo8mkbZIC7qlWFvDwTyb+upimGntrhMzPbJ69fGttlErpmYQKyJZjHg7dg02BQK+vSj5MwiyqGJGV6NG/IX9kC67t9Mu7CdmMZty5OWRipfclU1YAyu25V93+jaUiPMrNbMXzqY7bIYl6LCQTkkTplBtZXIRZwu/43u408pYGo43A5lNb2snZRfQt+/gQY0hitdlIIloi2giehYBvRavs7EQBglBmd87VHUx73NBqFuiU2KtZ6qY/ZMIN0dD5SnesMy0wiQkvobWpWg40PH9aKfVR20qfFb7FZZ5MtkLW3eDDZFQXMRnyuTZTCFDivnhZnEw5qYGzYYi7plUJcKlypUaMSG+wf5sIuXHgs19/r+M7jB9lqvMqrXAH0je1GpGFUv5MRUdDHu4HkjbSA/0VZQR/k9MLJ16 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f2e00ed-32c5-4928-42b7-08d91fb70b90 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:28.4459 (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: y2VxAX2/C7Ok7OwR4FEj5Ph2y4giRnR0kmBQEB5ebGBxVO58BIRaocDcrQp/jSIAg0EIcVYvm5aq4NqvzllSek2nW9dDLoooCg87P8OH8oE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4478 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250122 X-Proofpoint-ORIG-GUID: 0B19QxPVRGM2kTBGVfaQ5bhhPot1BnG- X-Proofpoint-GUID: 0B19QxPVRGM2kTBGVfaQ5bhhPot1BnG- X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 159 ++++++++++++++++++++++------------------------- 1 file changed, 75 insertions(+), 84 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 5f56b05..b35c742 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/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, @@ -290,8 +291,8 @@ 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; /* * If the attribute list is already in leaf format, jump straight to @@ -342,7 +343,75 @@ 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); + 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_clear_incomplete(args); +out: return error; } @@ -968,7 +1037,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 +1045,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,88 +1092,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_clear_incomplete(args); - if (error) - goto out; - retval = 0; out: if (state) xfs_da_state_free(state); - if (error) - return error; - return retval; + return error; } From patchwork Tue May 25 19:54: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: 12280027 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 07F53C47086 for ; Tue, 25 May 2021 19:55:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA31961279 for ; Tue, 25 May 2021 19:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233020AbhEYT5H (ORCPT ); Tue, 25 May 2021 15:57:07 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34194 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232996AbhEYT5E (ORCPT ); Tue, 25 May 2021 15:57:04 -0400 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 14PJo0uN185068 for ; Tue, 25 May 2021 19:55: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=QftG14Ie9+hiiNeRtV7kTMEXLO4BuF0eUx9rNA/vsjY=; b=xMaw6ERO4y+EWipHxT0WotBtU0F2eF7Y2sEaBU0QJQ7zLF6wnBMXFrsCt68SXWCVAg1L wl+DC8th3IQiNDHijwwz3NcYxBUmCpNdWC+kq6dSZcr790GbIYJuLymNKhrauPYNzhks p8QiXLFUHeq4b4cfovGpI+PdKQGmaLZEDeGXNnXCH5kgdW7XW1ZNcFZiztGGhAj5eZ2M wgEOs8c6GcF23rwQmmRbww5lGzVRuGfqaB1wfdWH3I82Dkx9IS6MCM18ZDlIcR7FQpwn QGHSKwj3RBZtfc9sP2s6kfqPNYqJa5Csw4z7RI8tmnuSTemS98q2xDNpDReLQcV925gr Ng== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 38ptkp736n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:33 +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 14PJoDie188864 for ; Tue, 25 May 2021 19:55:32 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 38qbqsjk0g-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QKRbH4MTPdZq1iXSjpgUSkdGi6FO18ocrYLK8CGbKxtkUsWRVLrDvvKG8+rFiLnwx2xTCepXhCQ7tS87sRgVaVj2dF+vhSFggexRugEGHZnorC3VOop3+HtBeJT3ZX3byqKhrFtxPgRA+cF1Xp/MMn/dnZaAjqfKqlIkJ1CLsoAhjnJqZzR+LSqYyWYyGkLw6aNmh71z59m3NB7zD3ZAdY3kzPFNW47Srp+PfTU/fxq4sP+TXmkCF3GwJTdAm0sW4SPfbzwkfTX6bVkmVLX0NV4P7g1vHY87kYh7TFzXXhzC8L3YAxBBDJy3JRJJrmWQ7cmkMPGozaa2m5JUqBHwoQ== 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=QftG14Ie9+hiiNeRtV7kTMEXLO4BuF0eUx9rNA/vsjY=; b=H+HKaQk95i0qMw4VeDJBYitMMM5afvImMw8owcY8pIIXYNIzyWqXJ/Er+NzygFQGLNRm/G2iYNqHJ0F6LJvuUkPj3muhuLndOVbZBiq40XtoB/h2D1QFnmvMKWqr42Zk7nHUp84ZIE07TbZjm+XC0GU8qMapNNk3tNRrKx3hc/NTLN5QW6Icp8N/fSSp+ObRMpJEqwrCciv+WJ8BqbVaVrZVWJrCOwUswrLSUFgwVAvsOMM/22X6r7iIgxvn4Xw2BYhg62SmhnGzsHamVot4KGyBltDcYZncbhcwqI6eCipAIZ0RtNKWeEJ1W6dEEB5iLdMnCgNfIQrdhXUF3eshDQ== 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=QftG14Ie9+hiiNeRtV7kTMEXLO4BuF0eUx9rNA/vsjY=; b=RWBnhHO4PugLG9NQT1w5yYgefX99/IOCW2Y9EU4Tmc7yZRPC3mysdv9ED4CfmpuTJ+fGKbFLSOBovHPta2th9uq6+6b7TOLPpPNKRXGgnD2ZY6JcBFO9rzNu021S4u2r29XvLhlc38QsiD6179A0vmqa0H9L6rBgrEWc8vp6IJk= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:28 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:28 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 07/14] xfs: Hoist xfs_attr_leaf_addname Date: Tue, 25 May 2021 12:54:57 -0700 Message-Id: <20210525195504.7332-8-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 431d06b8-c786-4384-5ba6-08d91fb70bcb X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: 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: d7VhrIE5MU29JUUH+YjYWHcW/dVRPWUP5QfjaJDDr00mHrR7xBsn1rAlR/Nq6d0J14Kxed+aVQSTJiShOhLF8M9FAVFVPX8rmCPiQkL6QC5EPvaMBQMGyYejvs0an89HEl/pDItcWTW1iY0sr5GaugqeS5blr15ryj4trHKQ4ivraisUmil2j49lMz6iIrZ+eTSh1cTeRzJR8OQNr6mHlF6Tc+5BAjDDFUbEQXjYXcQQsJmBLqcxkFAw2Z7mrfG8FF0YnFMhG42Z9NljP/kqR/HzMCLysOEis+DvFTs/NaCJDSZFYEi+Sdkz1FcuTmdoaLOXwlpmX8FeJQT6S8R+jpzZahIxS9FU3iugxivnQ/5mWX9IzoF08l5PoRmMJB32YDAwgiUoBhWUX3pGLTEKSeRlkdvxq02T03BDs3U7JmBhfEy7MQxCkQUR+ePucm0OOmmQJ6akeKAC5PmUu6KkUPXK7VflxqmUo4AAxAT6dqsWHX7zdQzvGkXP45FWWw7pTOnMAshSuQYBJ1DPMOkByqWcKaLEaexHzVHeXffZ1fJWPiLfvgyPIolaTUQZ7iyGCE5NLq6ruudnAvpgsbPJ82dqlwGwwH/F7S/RReQV05lepMiAgj59NtIm3MaHoXhW03kGCP/UlUKSUNGv/nSTkSAHWB7ohcV0/8WgdY/3qoQ4XNXZvHF9nhvH/L+Rcy8t 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Lz0BFCpfBwF9GRDnABPeRV9fvLoLO7dvir+yrau/A5dIvP8tHWbkSRFKyn0DG2UEa3Crp0BM+eTRcjTlSzGbnn0BkZr8GjouZOtibVv3UOSrnwg30ZT6VHSsZBD7pK//Z3+SpYre0ALQha1VhyG5IAJZFdWkDBVWCXNzLM6fdiwUxNH6Uc3KETs9nWPuS6yofoPHzjoAcMwePu4RWy1jwtreCA+Uv4zL9VHgLShud2/TetAt9bM5kw07i1NzRx3tbuFQi5ZeXpHI2pBC5gGealefcyO0VpIUeLXuOTBMlbylHdhin3/IVpWKRjrso1dlpuOSM1bJhgrsrE/SOSMDAbUdE5LYstRtn2U1/nnTcYPigaIhuZdFpexkCbBgI3OzOclrTyNF7inyjR9KPOHXQ2n64MVGB2klW/caadQngzIyNUKH6HbHYpC2v+da/AOOJWDkA25lTR7po+GFtQgz0BDLVqYSQbxk6RxKh35ynGk8eSPROJXGh2wOvclOmEf9tm/voFDIqRF/QvnI20Ur1UgroOTRSsavegjfgwa6m+5wrb5shxaydi6P4vik4uWLlhiKdAJaO58+TKxpv6wyG/jVVJQiTzHDqAd9CkKeewh14yYjzX6p2i835i42rTwZNqgw+OQIWXIr3LF2PIP3x2XSHdc5kJ4WED3+KkzaLaSbMyJexZQ+1MsLWRzZ/Guv91GvzP9L982GsMDWdnyVTzCoFxU8w4lF2xSPQjC4N2RlvvCi1WW6DOXTtB3otTqgGMOuWRNhufNGrfKYcRYhxQwHJtik7mT0ahpPW9WgvlT1UK/49ZezE0R3nUjgMBaYmE5GYsbJUnHAZZdh+JSOyxVMG/VG4+QXnU2m/coZhzuMTxSfIq7xfr1LwlYUPug3zn1COKKA1lJrwsT5qW/Jx9GxHSKQWLvkj25khN/YVa4u31cF2U999FneeRxzZBkbSxpimgJc5Va7G3dADdUQVuL4H3HHe97gv1DqRm21W3KxqUI9JkVPR8yskOxnm/8p1DVpfuUIn+SHOnq0C1zmAiUVRH0BvoH3V9rfIkNj5PlTON5xXs/HSHfKN9JvFhp27n2sL6ysrKx17SeJRJ5hQrfhdpJ61N19XXzSUFm9ISsVI9VcvrqpNRhJ5z4cyB/f0zvaPyyaQsLG/DFbf1mq4HQ0wVf4IzjaZ770RyQIyDG0KQiI50CSolg2f0lZ7CY0d/u1TRlHDO3YQpTPaXeuKrn8UgpMDRzNtXznxgE3EwUveXw16ieTheFvFF4WD5I107wwRsBMXOGVVi5IQ1ViKzsSgSJImJeYWTgnu2uIqlqIaclrgAGjjpJYKtHKBtyI X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 431d06b8-c786-4384-5ba6-08d91fb70bcb X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:28.8417 (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: sNhJwXCrLkQZVOc0la0+O1XHiijJiuQ2NwyO05OBBOAOG1sFQoKVBgi8gDU/MUTr7kq7X35iWUcB1LzyyraO1hXGuuWIysFnCpjocLiGm/8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: 2ndw9-IWxoexWlnZ3CZ3ZahWvK7_5bBg X-Proofpoint-ORIG-GUID: 2ndw9-IWxoexWlnZ3CZ3ZahWvK7_5bBg X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 particularly aesthetic right away, but it is a preliminary step to merging in the state machine code. Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R Reviewed-by: Brian Foster --- fs/xfs/libxfs/xfs_attr.c | 209 ++++++++++++++++++++++------------------------- fs/xfs/xfs_trace.h | 1 - 2 files changed, 96 insertions(+), 114 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index b35c742..4bbf34c 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/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. @@ -291,8 +291,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; /* * If the attribute list is already in leaf format, jump straight to @@ -307,10 +308,101 @@ xfs_attr_set_args( } if (xfs_attr_is_leaf(dp)) { - 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. */ @@ -737,115 +829,6 @@ xfs_attr_leaf_try_add( 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 */ diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 808ae33..3c1c830 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -1914,7 +1914,6 @@ DEFINE_ATTR_EVENT(xfs_attr_leaf_add); DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old); DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new); DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work); -DEFINE_ATTR_EVENT(xfs_attr_leaf_addname); DEFINE_ATTR_EVENT(xfs_attr_leaf_create); DEFINE_ATTR_EVENT(xfs_attr_leaf_compact); DEFINE_ATTR_EVENT(xfs_attr_leaf_get); From patchwork Tue May 25 19:54: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: 12280029 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 7F98CC4707F for ; Tue, 25 May 2021 19:55:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6708461358 for ; Tue, 25 May 2021 19:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233025AbhEYT5H (ORCPT ); Tue, 25 May 2021 15:57:07 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34190 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbhEYT5D (ORCPT ); Tue, 25 May 2021 15:57:03 -0400 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 14PJnY9c184912 for ; Tue, 25 May 2021 19:55: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=Rl5hjkbSu6ah9woombt7OArvqyhdXA1UKTGp09QgR08=; b=uvKeNyAHcSWL/HTRzJoiifHzjssx6W4KGYyHYilZkACAQEUae5d3PVQrQdRZk5foLJ7+ us0TCc7Wmxg3bTSE3LP5uXuwrJjI3RXPWfLz07hkobXoZJPlKpiaqnC+kCkYHLC3Ujtw 7cdjMSc7Yob6BVohAVFQgWZBlzu4DXZL4g7j3jLek51GYt3Yjmj6awOJ0FZQ8t7od0S1 E7AVBRj5HjLQNUmchKyBHQ5D5BE1TVL7iu89MZZ0Q3BIP0vWCRinITpcqxZOs6eZ8oKt OOShDwTQnl6hnuqP/u/s/vTdCYq5kM6+NGmqmPql2Rjsxmut0AKn5x73MgtESE+TYYGK YA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 38ptkp736m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:32 +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 14PJoDid188864 for ; Tue, 25 May 2021 19:55:32 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 38qbqsjk0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVyEyYbnRgX7nJPcwEA6evdx58COCAAMblxaJubuXxgY/j/b1WUe240bwPK3O9RzzPnPZzZI9TJdDY4l1jWvQUg720768a/kDFjnETrC7CtN8SCkXadxzhzj30FIaYo4qL1KlpUF78CwbH3jVYQAdAJHONsDkrGPuT34pWxCUtuZ1CnzgvW7+3RL6Bh8KuA+LycSPtJ8ve3yTEnUdQaXi2I/H/s5mVBKKeltVFvePSTKFRuAJQv3vBM66bFz0N6knJ+zTWg0RYM/H6DlbGnO+saFvLMKVz4x0VYfMNOOIoA2B2CjdVozdCigKzXOuvtB0tIhT0MZsC2q0JYrfg8iOw== 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=Rl5hjkbSu6ah9woombt7OArvqyhdXA1UKTGp09QgR08=; b=VHkgLVk480nh20jV6uJbhRrMm0nt8pOfpJh4yBJ9CHBjDQTGsrK3Tomkxety9Kd+fBI3Ben38LKOPFXK/fIEzXBzwhOprAgU6cZnzjxlJHuwfrgK0PZo7gJbtWqNAW8arRRYp8WEGaGLZfcI+YEWCNUlyDs/9hIN0v+SXNVafiKTaBp2zuZ6fVmd8eSLCd6nuMqOOntQ/M1KzJico77B4PP9RmrnSoW80qG/olHr7u822D05c0ghS+t+wNPQIVqCENGeU5Lmil9eDA7E6nVlbtPTpqcl4yK/2UEKtDN/Pw0+uhxdvNifKhhtIWjv9YjVyW4cM7n82P0fHVS1uPniIA== 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=Rl5hjkbSu6ah9woombt7OArvqyhdXA1UKTGp09QgR08=; b=d4Fk75VyHMLnUpgm4spjTFl31+u0eezHkBHoYmkcxQmyev4Mu12caGanJ+ThoP4sCgWOK4GP1egYUVr7a4ELYB6YIiVAnDVbsSTpA+Pgq0FrLAgPsC1tFCZy/yM3AEHk+WWdkuN01XUBRqC04doIdtfv/Xf+0KOSTEpE1YIXmqw= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:29 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:29 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 08/14] xfs: Hoist node transaction handling Date: Tue, 25 May 2021 12:54:58 -0700 Message-Id: <20210525195504.7332-9-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e70f6b8e-85f5-4f0e-406e-08d91fb70bfe X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LHRz435O34LimeFWtHZ6D+YQpUKmrnR2su1IJbD3Lze5HTnkB+dLt6O/2LYgdwCC+TWHizyw+542e97Us6qIYk0A7PzSvDOrJyHo4dB+tzZ3UIo7bTB1nOg1KaqrbSFpxpFi8WmwYk4D3poIfRsm/DszRoBmxXYLc+Jm/wppnEoacK8talYzm8cAC/7sv8uLiFBryF6rqUhqAL9X2l4feaQuEXnTF/cLEnlt1LpFeOKhFTlhGNGLbL/oXEhWdyHxdR0YZ8kJETIOKEUkVCSbk8HPM8FxGFvqppMXMhfzO41ORaiPPt4jCn+dHjYHYXHIhvqSjgVxUruTlDrW5aUoOJje5BTTwRJhkRI4X1ShvxXDAByr/Xuo7SeDm435VjQwrwwz69bZqLYUym/1zvWh+rcKxPuThSZnhSXD8rwumzpix0PwqIeBRRLrBcJ55QskWzbfoKxQI2xzeHfyE9tU7xlLXvKV20CZi2rjKQq3rzUXcUtNNs60FqZG/84cEGFE7Pfe2V5vbH+hfZyBXiAnGcKzrRhJbv3Pzm+VxTmXuOp+QM9/X9K8tF8nSYlzY/fso6fjcLJ12kfjLZWzKf5ZKZH7ea4fwagGlJGKxYdNYnOZ79JjbDKtwcZwSjjCeDYtRnMeaa6jYosDm4jJ60tPZltcqlsIMWHFZ/B+e7QXAJVpBPS4HkRVwA2thQAPLChp 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OljN4yqrzT7/Aw2Mdp3eIgZ8YLTCLLRCm+tczMY2gH6AVci2LxayllOELQ6KNYCn8ruAYphdSmkWkGKry0MXLt1DVYIR4HQuSgyg/ygg3cT7L5kMAtXNvLu3Ozq5BzIScAgKlgzI+pZWaskhJH5HqRsf+oucCOJxg9kum/Dz46DD1j7gK26Ra9txIePwnp4bJVE4CrnB1fhMIpJgSrfe5lI30zVYqFvS9kUxPnDnthEDgTqexA2HOwAtJeAuV/mstqWUfzTH4B0cGA5jJaMDWgrbGGKrsmOao15bBRA9wINBGlZYWMpp3TflAXw93bW0FEMATNBf+uQEFVJ0GvuLN5STloo1YOAIfjxOQ/rmz4porVqogBgCFLVsSnvX0l1LDcqY3zm2H2Re8Wpn9FKp5UPJNm3/cQS70D7XnLyaeetYSKybc+fa5zhaxVI3/OqaDp0+LT6bPG3jPcbojoVq9Azx/s/GrZIAj81IBDbCIoYB4hYu02Glh9oB2QdTP5oblHkwpts1H25M0HLmKz5WbVQqrWJvzMOyzmPY/lWUn6s8WRh5LUolFlCUIFCyKZevkRbKPR9+bcGzxwB5jwMnRgfXxZ9PM9HZKsBDcoWk92r6u93TpjSreIvzf6r2MBfIw+evrPlUL4VBuUTz2114jKyLXzHcpNeJdfziV/31YIQ/QfZsNtk2sgvWIpICKCaKSUjJ4KD4e6FAN1AaZiDhIRg0W/tjg8dwY6paxqy2+73hjsz6lH7iqSkSVbyeTyeqRqBeygH79TKdDtuTEimfAZTIYTYf9EuQzJjYzQXJ8QmZRrHR8Mh+Uj+hHlZw6UV/nnWilQmncHImXAveU3yPEwB8mVsmiPPLBaTQbQ4KWOiKq6ROpkMvYCiThULNwyKXZj/XBbTghhPSwOXa/ZvBDk5Ly2fj86pcquatNZwWvTHPKyBbw+ZoAYcxhuol7bExbCXBHgc5hAhdhAjK63oK/fZUcMotIZzJIT7HqVVfGE+QoBBgUu+xLejBmwAD4laoLbQzEVmR9LQRjVY8XxUPn9ZRBEhOy3toXHx1+k43ttjXCldQTYgRvvaK0q2YFkOokpaYie4XPVlLgs7icyAKm4hg1nYksFbJ+B6H3MTSGkBOts3P9z5xhM1xfPyMO3Jo+pyEUtk36nXKevFAGB7nSq4JwA7t2mMKW7Pq3vK7pjTNgUViIawdgw4ByE4ENlsZcl4aFZ+WQrsD2DphX/dotInvs/HN9JVsae5Vjmc3Bdq3Q2wJJzCyCH4GL14Cr8Uw3dp0a+MWRNhDPkY2fz+Zsl9QEcfb/2WB8Uum+5DVCWBIYcEGzoUTrPdEpYFdUWmg X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e70f6b8e-85f5-4f0e-406e-08d91fb70bfe X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:29.1837 (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: k2SKhlZQMaiP+2LmwO1IU5o6DePkSIJ7JeDx/K1Vx1wvyK9AxTK58wGzbziH2bTQu+gNAzEybRJjTxwayDUzYhqp0yHkp881jtzb79sYogo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: fkZp8ItkS6PXw6s3KFYe4PSzfXCjaCA8 X-Proofpoint-ORIG-GUID: fkZp8ItkS6PXw6s3KFYe4PSzfXCjaCA8 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 55 +++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 4bbf34c..812dd1a 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -309,10 +309,36 @@ xfs_attr_set_args( if (xfs_attr_is_leaf(dp)) { 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) + } else if (error) { return error; + } /* * Commit the transaction that added the attr name so that @@ -402,32 +428,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 Tue May 25 19:54:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12280035 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 B61D8C4708A for ; Tue, 25 May 2021 19:55:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F9676101B for ; Tue, 25 May 2021 19:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232988AbhEYT5I (ORCPT ); Tue, 25 May 2021 15:57:08 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:37910 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233003AbhEYT5E (ORCPT ); Tue, 25 May 2021 15:57:04 -0400 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 14PJnPtj034986 for ; Tue, 25 May 2021 19:55: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 : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=v4i0BZYQDBVoY/d5DvNAJhDnRbmdygAIDaRSkfGERok=; b=z9t1GCEzpLuFC2qwr/9mPLxQ1YiAMmiqOScK9Yec9oIzHVD+gkfAyzPErVgE1oVAI0Ai mfGtHhoYdvd7/tagN8OfTyit/3fqNGPZ+m4O8O7oSilIJ6q0wrWg18V0hEVNy/ruYTBO tgNJUPUCNbmIIBRa8g+14k+7TvL5WussidjC30BXzw9odvKHwSXbrfGkHyhSTGIHtfvh Nr5mJYEIh7bU0HFR67T0UT/k2HxqEKRQdsg226R9LgHUzvBlj7HmUSCWHoQ2edvqnRni z7tAx6j/UnjHCwy/9/UlZXCGGexu8ZVjrGrh3ymvNydUHDgnapcm7uwloftOUHpcRu0Y rw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 38q3q8xkjs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:33 +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 14PJoDif188864 for ; Tue, 25 May 2021 19:55:33 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 38qbqsjk0g-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FvS+6ms++evqw29l8hOQXqkTMNR2JOZOCa9oD2WP+7qEr7NyoTmS9HEtSVPeE+pjWuPWULEfys7DBWhUJn0TWWYp2OmWA6fe9mYl9EOnoqv/x2MIiE376UeSGo5lGUwSZEARG81qf7hIOjuWq4rxPpj8XFRiCsqVfGcgV9yu41RLMhGDsXFu4kfI9CdWk46vWPE8QPX+WHVftT83AMPwywA5h3Lr+RX2uABPyaGHYxGTk5/CAFG/qsI5E2buHn+g1QIkbPfbgs+pJWywlumQub874oDe3eyFdizexGrbjvUh5Vg5vQEfe0IGVCkj1W453KEkLxVH8DtF7s+ZPOmcdw== 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=v4i0BZYQDBVoY/d5DvNAJhDnRbmdygAIDaRSkfGERok=; b=gQXOn60W96KQBlclB+nz3LWkZm8WEGOf6cVpdaf2sMDnD4lmXCJAPjj/fdnf1FmV1Ai598Nd5sZO0M8PbsGql9M1cWZh0ZLGYu5l0ej79NjgJ484+ddNomjqtTu8HpS7E1c2ghuG+SKqn+ZMWq7UItL8yu7gGRdA+osksGOOk9gaaaVmvyQR+uy/E/eUmllC8MZeE+Xdzw5Kul719SggJCHG8k9YNfehNpNVGEvw46aLMcpTyQIu+SHmcll7sZthOoH0hFFjbifQkLZlrt4ixJeUNK1Hw+RBTmnQ/VWMFJDr4E5ItAWNt9A7pOMaENz57d1M7tXIAg4A9zl5T0Z6Dw== 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=v4i0BZYQDBVoY/d5DvNAJhDnRbmdygAIDaRSkfGERok=; b=D+6Jg/wdDDeqpcDGsTJs7c1REyV8R3F7AtaUKTNS0JSvz6K9JMTGZ0Illo5UlQMzS6SEXIu0KR9mtQbQAEKR49yf4OLcOjCmQhBTzYhRMc7vSdx49RgFalcJByBhEOvr8OTu5ZGZl5gT5oiAnG+fdeIPbytfCaXqLtRq6JnylGg= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:29 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:29 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 09/14] xfs: Add delay ready attr remove routines Date: Tue, 25 May 2021 12:54:59 -0700 Message-Id: <20210525195504.7332-10-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b4cea42-b817-4436-e1b6-08d91fb70c3f X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l6q3f+2J9n12BPyKZpdOIG3cZBzfV4M0DiOJL4MybaLoV6Cbk96yxg96G9UxbS2ILurwOqG2eqd6anB6t+aDQV0KimbWNedASF1BJtN1ZeIU/z010BjMSCeuS/4fXIzOldCAxCqmpyOpIpEYKuEcZU3BLENjWpK4841N+7xSmQKYjSTjWjlgNyX7GbQOE3UvZnBJ51ThGUzWw4TAb0NF7tdu4dgi5K8LLb97hvM/4ZWbdQbcOmIHXH7LCR10tSjlY8Cq5NN+R2UPk4+yd86oyOoH3CLmXpJbVixXgMSUnMMSu2ZMLjWTSw78oEBb3f2/dlqwq1GXkTaVMHo6ogjn2l5n4BpYpgVxWizb4/77+9vo+prA+2XEiy2yvO+E2l8/beRgNdv/BfSJ8qKY/XOZOIVvWUzI3f0+t1fyYsiuSPWU7l7/MfM8MMaDmu/5brwkJ3/9/zw/vqlrgb57rGjbhUmlK1eHnlXuxnkF8v8SKoR/xP5wo+PzSDYZW6jPDwZk2Rfu0u73P2qMvPjoIi0hdZphmikNCbJT9CUNL6r1S3y/zALB8Hr/G9TYYKJ/mw5oJNJS4pn1vMYEfI2BnS3KCxeIg277A6o3TGqkrzcRS1b+UaTY0OKcM8rC1QEbttCX558y/sZZ7yH0gZktWlYu2Q== 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?/+wK8iAe0eR7R4iBf2MaQhLTedTNmE?= =?utf-8?q?gC5gLYqqSJG8eTgAIq7NBNovKQlvqNjgFyGdpte3DIJ8GZLoIBHRtThdb4CmKc6jq?= =?utf-8?q?/bSWopFZTPgyl2qInZEzD9EBd0owiT2HRtlTjPKyiOdQM7TLdVi34IlMA1J4iE7vb?= =?utf-8?q?4ei2YbNqkqvoBaF7e6UW9n0Kaoy4dfZy2RrYf/j4r3UFboWkMs29L8WltCX8Zx4+Y?= =?utf-8?q?WjME8wJ1D5kMO8hb+m0oDKF9nBmxrYsLb75j+Uh6/ikCm3jVS17UMPxgv3vvQReRN?= =?utf-8?q?TtssJYJ5IP/g3OUE/AkLNDzj84zANjm2dD0/yuRu+G8BeoQ9MdCLYP/loex+izGua?= =?utf-8?q?CAeb4qtiAGhT6KyMrCKG6j4oDG68y9znp4mifC6y3iItMLLo2oGBp2VYt8c0kYuoE?= =?utf-8?q?23Ka/t0H0HtsGJaARmQeiSmI8aMjgaaEnFhftwYEczKPbBIKVg66IZcaF3L01/8Kv?= =?utf-8?q?2aEalhzOMpSMg2QXWygj1A13Jb2UCDqsGWne3uBPafsPKnKDLbjweu8PubeToospY?= =?utf-8?q?4IokRvEkyiO/X8O495eSG2juwy17tLvoy3bL/Toimzo3MijNHIis17qrYFX9Nede/?= =?utf-8?q?Mfp9ZQW9BFhQ5Vep0CfX2+1x9QXfXITdFk0T56/pn72SIjDk/AiZ5tobDVsiOx3GQ?= =?utf-8?q?2072hemLebZpzBK4DXMxHGy9P/jZ5Ro0WlGTZ+GhcHvLqOEJmFiAR0JhaaMjlyPDK?= =?utf-8?q?Xlz4qOrH9pGanss1cyhrJQQGTQPkoNP3HbVscRcGQqpcT6qfqnxfCK9UXYhl6ywmr?= =?utf-8?q?mCloZorOnhRe4e/CkpM/2UpD81I3nd8xC49v7xkLaXxJ3M/AfMf765N7yXG1vI8Jc?= =?utf-8?q?8flNn8B4hJtxJ46ZACnEily8PsrjXJgUwkvkshKXYkngboJVPk6wrQm4H4av0ZFN3?= =?utf-8?q?yeVpeCLg3tZxmPBAytTr5zD+pKUZ0TNrk/7fqkPybnpOviVUyT9nF1gAfOxSdytk5?= =?utf-8?q?AMWDBpWEEdabGMYJEicFkXBGbO7C4yLjyDkeZgWUF1dI7xPbKKtYqgaffzmsXI0iG?= =?utf-8?q?n0rxs2U5gjURtT9Rk9nlSpFixYpEQ+ySkLvlqD/8Zh13q+xOqJWAjcBLd/ETODB2l?= =?utf-8?q?eWZlScqzrvkXauQ7uPoisSEfIeg3xs1mIY/0ylknM41znUURcX8B7kYYQ7Y1d/bXT?= =?utf-8?q?MJLO7gFErBJfBNsj6zpjTn12lRn9bhxv7MNPzpYJstFPm74isTNDpbv5c/9BNYVhL?= =?utf-8?q?NJs8doqTSl+B92AIdg2cTI+tCXs1pf6d7vt5FdwJM/y4r4LH8OYe8B14eaN7QwOhF?= =?utf-8?q?3Dzx7M03fkn7AA?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b4cea42-b817-4436-e1b6-08d91fb70c3f X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:29.5874 (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: Cv5eB0TfBRpFw+px2oraF4DK0k/wZvUiyGyErZQcwbVMTWRB7T44sycuZOfQEb/6vmNifB6hnkXDcErUOrbJW6TQ57USR4FrFZKDsfwkNmQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: 7dGtlkdh-MiRg_Aj2iDnd7C2R-S8k6wU X-Proofpoint-ORIG-GUID: 7dGtlkdh-MiRg_Aj2iDnd7C2R-S8k6wU X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 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 is merged with xfs_attr_node_removename become a new function, xfs_attr_remove_iter. This new version uses a sort of state machine like switch to keep track of where it was when EAGAIN was returned. 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 calls. See xfs_attr.h for a more detailed diagram of the states. Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 213 ++++++++++++++++++++++++++++------------ fs/xfs/libxfs/xfs_attr.h | 131 ++++++++++++++++++++++++ fs/xfs/libxfs/xfs_attr_leaf.c | 2 +- fs/xfs/libxfs/xfs_attr_remote.c | 49 +++++---- fs/xfs/libxfs/xfs_attr_remote.h | 2 +- fs/xfs/xfs_attr_inactive.c | 2 +- 6 files changed, 314 insertions(+), 85 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 812dd1a..088f622 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -57,7 +57,6 @@ 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_clear_incomplete(struct xfs_da_args *args); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); @@ -241,6 +240,31 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } +/* + * Checks to see if a delayed attribute transaction should be rolled. If so, + * transaction is finished or rolled as needed. + */ +int +xfs_attr_trans_roll( + struct xfs_delattr_context *dac) +{ + struct xfs_da_args *args = dac->da_args; + int error; + + if (dac->flags & XFS_DAC_DEFER_FINISH) { + /* + * The caller wants us to finish all the deferred ops so that we + * avoid pinning the log tail with a large number of deferred + * ops. + */ + dac->flags &= ~XFS_DAC_DEFER_FINISH; + error = xfs_defer_finish(&args->trans); + } else + error = xfs_trans_roll_inode(&args->trans, args->dp); + + return error; +} + STATIC int xfs_attr_set_fmt( struct xfs_da_args *args) @@ -544,16 +568,25 @@ xfs_has_attr( */ int xfs_attr_remove_args( - struct xfs_da_args *args) + struct xfs_da_args *args) { - if (!xfs_inode_hasattr(args->dp)) - return -ENOATTR; + int error; + struct xfs_delattr_context dac = { + .da_args = args, + }; - if (args->dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) - return xfs_attr_shortform_remove(args); - if (xfs_attr_is_leaf(args->dp)) - return xfs_attr_leaf_removename(args); - return xfs_attr_node_removename(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; } /* @@ -1197,14 +1230,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 == @@ -1213,12 +1248,15 @@ 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; + return error; } STATIC int @@ -1241,70 +1279,123 @@ xfs_attr_node_remove_name( } /* - * Remove a name from a B-tree attribute list. + * Remove the attribute specified in @args. * * 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 in-line or delayed operation, + * and may return -EAGAIN when the transaction needs to be rolled. Calling + * functions will need to handle this, and call the function until a + * successful error code is returned. */ -STATIC int -xfs_attr_node_removename( - struct xfs_da_args *args) +int +xfs_attr_remove_iter( + struct xfs_delattr_context *dac) { - struct xfs_da_state *state; - int retval, error; - struct xfs_inode *dp = args->dp; + struct xfs_da_args *args = dac->da_args; + struct xfs_da_state *state = dac->da_state; + 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; + switch (dac->dela_state) { + case XFS_DAS_UNINIT: + if (!xfs_inode_hasattr(dp)) + return -ENOATTR; - /* - * If there is an out-of-line value, de-allocate the blocks. - * This is done before we remove 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_remove(args); - if (error) - goto out; + /* + * Shortform or leaf formats don't require transaction rolls and + * thus state transitions. Call the right helper and return. + */ + if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) + return xfs_attr_shortform_remove(args); + + if (xfs_attr_is_leaf(dp)) + return xfs_attr_leaf_removename(args); /* - * Refill the state structure with buffers, the prior calls - * released our buffers. + * Node format may require transaction rolls. Set up the + * state context and fall into the state machine. */ - error = xfs_attr_refillstate(state); - if (error) - goto out; - } - retval = xfs_attr_node_remove_name(args, state); + if (!dac->da_state) { + error = xfs_attr_node_removename_setup(dac); + if (error) + return error; + state = dac->da_state; + } + + /* fallthrough */ + case XFS_DAS_RMTBLK: + dac->dela_state = XFS_DAS_RMTBLK; - /* - * 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. + * If there is an out-of-line value, de-allocate the blocks. + * This is done before we remove the attribute so that we don't + * overflow the maximum size of a transaction and/or hit a + * deadlock. */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - goto out; - } + if (args->rmtblkno > 0) { + /* + * May return -EAGAIN. Roll and repeat until all remote + * blocks are removed. + */ + error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + return error; + else if (error) + goto out; - /* - * If the result is small enough, push it all into the inode. - */ - if (xfs_attr_is_leaf(dp)) - error = xfs_attr_node_shrink(args, state); + /* + * Refill the state structure with buffers (the prior + * calls released our buffers) and close out this + * transaction before proceeding. + */ + ASSERT(args->rmtblkno == 0); + error = xfs_attr_refillstate(state); + if (error) + goto out; + dac->dela_state = XFS_DAS_RM_NAME; + dac->flags |= XFS_DAC_DEFER_FINISH; + return -EAGAIN; + } + + /* fallthrough */ + case XFS_DAS_RM_NAME: + retval = xfs_attr_node_remove_name(args, state); + /* + * Check to see if the tree needs to be collapsed. If so, roll + * the transacton and fall into the shrink state. + */ + 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. + * This is our final state so it's safe to return a dirty + * transaction. + */ + if (xfs_attr_is_leaf(dp)) + error = xfs_attr_node_shrink(args, state); + ASSERT(error != -EAGAIN); + break; + default: + ASSERT(0); + error = -EINVAL; + goto out; + } out: if (state) xfs_da_state_free(state); diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 2b1f619..1267ea8 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -74,6 +74,133 @@ 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 called 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 + * have attr to remove? ──n──> done + * │ + * y + * │ + * v + * are we short form? ──y──> xfs_attr_shortform_remove ──> done + * │ + * n + * │ + * V + * are we leaf form? ──y──> xfs_attr_leaf_removename ──> done + * │ + * n + * │ + * V + * ┌── need to setup state? + * │ │ + * n y + * │ │ + * │ v + * │ find attr and get state + * │ attr has remote blks? ──n─┐ + * │ │ v + * │ │ find and invalidate + * │ y the remote blocks. + * │ │ mark attr incomplete + * │ ├────────────────┘ + * └──────────┤ + * │ + * v + * Have remote blks to remove? ───y─────┐ + * │ ^ remove the blks + * │ │ │ + * │ │ v + * │ XFS_DAS_RMTBLK <─n── done? + * │ re-enter with │ + * │ one less blk to y + * │ remove │ + * │ V + * │ refill the state + * n │ + * │ v + * │ XFS_DAS_RM_NAME + * │ │ + * ├─────────────────────────┘ + * │ + * 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 call 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_RMTBLK, /* Removing remote blks */ + XFS_DAS_RM_NAME, /* Remove attr name */ + 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. *========================================================================*/ @@ -92,6 +219,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/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 556184b..d97de20 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/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_error.h" #include "xfs_trace.h" diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index 48d8e9c..ada8254 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -674,10 +674,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); @@ -685,31 +687,30 @@ 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 && 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 - * transaction and re-call the function + * buffer that it is stored on. Returns -EAGAIN for the caller to refresh the + * transaction and re-call the function. Callers should keep calling this + * routine until it returns something other than -EAGAIN. */ 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. @@ -719,12 +720,18 @@ __xfs_attr_rmtval_remove( if (error) return error; - error = xfs_defer_finish(&args->trans); - if (error) - return error; - - if (!done) + /* + * We don't need an explicit state here to pick up where we left off. We + * can figure it out using the !done return code. The actual value of + * attr->xattri_dela_state may be some value reminiscent 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/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h index 9eee615..002fd30 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.h +++ b/fs/xfs/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__ */ diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c index bfad669..aaa7e66 100644 --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c @@ -15,10 +15,10 @@ #include "xfs_da_format.h" #include "xfs_da_btree.h" #include "xfs_inode.h" +#include "xfs_attr.h" #include "xfs_attr_remote.h" #include "xfs_trans.h" #include "xfs_bmap.h" -#include "xfs_attr.h" #include "xfs_attr_leaf.h" #include "xfs_quota.h" #include "xfs_dir2.h" From patchwork Tue May 25 19:55:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12280043 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 36E6CC47086 for ; Tue, 25 May 2021 19:55:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1584D61279 for ; Tue, 25 May 2021 19:55:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232996AbhEYT5K (ORCPT ); Tue, 25 May 2021 15:57:10 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34208 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbhEYT5G (ORCPT ); Tue, 25 May 2021 15:57:06 -0400 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 14PJnw2V185022 for ; Tue, 25 May 2021 19:55: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 : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=OBS2gkqW8UklTI8j4E5c/5jURPOUHwnRr9x6JYcTYr4=; b=C4BDcwY/cmoZ8fwAfliBCmuOW27z21Vof5yoyYYEkeqC7xLQUmufn4x2IQCfrjFQop+t N/+6lbXVux9yFminjTEN6/CnxePL0mbvKgzTBxZqnBOlf+/K8OasRE0Wm5wNi4SN56kI qCANH5XHcRJhftl2YGYP9MzONxWC8/ddca0MRw+m15YajTgeyYKGhBtqWBKwUAZRz+yZ qto/QchSOT7uNg+qVoGRk6N3us9tm1Fz3jyOCAIjiSxo62aq+Zk5NUosWzGa14GRVDAe OPlybzrvmtxm897sW8JZ+JOmLsLPo0RA2hZ22iuZwWv9qSQtenCLhI9R6Q3hcr6XRhz6 Yw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 38ptkp736s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:35 +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 14PJoDii188864 for ; Tue, 25 May 2021 19:55:35 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 38qbqsjk0g-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aemazSsR3b1Tbm0QRI7L42eHmsK64G6mCqZMTxEYQBMt21hEbpnfRx45gevpJCuGmzl0nkhf8i3csoO4iWqEmwBXn9hVdQifu/p2qOZkJaBbkIi2V0nySlbh7y7nwqmQetko5rLV9+sXL5+dJtvaXMUiGb41LPIDqR+HPj3ho/wckD85MgJ5VZccNQmYZKftWzYA5EiDwjnxtx4LgpHLtdjpHAQYilPs2YCNfYkZCI5Vzh7sWwLFCeHstmsQAUGVT8rAowP5yWcbPycf0R7h8PuwG6jSPARwRnBY8wppIReSWIymw3H/FJqeKHsjBmv/23qm+f+looqKvO+rIumfSQ== 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=OBS2gkqW8UklTI8j4E5c/5jURPOUHwnRr9x6JYcTYr4=; b=lHifnY1fzh4QkUqFKT90FVnp1trb7QNxoHfl/vLyDDmUbsLPlscU5nRjKpXEYNULKu2FOaMvEyHFhzQagXKTXjX0Iwwdw2dnW/UnnIcKMBrEbqxZUq1U5oWRgfC9Uca6GrcGT5yMC5WfTqWrcgzQxsgPkfYsPCCOyrGuQaTK8xLQLBPuOy6yj4hOjzCr5mZxrLjDFvFUSOpra8t6nvaw79lcVEfObdrHKCyWSdHz73stBASMUU2FcoSsImMlAwvH59wh5QRKiIE2TksSS7AI7eS3DzTbAhc6401PlHK+nMKJybuPlnjiEu18ouNrmS4s5cQG63hhuP24mTu7sk8SEA== 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=OBS2gkqW8UklTI8j4E5c/5jURPOUHwnRr9x6JYcTYr4=; b=eYjuz9hVotThgyK29jC5Ac6ewEmjf6E78h7MJ3MLmsEs4wcfcl7vfPiwqllERrorQfnGsEhTJjh6D5N0iGV4+Fga5XynMj8Gj5WCyQ8rJotT+DlCvWVy9zKrQ3T+RDzvyoD3V+TOwdtg55Sk3I7TOKRvY9rR5cH1Y49etEOXASI= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:30 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:30 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 10/14] xfs: Add delay ready attr set routines Date: Tue, 25 May 2021 12:55:00 -0700 Message-Id: <20210525195504.7332-11-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00d4eac1-cabf-4d9d-5ed6-08d91fb70c74 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: 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: K219yEHW1FCmxU+EvrBf2qZnAo+GH3yjbwJVcTdHu5b5+7/qV7FuYIB0znFNhXzRyEXBs9fdkZiB6nJ4igVhemINrrg+MB8AxTsIn1vYNFGw4KH+iERJ2E0s3/RHBqdxMcJ1QxjoUwul02vhwcyajZX0Wfhd5UB7RW8hug4N6eAUI4gecx/0LL3NjmiKDsYYYEWamCPl3VQ7dbDkuuwBygzsiYoSoIpHpYtdiFnScUoTgz1XJPmi40Y3KtOCYpN0q6d9gDfq1Oa/bGd32+YYezZfql1Khst5DS/aEC/mbsf7NRwlzTMppBg5uXsAWathlYND0AMwrPS3wUb9SGIf4s2gyjz28P9cWmN7dEaAj2kSZTMUyKe9CsdCWHqtLsrbDbVnrP8Kol+LeC0LbnsQJ5CNAUn736WXwpg5qK0uud56HePHinyG2S55o2FkFN/dx5PTr73IbIs1qaTYupGUrAZzmCoXK3eD6pMEjrHWb3h3keFiyI6zVsxbinSRY1K6xtIlIFggJybrv0EYEMMxHpduSWtjjSBQfsLq0x9Q6F9DlGenqEe4lHZlsmkbMI9U3lkLIdOq+dcN6lzlPE5HzTnDQw1wAEkehzOlaEXdy6esEGFbcTVK+Z86tL7vLQa34etYqXc10ZcMYBZ/asgl+w== 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?KzfgNdngSSk1qRrCE7SQOOCYws72Vw?= =?utf-8?q?4qTXHInvjWF9Zd5TWj0BJlcCVvCKHdu94ZqbE5pqK5TOCQMPuDHckIqRkaHgTbTrc?= =?utf-8?q?3bC43Rzh1bLClEhJPrU1e9gwhNCdUDOUA8bfxBlOeKJoh3tF2d9f9tPEG8IC65/Cx?= =?utf-8?q?fNF2Hl6lU/TbNIaef08iTKjP2QocyZvdDMVhzXVXrfxulmdECkt5Rz3o+mEWip9OI?= =?utf-8?q?t1aHfZlLD0jx98jNzAUc7SM32l/ZhQ9SFFVI+v+Vkhkkg0zds0THbHouhkxUFSRtg?= =?utf-8?q?cT2oCvxsdExu79mbxxgSpd5N8WjcMuJ6SmVIYUKpIsyQEve8W37M3cstobYzh6+S4?= =?utf-8?q?mJPDMiUllDqwN1nodWJgGREVTIX6CNGIrhsOAoOIyskS16e9AwmO1cre8qBlDDIck?= =?utf-8?q?T9xJ8hyxRq7giQyLhfEL7KuziskOY9qWbYc4Bi9oILqlkJsbAy+ex/INdj/+F43WD?= =?utf-8?q?78Udq340i3152OOexr20s/tRJzcF3ZlbWSDFLOoJcW+LvuNmni5ikvyS+ZA/3SVqj?= =?utf-8?q?ps9h/roArq+eLzbCxSUBzN/ZscXkKL9QybE0x2rfMdPLQP8UCYkGwTeQqNjbTzuSa?= =?utf-8?q?XELBK6dzbI9daS5/UCPKBdkmPHX0YaBI8N/5VRQ2SAgThyfj4Ud8hdYtg6CM2H6U7?= =?utf-8?q?B7pVGHZ6ZIEWiMobWcUcvCojTb0BLK7zowA/Atu1nTlpcnismOneQ2R7tk1B/AJOa?= =?utf-8?q?kTS3Kue22cP+MFNAhmv6DtIrmWOlZHxCR/GHVa1tq1Xg0cjA06fgrtN2XVJhtVfZv?= =?utf-8?q?kQsV/HoO4RvZSlyCSZF6yXIU3uuCRIMQecXtUmH9c/vPWT/HAgWBfY9S4duFF+W9c?= =?utf-8?q?/WnCY4oiorVtJ2gRtrfX4SFjZkFa3gcXC27b+Qifgf6luwxqKQHfERR0bFxmuqfpy?= =?utf-8?q?h4V6lt2Vjqy9X+ooQx3fhcda2dro8SaZEg3Q5nXr0/gt1qaTxWcgpNk0NjmAXITvP?= =?utf-8?q?7USZAWI5UU1UT74sTUEyj1841G4iEcMKff/n+tf8hRQ4HnJXk4uGB5aiMpnzho5Ob?= =?utf-8?q?mC+sQLnmkxi9itTgOHE9yI5qnzRx3Y2jt1HG8Bbc2uQyO7/lytdXgy/Bva14Xu9iJ?= =?utf-8?q?/5X2iRxNqqOKDE7QkPoG66MusKfD/HkDaCe5w70iBPcw/f85J8pJC5kFemwkfET61?= =?utf-8?q?kkagYYqIX2UsBGYSDNeHlWOda3wosYLW+ZE4E/e16cKLn1YQGbybAOnDzxl4xDNC6?= =?utf-8?q?rr3MbhVSXo21shgDvIVGFWm/2Jy2lb9qzY1UburZK6vvxRotR/PCjRIPfcppUIPtd?= =?utf-8?q?/6+ZJtacbtRba0?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00d4eac1-cabf-4d9d-5ed6-08d91fb70c74 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:29.9364 (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: TqZM8gtpMkTIL5bf7EuAFVS6TxeOSWlr/qKn5JrtbWC37QffJdeFUokNxvJvWjh7421TVHsKTjyz03O19HZP8n3/nXKlBgfRTIa31l6NwEI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: q_tFtFWIsxVr7LZjpHPE70-e2zf6U78T X-Proofpoint-ORIG-GUID: q_tFtFWIsxVr7LZjpHPE70-e2zf6U78T X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 Reviewed-by: Darrick J. Wong Reviewed-by: Brian Foster --- fs/xfs/libxfs/xfs_attr.c | 450 ++++++++++++++++++++++++---------------- fs/xfs/libxfs/xfs_attr.h | 274 +++++++++++++++++++++++- fs/xfs/libxfs/xfs_attr_remote.c | 100 ++++++--- fs/xfs/libxfs/xfs_attr_remote.h | 5 +- fs/xfs/xfs_trace.h | 1 - 5 files changed, 610 insertions(+), 220 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 088f622..f7b0e79 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -53,15 +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_clear_incomplete(struct xfs_da_args *args); +STATIC int xfs_attr_node_addname(struct xfs_delattr_context *dac); +STATIC int xfs_attr_node_addname_find_attr(struct xfs_delattr_context *dac); +STATIC int xfs_attr_node_addname_clear_incomplete( + struct xfs_delattr_context *dac); STATIC int xfs_attr_node_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( @@ -244,7 +245,7 @@ xfs_attr_is_shortform( * Checks to see if a delayed attribute transaction should be rolled. If so, * transaction is finished or rolled as needed. */ -int +STATIC int xfs_attr_trans_roll( struct xfs_delattr_context *dac) { @@ -265,29 +266,58 @@ 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) { + if (leaf_bp) + xfs_trans_brelse(args->trans, leaf_bp); + 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 error, error2 = 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; @@ -296,102 +326,130 @@ xfs_attr_set_fmt( * 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; - } + 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; + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; + struct xfs_buf *bp = NULL; + int forkoff, error = 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 the fork is shortform, attempt to add the attr. If there + * is no space, this converts to leaf format and returns + * -EAGAIN with the leaf buffer held across the roll. The caller + * will deal with a transaction roll error, but otherwise + * release the hold once we return with a clean transaction. + */ + if (xfs_attr_is_shortform(dp)) + return xfs_attr_set_fmt(dac, leaf_bp); + if (*leaf_bp != NULL) { + xfs_trans_bhold_release(args->trans, *leaf_bp); + *leaf_bp = NULL; + } - if (xfs_attr_is_leaf(dp)) { - 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); - if (error) + if (xfs_attr_is_leaf(dp)) { + error = xfs_attr_leaf_try_add(args, *leaf_bp); + if (error == -ENOSPC) { + error = xfs_attr3_leaf_to_node(args); + if (error) + return error; + + /* + * Finish any deferred work items and roll the + * transaction once more. The goal here is to + * call node_addname with the inode and + * transaction in the same state (inode locked + * and joined, transaction clean) no matter how + * we got to this step. + * + * At this point, we are still in + * XFS_DAS_UNINIT, but when we come back, we'll + * be a node, so we'll fall down into the node + * handling code below + */ + dac->flags |= XFS_DAC_DEFER_FINISH; + return -EAGAIN; + } else 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); + dac->dela_state = XFS_DAS_FOUND_LBLK; + } else { + error = xfs_attr_node_addname_find_attr(dac); if (error) return error; - /* - * Commit the current trans (including the inode) and - * start a new one. - */ - error = xfs_trans_roll_inode(&args->trans, dp); + error = xfs_attr_node_addname(dac); if (error) return error; - goto node; - } else if (error) { - return error; + dac->dela_state = XFS_DAS_FOUND_NBLK; } - - /* - * 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; - + 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; + } + } + + /* + * Repeat allocating remote blocks for the attr value until + * blkcnt drops to zero. + */ + if (dac->blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(dac); if (error) return error; + return -EAGAIN; } + error = xfs_attr_rmtval_set_value(args); + if (error) + return error; + + /* + * If this is not a rename, clear the incomplete flag and we're + * done. + */ 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; } @@ -404,7 +462,6 @@ xfs_attr_set_args( * 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; @@ -412,29 +469,37 @@ 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); + error = xfs_attr_rmtval_invalidate(args); + if (error) + return error; + /* fallthrough */ + case XFS_DAS_RM_LBLK: + /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ + dac->dela_state = XFS_DAS_RM_LBLK; if (args->rmtblkno) { - error = xfs_attr_rmtval_invalidate(args); + error = __xfs_attr_rmtval_remove(dac); if (error) return error; - error = xfs_attr_rmtval_remove(args); - if (error) - return error; + dac->dela_state = XFS_DAS_RD_LEAF; + return -EAGAIN; } + /* fallthrough */ + case XFS_DAS_RD_LEAF: /* - * Read in the block containing the "old" attr, then remove the - * "old" attr from that block (neat, huh!) + * This is the last step for leaf format. Read the block with + * the old attr, remove the old attr, check for shortform + * conversion and return. */ error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, &bp); @@ -443,97 +508,116 @@ xfs_attr_set_args( 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: + case XFS_DAS_FOUND_NBLK: + /* + * Find space for remote blocks and fall into the allocation + * state. + */ + if (args->rmtblkno > 0) { + 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; + /* fallthrough */ + case XFS_DAS_ALLOC_NODE: + /* + * 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. + */ + dac->dela_state = XFS_DAS_ALLOC_NODE; + if (args->rmtblkno > 0) { + 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; + } - /* - * 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 this was not a rename, clear the incomplete flag and we're + * done. + */ + if (!(args->op_flags & XFS_DA_OP_RENAME)) { + if (args->rmtblkno > 0) + error = xfs_attr3_leaf_clearflag(args); + 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 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; - } - - if (!(args->op_flags & XFS_DA_OP_RENAME)) { + goto out; /* - * Added a "remote" value, just clear the incomplete flag. + * Commit the flag value change and start the next trans in + * series */ - if (args->rmtblkno > 0) - error = xfs_attr3_leaf_clearflag(args); - 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; + 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); - if (error) - return error; - } + /* fallthrough */ + case XFS_DAS_RM_NBLK: + /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ + dac->dela_state = XFS_DAS_RM_NBLK; + if (args->rmtblkno) { + error = __xfs_attr_rmtval_remove(dac); + if (error) + return error; + + dac->dela_state = XFS_DAS_CLR_FLAG; + return -EAGAIN; + } - error = xfs_attr_node_addname_clear_incomplete(args); + /* fallthrough */ + case XFS_DAS_CLR_FLAG: + /* + * The last state for node format. Look up the old attr and + * remove it. + */ + error = xfs_attr_node_addname_clear_incomplete(dac); + break; + default: + ASSERT(dac->dela_state != XFS_DAS_RM_SHRINK); + break; + } out: return error; } + /* * Return EEXIST if attr is found, or ENOATTR if not */ @@ -997,18 +1081,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 error; + return retval; if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) goto error; @@ -1034,8 +1118,8 @@ xfs_attr_node_addname_find_attr( return 0; error: - if (*state) - xfs_da_state_free(*state); + if (dac->da_state) + xfs_da_state_free(dac->da_state); return retval; } @@ -1048,19 +1132,23 @@ xfs_attr_node_addname_find_attr( * * "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]; ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); @@ -1077,18 +1165,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; } @@ -1101,9 +1186,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. @@ -1120,8 +1203,9 @@ xfs_attr_node_addname( STATIC int xfs_attr_node_addname_clear_incomplete( - 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/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 1267ea8..8de5d1d 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -164,6 +164,264 @@ struct xfs_attr_list_context { * v * done * + * + * Below is a state machine diagram for attr set operations. + * + * It seems the challenge with understanding 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 + * state machine. 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 state machine to + * a subroutine, it needs to respect the simple rule that it doesn't "own" the + * state machine 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 state machine. + * + * xfs_attr_set_iter() + * │ + * v + * ┌─y─ has an attr fork? + * │ | + * │ n + * │ | + * │ V + * │ add a fork + * │ │ + * └──────────┤ + * │ + * V + * ┌─── is shortform? + * │ │ + * │ y + * │ │ + * │ 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 │ + * │ need to remove │ + * │ old bks? ──n──┤ + * │ │ │ + * │ y │ + * │ │ │ + * │ V │ + * │ remove │ + * │ ┌───> old blks │ + * │ │ │ │ + * │ XFS_DAS_RM_LBLK │ │ + * │ ^ │ │ + * │ │ v │ + * │ └──y── more to │ + * │ remove? │ + * │ │ │ + * │ n │ + * │ │ │ + * │ v │ + * │ XFS_DAS_RD_LEAF │ + * │ │ │ + * │ v │ + * │ remove leaf │ + * │ │ │ + * │ v │ + * │ shrink to sf │ + * │ if needed │ + * │ │ │ + * │ 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 │ + * need to │ + * remove blks? ─n──┤ + * │ │ + * y │ + * │ │ + * v │ + * remove │ + * ┌────────> old blks │ + * │ │ │ + * XFS_DAS_RM_NBLK │ │ + * ^ │ │ + * │ v │ + * └──────y── more to │ + * remove │ + * │ │ + * n │ + * │ │ + * v │ + * XFS_DAS_CLR_FLAG │ + * │ │ + * v │ + * clear flags │ + * │ │ + * ├──────────┘ + * │ + * v + * done */ /* @@ -180,12 +438,22 @@ enum xfs_delattr_state { XFS_DAS_RMTBLK, /* Removing remote blks */ XFS_DAS_RM_NAME, /* Remove attr name */ 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_RD_LEAF, /* Read in the new leaf */ + 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 */ + XFS_DAS_CLR_FLAG, /* Clear incomplete flag */ }; /* * 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 @@ -193,6 +461,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; @@ -220,7 +493,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/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index ada8254..ba3b1c8 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -439,9 +439,9 @@ xfs_attr_rmtval_get( /* * Find a "hole" in the attribute address space large enough for us to drop the - * new attribute's value into + * new attributes value into */ -STATIC int +int xfs_attr_rmt_find_hole( struct xfs_da_args *args) { @@ -468,7 +468,7 @@ xfs_attr_rmt_find_hole( return 0; } -STATIC int +int xfs_attr_rmtval_set_value( struct xfs_da_args *args) { @@ -628,6 +628,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. */ @@ -669,37 +732,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 && 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. Callers should keep calling this diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h index 002fd30..8ad68d5 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.h +++ b/fs/xfs/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__ */ diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 3c1c830..96f93a7 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -1943,7 +1943,6 @@ DEFINE_ATTR_EVENT(xfs_attr_refillstate); DEFINE_ATTR_EVENT(xfs_attr_rmtval_get); DEFINE_ATTR_EVENT(xfs_attr_rmtval_set); -DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove); #define DEFINE_DA_EVENT(name) \ DEFINE_EVENT(xfs_da_class, name, \ From patchwork Tue May 25 19:55: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: 12280031 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 47BAAC47087 for ; Tue, 25 May 2021 19:55:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 346ED61420 for ; Tue, 25 May 2021 19:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231612AbhEYT5I (ORCPT ); Tue, 25 May 2021 15:57:08 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:37916 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232988AbhEYT5F (ORCPT ); Tue, 25 May 2021 15:57:05 -0400 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 14PJoBI7035360 for ; Tue, 25 May 2021 19:55: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=O1+ZN1ZUPsgwHF3F/2hEPkSMwZmcxdwsopEYGFc3tR0=; b=0hOCSsreE6q3vDYlQjTaIsXLtoYOaIL7f03aCnKL+OaXPd3MEYLnIRmXqg6NhD1KoQzK bXIteEfaGgMp3GBv9xqSYzxgzb4dcxBsPg9bGJY+h8SpB/h8haOpa/TLTNQU+GJ7BAje 6g30114u/zZPfZonOk3u0HLqCaos0mQd8+yMjPwdauDvVX1dtpn2gVo+eY9cgdNocI76 Q+aFSOLgE+3g7vsPNeI8xs9/hnsq5I5y0unWGSP+R1lQrOqIG2XXV3G88aQM6O0uHgmx KMfXGxZDHxMgG9lsbT8vS2xlFmMgudEBSwlztIFZjjemRdnFu7X9IwzeXAnmYjxDR32v xg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 38q3q8xkju-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:34 +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 14PJoDig188864 for ; Tue, 25 May 2021 19:55:34 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 38qbqsjk0g-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WL+FWQ2O3uw7tPpyQirsXRN+u2metAdwnUFyVW2ih3kpaWis+cXkOqvICye8yVa2wqmlA9r4qq8doSbNhrGXyZ5CI0JXI+a3IurQ2G7KVGwrCmBalCvVWzB7RTNh63fb3H1wVUwXhMtb07iSgvd5nV19vDh56OAhRFsMfhA6EOzkF2QmgQCOWItvo2Coloqjw1PUE485iaq0KnvcvhTwK5TH64XNTBKDRdxfUSIU5+gV543p/MVS/j6H+8jOlb86v4oDPZuR4SSAA5NBZRGcvy6Gi9hCg0quKfgil5JE8h5prIvERgEjRn5Iwtwy6PdFtKat2TTuozxLiYoDdejwJg== 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=O1+ZN1ZUPsgwHF3F/2hEPkSMwZmcxdwsopEYGFc3tR0=; b=H5mno8Pc710hdxCkkMz06K/LHxYUs0999DizKXnbjYt+nuujOzPZYxieFtNQb/zoLs52gd+3Ocy5A/z8HbkeWf8SI+u8Tra9l2C2XTO7QZNhZocO9PsnFrheRz62e2PPC4CwVUf4kPki4JTx7enKeMzvFcP8/H+0T0yi9yDan6ZyH0Qrb6Ny7NF9lX+ZjOndf7s5vnqfc044CtOL+AbOxf1j8mX9JuCBSomxLtkr80RtpPkWuOhmRDnqijhXnZNcVUincHRvhC0C12YbDmNoxT34kIsh70LOiizppKy7QvCXkvNVIbp2uIBR46m7oC8Tvq9CrJSSGp8U1u1sFT3ouA== 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=O1+ZN1ZUPsgwHF3F/2hEPkSMwZmcxdwsopEYGFc3tR0=; b=rHoxmBwqn121rhDyfG7oSqqnHypxWw23AEJQfGi3IBUZOjMWnQOeUPwEDr4CXhzmZRPkhVYNC7h6BhM6qLloDbRaxbUlwGGYM7Ai/JpLs5fofIYvkMRPRoxTFuhU8Z1lf+ZsBjeFRYmPCcl82brGhulqN/fMBYaYXZEyrmC/dRg= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:30 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:30 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 11/14] xfs: Remove xfs_attr_rmtval_set Date: Tue, 25 May 2021 12:55:01 -0700 Message-Id: <20210525195504.7332-12-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e2d8626-9a4b-4273-3a04-08d91fb70caa X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: 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: GyqF+CRLqz8/+F1POWxvymuwsYSi0MV6/gTvBd8g0VrtqKerG5UIwfBCPw2OzdjJLcqsuhpiLo6u9gNrtKQquCeqjW6d/PLID7HrJppldW2O9lWXqfMUSUmCk30eQN0dLbrqycXf5ZyXwKFNkyml6EYF6JGjVNsMqk/jcU1kcC7sn/qOgmq3NUWIdz3R4sh4TSMNGPE0DFyC68AtihW+i0aNTE0FKFXSORJL05EhUC5Ere+3wyCLHaDVbJ2E3ntD4myQg2sTurJ0ls0oCkdBaCzRc0Kdnz5gnD+Gc4UpKmCZTi8/Y97ktLuWIhBZDMUeolntoerRsYWw3MEjCDDAGfYyzZnt4mtguBuwn76pmtD8KrKRWT+Ikr7DG9AkLHXZKLs9ES2tkWgYGwpfb7Hhb8aCnHDa3UrgExSxqVEpeRGaPLkxUAYcNcYFdygPyhWyO5sg43WaFNHrkVr72sfR0z6BFxY/qAuqfrmSb6+6csYtu/Sdop0bSsnF4HrdasJttRNybkl58UO1kEc3DAkTkL5728WgVgUdrUC6YRpxKIJwcFYMHulhRMLiEY/2+GaMRaCa+cnOKNhmYwfUgjMFW7dDJeYr4OpxqDZEXvlgs/YuPxLgnDOr0il/KtY6f0VIaWIqfXvXsY/QyjG63VRqLg4qF3wFDSpcguitnyvuwmoJmW0bzU4Cc3nGbPcjhoTz 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tETWJ35AzMnI72nXd5Dc6A518vKnyD80g4aqURN+Iv3NRNbyi6c8dDqq1FtMrjifklngry31eVFK1mOl+EtfYldAwGoKQWg1Y2PVal8G8zHekYd51SobQ8nL0ZVp0WY/i4m4YKFovAQrIeWX/Zr2zEUuKzj2gGLs0paYhW9EC0XeRxkzbOMq6Cq8jMGmdueskmN+V8rQKZ1op/o307L7ixVG/LMUfYiATtbowh15oYQAdOx5LDzt3JBK+0DjU6LrAS4qvl0U2mGO1BfopqKFsbuQx55QOtGF949Wm/T9vwZxl4uF5QdEAOJU4VPwwYh9CVaPHbtqqQr7yg95L8RUciypl3JwK883sdjBP97l1eK/B7hxS2erfVNPhSolJ+nDmv/OvB+MEP2jTHsVh9EEyo2xDrq22hW+wI4rQE2nfGj63kQC4ND8+3bcSEBeKtB4g7xxHvxCep/8kiswWvcXWteZ9bC96GMFDWnbEeTA/YEnnjyT+dgbjRnKFe3XPJh+ce6oooLhA5sF2eW3CfXAfOxnO4Bc75+OqrAIj18zQee4DTdLFKMWKo+xtdtqRzzpT1t201FRAi3Yoern8bbVA87+Y09aeElICHjQyFEadzjkS3xRKyWxzRJYwMXL/s8X9BRVgSL3i22kQNkWclTdpB83DIW0QPop3m01CjddKmDxQdLAYQHLH8UqZj3NzVJU/qbI542LloXT82vRQmw7LYxuCWiHKOassCkuWu83aXTFKwdFZ4DEZl2DMgOABzZ8v3I1HHuTfoQgNzJav7SNPDSo4uXzKxNJA0EkqnVAcuz4ij+/jI0LiBkpPgS7Wk92Dvb8uMSJDvvGXaYCEAqcMAcbYfGRwqH1i9yCPi1Tj4wuTnRXwlsBzewUEhfTcebPJ8MRhdHRPBgD9/3M9hecxlo47SAQq7rjhDtPaEO/2o9N5D2gqsscSLvARf7TLSYfe723MZyW4TnrhevUZfTH5C+T2p6ZZr8yblH0Kndm4IbflPgOuuuqooR/EQ1eBuz8lbjCQX63bbkYNGT6drtU6fq7/PpFBqkCO4j5DQia3i4sJWYLmSZeqItLRiau5TNP3CN8scBlMB4AEm1KleXF/8Ul4E58q82v4GuHKw4KAmbhRVDOupHMLCeke3gvk+UhQlEMMXJbR7F4H/edB2Rus2FcaTRgP+8pZE7oLw9kAanoToptHYOK6sA8tib7THf+5j+NXmXSOmh42cGmmf3ok9B1c3nI02Ev+rXCk0yEk0Skm393gqUXpG1rAcHkL5zFaf1w+n45mAUlfqKyf1DkyE9vmaTmcos1oQKq39MmvMvJNEgDWaBZNFhgIi1l5TM+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e2d8626-9a4b-4273-3a04-08d91fb70caa X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:30.3406 (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: bImHiAPaoGNJx1mRHIeWk3bcBypLm6E8OQAV95ruar5Z1GC2F/+ggOilfqmr6dc2a2z53lQSSFymFwN1UfMhlydJDPUiXYYDprG+oMeq8K4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: 6OtZDqiso9R5gjBIooHxFri5OVjD0-fl X-Proofpoint-ORIG-GUID: 6OtZDqiso9R5gjBIooHxFri5OVjD0-fl X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This function is no longer used, so it is safe to remove Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr_remote.c | 66 ----------------------------------------- fs/xfs/libxfs/xfs_attr_remote.h | 1 - 2 files changed, 67 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index ba3b1c8..b5bc50c 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -562,72 +562,6 @@ xfs_attr_rmtval_stale( } /* - * Write the value associated with an attribute into the out-of-line buffer - * that we have defined for it. - */ -int -xfs_attr_rmtval_set( - struct xfs_da_args *args) -{ - struct xfs_inode *dp = args->dp; - struct xfs_bmbt_irec map; - xfs_dablk_t lblkno; - int blkcnt; - int nmap; - int error; - - trace_xfs_attr_rmtval_set(args); - - error = xfs_attr_rmt_find_hole(args); - if (error) - return error; - - blkcnt = args->rmtblkcnt; - lblkno = (xfs_dablk_t)args->rmtblkno; - /* - * Roll through the "value", allocating blocks on disk as required. - */ - while (blkcnt > 0) { - /* - * Allocate a single extent, up to the size of the value. - * - * Note that we have to consider this a data allocation as we - * write the remote attribute without logging the contents. - * Hence we must ensure that we aren't using blocks that are on - * the busy list so that we don't overwrite blocks which have - * recently been freed but their transactions are not yet - * committed to disk. If we overwrite the contents of a busy - * extent and then crash then the block may not contain the - * correct metadata after log recovery occurs. - */ - nmap = 1; - error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno, - blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map, - &nmap); - if (error) - return error; - error = xfs_defer_finish(&args->trans); - if (error) - return error; - - ASSERT(nmap == 1); - ASSERT((map.br_startblock != DELAYSTARTBLOCK) && - (map.br_startblock != HOLESTARTBLOCK)); - lblkno += map.br_blockcount; - blkcnt -= map.br_blockcount; - - /* - * Start the next trans in the chain. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; - } - - return xfs_attr_rmtval_set_value(args); -} - -/* * 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 diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h index 8ad68d5..61b85b9 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.h +++ b/fs/xfs/libxfs/xfs_attr_remote.h @@ -9,7 +9,6 @@ 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_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); From patchwork Tue May 25 19:55: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: 12280037 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 943BBC47088 for ; Tue, 25 May 2021 19:55:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 73F7861279 for ; Tue, 25 May 2021 19:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233006AbhEYT5J (ORCPT ); Tue, 25 May 2021 15:57:09 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:49634 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233013AbhEYT5G (ORCPT ); Tue, 25 May 2021 15:57:06 -0400 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 14PJnjAL038703 for ; Tue, 25 May 2021 19:55: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=EdEkZaR6alQV398zHx9t8rPo4BCLa2RMEctKAGGLTSc=; b=e0ADoQtVAhlp4zIuFCqYygMaetEFuk7V6uigI4ao76DGrmJvNn902wjYyNR3ci1nELwI 5GclAyTP/7sk+GOFKV0CnL9IwxxcBL+LzQMIwJbUhjWrY/s2Pb2cliiDPGXCwdssSOaS ZjBy/e8jIK70wlCEQz/Ok65seYTIb38+Apn9jxk37op/WztqEO/cCJALsu0yIfZNyxrD ei+XEd/IN96u3Syy2xHfaBZtk2+cwrVgMOKmhOej6gFrrVFe/wfn6L+fpa2yTwleTEVX 09NI59QYolrOAjWHQZ7DqcDaHBtSbhLdI0AyAmW5hpBR6Fd7suPKO1hBmHt917hl07N9 CA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 38pqfcf6e3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:36 +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 14PJoDij188864 for ; Tue, 25 May 2021 19:55:35 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by userp3020.oracle.com with ESMTP id 38qbqsjk14-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AtnsSxOle8CRaeUm85Z5MBZG0f9g1atoAjZ4e/LKprbIgCDG9HT9DPlqoSh/j21gNOySxErckq9Q88XPW0rfHADSlJ9GEub9xoXA6ET0bq96FVqz8vD/HFYrdgVwHJ+UDA84DLg6VNhh6VFxPOdkns//rFmALvgRsLz/zvvqMv0Ed50Fu1RfKj/Cjojw7Ph7D5BxUBoYvP1tlmpK2zL/RkIWr1Sb70UK6uBGrLwX75/JH/uyvfME6tTzCeH5OErwjBg40oN5gJ36M8NpNHtsQTEuSNHuyDO0Ac5ZKqn9G4ifZ9OVHpK9XPaJiV3uYtro59RJlxmzWugtkl5lIzissw== 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=EdEkZaR6alQV398zHx9t8rPo4BCLa2RMEctKAGGLTSc=; b=YxsdvAdWpdEp287Ni9UVwS+A6H0Te0vkEU/w6G3CWs+P2kbjjhOpD3zxEOdPx7O9ZMNJ1bVCzh+N1uLOHxH9Vz1WsI/7PcTJdu2grAi5iyolrcC7r72DPzpK9X8QvnmlJhdmdK1S8i7/P7CFHhsAG9pBOTNjcMLFNVRkWHWgGKCb9I5dbaY7bdcf5+9nN1xJz8pFvUj69Tg05qfNwoQ6OL84nzR+WuXL6YKaPIjA4o9n+jmMPe6aKqDjN388ks3131vx7co7oIlR7V8acIsVTQ1AGgKVZBEG6MO66RH0mWYsEwLH9srMBWgdecAWPVKSrmEpTca7ZmZgUbrCSuBDxg== 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=EdEkZaR6alQV398zHx9t8rPo4BCLa2RMEctKAGGLTSc=; b=ToegPAqQYHCqFP29aQnAxOZnqXLUHmNIXqa35yUrbU/9QjgGuRTHSs0T3Eg6MbKxsdIHSUZ4XHlqE/ExISLAGfrZWhryxWmQB4jpHyYKj0NLovxVmSzZ64E3JQBAHN5v3UcZjrzsa1o0XaPlrB3Mx3IyIQbPp2yD3350O9K23II= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:30 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:30 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 12/14] xfs: Clean up xfs_attr_node_addname_clear_incomplete Date: Tue, 25 May 2021 12:55:02 -0700 Message-Id: <20210525195504.7332-13-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ddca837-3c87-41b2-eec3-08d91fb70ceb X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XGmYyG4c6EbD+Se6AwbUT/RW7GQsW1cRgmUL4no2ZqfCIRZ9egwUUFYPWUUpXbWEj4qU1RguBDjYxJK5U2/m9vL2Clg9UNEgkZnMpPDX3hsGAzYWgzjMQaH+TksW3x6rIbV+Gcjv8xHszVXcDPhtilzJYdLEpGScskEQj+1x5BVLTPcM0445weWmTcRMIJrLXE+jc0To8SojG02O3Q0eJdBK1PZw6zE1oqW8dPnUjTaxX9bBuux+4YkIs5+m0NpkkVka+kNF0SmdLRKzI+idYcoRDnsCEV74aGuQpWMT2SOR8GYQztVOkRKI8/uP1ft2FTarqpitinOZcKOqZ6jHCNfT3KLg6MBJpXHkSu5q5kP05rCDMraU1hiV3KH8RWOW74RLxTOOVF2p8m01THsiZ1lOJVshn7yLsMoKetlzpBzcuaHXrJJgGdtU1ri3qKXfTTAvpR5pbFJaXRFHvvOSKkTj5Ee4L5mjnF8gJTnsgiKH8ruvCcal9mGk1ZhJXtmirPbCv3e/ePewVQmHlhVlaIzyHIUn5OdpjLGj9EqFXtU9BtVPn6/pLmJMsmWX49KGFILvLPGfIxdcCkyX6h47i9uIeUJuECLMHnz1sVb41OY6m4xb4pjp1qB6uVPrkVUMUwYjKraA9kDs5ZvvgD5+1jz69uy11NyumD/U7rmIKMYaaWCOY4tB08UlWjafSA5H 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wMT8pLhQjTDIZiCCikrs7P+DDOI2irl6YNz7BKxWgR1mnwDSccUK2u75v+1ntHTR2CTaZ2cUTWSbVLQJc1U8ddkrkQyvColF9z49MEfmvB2ELE+asyw+6jShpm7GB0h147BfBBqsV8ITrDgOd2PlkMLCtHqNe3B/CqEtqi8NLTapDGsm7PFKTu2MuUDLiZQNs04qFyxWfueeafFxBOUD+W3ToEUCyi6qQ+VkY0MicHIvAEYLgZBYaLTOIS962u78edM4xTdF9SWlXXnYXzCBlqmGA9gUBL3s2IaF5TTlMY6RnB1ElCbHCutMeDiY6dTPZ4GHt9Wr7Uh+7YY7vEosqJyJAmAW8u4h4WzOFzClkgx1SlbsO58qZS8nZEt85lRvpIuEdEr3fcN8tCEK51yiZFwvQLfmB4/AVmkJSBaWeYoK7Rvj0IrSQL8lJYuN/83oHeMCksrMm/HIeWI69qFF19gz54WVjEK7jNng23caVrvbWw0nYSYAqaO8yL9n7LnUqfyJUZ7HBtGvOKRv0QjAiZ5DukCkCf3pFfHy6Kyv2FPhkecOViDxFwSSbt//vkoyjW7g92K8dcRepVJ6ZSrlJ0v+XQeYGdfye6ch4SYeFk4JAX14L/JMOqQtqKXaGVUrKXDzrseLp9d98GY9tNJyYDRrmrds+F4G3FAy/46q5AFpt0YDmaMfJVLhPkHEMqDog/JuS8SbfEGmMzZXuj351yQLftd8xuCJX8mUYhZb386b/2dwr5wC+CqMgBjV3FaN5CmTR3YGj1J8isquFA8WUklOOUoIKGs0YG8r7IxwPkdu+jq6770+JQeUK5vEfkPfD/HDFsBPRW4DD9UdiUzVh+qOriNQ6v0027JFJHW/cRUll41KtdW7HyKdVGNvX1fsRmZbLWe+b8W0oTfkteUZRvFIhm0IIT3Vvcf63+uY04mhSiHaTt5PXj8I6yUw2AvBwBfBZ+BxAzcwIAYfqPZYuv6j1mqvG+SwyZkuDC5XSc6ucgzOYkkkmsZn6uW7F6RhpYRu4ObYc/UFPRhNtyCWXKaULDuobg2geZvfMPJHh5/DsUNTavkQi2wObDQlnnROHK3/W+hhHNPCovhp6PStoxBAKH5ZETi/uGNIhllBNiNrOoobrxDzPryXkziugbkvyL3XL9App4xUeWJ9TfEhAK4ugVVpYVPqq3Bf1i1IgHGY/Yn3VbISf4J4fxdJjgRCHErnX8xYIhx6ocQYC5W3SUd8cUVUbskPAw1tejPSqGo+2aOlj4XURMT6HkpX1CY3z7PVEHGRyH5t73PYuXdu08zPbIH+O9Tyz/mfkMdDOVgIWj6lW9vdvHm1EaqaUtSl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ddca837-3c87-41b2-eec3-08d91fb70ceb X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:30.7294 (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: TNU9RsMYPyEpvBsVfOE2Kah1aGwHs6LSj0+CtAwy6VhTT0EbduvPOe1gf0ZMcW7JySg8Y2yFm3LIcVbPbXTcrnil0Pnhxf8HOc3u4Ileo4g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-ORIG-GUID: AXAbKXSjDqIN6ifMWBEE6Zka9euLAsCE X-Proofpoint-GUID: AXAbKXSjDqIN6ifMWBEE6Zka9euLAsCE X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org We can use the helper function xfs_attr_node_remove_name to reduce duplicate code in this function Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index f7b0e79..32d451b 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -63,6 +63,8 @@ STATIC int xfs_attr_fillstate(xfs_da_state_t *state); STATIC int xfs_attr_refillstate(xfs_da_state_t *state); STATIC int xfs_attr_set_iter(struct xfs_delattr_context *dac, struct xfs_buf **leaf_bp); +STATIC int xfs_attr_node_remove_name(struct xfs_da_args *args, + struct xfs_da_state *state); int xfs_inode_hasattr( @@ -1207,7 +1209,6 @@ xfs_attr_node_addname_clear_incomplete( { struct xfs_da_args *args = dac->da_args; struct xfs_da_state *state = NULL; - struct xfs_da_state_blk *blk; int retval = 0; int error = 0; @@ -1222,13 +1223,7 @@ xfs_attr_node_addname_clear_incomplete( if (error) goto out; - /* - * 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); - error = xfs_attr3_leaf_remove(blk->bp, args); - xfs_da3_fixhashpath(state, &state->path); + error = xfs_attr_node_remove_name(args, state); /* * Check to see if the tree needs to be collapsed. From patchwork Tue May 25 19:55:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12280039 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 8C5AEC4707F for ; Tue, 25 May 2021 19:55:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7425461417 for ; Tue, 25 May 2021 19:55:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232990AbhEYT5K (ORCPT ); Tue, 25 May 2021 15:57:10 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:37928 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbhEYT5G (ORCPT ); Tue, 25 May 2021 15:57:06 -0400 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 14PJnOxO034959 for ; Tue, 25 May 2021 19:55: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=aLt3wXn0qkd5LzANTH9fN2pSM8LdVlKxuTnBF5QjBbU=; b=mDtrTFEiUbC4vjiWSYmmbCvRGm80mlRusFcQa8PLVGOApM107yY3EB78eIHbWMB/dwI4 4VLIQSxthgA9p6EUxmTp7p0I55COwhYsf7x6rfS2iX7RzJhjykPigTU7lcYp/rmmdGaG b96LyFMB46bvfqcrrSu0K+viRT9sK/2nWRftbNw9ogYsqzneJuBfwq/tC2ouPYsW1XTd EQtNZdkoYBjpwaH8bCIb3ENMjlZrDdjvmEfJpGIyeuKAtJwjY4Ykw4z45i44oo22vlGB bI2SHOQjFLv6QwW4ryqOY1TShgOJ/w+Ii22HJxGEYdvIIC/vo2VHPXjYbNRIzAGtQS2s Ww== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 38q3q8xkk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:36 +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 14PJoDik188864 for ; Tue, 25 May 2021 19:55:35 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 38qbqsjk0g-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YXTK8E+xkMH7QtMHZrjV5uiZIPPr/jeUaER+/GR2hB6stPnfEWa06oWWX8MOm5DtbTDUFVTqSkNqGZIgMXMIVZj5mzy0TVDRVq+1VUdT42yy4JJiBgxyYa5RKExHv3d3pqpm6uBY4iF4CWiQsZVuP/oJvIonfvk5CmalZbJ7lwNy/QA5Y/cotMORCqnRyU8+MHzw2UiH/SyGCoSpaKLnTS9AdHfWJsMXsfbPv6EdQb+Y8mEkDvhYjBIQhG59cwTIvEz6fRgOOLrZqwqCmW4rNeejUT6v2cqBjNcVKHOiWpaK0T5Fa34IaCKi72kZo9GDQylRJL2z19TTwEptupJT+A== 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=aLt3wXn0qkd5LzANTH9fN2pSM8LdVlKxuTnBF5QjBbU=; b=V9emXuLBXtabosbZqHdDFdmuq2CqI7CusPEF0iLK6OVsbzCzh42VEHWnijzSNFmNAwYaJrJ1vo/KfR0CrhHshSXv/PPnb/KsTlODXdErQHa45ViLdjA6akFTe10HhSFXBiNMuaigNK0oMHE9o9y1i/YNgzomAMQxifJHAn0WXw38jBXG0gK2h0WJKtkQ1zhacO1/Ak6m+IiDb/H5lSISdTNjV35M2L93iXnX/K1nF0NBUuWoSdtXls/WJ6dUUobN1x4hcsnwBeFIW12qFNtYW5TZSzv8G7QCctiw/aGzJ1KUX+cH9CX0TH5B4L6ZGI0YCqAMTBaA+FQJ59joTMLZfg== 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=aLt3wXn0qkd5LzANTH9fN2pSM8LdVlKxuTnBF5QjBbU=; b=zM1SlRP8GVRhExA/nbBiHLWjFJsT5/U5OXQnOclW0MSSjIcfSYLelupgxDy7oioDjcxBhDhLBThb+1htOHn5eObLlETPIdyLH6bpNLa5jq1bXwqDQZ+N2zYwfq41M3v/0wM1uozhvI0oqPu8PrwWGZCD5NhHAZs2WuVp/QqbXYk= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:31 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:31 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 13/14] xfs: Remove default ASSERT in xfs_attr_set_iter Date: Tue, 25 May 2021 12:55:03 -0700 Message-Id: <20210525195504.7332-14-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c30921d-c75f-4bf2-9936-08d91fb70d1e X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VGasIcKFtzICajR16ND8iDeP9poxjwry4Ji1VjiF/GlxQgCl4uejTQlUm8kBZGQxZDdgiOrb2SHmlvDIk8OZrERhlQNF3jjrMH4QG8InyIx9OC34VaLycvqHBaRH+k86tAjCujFWxr8WeA46fZC3M+7C/iJ3gmdiSUBKLhCXWpmAGv4mqXy6Y1dB+u7HAkpD9yqHXd3shJVNeLHh04yJNAMDIInZ7zthDkTBJIRTHIs3GKw4BbiKc8edhpftvZuJyrg0EWl7u7kNs12m0+3cmKSrpD900TGtInO83fnBRp/PM7FTCwbUD8Ha9UUJVp8gGrOX9P2S8yDNTTNeWSlbHFvO1y0/QlhEzL2u5JyUg0TVwQs5LMBuNi0bkYij8qZQFdEE/OlvlIcm3XxzLJAl69ZnL3e/Kdtd0jU97RzXHFIluP2hn+0ySTzQ7EfjbkRJTAdqfPQPE2kf/xfqhL9ie0LNJ6NNHviRvdNoqG3FdpERalNcuW/F99zFHldgOqPh9k28mnCeLyZi98QB/+mYUnpfLYlmPsKTUsJESxw+hJafasXaBY6SMvEF+HGxYWadJoQVrHxM7Crj5t+6C4k8WKKPLcARhgi7WxL/KPEZH3QfxNN/BN2gCrYbBfm7lqUFl3mlsLuZjwSehKix1C8YPNst8i59piAxA9J2tNbUJRxNBOQsCWVa88hB6BVj1kLJ 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(4744005)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: XOQs46Iz3syxQ/34tZb0k03IQwpTSkqJAnPlgY1jpViPysaoQmEGLpHpFDENMaIeUiHkqpYvh1G9ZvxSBbRqGpGAHCsYE0xlX1Dz5Z5ADrVpyn7phIjYPoNP4myh+u7e3rQTonY211A2uSV3ssEXAyw5jBMLoNuYa3xpvFou4QcCH9QnoTVagMxLPepy5auHkMaOIZjbz04v5JG8JZA43mX+zjJm3o4YuBPMt+alkdzvyic7BLDubaV4pCLZoHsBA7I/XdATTiMOZeGKgCd/lLMQT+hJ7GckaSA0ujQKuGt55m4FSgox6IZC9Fgd3gTwZgOWMuFVkolq6KaJgtOI6+orF2MEYxZXpTcbyomiIQqYWcU9b/ID6v9mZmuZsSpsTs4dehonx4IrS8B2dJjmDYuHEUf6XJKiwns/O2opIi2WqoQhS2s9M0zQ/yjO0hoPcbp9cfOo4Swuv26B26FUxLA1Gx2YkMkQ5W8qjDo3oNOdyRwLKm5aDR4vCB80o4ZSo7y6q75F45qIsDD0lWOkKcUq6bVDdtUg8heA+5mfV6NZqwqUosiMzpVQcYfECNdvYVfzh6ZBda+BM6S+3T7X6xXDvVjmzCNvrlvysZJ6p7fq5B8TWnjtmwRulrMXkiGYe5iLAYZoiD3/KT0ZE6SIm4HZCi0NfrH+WBT9wGXTV2+X2+3KmhcRiaMyEw10uz2gQCNweQVLFDXnXa6KNKsNHGxn7rg1OObn8DVIL4O93mO7/DGyJ4HnOutRra4io9390pHXSext4Nc3NwSMPycgXIEZ11IJJhTZMn6ubt6+ORh/iDRFGZzpIzVZoRKOtB2gqL9UX7/rLbWUQ4/ChsCacLCBLCboE6vtk9cdjJg3J4tzln0GFnCnejippxIa/ffvs9+6yn5wGSlSeNUiRMl2EDJumiPvuedeZRmqoZQHFfBsvpkF30tDtLY8cI7hx69C+lp5tubEj1v15yhh7SJFv1uvRzCAFjRgfaYDriRbrMvrlGY/xWgoRZVFD78bVwFZVRttRMB4X7pB9U9v7+4M3GN0wC1QhmwHSNAY16SPvFcnyXdSFxbEqzX46mFriCO01/8J9GnLfSCjEB5ppr0hzmjOpo4UAXfp/HRBKYGeLp7SR470eHVvRac/HtN7XL/Epu+XKmVivvy0a26A1VzhItXcs5clA0fTQQg7YGFk+J3nhzjIoNFhoiObZjQotXIBJa770zMChK6J/KS1i88SIM1jrNIK+WDRVBdwYtB/3lI1GiR6YzCe1PAXmlsuya+adTvM0T8b9bF9kDnLxKUY5JESsTNJI9gM48Zj/Ny0hmwb0q0ayNToE2RH/e5Qaq3n X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c30921d-c75f-4bf2-9936-08d91fb70d1e X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:31.0331 (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: eMveKpVMxT4c+S3RPYUktlusQghiANJmbyGJdoc0Ih3fbQ/baSbyjDrudT0F5Q3wyXvuhj93C/5eq5sUBsx70GxWi9SZxSW6pVXn3Q0WO74= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-GUID: YcAGu-VNlvUHzQ5eJjsWoAqj5eKFcbM2 X-Proofpoint-ORIG-GUID: YcAGu-VNlvUHzQ5eJjsWoAqj5eKFcbM2 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This ASSERT checks for the state value of RM_SHRINK in the set path. Which would be invalid, and should never happen. This change is being set aside from the rest of the set for further discussion Suggested-by: Darrick J. Wong Signed-off-by: Allison Henderson --- fs/xfs/libxfs/xfs_attr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 32d451b..7294a2e 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -612,7 +612,6 @@ xfs_attr_set_iter( error = xfs_attr_node_addname_clear_incomplete(dac); break; default: - ASSERT(dac->dela_state != XFS_DAS_RM_SHRINK); break; } out: From patchwork Tue May 25 19:55:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12280041 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 5E490C4708B for ; Tue, 25 May 2021 19:55:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D563610FC for ; Tue, 25 May 2021 19:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233013AbhEYT5L (ORCPT ); Tue, 25 May 2021 15:57:11 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52470 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232992AbhEYT5H (ORCPT ); Tue, 25 May 2021 15:57:07 -0400 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 14PJnA0B162043 for ; Tue, 25 May 2021 19:55: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=7KrpfNIpGkq21hxTRQClmWcIcdcnniPh/z+cCZkGWQM=; b=ufwCkkyxixepfr5FbTbiwJQH7lecPA3UKQK9h3Q+avvOB3eMOOwnLuqZYd+ZHbWy9fKq L9FlHiL5LRfNH+4sS1033T26p/YuQrVfU0kn5fkU+KUAHoCzZWznomDqn36D5RfNEoqE AHZf9u1O4r75AUOnCuwjWeeEss91Z6nPk1Vjfu98d4xy7GNzqOedNXoO0hDR47QfEvV3 08b15cIoVu/F6wqNLC227WI7sQShBJ4yRhtpycjDJEsnxELa7iakbMVLWaPQ2EGQr/T1 5MF5rix6UMHANOEoSPJX7iRc5OvSmktsQpUlEDHQacxA/RqoQRDnRiHU4Gwy19YUEJKG 4w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 38rne42qcs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:36 +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 14PJoDil188864 for ; Tue, 25 May 2021 19:55:35 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by userp3020.oracle.com with ESMTP id 38qbqsjk14-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 25 May 2021 19:55:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=akCQFwwxsUlQgxiinmbwkKCWoUeSjTPPqEIZVog2kjTvThjR7WQ/fUfdKmTMiQOJsthFjJk7wnlaRu2/IjFIssKF41+SRozPKslp6pTzYidcZCXxjfrCXYr9FgQMEgKNnHycNT5fAcpRPNRgVj0nsqCxke4E0/0rYBOeXjQ7f0Pe1hOLXqbMC+LtGHRpB3BdYh04KqyXeIDKLojk0f1G5s5tCjKlk76Fzi4hqvFB5SgnS8R/StWqPMHjo46JqCptWpRxK2z6YTATz4LE2Fso/KTlmsSpk/hMSSc7+vLornm4y1xCj0yPx7baEHLBubpT49xT4NacAgyRD4VzbgTs/g== 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=7KrpfNIpGkq21hxTRQClmWcIcdcnniPh/z+cCZkGWQM=; b=c0QN/yhT1nDgTEA8gWlrwZF4l7lw4wTfKVtOoh1TP2iNIAfYBX6C683Z2GqvZyLMvYTOuuDz5ugW6xF5mpluJvhjMee+TQT7uAD0+ZULMv5yYyM8EC2i2/NYp8zT4ONNjftnROocI7MjLG2IxmBDgs3w+0cfRmY2YT0VmpfWjYcANcoUi6tzU1DelFov0a9TZOliTcw3JgIxNn0HXv+Ew4hxIUXYK6FxLcmY7r3r1Jue3Z6iKJY9CJfk59PnQYauAGyuGv6LaxY0IlUe7qXMNryGsEh7iuwdPtHsYiSzWgQyXnprHcGff+3DJtZrXo2HUNNm6/mNQ3O3jo/kQ4EtXg== 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=7KrpfNIpGkq21hxTRQClmWcIcdcnniPh/z+cCZkGWQM=; b=hEVWAebAtDRY+93/8tb+7VVka1RXh+eTBcBl/zLPj0HHnHKDxQEGAlJj72H2oVGI+4ag9yNv2dinZYVaEdTveefQfUkAY5ZsYhbwg243j6ZE5ZhdlN1c4DOIoe2RVzcdylY8RTghkDpNZKvi+V3qGOfPbdqae24RBLjqioLC2Hw= 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 SJ0PR10MB4544.namprd10.prod.outlook.com (2603:10b6:a03:2ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.25; Tue, 25 May 2021 19:55:31 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::55a0:c9fb:d00:cd88%3]) with mapi id 15.20.4150.027; Tue, 25 May 2021 19:55:31 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v19 14/14] xfs: Make attr name schemes consistent Date: Tue, 25 May 2021 12:55:04 -0700 Message-Id: <20210525195504.7332-15-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210525195504.7332-1-allison.henderson@oracle.com> References: <20210525195504.7332-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.210.54] X-ClientProxiedBy: BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::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.210.54) by BYAPR01CA0016.prod.exchangelabs.com (2603:10b6:a02:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.26 via Frontend Transport; Tue, 25 May 2021 19:55:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d9a1d93-68d4-45f5-0c8e-08d91fb70d50 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4544: 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: 49CM+Ddz4YaFT1JKWyR+AIKllv3xSlQsGtghVqoMjxl5cBpKBmrfeaBQFjJNhIMJdNn3Zq++k7++/QgDSipm4AipJ1e6g3EJjS383zyiFpCvn3vPGy62JDmKcZ9eixoFUefZi6NcDgYnu/nsgBwiNg0IzM6acN/FB6RL0NIek2Kc90A/rWyMxZqW8faZ1bZiSuml8fXgOserNZUycyfWKKO9TOKxNLJLZU3Et404U2UJdTtPf9NTBKF6DB3gTF9FZc4S/FVEstnqDxYphXeASEFvA6qWXS1S31i0D2T6zc2ZfsjqRupQMxZHSMpES4qzpAL9qrzWABEa12CNs2RIclGrO4aZX3VfsS1UAGAIfHL3EVxi4USO6QtONzNDV8j3ReD8xG5QE3y/xS98IkQx0l9f9mi6Z5NcszW3B8o9Ar/GjV0P3XPUgvgCo3kzXcmMRSpGdv1kJzN5C05k9iN/ammEwrRGiGjRJ4KL+Mwp7b/iHXvybiU/nvpAaDBEnxSNd04unphr1TGaUu5AeKAxIaYR8lF1uiaiFGiXkLuGtpS9jFuWyZNv9SalJAcjfZSzG397pX87Dnnu4O5Dhwi3kxamfuPJsndvrB1Zw4N1G1e4vgZu1J5rG3Fuo/U6GM4KaYAvpVCvg/hsxLRS5hGFxk2kyG6qokxJgUUC/Sl6eCQ7OFWfQ52Jvk2PZ/TbBbCF 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:(39850400004)(366004)(346002)(396003)(136003)(376002)(2616005)(52116002)(5660300002)(956004)(478600001)(186003)(83380400001)(6486002)(66476007)(36756003)(2906002)(44832011)(38350700002)(66556008)(66946007)(26005)(6916009)(86362001)(38100700002)(1076003)(16526019)(6506007)(6666004)(8676002)(8936002)(6512007)(316002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Bqr/8zZU6JYF2tPggO6anAfCePFCOYMqMLlIIRBdq51B7vuLptjnPVksZIHUEWBpKaPH8L+K4yRjjmucLQzepRt+RkhOLh97q9p4942v/HJFPNAjPCBtXWTVwxrldf4m2/cl6LbJjG4B7N783pfGJ/1xHd3Uv/s32obPhxeIakuQoQF6y8Z0ynzuwHgNeEb8oMD8CdeqeKdwNcdTXrOlkxsUH/JErzL6hnz4kWIv6ioZs8Yt3fxs7rDWNHiHHHmckl3N2nao956lXDLvfHUIkTPs3yJDl9qleFe7Lj1AGJ6qligKAbxGSzOLlqHmHpc61y4qZQhI28aknOaS4Izx6cWmvicKvnKpCQsLq5MUEY1sc/qeSM9m7rHvv6Vfz4BBsOtOBLOLczEWFVukqb9s9xGtXX6vums8CerItK/Q1HbOfNRmO8CuzmXQ/vk1UeQ4SfnTjtY0nLsaKGuQwYQiefZcylrcVIF/qcBpYLDE6HEnkaJtagJWj5uF7b2gRaYwnA7JnNq+YNfjbjZJBU17d4ORh6YfieiOQw/u1n1BkZOAGDwguJ+29yqLnW5Xp2rs+iuAhiF4YjI3ydX9BX1lDY81CAlD+qkInjqF37vPm+BA7ecNsAqWy9jP00cQKET/qcBJKeEMuNLkPwxLeupWO07rnBTMHpvEkinl4l0qbayqEWEexF340GFSl5U5KQ+1LEliHkGvcKqTwU+Nclbmu01nsw+cxbfzjPgD9CFRjtRsWcnjgIcK8ChO0ixlr+6oqze1wKXvrI2EU0eBntC1blrgUgn8O8jHbd1t6L0Atj5O1qTI3bQcC7mQrJovJgFS/SVrWhuQEgFVTcQoFqJp/UG2JY0AP2L8QpKOquPrp3UtjVRMbSh6e/uqX3ujcwAgjRR5JHkAawDAKOJMLF8qUdSd62/aPcqnCOHw99K7ZdpQYfylI2ZTIYjKFKqaIHHk0HledTUdFn0o3UgeX5QXSOsYVDPj57goXzRM5ccgHtur+blOzbdMb/f7urOme8/8m5kyGsMpTIwbviQyHF/PB+mhDOU1icbGnlr2mlFRyIpjE6xztSysAhI5gLQdbVMGwImkJJ5uZWdMI54ZPjzChPjZdpYbBvBmSJtwnaCPktbsZWBKMi625NeIHndU6ah0Xl3Q7utiamHHemfwXJ2CPjXz8sHwWGa0g0ff6C7cx6zwrOfu4KXuPIjoBf3p9EEC9xz786hUbAxx9KR58/Y/1y3dE18CfzQq6jbmOcrJikb5vtq25+0zeviwt4FeUlS4LZyy7YIJWewsVuWUO9Ci82ZdilIMMSM2CqlAGmEAFKH7hNMvT2ffNor3DW2Ae2IB X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d9a1d93-68d4-45f5-0c8e-08d91fb70d50 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 19:55:31.3915 (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: yG6g88Mb5ojLMPbMSMaCvi1RqKLYxrlD89JO+Wt7phEUolGyQRcHD+8aS2DMBXLkm94XaC5wcFLBxw0aDTHWjeFXZu04IGYGoASXCFEdxpM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4544 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 X-Proofpoint-ORIG-GUID: qe6k-o7eQGOe4dEc4ff7lflChUqPcz6l X-Proofpoint-GUID: qe6k-o7eQGOe4dEc4ff7lflChUqPcz6l X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250121 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch renames the following functions to make the nameing scheme more consistent: xfs_attr_shortform_remove -> xfs_attr_sf_removename xfs_attr_node_remove_name -> xfs_attr_node_removename xfs_attr_set_fmt -> xfs_attr_sf_addname Suggested-by: Darrick J. Wong Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R --- fs/xfs/libxfs/xfs_attr.c | 18 +++++++++--------- fs/xfs/libxfs/xfs_attr_leaf.c | 2 +- fs/xfs/libxfs/xfs_attr_leaf.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 7294a2e..20b1e3c 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -63,8 +63,8 @@ STATIC int xfs_attr_fillstate(xfs_da_state_t *state); STATIC int xfs_attr_refillstate(xfs_da_state_t *state); STATIC int xfs_attr_set_iter(struct xfs_delattr_context *dac, struct xfs_buf **leaf_bp); -STATIC int xfs_attr_node_remove_name(struct xfs_da_args *args, - struct xfs_da_state *state); +STATIC int xfs_attr_node_removename(struct xfs_da_args *args, + struct xfs_da_state *state); int xfs_inode_hasattr( @@ -298,7 +298,7 @@ xfs_attr_set_args( } STATIC int -xfs_attr_set_fmt( +xfs_attr_sf_addname( struct xfs_delattr_context *dac, struct xfs_buf **leaf_bp) { @@ -367,7 +367,7 @@ xfs_attr_set_iter( * release the hold once we return with a clean transaction. */ if (xfs_attr_is_shortform(dp)) - return xfs_attr_set_fmt(dac, leaf_bp); + return xfs_attr_sf_addname(dac, leaf_bp); if (*leaf_bp != NULL) { xfs_trans_bhold_release(args->trans, *leaf_bp); *leaf_bp = NULL; @@ -839,7 +839,7 @@ xfs_attr_shortform_addname(xfs_da_args_t *args) if (retval == -EEXIST) { if (args->attr_flags & XATTR_CREATE) return retval; - retval = xfs_attr_shortform_remove(args); + retval = xfs_attr_sf_removename(args); if (retval) return retval; /* @@ -1222,7 +1222,7 @@ xfs_attr_node_addname_clear_incomplete( if (error) goto out; - error = xfs_attr_node_remove_name(args, state); + error = xfs_attr_node_removename(args, state); /* * Check to see if the tree needs to be collapsed. @@ -1338,7 +1338,7 @@ int xfs_attr_node_removename_setup( } STATIC int -xfs_attr_node_remove_name( +xfs_attr_node_removename( struct xfs_da_args *args, struct xfs_da_state *state) { @@ -1389,7 +1389,7 @@ xfs_attr_remove_iter( * thus state transitions. Call the right helper and return. */ if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) - return xfs_attr_shortform_remove(args); + return xfs_attr_sf_removename(args); if (xfs_attr_is_leaf(dp)) return xfs_attr_leaf_removename(args); @@ -1442,7 +1442,7 @@ xfs_attr_remove_iter( /* fallthrough */ case XFS_DAS_RM_NAME: - retval = xfs_attr_node_remove_name(args, state); + retval = xfs_attr_node_removename(args, state); /* * Check to see if the tree needs to be collapsed. If so, roll diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index d97de20..5a3d261 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -773,7 +773,7 @@ xfs_attr_fork_remove( * Remove an attribute from the shortform attribute list structure. */ int -xfs_attr_shortform_remove( +xfs_attr_sf_removename( struct xfs_da_args *args) { struct xfs_attr_shortform *sf; diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h index 9b1c59f..efa757f 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.h +++ b/fs/xfs/libxfs/xfs_attr_leaf.h @@ -51,7 +51,7 @@ int xfs_attr_shortform_lookup(struct xfs_da_args *args); int xfs_attr_shortform_getvalue(struct xfs_da_args *args); int xfs_attr_shortform_to_leaf(struct xfs_da_args *args, struct xfs_buf **leaf_bp); -int xfs_attr_shortform_remove(struct xfs_da_args *args); +int xfs_attr_sf_removename(struct xfs_da_args *args); int xfs_attr_sf_findname(struct xfs_da_args *args, struct xfs_attr_sf_entry **sfep, unsigned int *basep);