From patchwork Thu Feb 18 16:53:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093945 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 8BDAFC433E0 for ; Thu, 18 Feb 2021 18:48:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34E0461606 for ; Thu, 18 Feb 2021 18:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232963AbhBRSro (ORCPT ); Thu, 18 Feb 2021 13:47:44 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45840 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234017AbhBRQyt (ORCPT ); Thu, 18 Feb 2021 11:54:49 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGngnD069596 for ; Thu, 18 Feb 2021 16:54:06 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=WnS28Q0eLfLg7beJiPLd35hxS2KWbzebfpmi0Pra2YI=; b=HtdhuJ6z1T7PW76G0LS1z9s21kqyaWKlkehHqpFL4NRoywzd2tLB3ygHUpAVwFuZAsg5 mktska7nZkGvGxllX2tA5/tefEHPPQAv9jvlKNpNnF2Ljh6imH76+YUa6Ifz+XGNVov7 6bQQkGHX+i61pJspAk1LauvRyND3OEculFA3sukSPzOvhL78EsPPzPfoIvdnaCbs325b CgTw+gmoyGxmJuudNURsyW3bK9XC+s4WjpchS7EwZKL6z5IoKXELV6b6UMCbVWzr/DwO 3xCq2gwh02eFqD1Qby7pixa6BW8ZQM8u/842cjVqlneGOt0Mkd+G/aRTMYSOFD/sA9D4 Cw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ae4pk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:06 +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 11IGngUk162355 for ; Thu, 18 Feb 2021 16:54:05 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by userp3020.oracle.com with ESMTP id 36prhufdh3-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h8jAwKRXxybwPUyWun9UdOEoevduRjRvFxaDv3y7Q6BLKNmvBQtJ/yLpSt1rnjmh0Hqm4aZ/z8lNyqufe2NlCHEUbqTgb/+iPD5+0rcPRgtBuLT7ajw2C0NMdSFcLdEHQ/9TiYm7GQjDZAg/5gjkvYCgud9gfORDZj59HwNeIIYr6IBLyVWlL+fBYM5Dz2LNOMLXunHw+unEYRPeEGRTA9FcLQ2kkd/J52sCVfvekweaRRtTLlOdykpeCb9dCmV8h0VHwTmGdQfy5B4iW95dJLJKtL955o/1ww0i1DB1JOV+ETRjD0i5C1uv3eGdu7dLpgLFQIqq1op/H3ctkb9mKg== 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=WnS28Q0eLfLg7beJiPLd35hxS2KWbzebfpmi0Pra2YI=; b=DGQB9rIdKiKbKy1iZFWw0QUEvkcD9yx5yHNxTv0ZvwVytLxUcAx8PkGvqWxyBlw4YvKQfUcZq4rfTkg40fl+cBED4cBFQla6aht/906mjVnwu1Xui+fu6b4NJ84URQx+5RJ4PGPaNeqYNllfdHIuGwrBtsot1afQKstyUfnvP/PNiwghNslO4VOdjjbDC80atWvrRAkXvfCFuCUW2mgol+odCqnzS8aSC7U3m67TGKD+r9X8oPdi96zDM1GE0ObH+GDAjYudnkt9/8AxaCaXz/Yklahva5TVzpcwdk2+bZbPEjSAj7fFVEXxBV/IN8PgHpEJLORfFuat67zTj09Ihg== 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=WnS28Q0eLfLg7beJiPLd35hxS2KWbzebfpmi0Pra2YI=; b=IJp7NkkbWmJjzcU5UGPUXKxvr4ecIZfB+z+GdK1IO6FWg2tTslAFfIIGoVXjSvcYDR4JTVQGMPgs86pmdoTsjrtdUFADVe87Cu0do0qs4uypFvRM17nEF8AQh0Of737jaFTraK4BY2rMpPnpq7YRER+f2uYavlrKta3zZ9m5Vdg= 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 BY5PR10MB4161.namprd10.prod.outlook.com (2603:10b6:a03:213::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:54:03 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:03 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 01/22] xfs: Add helper xfs_attr_node_remove_step Date: Thu, 18 Feb 2021 09:53:27 -0700 Message-Id: <20210218165348.4754-2-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 95a417d8-b919-4aa3-40e4-08d8d42dcbd2 X-MS-TrafficTypeDiagnostic: BY5PR10MB4161: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2582; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RuHc14fx7bCt2z5NJnHGbbwDiEK+5XFGhNHoqobbPeb8Zm2C9vL7/i6tMuj+jI3f+ZyLs0/wG1X0hctHfisINGnRx6rUFfGM04RkFXPGfcu8CyDnN/R5A0S31s92fVuLaGl84qYaEXw2GHISqNudIfNOQPuZmf3uI+DzYf/Wwq7UwWg9aJUWziSEZ2SLU1sef8wT8NAasb5RdtL5gYMcreMxeJw3UaDlvp/v4sFgPo2DzfrpegmcbeR5SlvRdoRrklyIiI6UzxtcpGg0k2IVxXt3IAxORG5aBTWvvakJHA+EhJIic+kfeCQHlsOpL8yEjsRYFwq7TEygv+8zydu8xehr9p+8OpVL+XBcaWTuqkL3J7nMCs6lm471SxdHsnvky10NAf/VjCbdXNR1bHZ33CRrAnhfdwPuCI6cDPuoH3BpOeCPM4ealvQqBmLj+kXWp/vohXZWvUQCJjAG5wWj2DNpsI7AP48R+aUgII48C93/X8iLbFgWrc35rWbVAiCtOLrfYBqXGc7e8JmWKVHJg8o+xUJChaGF5s9XlYxlxGKA4/ffaWIMeoZ9XDJW8UXXdt3GBHcU9QtoN1GyhCT/YQ== 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)(376002)(396003)(366004)(136003)(346002)(16526019)(66556008)(6506007)(478600001)(5660300002)(956004)(69590400012)(26005)(6486002)(83380400001)(66476007)(186003)(66946007)(2616005)(52116002)(6512007)(1076003)(6666004)(316002)(8676002)(8936002)(6916009)(36756003)(2906002)(86362001)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7YDC3zfeCoFT2RJHJeDcDxKWQb18A2+3ABmRtref6cv2uPzC7PveMJP+ddadSH97vZ4CB+ZS7xSprO2hVYdCelbzVPhqbuvWEmWSAqhF98PYiLR2ebSYIzOns6IPnoXleedYexw5SO9RTqwRpF9izaTxRmN3HTNUeuctX4AN/UhL/wPk3aV2GU/i+dp46Su8SMCOf0P7f71lTnrzxhCWcAjX6RwNQDuVLhXQZIQ2ngyK3cor0FNxvQ9phcFGArAleFAn654XGi+9LVhbKVNpQJPjPeDm3tjAYnc6tIQ+Wpke6+LA3uQYBD/K8Ny82VRPZbrEcGUvX1t0tGthqHtqds7jx8RMtqj2mmhFzRVoz9MRxEmCydpyj0udipAcqAAfucu9ESbn/WNyP6R7Y81xnyxBTuCn2tO40dtIUAmXLXjChqJ/zae4hP9bxhfiuz4O0Wi7oP19Ytkh50/CAqTRHCgIeuZ7lXgSX2H7EL/u01waOyw/deRBd3GgXwpD7jydaZz5QMU4cgdTr5DvGLXcKRwqlai3k7pc33iMbzdgxjHvTPUy2HutfZ8h45pWLiHDlwWNVsYx4LbJ/2evRTBWdxzsajjeSgcJJVFGyzi3VbiD5qlRopV3Zbwahwn4kFuG7C2SMOZ+lgrjF7bFFZGKj3+bnNeEnU+K/xXmGW35d+u+eYQGbs95D5qmYEmjlIfr+ycGnpQ9KVEQ914J7PxCpQ7z1qftCBD/B0paQShFOCwcNnu30v7k674b0xdAqOWOki2PZrO8PJhKABCwt+rhL8Sse2kxfLRn/1f+iAWOa4nznuqbPGPnPJW+/OKEaoBpL5LorlIVOEE/ity10wdA+lk9xR5rLvUyXpcoDLVLk3E9HwP34IqMaC/FIEt/QycIyKsNMbMvq4+cwoqigG+AsRL34G+uJg79/iD6hWc26xNIGVYTZveVYlNiOhIXKf4YrFADVDyopziI9pSGp6lfNryvi/3lhi++Cm1oXxtMtb3cDiYuNMnmN/BNSJPjV9bQNw6vCeIzuzLrVqw/lekbMT1bo8TnEM+w8kmLqLuvNstigX1lSR4frc7N2RVLCmU24fZZYIuBRMIRU4f7g4SD+lAAP6F/fyZT7ktn+nZQSEJDPSX3nVXVjG5CD1icmHwXKxmnyA85XiqsC0i4EHL5nvzRSAnPcVG2iRYOKhzDSpGKhO9iW59v8ZVSqWl2y2x4CuldgFaPuXKmairSJKkQZkgkIK+FpIUc6hEyePlHt9BvKrSQleIRufOuuAXkghCTt87zGKrv5FYp5Gzk5Rlq67ESYSWO6WtZaU8Xe+txtdMAk8wvwZfaN8GoK8h5YvmN X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95a417d8-b919-4aa3-40e4-08d8d42dcbd2 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:03.2947 (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: 9fjskxsVO/Wjt4yhICvPCOUcPg1mV8Gnrub7hR8D50ZgabCRJF0gNMsdLnVMPWVzvblebDT9rDRf/vS5NhixZ+DIbmj+u6wxkBJl4hl0hSM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4161 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Allison Collins This patch adds a new helper function xfs_attr_node_remove_step. This will help simplify and modularize the calling function xfs_attr_node_removename. Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R Reviewed-by: Brian Foster --- fs/xfs/libxfs/xfs_attr.c | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 472b303..28ff93d 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1228,19 +1228,14 @@ xfs_attr_node_remove_rmt( * the root node (a special case of an intermediate node). */ STATIC int -xfs_attr_node_removename( - struct xfs_da_args *args) +xfs_attr_node_remove_step( + struct xfs_da_args *args, + struct xfs_da_state *state) { - struct xfs_da_state *state; struct xfs_da_state_blk *blk; int retval, error; struct xfs_inode *dp = args->dp; - trace_xfs_attr_node_removename(args); - - error = xfs_attr_node_removename_setup(args, &state); - if (error) - goto out; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1250,7 +1245,7 @@ xfs_attr_node_removename( if (args->rmtblkno > 0) { error = xfs_attr_node_remove_rmt(args, state); if (error) - goto out; + return error; } /* @@ -1267,18 +1262,45 @@ xfs_attr_node_removename( if (retval && (state->path.active > 1)) { error = xfs_da3_join(state); if (error) - goto out; + return error; error = xfs_defer_finish(&args->trans); if (error) - goto out; + return error; /* * Commit the Btree join operation and start a new trans. */ error = xfs_trans_roll_inode(&args->trans, dp); if (error) - goto out; + return error; } + return error; +} + +/* + * Remove a name from a B-tree attribute list. + * + * This routine will find the blocks of the name to remove, remove them and + * shrink the tree if needed. + */ +STATIC int +xfs_attr_node_removename( + struct xfs_da_args *args) +{ + struct xfs_da_state *state = NULL; + int error; + struct xfs_inode *dp = args->dp; + + trace_xfs_attr_node_removename(args); + + error = xfs_attr_node_removename_setup(args, &state); + if (error) + goto out; + + error = xfs_attr_node_remove_step(args, state); + if (error) + goto out; + /* * If the result is small enough, push it all into the inode. */ From patchwork Thu Feb 18 16:53:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093953 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 CF9E4C433E0 for ; Thu, 18 Feb 2021 18:48:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C82261606 for ; Thu, 18 Feb 2021 18:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233014AbhBRSrw (ORCPT ); Thu, 18 Feb 2021 13:47:52 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45854 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234018AbhBRQyu (ORCPT ); Thu, 18 Feb 2021 11:54:50 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGngmr069610 for ; Thu, 18 Feb 2021 16:54:06 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=clKcZJdLjHg6bd50Fr+2oNJzg5EPFjZgxeEk/SRh8pc=; b=C7GqT4hKWijXp5jhQJHYo6l70j+9Z2qBoJsQ8Oiv6nv9WK/594ZQKYc+cM6zoor6KDSC RbcdmsnmRqcYXJgmJalSdUduOfkagGvas/NTm5UXGl+OzDOBya6HWZ+imOzjqQZXEEwo RjQCAy0kWbHSfObFxGw0u1w24plZj/ntynN2kAiTWTnCl6z1P1+mV+Bz7KaISQGr/0f4 ztEVeg36+8T0WS7wzaToeC/tUasbh8oP0WLVf9+w/QFJ5/2AkRgk2Em+31pYqxWCSXGd g4xrO7I69qSrhrZeGR1UAAPViTJHa+b4OsSPTYHiTZsHniQSkC/Hta4miTyyqE6nPYeQ LA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ae4pn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:06 +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 11IGngUl162355 for ; Thu, 18 Feb 2021 16:54:05 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by userp3020.oracle.com with ESMTP id 36prhufdh3-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PaI2Q5pmtclLIx3wOSGzCCnxKtJbp6ybhL9SZ8levwwD30Xv2JU4jcecGmMoDfRocJN5YzzQAL9qYnoXZAuTgcU7RzUsxyR65pkc/vVfwwOdPLWsu7BznqJOXd1Q5Dog6VyYFnLELGfHmc4nwMu4PXbLkJ2RsqHoJva51TgVKYKULS4PxTwpl8Cc3B39m1MkriDqvL5kAyMzZ0lRnQywL1JyPBn+8HGm061acnP5tHBEaKPlPyMh3zbh5Vx8ymzCrRKFSGNknt0z5u57XpHAcEMnlAROIljHfNf1xXB+atG8Rps1POIILhua/9urc6jmydRulfMpTwCIz0tl3WmuLA== 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=clKcZJdLjHg6bd50Fr+2oNJzg5EPFjZgxeEk/SRh8pc=; b=CcIDHIWXexQelpSh6A/0Roj4Uc2LXVE6Xqy2cYUm8CClmC2aNQ1x6gprr8YZ20yKDgVKe4bE1bGXP+A55C6KzY5IefKLkmlqzMG/zeIKm78NcE5vCrM8hND5F6GyWLldFufkPIZO3M4XpFBAv8PPf1Ne9TH4lDzcLZ8qHnT5oBoGo3g2qzEu82i6mJdtdkDMio4W7TOc3Wz4EG9FrQs+PqkhrsfoxcIBud8wFcCTCDO++GGDLPAGuiEo3rKFpXt8hMIVFoKjhTPKlg2LZ4wbJSMO1iU6He6xyotW81YzGLqoUULQrsU7qoodjrDWVCEW8uDPy5UJuxPWg510u+YHiA== 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=clKcZJdLjHg6bd50Fr+2oNJzg5EPFjZgxeEk/SRh8pc=; b=GtbboYDuT8bJfRBuic3XTgelR9+msbVU34h5au00JJUyLYBesAM1+DV586Zw4mNIwOa1hIew+z0rMi9Nkqic81R5DoqWYMoZBGOHvFdG8/zdCxQjSBwSASGsa3B1ZOTy4QwIMLFXEfxfLRFjKE36LNnyuBx4J9ko+c3wTeUJeh4= 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 BY5PR10MB4161.namprd10.prod.outlook.com (2603:10b6:a03:213::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:54:03 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:03 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 02/22] xfs: Add xfs_attr_node_remove_cleanup Date: Thu, 18 Feb 2021 09:53:28 -0700 Message-Id: <20210218165348.4754-3-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11429e4e-5d23-4415-f951-08d8d42dcc1e X-MS-TrafficTypeDiagnostic: BY5PR10MB4161: 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: zRXtuwsI6p3i2GaljjBajq+vsTFoD6UYdt4TwNOeoyXEg0ecGUhjLxHPG1PPFldbXoej41I7pDEGY1V7w+swjNPEPsDRFjugQ4oPyqEtIhCVqZVmmjLx96uU0oc3RoSfNRyWBYDl0bj6K8BM6+pbylSQ2WlGgvQeBcmcSP+NYxEVou1521w6mz4W6TJnmwUvMBpnbNFsyq0jn6kQdENMO4ZohFfW/IE+Dik1sJA+v+U+hNv4y1MN3JC289RQIfzGfMzr47sZvYAIKWYMepZ8mEp9TyUF5fwbycZDaT5sgIB9Ch36T3zSi+wkR11Z11AXx1e25vp8UT2tjK26Zc/2BJHJK67QhkkuthYzPyiahrKcvgzXJ8vfZuAO87ZDq5r2z8h6Ag2Ey0jk7nrMV0+w/Downifzt8lK+EGmROiYkuG7Hhr50j0yXUjytZiZgf0UGhGxgBZExukAzgSXMGxgEZY0C8idB48jtssUXJKOmg7F8IE5OBOrh1fiG5S/3xh2B1InDaDNGzH45lhFj1xVMfgEMOg/BkXqy/0Jme5lM+VMUk8aX+Noa8vD6WGLawt47etrh7CdPLoz+B9kPVnlfA== 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)(376002)(396003)(366004)(136003)(346002)(16526019)(66556008)(6506007)(478600001)(5660300002)(956004)(69590400012)(26005)(6486002)(83380400001)(66476007)(186003)(66946007)(2616005)(52116002)(6512007)(1076003)(6666004)(316002)(8676002)(8936002)(6916009)(36756003)(2906002)(86362001)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LGwwttblWOPY9xAnE3WtAL7MhZjAJCxg6TRxAeUg9YxcGBly1k0kqcfNbIWdaOPM4oK2vmbnK0r6egMPxBELSqkhVVDrOZzwsKQGviNjcJCpwjYIGyoZabUtI5XUcDSlsQ/B48n9K39vcg55nepdvQfemLm8ekCvM5+mo9W1bCU7UNkLmNnB9/bLcrx+oFOQA9966N3gLfsfeBrVskUVe09FsoB2kVpdw/sPKjHAlm9bgUanCwf8SCVHE7OP/1G9VErG9AG2x/1J8CCfLmukzHVFF2QoqoF2S7zWKJZpA7DfFpvGukfMYkIwSwmvlFw1BW++p8esxYBk5PrmSfDTrvlhjaUGexVre9hgGnnlTnOeYthvIlAqV9Kq1MPwcBjy6d9TZNNu3GmLpJPRrTTrFRXipLGWv83djrTWKLybFAWftCoYGl8ia1kiN6CvRH4r8X8mXuNgZQ1WHX60FL78dFa9eCBrgSdIW+rIBkzJ0kK1Imyra+2abzzmV02NfEZz2H2ysalIewGEIXOnq9xHA3hqaWno0gNsGnFogJYL/PukIiK64Xd5T8uU6ey0j8/Z5rpj64cXdiZzhWBeT4Kr5RYTnqUmsLpQOhiP9684BWiMwr3yn2+OmZRw517yf5ZSfyokQdT0ZcsFLeeS4d5rE2tQOr8+o0FUoROBOnlC6WLG4g5UT93OS17lbhCMl/u45zbx7WntgwOZ4/rV0BQAsaoHIitr+o72C04pnSbKvKNnIp+HFmuJ/nvmMT+P3wS/cty+l4KPPqUfu2IpeND35TScQUuFsvvvg30XSaUWS9BG+9c59dFXNFSNc5NRSLr0lchEEtLE3jFZRBQWvQ5wolxPTej+e+/bQH9pMofyfnrLCNlSAYs9JtKXQ51T1x1/kvzo98zj7kgQMAQy7KLBQjH5cE3692C1mSomr5Rh/DBdT2P/0sPx5mBIhRGCdgRwxrNMPnwX+CgFcsY84rnK6PKG7iAaANf9D2aw3MekxbcA2kH8cLpJRTPz5RkCrVqCDKS9OSsxWEQnpqmMXWyIo9M+BcfF00bVnhXOAomEgQDaWl/WDR8rYx0rUTJgZA13dQSoAaIzubaTYzuFJ5r2G0oduT2n3/AfXiqCHohb+EUXZgUU1oam95WzrSrVdxbAflxOv13PYOfy5DYjw5nZ/oMVI1x5ElRwvU/ephK/8c529CH/EFg5Dhd7NI9MECkwgYrqw+5nIMYcRqrMOXQ7/tWZO3JFTDoaIOOEuGA70U1CKzQkaWlhG3xwIilZ3euJP8sRomLQ4WBgiATk39G1M6HBBQMPnepDoA7yGJ3/47UpGIW7PoXYLOk52XPsCSCb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11429e4e-5d23-4415-f951-08d8d42dcc1e X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:03.7358 (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: /dFr8+PUWq7z2/R4Xql+98yDrU4iPbshs+4fBbawcW57jupd9pUrUTnnjJUWY7hYx5dunDuoFENHLpaDQ7i6+z0iWWvs+2DJXB/Z7l2eOKI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4161 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch pulls a new helper function xfs_attr_node_remove_cleanup out of xfs_attr_node_remove_step. This helps to modularize xfs_attr_node_remove_step which will help make the delayed attribute code easier to follow Signed-off-by: Allison Henderson Reviewed-by: Chandan Babu R Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- 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 28ff93d..4e6c89d 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1220,6 +1220,25 @@ xfs_attr_node_remove_rmt( return xfs_attr_refillstate(state); } +STATIC int +xfs_attr_node_remove_cleanup( + struct xfs_da_args *args, + struct xfs_da_state *state) +{ + struct xfs_da_state_blk *blk; + int retval; + + /* + * Remove the name and update the hashvals in the tree. + */ + blk = &state->path.blk[state->path.active-1]; + ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); + retval = xfs_attr3_leaf_remove(blk->bp, args); + xfs_da3_fixhashpath(state, &state->path); + + return retval; +} + /* * Remove a name from a B-tree attribute list. * @@ -1232,7 +1251,6 @@ xfs_attr_node_remove_step( struct xfs_da_args *args, struct xfs_da_state *state) { - struct xfs_da_state_blk *blk; int retval, error; struct xfs_inode *dp = args->dp; @@ -1247,14 +1265,7 @@ xfs_attr_node_remove_step( if (error) return error; } - - /* - * Remove the name and update the hashvals in the tree. - */ - blk = &state->path.blk[ state->path.active-1 ]; - ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); - retval = xfs_attr3_leaf_remove(blk->bp, args); - xfs_da3_fixhashpath(state, &state->path); + retval = xfs_attr_node_remove_cleanup(args, state); /* * Check to see if the tree needs to be collapsed. From patchwork Thu Feb 18 16:53:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093947 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 D1533C433E9 for ; Thu, 18 Feb 2021 18:48:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9291064EB8 for ; Thu, 18 Feb 2021 18:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232983AbhBRSru (ORCPT ); Thu, 18 Feb 2021 13:47:50 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:53528 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234019AbhBRQyu (ORCPT ); Thu, 18 Feb 2021 11:54:50 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGmxhH185318 for ; Thu, 18 Feb 2021 16:54:07 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=3S3Hhw/i/yOG9xMWB2Hm7OX2IWpJcx7J9BdJNvdZ+WA=; b=Uhpd/TC0zphgLuPMemC4oawloCKfy3nk0/KrfMbfJUaoX2KPPwrkvYdSkKic7QUUzWVx nb71tCKfAuxpNbsVeO1+0fFjUJ+jUm+5HcPBRH2wCsFFXcdeI7pFGAYsZX3vC6zLQXbv 2EZNAVfxZer2NjW850eonJ+mkmxieHw5qOjL9hMuSl9g1NRDHToDFBsO2mFlKbdV55it gfS+hhgTF9UdZOd9zBA/wzwLEm8/Cje20Om9tT6Y5CH0UHs79DQp6pqIsTJJczXfRT8N pzWKWBU/JbWx2OxgrVcb3isJcDI0KTGtubPIUxQxZdWIUuf1Pbs1Z8xL3a0EsGWSJC1D jg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36p66r6n8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:06 +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 11IGoG3M155234 for ; Thu, 18 Feb 2021 16:54:06 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 36prp1ruuc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=INHKz0ZWUvAGfuNk1tMWsYOVHVmmhxARY4AwsjoOYbRBD7yvw6LPcxmp6w5PxcefQH9oyA26iI7X1CfuoGTqxN1IzoB2RJlFVfl72d/uWrwFM5zM5yWhWs/F2MtTomM8NbMACDLXC5MRj4yJBDtw4V1WPrC+/9JxrY8D7wSkZVcJHAqwSzDyfkHOJn3WzYAHG8kYA7ZB3tidsZXXlLsgYxX7dwgtrbMVWCCqiSX053T5UW+QwzFFdtL+1m4R50pzLjpW8kKOqv+GqHpK5QBpaU2N4ejTWFqpm0QkA+FhzxBdhpnVmpP8LAgU8yOlhNGOeiPmFPZaE/7SbFCD/IW0Zw== 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=3S3Hhw/i/yOG9xMWB2Hm7OX2IWpJcx7J9BdJNvdZ+WA=; b=LMUCFfwI0z9KHPi9NjoExg8IAe2TZh2mLGMko1o8IIZVuyT4GgArqUxq0abQ36CBJAK4O7tbphtuixiiTDVIX0Mol0pdO0w6qzucBvVywIjPnf6qzU8fQ5apwjfT7m/zCSnyxTtuIPgSuRFLwhor5iLiBV8XXDhGDX5MsmWmwdyDHtX/6hk0YI9VURSG4rZMak5FsT5fOnm9IyWtjO2Z/AJWCg/vLWRVufB8L+33Ll2JMxUIeGX1h/DCwz5F/N46yV8cSzriybu8GCFNRQLoNecSZlUN5PspOgVHuA18e9L3CVGCDB+6qKklpG9hx3jVkYXpirfs6Kc95p1fFNyUGQ== 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=3S3Hhw/i/yOG9xMWB2Hm7OX2IWpJcx7J9BdJNvdZ+WA=; b=F3vRndkmeits10KQq7/vbkxEVrkxgL3EmWWD/n/9BhZgAE9P4HTzEWqtyfSrD9jnoNifXP1dIQUjXIPpx3jUZbZLEjUBXXvYxfPB4ebqbQDFr0GmGmglulz8vWu1vuBpQrVAfy7Mz6j94sRxL8yKjXsBzV4iV0R4hUzTbp4frR8= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:04 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:04 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 03/22] xfs: Hoist transaction handling in xfs_attr_node_remove_step Date: Thu, 18 Feb 2021 09:53:29 -0700 Message-Id: <20210218165348.4754-4-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1232ea1-1a5c-4bb1-503c-08d8d42dcc65 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: M0XSaHISLF2CnEpSq+hEyjnyLqgRWuw1PqnhxhgY7wMV09zYd8spbZSbfBgK7GENKvqQOUngwPcqb8u/2DW/V/TrHkUc/aFokAqNHfg7bTn1D4nElU0kHbaYtynZH7+0lLCGaCHRkg0fkEJ3l9VjIxSP9SuJeCXNfDkGR7HkJfy2gr4xsx9ltczg3CA85cZ2434LsRtlzay/b/7xPEI9rUTPs/mcSUjitJrpjyTDfY+DD/74zfDPZJy6HnnKKr2ApwrG0JWVq5P1Z+IcU6LmHmeLf+njH94dW/ltIsNn74RovtcG4hNtRBYB7sKqGEzWXzyZQ0nt4G69c5oYMgaYR65nhD6eTCECdBqWmYmXclrN2E3ng04MZxosv08IfT8fkhzOZZWjswXCL53oWDWSf7ULmaXfTwlRPti/TptInbizpWRB7fiVGYoSaImRs5HEDwgK6g87/KFFdC00qBgUJT6E/JZaHmqDQQbFGoui41x7PbRu7AjFRf2JsePhh9T3zf+CrwsvaOoo4NIPLH6TJC347f8PoaBHy4uTapvZ/YyY6LnxkKY+8sZ4RmvhGs5SnOzg3yBS/c9/128VCCLxbQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: uu7JObaOkET3AgGdVcy7b05Y7D46seu9PxqlBflLVwEYSUO8jjKd9UjgSO/RNfvuVAgBX/b/KDOFvw7HiqvXhabeaZ5Gi+gTn/oxY1siRUeZFnLHjkv305Iju/jrwfv7I7a/iqNfO1TUB1VIbVgwRyT6bXavKfU8PdyFhAiPc+g6Mcfin6eQEfdqcvLriZtr5M+mveD5MzR5qzh2musm4zx/hkG6zwyEvD8eatvXC5RYchq+j5lmqf2omgccdgB1QZ/VYPOO6/Yxz2EX1ZME4+PFFlGkdeZ5/qTFUZTx0ElqdkLqUuhD5VrAWKd4/oYB6mKAzaf8H0BKdsMJI6RYXrInglH43jotwPSoya6fx25kQ6rqGVOzVFEneMtokIYx+ZPk1IMMfAtj/hzCBGV/qr4h2UwYGzyHeSiArAR27SW0X+UPgBp63mruzJt0NTsUqgiGCS7OjIc45NaGRymL5rzOCDpVt19Ie8OR+CZJvDBS316qrt4Dc5bqu0fBZxSxSCj5s2AmHkUBFX1PRzAlZvyOsbI8fxzqBxiUhr9CEXPBOIKBWNiIiUJmlTd5ugjEZiCSVD6GfV5IKjvIRmeEL3CyFcdWgos9KEq2ox0T+/Ngsxi7vr4v7LizPNSYSCaFR+8E2BCRu8QOGp+MgOCLdFQeQxhl3JhJnVfBLAZTT1bHAKwgDsZMW+TneSKMNm+Vdba11agRpVfFyScy4rGQMUthremH0f3NF42DiodsANJA/y8MpziLI18cckF9tscgpSg8r0izg2Lv2HjP3NUh8dRC3Iev6kajfA1tUu4BGhqCGlhjW0TWVdO8Li0EYRz+6AKz4bfV7P8p7QvenJGh4aTwWaTrN7xjvob0FzG7ZJ+UQ4L7AT0dSx0wIfRi014dNOH6LclTwQVBk+A1g7fzlQ0TR7W3HeXwR8u3FsBQ56JK+rIHvUy7WRG8RRYG4cQnLWDqIr4rGs0QWSZtrvE84/zmRvlRzlAqMwas+K4zsARGCouHfQqBtMuVRA68JoHPG64L859ozENNs1FkWikeqfTWg/26DC/Eea67WMf/YdJanQdeqEj1o3draFDNkQcDBLEOoxZcPBYi7KElrmxkS8L/hn/zJdVcXlseicV8IK5Y7qXFUKNueCg7ZIZfxx4Zi1MusKp+h3wCEwvqnd2N6keJsGZY9S1L8i9+ivKupzJqeKKHHZzSlIhOwfScH68FWkTmnPEM90LjaZ7Ly0X8kYNVRVd4zuxjtSep3IHaglCDSJJo7MMqFy0S2uYd7aLMF/EGaSB155/Uiaq5Ou1TJIK3UK9ldV0bXIFs9fribu1jaH6oFKP1kRm+SI5JpnTX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1232ea1-1a5c-4bb1-503c-08d8d42dcc65 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:04.2047 (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: 973/gQOYwwprF/YGPn/kdV1QPxiHRkzEiwKd8r9/HDNXnUC2oOZAUqSpKuoRW/5EgXULZUEekRMEzerrr4yXz1mtk7I/TNzvZY9+iYkz3v0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch hoists transaction handling in xfs_attr_node_removename to xfs_attr_node_remove_step. This will help keep transaction handling in higher level functions instead of buried in subfunctions when we introduce delay attributes Signed-off-by: Allison Henderson Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 4e6c89d..3cf76e2 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1251,9 +1251,7 @@ xfs_attr_node_remove_step( struct xfs_da_args *args, struct xfs_da_state *state) { - int retval, error; - struct xfs_inode *dp = args->dp; - + int error = 0; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1265,25 +1263,6 @@ xfs_attr_node_remove_step( if (error) return error; } - retval = xfs_attr_node_remove_cleanup(args, state); - - /* - * Check to see if the tree needs to be collapsed. - */ - if (retval && (state->path.active > 1)) { - error = xfs_da3_join(state); - if (error) - return error; - error = xfs_defer_finish(&args->trans); - if (error) - return error; - /* - * Commit the Btree join operation and start a new trans. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; - } return error; } @@ -1299,7 +1278,7 @@ xfs_attr_node_removename( struct xfs_da_args *args) { struct xfs_da_state *state = NULL; - int error; + int retval, error; struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); @@ -1312,6 +1291,26 @@ xfs_attr_node_removename( if (error) goto out; + retval = xfs_attr_node_remove_cleanup(args, state); + + /* + * Check to see if the tree needs to be collapsed. + */ + if (retval && (state->path.active > 1)) { + error = xfs_da3_join(state); + if (error) + goto out; + error = xfs_defer_finish(&args->trans); + if (error) + goto out; + /* + * Commit the Btree join operation and start a new trans. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + goto out; + } + /* * If the result is small enough, push it all into the inode. */ From patchwork Thu Feb 18 16:53:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093965 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 7D02EC43331 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 502FB61606 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbhBRSsI (ORCPT ); Thu, 18 Feb 2021 13:48:08 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53494 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234032AbhBRQzU (ORCPT ); Thu, 18 Feb 2021 11:55:20 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGsCvs016465 for ; Thu, 18 Feb 2021 16:54:12 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=oPQa1+7sybLIQmDPJ0z39bQTtxT344ZVosAGSEjeWP8=; b=BENLhD4ucOw+2n8uF6wllQm2Jl+n3WW1rYPA3B1k7bd4Ks39erXz3Xfe0/wIFNfXsVnC 1Wh8ghv8UyjFtXuBDVlWgO2Mnoq+a8xh8agbMkxsAnZI50qVfql7wFNydsuYfYzByQ9N RJtn2jKV+wcJ3F+iyP0xdu1m+Jx/6tdh8biDnNsaFAmTMOdNgZbOgK81KMLBkq34IMbA MITcl7sMncSz18HrAoQQrKrFvUJY8gIphdntq6SJe/z3mP9pNPrljL33cJ0IXlpz0i1f ZwjqCOYOO/HIB2mw+yOvO8QqNsWXKEDWHMU9+oqXSWmBvcQqn0kQx/fXXmOGrHO5CXNG Tw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 36p7dnpj6a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:12 +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 11IGoG3N155234 for ; Thu, 18 Feb 2021 16:54:06 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 36prp1ruuc-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VPTTJ3BJ1gXavfJBwtC7UiQMKw8v3YzG22MAsCl0iK7VAGTEJSLjGTydlwPZcvqFMe4urWsifvly8nwyxQE8PJYjNNdUr08qWQc6Yg5XQex46HawWanZvU6XtnaAW030kjPrBBhakc9R5jvgxJ2IPsROzbDiJvZg4wAULTAxhkGjDi4+IoVeTuTcUclOIsz9FSTrGSZydh1UKSQTng18TpLJMZpKYh3/un6dQVhoqiq4qAEfjx4SkD5yXjFVuRfUaLUyeUil4bYSDxKcQDicsIBRofq/ZJ+9/BWZLiZ/+7FZiaCmB0VjG0FMJViPzUvjzngo9H75osv69opK7n8NXg== 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=oPQa1+7sybLIQmDPJ0z39bQTtxT344ZVosAGSEjeWP8=; b=RWCbUUhHSUSOlT3VIoolUdjiyOZ/ml6oFWn22UjymasEtRuGfhaIiCa+qjMUjp7APuqpaDz6lwFFH8dFvoiEYopnfL7/kvp4KYfTPvK1yJaVvjAKsqT3AB2BgSVZnIGtehBjHUETOrXqDv5Ll7osB6IO6Cs2BG+qLDkNVkWTI0lWcvxt1JFn5vSLW/Tv1PpocvSORtn1OtiO7j6Gb0SusH3mXMQqyXsCO8qMEZVppxt7YJNWqanJqA/H/Q+qU9AgqSUpRxaUM7SDJbEU2VieMtWbvvxtNN/4v0BrG/eVCuUUbuwKhwbJM+JFGduEUNN7lPleljcmGbkOTdagqwevnw== 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=oPQa1+7sybLIQmDPJ0z39bQTtxT344ZVosAGSEjeWP8=; b=kkn1dpYYuGB5HDl/Z4MUEruQpsvWJGgmZnq4qpB1LT0jeoDjAtlU0YbronxMYcC/Z25Axkn2AYSfhv8DsYi60oUPmADtrhtfb5lhAiIxlMfZrZCrZH+AkL1b8vaZXWKhkZuiiAFQN+OxORwY0HbcGNZOAGozYPwikseSN0e7RJg= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:04 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:04 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 04/22] xfs: Hoist xfs_attr_set_shortform Date: Thu, 18 Feb 2021 09:53:30 -0700 Message-Id: <20210218165348.4754-5-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5c09c94c-1693-4e80-8726-08d8d42dccb5 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uCvCe4kUjbFDtRVgASCiCPNcIAEd0wus5QJhux/71JpPNDC7+QVGKKXWHgiNC3WGad+674rCCm9oWmsS09GYpA0ZqMRZEDt88SbHEwE3fKCxjzDIABBXAWYNysyhv0z6fChx9g+Irj5UclNz+NwD81Vj2YlrNmG9Hm2lr368Zg1XyNSnsWLLWlaB7cIe1Z9PLZnOxKSWAcP3lDBkibgKQnpCrV/tIjU+CaZS6aTBewQTR36QDURUZGQyNqBykCUXsRS0FgueNYmS7uasdeAP5qF0GTxHpdON0BsdudXu22OEsD15yx/2sD2X4JgltjPCJ7BSQ7sBhmThMjU7YE+c1XKX7LaFw3A+InD5HIKcKH37plaUXQbniW71Q6Afsl4hXKBpl4Sb1+C6PZSVAjuhOd9p/LK5w3JdPIlQygOcmy0JDoLWjqf2lCJsssqo64FmnrrkauUufIWTrouWalYFrLXb9G1wjpXH1ueL9ZAJQqPPnrwv9F7VlCJ1VKpwqUUih5Px+w0E3EWWTmczD5wqnwtF9PVrDU0mwX1lUhz0A3RtIvk5kErzoxmv+l67vN5vWZFgB4trJH6xh2k88gZz3Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DZQbKDkMq5p3qpMW/PvndLi/c+CraxheqwPxC4h2D6VwzeR7G9JAmJrEg94f07wOOBuyn646XnS1e9r6DhwscsSxdYqb5Cl5DtqSPGZzWjt0sNpOJcyFS6dLLo0QxyEqdtl7KJHT5sCgFBYZzCGw+gjquKjvCCnuWUNapCqdGv+D0KM6sqs4wat2bP331LeJk4+9rShF76fSJ4MM9mTtwpGyfVT0JaDX5vFbvnjfoGQctr/USqc7/xixOXjnWig0ILeIAHTZxDTXJdFH+A6Po31S579P4JB+Lg8OOd046M862jdnh86YxQPlsgJ6Y58ytdoClF9CTdZhcHzT/najdE/xgnBnGxBX1A/rHwwmmTewpBr8P9/go/hKmNCm2BkAyxE6bRLAflGENMhPFC+N8QYDvW5guLSSvgU6ZQ+3MYnWl7I9VeurdeZxb3N85193B+1G/vlCNexEO3c7bQUxL8Utahb2kwHWZuUXE4DWM9G+fPI9rRcKPdtasXN1CFDunTWOSqSDn2afcR2KakqTkP5SxWwIRseWPK8lmdB/3i15KMSQ7oQg0waQUNz9Q0JXWmfKK7DEiFkgNgKsT23+1OVnhxJvsQma/4MuLJOxMOM/jdGZsmHxOdHE63EifmW3OplSGaP/GhLs/CzsvV9lzYNIehxh8NoWG8Eh0Qdr68ZZi5PbIN8L/++6IgNCGvnCanU0oPrPW8sTi5AwRpxqm1Q1Kttzd0KeyCGX1G+VuuXP9ypW2uLQ7+Z8j6WCJOmFcb3oYO9M+Yw+tAaK0eWcCh9u+HlK3kSvQnnCpXYBeSrjF9ScpA3yIEB4RllOulRolhhxucXKW+1bXR64p5K1UYWdEF1sON8ALlqxKCGm3bPblicuD7R/scUumrQ2vhB9/+IM5CXwQNU7L+q2iRLhzcqEYvMKBnHNU2oYlAlPJmnHUtfdyynuQ9LmA1MXCS8RFN4Ee2ITRpcTP0gpwIPx2VDn8eSL01GFhocZczQm5GS6hkKWDUCpZvaSrtrJzolK3nnIBh++Ex1rAMT/5xaVZ0j0KfiYx7nce4VKsr7xrOaQ4MphRbD8SKGUKgZ20HUZ56YnDDZihbbmBWCLbxwc1qjWuywOU0IQztdihnaBfswf5BysjYWXyoSd1f3xgJmkQeO5O9p4LPVOLwrx6yQs4amNSSRbKAikadd3LITkrcXxiLma97UnBaBr7j4C2YWrcYqMfoY8pKvF5iRVFVLphqV9gxUO00H314SOCsTDwnYougygp4eGauKrUyyzCsB0QI82o7QoV8lDE5XQXMyuQ7WYPaAhcRuF0YqT5e14gBAwcX0XV00KDghgDvl88gaP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c09c94c-1693-4e80-8726-08d8d42dccb5 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:04.7265 (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: SpabC3QzH2/ddkjIw1YPKU1VNNwDgLNANodfQeUMETdXdBgaxnLWfsHgOlxNZBmHIMVgkFaKC85Kk2gAKwUPnAmFD6/Y8E/TuKznqUK72NY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180143 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch hoists xfs_attr_set_shortform into the calling function. This will help keep all state management code in the same scope. Signed-off-by: Allison Henderson Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 81 ++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 54 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 3cf76e2..a064c5b 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -217,53 +217,6 @@ xfs_attr_is_shortform( } /* - * Attempts to set an attr in shortform, or converts short form to leaf form if - * there is not enough room. If the attr is set, the transaction is committed - * and set to NULL. - */ -STATIC int -xfs_attr_set_shortform( - struct xfs_da_args *args, - struct xfs_buf **leaf_bp) -{ - struct xfs_inode *dp = args->dp; - int error, error2 = 0; - - /* - * Try to add the attr to the attribute list in the inode. - */ - error = xfs_attr_try_sf_addname(dp, args); - if (error != -ENOSPC) { - error2 = xfs_trans_commit(args->trans); - args->trans = NULL; - return error ? error : error2; - } - /* - * It won't fit in the shortform, transform to a leaf block. GROT: - * another possible req'mt for a double-split btree op. - */ - error = xfs_attr_shortform_to_leaf(args, leaf_bp); - if (error) - return error; - - /* - * Prevent the leaf buffer from being unlocked so that a concurrent AIL - * push cannot grab the half-baked leaf buffer and run into problems - * with the write verifier. Once we're done rolling the transaction we - * can release the hold and add the attr to the leaf. - */ - xfs_trans_bhold(args->trans, *leaf_bp); - error = xfs_defer_finish(&args->trans); - xfs_trans_bhold_release(args->trans, *leaf_bp); - if (error) { - xfs_trans_brelse(args->trans, *leaf_bp); - return error; - } - - return 0; -} - -/* * Set the attribute specified in @args. */ int @@ -272,7 +225,7 @@ xfs_attr_set_args( { struct xfs_inode *dp = args->dp; struct xfs_buf *leaf_bp = NULL; - int error = 0; + int error2, error = 0; /* * If the attribute list is already in leaf format, jump straight to @@ -281,16 +234,36 @@ xfs_attr_set_args( * again. */ if (xfs_attr_is_shortform(dp)) { + /* + * Try to add the attr to the attribute list in the inode. + */ + error = xfs_attr_try_sf_addname(dp, args); + if (error != -ENOSPC) { + error2 = xfs_trans_commit(args->trans); + args->trans = NULL; + return error ? error : error2; + } + + /* + * It won't fit in the shortform, transform to a leaf block. + * GROT: another possible req'mt for a double-split btree op. + */ + error = xfs_attr_shortform_to_leaf(args, &leaf_bp); + if (error) + return error; /* - * If the attr was successfully set in shortform, the - * transaction is committed and set to NULL. Otherwise, is it - * converted from shortform to leaf, and the transaction is - * retained. + * Prevent the leaf buffer from being unlocked so that a + * concurrent AIL push cannot grab the half-baked leaf buffer + * and run into problems with the write verifier. */ - error = xfs_attr_set_shortform(args, &leaf_bp); - if (error || !args->trans) + xfs_trans_bhold(args->trans, leaf_bp); + error = xfs_defer_finish(&args->trans); + xfs_trans_bhold_release(args->trans, leaf_bp); + if (error) { + xfs_trans_brelse(args->trans, leaf_bp); return error; + } } if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { From patchwork Thu Feb 18 16:53:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093941 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 05859C433DB for ; Thu, 18 Feb 2021 18:47:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B79DF64EB7 for ; Thu, 18 Feb 2021 18:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232717AbhBRSrh (ORCPT ); Thu, 18 Feb 2021 13:47:37 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:53548 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234022AbhBRQyt (ORCPT ); Thu, 18 Feb 2021 11:54:49 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGnNOl185646 for ; Thu, 18 Feb 2021 16:54:08 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=WHPVxYttsJ5MpLMajqtks/Wvuwpcn1wYQLiSDY59BS8=; b=iDwKMrV2PcnsFGN2zNFeo+cODiRh+m5kbKdUVp1xCDITwAaDwq/zshsIjbzbgDzQR224 EP0vOM5qVNfsusg2ylxsL3EwGZRZapHuIMKr7/hmErxebfYfnN77a7FakmIOKJBAmabq 4BFRAUE6ukaiHi+3lZunvL5+VKxoYwLo/jkdpaq94z6MTrfXUtUCGqEa86WDASzgv9wJ xjCZZBxJs2enIg+hn5PmttKWx79xrcINz+vhHsisXJwJC/nwY+8LUeMJFZg3stxsvG8x HJoXHmnTUKp1cH8ZNG8305WUUKfmdfiCyXzlsHK6VgoTJ9WpaMe8yaKwYl8/aXdS6KyE 9Q== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 36p66r6n8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:07 +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 11IGoG3O155234 for ; Thu, 18 Feb 2021 16:54:07 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 36prp1ruuc-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WV+DUUVIXwkzinqjZ0vDWgLQlRs64GLP/5ySdWREZNsyfh/VOW4D4rxiOMM7zkXMjLW+SoBwgZgGGJiwgSKpKrrRoPSbm9RzjC5wpdC1/C+WeC/faKT2eMDKdNRrD6oc0R8qStrZRr2bVCPQxDkEb695Xk0mosAIrSwVzU6kW8VyEEmrILUKRgJRzGL6NG9PUsBsFFpwGuNocqXPhoB0t+QdbJ8iPwzQiKc4uJn/PWcxQesumUXoiOzf8syabSvogNsjLjtWKlAK9trMmdSEygsrG8HFqLrwV3Fi4l3TRGMeh03XpSPYGJPcnAaDFW5sBzHRlcqAGb6xSRjbwM2uuw== 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=WHPVxYttsJ5MpLMajqtks/Wvuwpcn1wYQLiSDY59BS8=; b=XA9ixw534q39Bqug2uysNqmsdwpXoMOZor3DFWbuKP0iFed7g2T5guNs0UbMpgk50eZVo4QHawg93kRFbyfRAzFBZQoE2oUaMtaB1fdR7TsX7INWZQbH4Gy5Zhhh4nsq9K6CDN7+dq+9czCX5KJQRvVSFKy+EaqLJL0WnxBCZIBxFr2hlsdNtfYs5KZ5sWcjz97/LOgX5gL7Nby+E4FMop3OoZZJzxLpChhVsbcLPD1+suh9MoPlSNcN65KElqjNWJPGLLEABOdgmexIZm3AyiR5UzHRpJ6zs+gUgqSstr7exwDc39UMRq3cPZhDxl8DnKJXD3WK33ZbLnQHSlrh/g== 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=WHPVxYttsJ5MpLMajqtks/Wvuwpcn1wYQLiSDY59BS8=; b=DFXL/M/bZ6fe6V0BmILLSTbGyxps4wHxPwTha41cGv0y60jFSHKEiD0TDa2NIYymbbKApAw4MZsejme93TyT+pGYqvKSb8WFrq7l6Tq6V89+HXbNpfvbEX0D5+n6Qb28SfZI2sKYO3anHyTjwIxIBwLDdI3rIG98IIBFyCFO2Mg= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:05 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:05 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 05/22] xfs: Add helper xfs_attr_set_fmt Date: Thu, 18 Feb 2021 09:53:31 -0700 Message-Id: <20210218165348.4754-6-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f92eceab-348c-48f8-0189-08d8d42dccf7 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:586; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NxxOcYpA1AfhhWmGNHZ++pezSHovIHq3VegGk/+gkRc1OYXv1lFbTlgBolxy6Y/dSvkkDJ6L/c/D41M4Q28zj6/nqYEpI4lMnLPdybLdudUnelFiXNNxmgJKwe+64DsOhg9Xk6dj5fyQpRXDdPijxkeWtpZj4m1VflNXr3ocX2D3GFMjGk91R0tPr6zKyyZSUjw1xV+KFZ2i+RiLzwWzH/VLZBfb6MbITD6PcLStIPO7jSkM6yzEkNEYL8x1TAmfaYDtti1ErVdqjOTMXv+SF2JVRi4dNDHZizxDZsxvRuYYzlicudK6RUT4T3jKffyJbWGpZ+m7xDhSbL+ws7XQRJBEpknkDrk046D61PFKvVgZVarq/G+qtfu8iy9IBVjrZay3Bgpx1O6fxM+l2nLHA4PcHe4u9qKDfbk2GiibtjhlzslOYU/ceJI6ScFwmRW2BTNC7hJSdNlQ3yEcgYWWlmtUprGKMEtst2r413/YoKFlA0+jVPx+R6SoEgs+z2KJ0IuR5UiyeGHuS2HRd0KTC0nDVCILrsUugaIVdrkwW5gy7NM86JrX1DfUgkwOqrzFkvAbve8hWPxJkhx6MUMR9Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dqhFawxk3yR794OU4bkxbKqExhG4Fmq8NQuCMaywnVGkd2+VqUzkS4IzyDtP1gXc+ql6Tn6C37kGQUwfibQwKMMHmgvg5un75ZZiFOzExsQFvQz7VCNTckuMT+l54l7yHkcLzT4BJAjCagnmIsIXfpyUtCgFfXc65vmywd2cWXrUBiv4ycuvnDPmqvFRLYHG/fgu09TkJCfWz6iHES3MXJ3QT1AewhTMP0pSL2kqmksRco8X0Tt5hc6z6QNomOKdvBgnsc2J8krZf2tn5fCKCG8WYDVifr7MnNisL6kYs7bNyuHyBxDIDumIe7fHg6ZVVVvXSsZKaJ300WoyumRcgUVlkZhxM13bHkPUOfFNgL+h7jZFbk09CVKS0So3FVHPGeP8Xka01c5yA5OEWmXIikvtNeyVtO2xcAQlNzwyERugVvXLOJgz3hRlHKP1M1NGRieTuJEUDKX/U/dFUmK4w3hqV6mzC7owr4adh31UnrnyguVkInTf815BATREOVE919lTw13Ks/3EqkXpjXzGXvedATaOEppoY5xoU8v2257UopHksXoreDBsstDRvElZTp04h5RhpAbqXCCT1UPa+VFi8xg/ECz8YE5jZnQaJrQcGLD0M+HjQ0Za5eg2QJMojxlFYBgnkS1AMtng4WpJND0giLYkkSW/C6ylvxq2ci/IIos4728IRuMsarKImOSEr+qGHyfDwF4+z39ZhlZdpsXQ70fSyWGwWNQ6EIUqI9f4LL+UAv0A0NxJsZAx/mwxouSjExidlYflwdgP7dRR6s+Hc90ckGMc6X94bA8Rjw6zHrlavqFK5OxlgBna9D4H81M4w3fXbz3Ld0e9Tdt+sst4gTOVAPk3+kE7o8P38geEPYvD5SAYZGTeLmzBGmy/RGuPxUtj/5ugcExtTsZWqqk1I9YTIQ4u+1oc0fYv6Y9cJuFGwqVKIxlCdxr3u6fbTrT9r0//VoTxeHc2Ht75xBahnUxbU2st6fNR5jRl8VOoiS3xCDwPTwyuzkuTF1Vt85/qTTdKa/GUBdJUa360l7KX+dS36fkQA6HMkzAxhDJlktaES8QfmoL3ICw99MWLBAnNSEMxf7sr2Z5X7FKyeB98nDUuD3+jYFUDRffqYJ8tuTUD0x+SsQI7ovzidl/J3Vjqmxgpme+NhNB21zq2vB1iqDbM156j8r5k5JSmOGtrR1YAaTRTwVbJcQvKlvpN7KspNFHa0IMOFMZ5xNnOCuLfj8LhbLwBzgSAK5EclzISrSaxIYiNtFOUeBt3u9TKRu8/O+W8VtuGtLqDXq9t35BRfzkPWZ4aLZdTL0djmXSOut0SiL95WSbaTrASm5f3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f92eceab-348c-48f8-0189-08d8d42dccf7 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:05.1795 (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: aGiSLqUbCWR10lxT7RljcB7t+awxOd5cTbRO6x1Fx6mLEXEMYkJ5FzLSQvk40w1XGRCGgwWqD4t9rFhFXYRLMJ00U7+U6YBz/+OOLkR4g3U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds a helper function xfs_attr_set_fmt. This will help isolate the code that will require state management from the portions that do not. xfs_attr_set_fmt returns 0 when the attr has been set and no further action is needed. It returns -EAGAIN when shortform has been transformed to leaf, and the calling function should proceed the set the attr in leaf form. Signed-off-by: Allison Henderson Reviewed-by: Brian Foster --- fs/xfs/libxfs/xfs_attr.c | 77 +++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index a064c5b..205ad26 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -216,6 +216,46 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } +STATIC int +xfs_attr_set_fmt( + struct xfs_da_args *args) +{ + struct xfs_buf *leaf_bp = NULL; + struct xfs_inode *dp = args->dp; + int error2, error = 0; + + /* + * Try to add the attr to the attribute list in the inode. + */ + error = xfs_attr_try_sf_addname(dp, args); + if (error != -ENOSPC) { + error2 = xfs_trans_commit(args->trans); + args->trans = NULL; + return error ? error : error2; + } + + /* + * It won't fit in the shortform, transform to a leaf block. + * GROT: another possible req'mt for a double-split btree op. + */ + error = xfs_attr_shortform_to_leaf(args, &leaf_bp); + if (error) + return error; + + /* + * Prevent the leaf buffer from being unlocked so that a + * concurrent AIL push cannot grab the half-baked leaf buffer + * and run into problems with the write verifier. + */ + xfs_trans_bhold(args->trans, leaf_bp); + error = xfs_defer_finish(&args->trans); + xfs_trans_bhold_release(args->trans, leaf_bp); + if (error) + xfs_trans_brelse(args->trans, leaf_bp); + + return -EAGAIN; +} + /* * Set the attribute specified in @args. */ @@ -224,8 +264,7 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; - struct xfs_buf *leaf_bp = NULL; - int error2, error = 0; + int error; /* * If the attribute list is already in leaf format, jump straight to @@ -234,36 +273,9 @@ xfs_attr_set_args( * again. */ if (xfs_attr_is_shortform(dp)) { - /* - * Try to add the attr to the attribute list in the inode. - */ - error = xfs_attr_try_sf_addname(dp, args); - if (error != -ENOSPC) { - error2 = xfs_trans_commit(args->trans); - args->trans = NULL; - return error ? error : error2; - } - - /* - * It won't fit in the shortform, transform to a leaf block. - * GROT: another possible req'mt for a double-split btree op. - */ - error = xfs_attr_shortform_to_leaf(args, &leaf_bp); - if (error) + error = xfs_attr_set_fmt(args); + if (error != -EAGAIN) return error; - - /* - * Prevent the leaf buffer from being unlocked so that a - * concurrent AIL push cannot grab the half-baked leaf buffer - * and run into problems with the write verifier. - */ - xfs_trans_bhold(args->trans, leaf_bp); - error = xfs_defer_finish(&args->trans); - xfs_trans_bhold_release(args->trans, leaf_bp); - if (error) { - xfs_trans_brelse(args->trans, leaf_bp); - return error; - } } if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { @@ -297,8 +309,7 @@ xfs_attr_set_args( return error; } - error = xfs_attr_node_addname(args); - return error; + return xfs_attr_node_addname(args); } /* From patchwork Thu Feb 18 16:53:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093943 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 8362DC433DB for ; Thu, 18 Feb 2021 18:48:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2601B61606 for ; Thu, 18 Feb 2021 18:48:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232640AbhBRSrm (ORCPT ); Thu, 18 Feb 2021 13:47:42 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45870 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234023AbhBRQyt (ORCPT ); Thu, 18 Feb 2021 11:54:49 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGng83069662 for ; Thu, 18 Feb 2021 16:54:08 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=pQjt0tBQ44BuJKL/rbtqzdmAiwqQCNR/9AanLSad+OM=; b=W1NNtV5bracu+XV4Z9AUC3vpPe5rnO+DVGslRzYkLMBYvZFnWCAN+wzO5+U7lfQjtJZz WS6bAw7EUrA2/whbMeUa3rYVHOvHSmANoEg+L5pPDJ+5utP8Lr5uEsGu89DMUCeKdXm7 TbblfPogS5ebI3Q92xhXfDPTU/c8Vjav/osjn+5obPEwVHaOVsOsU3QUCKIlye+gkPOB NKJxiG5rjx9hbqYRwYljdra2GDA/hmGnlHY28rXzfZ2blJtwwycDFM6ksgRTofFdvzL1 9o24w1cowG9c42Sz+TnhdANxc2qB34v8yWOVB/AX7Nyiy7NCAU5SCylmwAFiC6gcE/C9 Qg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae4pp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:07 +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 11IGoG3Q155234 for ; Thu, 18 Feb 2021 16:54:07 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 36prp1ruuc-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gydSnamzn0shyvB82WfAg975DOHzWnSC1uzZuaXh16j2doE9tHd4DtjRI6PMF3Q8y2K0t3zqoN//YIBL5WPVuhfOdfpL15lNw4cg8xssAp4MN7ZLicWYfutfaCbtptE2MG2GcV6ZqX+DWfbdT90kuadRe36vJ4TRIiddRkqbn25VWVre3oPaHY+wn2LnII1eErqsmLmOId2974t+5CSmiaFgLXd4XKzBiamZbuHhCyhK57loRHvUyJ3KdmSzrsIUT8/+Ae2DmV1KenxlxY0QF58idRjyBQNzAYqrMyStIDN0Kuog3W1aqq9Ezorz+VEGeu1cD0I3sk0It2d+zJO7zA== 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=pQjt0tBQ44BuJKL/rbtqzdmAiwqQCNR/9AanLSad+OM=; b=fhQV06ivoWwrNyx8ZFslVcrBF51VE013llBYE2pPSvIwquu6+lw8O9ZAWjRMzOupv7uG6vURqtayxwEtF2gbKAfUuTaGBX/Sxkf/DtIMWXAIqI+XIa6eGJphFTg+/Rbbb86yACTtnz4YJdxzlD7OsYrBcJowk/vy+u7y3byp8X7z+xexq/ULcAbREngaS4GlaAXgjLx5Z9Doswi67ll3T/vbskoJo8xwPOjjR1GEDb+ny+q13O5XAhQLDnefFG4JeiieG4tUwVR4Rg4uIfYVf4QXuubO+hsXNjUnSdaAaExGpe/4qtjr0bJsANNimtAloOa1D8mUsNWiuYuE3T2Y5w== 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=pQjt0tBQ44BuJKL/rbtqzdmAiwqQCNR/9AanLSad+OM=; b=DoD5so/AU4RBz2NtiSyVJt+VoGJX9/OCfnoAEflEqeucbTyNZKcGBgl0JuLbdT3h487lRuQlexnDbzsEAMnJhWxTnZoMnAWSr1vMkM6z5sYnMkNk6emdTvk8hEdubhl9r3+JmvgeR4rboVFZPapRY4tBOIV2PBnKU6+uaLP9pyE= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:05 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:05 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 06/22] xfs: Separate xfs_attr_node_addname and xfs_attr_node_addname_work Date: Thu, 18 Feb 2021 09:53:32 -0700 Message-Id: <20210218165348.4754-7-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d3f4ace2-4c0d-4efc-2b32-08d8d42dcd3f X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: oxOSazc0y4H+2eLuw/852jIRSsf4FnkqswnmSv+xvYlgIZrJd3O6D2mEhGseFtmcrnE9qYRi3NCenM6XAUjL4ijBL6EEvmkjWrJyVhp3aA1XO82G077xtjPK0ZOji11ttKJoyfHGphvXMTYodVijbNiyYr6/6JsLaEZ+J3tYG07N96ROChpOQkTz7Fnic7LEHB1EGEhc9Qi+uy6wq6rgRogwtH0WSj1XX2VsN1pQt5V+NtvzgvXZBL9n1Y75NncaDdsEaqoEWoWMRfaz7sgUK+rKVjzzNimuW/3JazHQcy9FYKdzAtmzO3KqxBKUWv349p6mcKGBgZkvATdqRAIlNC2cS4yjPQKQl2Is/e8d4+4+e8z57LDVSO0DCFryZfKwmcM8j6k1OWyISevl3sAGx2CQAbh4hwZ8KIjxn641YkQL9Lm5gYf9Mj6DDqZ9TsLYnT0Rbf+/WukeAWqgBdajQl5t6X72xrerJGHEAtT2DvuW8KV95uqdlSN2LxNX0LqCd0E1ANe1nzwyw+kIz68cOau50TaayNkV+NK3Ev9LypQX1DoDXI/16rdDed6Huk0S/qEB9gl2qxF8hTfkszOXIg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tjoUOpFvaZjnLRu/Z6h6OMQ1aoBB4x+7f6mkTLHd/Zmo6ecWpXlo3rm6ZIfvnJ454NB/g0gQrjoVfbfs6sdE9zbKQVfbbre1Gggg1Pj8PLQhLihangGbuMyi+vGu+4dKRHLznSnmtUbJqmxFQbk1ShBGepRV7U6uz1DJGXkAfxn0T5gglMgSj4l3y+kgIU5Lwpuzs4L08hBlFkw4XXXoKHuLxylUuFZmCrDeZgazHoWnx4InCGxRNa0sVwbeiYk6k4knRDdn5Qgws2CODXowSqamYgI+5ykYd/eDRZ7+H2ESQl2aHU/P8b0AOOnRuI7WUC0KkjVcVfN+3EPipudxggPDsKhLfvxVArspwdU00GpL2DVrq4eQPOMSZLga27v/gIbO96aAL+PTo/SfgazR3hJtv6JrDz+iPob6U7KDQ0JFTblM4hJpiRg6zBPO20FcVxZ9W554axJydIs8RIcSQ6sXQdgS+YgaXLH5TZ7vSYwUsnCDR+zCJWdHsjwsfUA9R53YRyQ1RVh8n8qfJ7JPB+GDKKIWt3n9fJ/xNXfPtPfzcw4dLGORI2YI7Aejmxuf8Wd8cG128uzYXAzG+nG1h3eyownC+XtM+FgvqKall/sEzmYbPHsCEHPgojs44T03fy33KJ+1y4ZuWBptZ1IG1+EEzpHVTRATN1sq98oPSUaqHw1srFH6HLTZLEelOtbCD1eNmpwmvPtPbaRiRd4X74n/5EsCOUSEoxaxy/wDt2AABBVrxy4j25FhvkfkYT8bEggCLUebvi+seiWvSiNIxgItE0OAVVZHhY/lMbJg6Vs55o99TpYLYqtQK66y7bNQ6dHRaBlWGvSU2ZsO5Hxl7BvMQXoFPcI+Rir1cKSZSb/zxyOa2COE40UpxfvVznwrgP5m9kjJmDND3T53sfsX42b8Y2RQirLPRQVUQVNhmCsXFPv2R8WpT145eUSTunKXtOaXqEoxPPmjcnbsO8BlTzVUf4Hab13LW2MfaiDJzl0w24T0qz5AHXBKi851DNb0tAxxdYZTRiSEhiUIDA+LhrM8ONZZt/7gvU9J7J+C3W1ag6VSfYs4xTgLbRjdJIbXmq8ldlJWs3zmiyJMZRENK2IYgaHpDCylPG+uMJaj+dFFT3UV4eFhvWSF71sqUup9jcEgZ0P57+kfJGpqeUfMLiUIFDlDQkpj+WnB9GExTPs11DduNUAV31A3CR2B5w766kvzScwq+zBXYAO+ocMeDZTe9ktVUpJMMz1I0tNsii7m1mBysimDeYNsjgYY+HTyu1WQg/hjsxUkkdDQ+O3rF5UHhhYY1YbBqJoZek6KwGuFErHucSWbkNqFdaTLL5jb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3f4ace2-4c0d-4efc-2b32-08d8d42dcd3f X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:05.6166 (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: x6sXVwXQR2WvS1Sh+MW7mBDDd734Bs/vNa4Oxq6LJYRTcQ2dal3kVSMqsTYls0ZBQH+viPLw7Um8BZN/OixESZVGBut3+lpQhWniMRE64Lg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 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 --- fs/xfs/libxfs/xfs_attr.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 205ad26..bee8d3fb 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_work(struct xfs_da_args *args); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); @@ -1059,6 +1060,25 @@ xfs_attr_node_addname( return error; } + error = xfs_attr_node_addname_work(args); +out: + if (state) + xfs_da_state_free(state); + if (error) + return error; + return retval; +} + + +STATIC +int xfs_attr_node_addname_work( + struct xfs_da_args *args) +{ + struct xfs_da_state *state = NULL; + struct xfs_da_state_blk *blk; + int retval = 0; + int error = 0; + /* * Re-find the "old" attribute entry after any split ops. The INCOMPLETE * flag means that we will find the "old" attr, not the "new" one. From patchwork Thu Feb 18 16:53:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093949 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 F3342C43381 for ; Thu, 18 Feb 2021 18:48:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE33161606 for ; Thu, 18 Feb 2021 18:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232995AbhBRSrv (ORCPT ); Thu, 18 Feb 2021 13:47:51 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45878 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234021AbhBRQyu (ORCPT ); Thu, 18 Feb 2021 11:54:50 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGngwT069595 for ; Thu, 18 Feb 2021 16:54:08 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=XpQTPeHbjK74SZ8vmljbqNgRJvR74CaIxXa2tn769B4=; b=t1IhaOuO3ya/TIE+PETn9U12jlMi/OnW1cNDbCgVEcTmF+Wjk6BjKWKnMd1qyiHPNCpE Gf9GY/lYomxpfQlsI+IMSj1ovc2GuQDtFDIxXrfub8/7jDLREQ9N4+5tzKLp6uBBiLTf GX4iTzRig1PNvQErvRYnsUsLoOrahrjhRxpjk2Zu9e7YPvrIZoVYldxz5mEgTghL6Mfj 7TQrNcq26lv9XBncTmFW1rbDy53LrTsQE2r3VzWJpsHDYLhIQB52nCZ1UpRO/TJAjBRg DrjQf0cqxKclZy/7Zs26TsY/tTTnPxv/Gfx0wgPp5UrFvOXQt1bBRlV7PHzatmDqcR2M tA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae4pr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:08 +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 11IGoG3R155234 for ; Thu, 18 Feb 2021 16:54:08 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 36prp1ruuc-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JFrvgpUoe7n1iOheQVtqRzgdr7duviowTfgAA4gZs8t56+csjeoxJj/Oe5cnhOJI5fVrt07cxlb5F2XRlvTgoJZJ/EU+052lDrC0onnJg7Sw5CPWFKdqLG1kgKl9PEdqSvZPBnvj/+wsZ2t73FmLxuGxRmv/oJrMXoJvoeD3RDtjq7gRUHhWU1Pp4tsBSfaMMWGZUZb52sliM7b7uX3rrU4tGbx+3qERZrzUvzxrLBtqC9TJozrF2TWjTsm9QbWaV/6Rmw8pDXHFnw5wrybUKiFzggtet9BUKiNpYz6PfiWcqRCth4/L9ZpJ7re9JMhseM+oWUJSisReEM26H+mqjQ== 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=XpQTPeHbjK74SZ8vmljbqNgRJvR74CaIxXa2tn769B4=; b=RTmTWsm4JJBRNygQc0NPujY4BJR+fxS84Gc+YDsuqoc8CifOJPkULXNfCjzAszxKumXpcMm6l+E01x9p6TWYNvi0K7pN5ao63Afrwcjm/91v0epwF71y7XFJ2rrvAk32tewVTI8BoKWRdIPwX0HvbqsbXQviHOOpDNMDtmlSRyZXkGlW0JfwtEJJinXtpce4zfnihp9aM/HYHh2LAxCgWNkZK1U9jrDQ2hFST0KSKyEOFBtKV64A60UoXy/FPzGB5stJfmVgUqM+gwEXfGjhYruZl9Cggsq+xjgb/AoJi2jfIncBygMfKHVv6mZ2BrEADMHi7hrJdnQmzCTJ6iPGbA== 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=XpQTPeHbjK74SZ8vmljbqNgRJvR74CaIxXa2tn769B4=; b=MixOG35xwhQJ5ACuk0SyL5RkwKdRauAjWHDLWl+uRPX7DuY/d25DqP9earQHlUfREKZ4a1X7rTlVn6ufLUCJDTv4H2vwtsHZ1HfkhPspj1XX3x49HMRF/SoXwad8S4H2cRzLtahuJ+laquvt/vVVeJEUu48ANiAARVenJuxxV7o= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:06 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:06 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 07/22] xfs: Add helper xfs_attr_node_addname_find_attr Date: Thu, 18 Feb 2021 09:53:33 -0700 Message-Id: <20210218165348.4754-8-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 95d7c22f-d37c-47ba-fdac-08d8d42dcd8f X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: YeeMBrt4VfeBQRJyFOrCdhnNUyHW5H4gxRTblsR6HTFMiG23BJxZEVhlZoyVZiwI3FGMPt8RhtprJw3AV25lwEucuKX7sc3beJ/voTwSVhyeLzRtzwU39oyruAc4Gdj+Hajrq9yYk3K6pC+YIt7xBzRL5YK75q059PTxzMHgttWfa6HAczNkml/byxGrmEY0LhhPTeiOmUJrZUTIpKsMYnQfhaCVezInl2qc6Cg6F6fNDwWGvTxVypLx1dd48wA+/L6M0PgG98FIeCtD0YRGqH+Lu60nq5ehUK1t5ibQZ6I3OSuuvjpLoxx/dmfYdWwdnAQHEMRRtKhJK3E9EzC5O5gtbN7apIiQuqa+iDkuqn6V7xBsYY0YOUGehwdCHUExrq5pkxi32b4mZcD3i0KR/+wXMGWqxtT7nW7U1+wIXc1f7tvHLMvkbUF39cLyqJulpVeRU1dkhuSJwCiatVaSAi2iGZp0PKTi/O0ip8p2caAipo39ANoTmktcYxFN9Z9xGV3YSmkXVBT0BZF9GNKt7i/Dns6K+VVUBHGptdESmUT6QJLx5pBtXgeqzzNNGqoAQ/i76gsnSnaXBnQNkOtQHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5veJdHyjPVms13Y6M5XiZn4E60cxOyjnxgNsiacN/6TcxSmbvOgSJlAGe1PFsRYH9zsDOGixe0Mu1l2FCP332GwZGZ1ZV4+TFSVQOHI2u2WqEV/Kuh29jDNI9VhWgyW2XdJ/u8sgW1ThdW0pGJyjPhfOXbRViCRf753vl1KsfFpWEAC/R7g8Vdt4CQJim/xCHJQ4OpUQMFYvoBbzNJpbpm8EjNVVU182IGhgUwOtvkW+SYlIF01FDHT2QY6v3vuucYJYkkXZcu8hii3EwFCTRDM3SUmjMnXgqc55UsahLq7/W7Qsg6Sq47Nk71317R26rL5b0Aljq0XQ+wAzqDNpd8seBeUlr4jzH5ZSkEVAld7LmvPZ8vHsKjsM16uag2oxy8SbIGFugW3WEA7PsmQqqr0jZB2RS+Rebo8usXJ8CpbIENfA1uhfXf/mqnV/UoxpCIi8+0AJQ4cg/OCT3/TGz9Sdd+h9AFYHNARoaMN2zkv0Hpfd99K8UorOrps6RXglfgy11dD9lwJP/jf7M5r7aR/ovn2nktdpZi9EM+kG9dHjCvjrNhAs8uTxM0/VTu10r4u95qTUtmImtGUiy013N2ZYj92VCeCxB65n+l8SJKWO6l8cM7ZePWBnJqigiTzLSd4DXigt7ojLRjqv44u4ZpS/+w450Y/WiFMV4ktfRDPSEA46cAt0anqqSy6o1QUXTpDs2vHNSKIE/Kbju3TyLS3gjhpz4MKmZ77GTNMkyJu9+Xug6ZMp8S9qkyHraoRyWk96se3hl0xL+SxE0273LenPUYTA9wjQl7k3PD1/Tug8jxER8RoPksJ+JRrBA8ZbgxoGaXpQNZ351u9CXoi9XDyl9J0zUHQY+W1s/jhiz3EexSoD86WKot1nM7yrSWWjMbtWUBDri8KyGbS0NlsSxkT4j6cKq/LJNVem2JfjwA2yN17igvolAVTV+PBDqLaW1tgkiv3r+dCBtTJ3Vjda9q9t/TOi6+jS1JTuWj9WebayyM0ytuxCiXUnTZVFKGarNaXp+99PpP8BxjQhPHtxfcqGW1mMG9eXSCnabgh3Ln0tLBZvAcn+6oeCS5aOCAZbIeCPJlFoBt2H2U9SObpcva7RzG8G8Rh6OLoDchvbD4GN2t+TH+wSq4FzXC5A4A7hT6q6fDR6/KjQZtL/gPRnwPnn/eg1mYqgZZGuKPErMsuFVmqyEcAfZvGJAd8hCevRN+etZm6DB6PPYFYyY/gb/YpGBBJkmzp3ggiYupEs2Zqc4tXTIfCFJT7bLgHqsNNeqiK9vFzoz7vLEg0WfrV2Qc+0ro3EQHk3ggU1lkNRaP4TpDtPRml8xbpnDUPGr7zw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95d7c22f-d37c-47ba-fdac-08d8d42dcd8f X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:06.1622 (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: q/KHaVp2qmWBxjksWp6egO8O60EtZ+yzuLRmyqurIxw0F1/esfTiZJs/QviTrGHQa+pet07GXLV+3131Ex0397G1XY+iU6lo9at++YJTKHY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 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 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 --- fs/xfs/libxfs/xfs_attr.c | 80 ++++++++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index bee8d3fb..4333b61 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_work(struct xfs_da_args *args); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, @@ -265,6 +268,7 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; + struct xfs_da_state *state; int error; /* @@ -310,7 +314,14 @@ xfs_attr_set_args( return error; } - return xfs_attr_node_addname(args); + do { + error = xfs_attr_node_addname_find_attr(args, &state); + if (error) + return error; + error = xfs_attr_node_addname(args, state); + } while (error == -EAGAIN); + + return error; } /* @@ -883,42 +894,21 @@ xfs_attr_node_hasname( * External routines when attribute list size > geo->blksize *========================================================================*/ -/* - * Add a name to a Btree-format attribute list. - * - * This will involve walking down the Btree, and may involve splitting - * leaf nodes and even splitting intermediate nodes up to and including - * the root node (a special case of an intermediate node). - * - * "Remote" attribute values confuse the issue and atomic rename operations - * add a whole extra layer of confusion on top of that. - */ STATIC int -xfs_attr_node_addname( - struct xfs_da_args *args) +xfs_attr_node_addname_find_attr( + struct xfs_da_args *args, + struct xfs_da_state **state) { - struct xfs_da_state *state; - struct xfs_da_state_blk *blk; - struct xfs_inode *dp; - int retval, error; - - trace_xfs_attr_node_addname(args); + int retval; /* - * Fill in bucket of arguments/results/context to carry around. - */ - dp = args->dp; -restart: - /* * Search to see if name already exists, and get back a pointer * to where it should go. */ - retval = xfs_attr_node_hasname(args, &state); + retval = xfs_attr_node_hasname(args, state); if (retval != -ENOATTR && retval != -EEXIST) goto out; - blk = &state->path.blk[ state->path.active-1 ]; - ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) goto out; if (retval == -EEXIST) { @@ -941,6 +931,38 @@ xfs_attr_node_addname( args->rmtvaluelen = 0; } + return 0; +out: + if (*state) + xfs_da_state_free(*state); + return retval; +} + +/* + * Add a name to a Btree-format attribute list. + * + * This will involve walking down the Btree, and may involve splitting + * leaf nodes and even splitting intermediate nodes up to and including + * the root node (a special case of an intermediate node). + * + * "Remote" attribute values confuse the issue and atomic rename operations + * add a whole extra layer of confusion on top of that. + */ +STATIC int +xfs_attr_node_addname( + struct xfs_da_args *args, + struct xfs_da_state *state) +{ + struct xfs_da_state_blk *blk; + struct xfs_inode *dp; + int retval, error; + + trace_xfs_attr_node_addname(args); + + dp = args->dp; + blk = &state->path.blk[state->path.active-1]; + ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); + retval = xfs_attr3_leaf_add(blk->bp, state->args); if (retval == -ENOSPC) { if (state->path.active == 1) { @@ -966,7 +988,7 @@ xfs_attr_node_addname( if (error) goto out; - goto restart; + return -EAGAIN; } /* From patchwork Thu Feb 18 16:53:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093955 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 8D617C433DB for ; Thu, 18 Feb 2021 18:48:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4154A64EB4 for ; Thu, 18 Feb 2021 18:48:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233035AbhBRSrz (ORCPT ); Thu, 18 Feb 2021 13:47:55 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45890 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234024AbhBRQyv (ORCPT ); Thu, 18 Feb 2021 11:54:51 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGngms069610 for ; Thu, 18 Feb 2021 16:54:08 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=snS5fN8oi9aiTthTdIdPGlIRsX9eNM23gcfkIqilAcc=; b=uay3oMEisY0sUgk6PQehp6Q9/oEQ3F76FeoqycEvJdPuLHFVpfvs+qkRCJCWMRoMsTE5 xWjwhZjS4LwQtahm9x+RIGdMlnlBgWoupFnU2c8nlOHk0CBl8v3VVAwH1M2YAVBbf6yB /FZaxQQXxyjfgVHhiYiMSOv372y9Wyidz47WJKVPStZ6830TJrwW5xPMHcQGvfN3DDhB GXATjfGQKVi/j5OD2gYLwnBMcX26dUMAKt6Jr2WhD5joye6/uyBw7XvMNIpmiAK2mmMg dN9vFsf2aDnqkq+DZaOKBNHWCrnLUeYFnNZ979vey2EkC1GzWNkQoskunaybg9p1GBkC AQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae4pu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:08 +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 11IGoG3S155234 for ; Thu, 18 Feb 2021 16:54:08 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 36prp1ruuc-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aX9kCt9COg7lBr+gH15drArYWOL2cMXcbZ6LAEpMnQI0c3aXDIiNiJqsIoELFOYYz6AsAh0uZ7poFYXXaqNSs0Q18476Lmx0ViPb2WogUV3LOYU04VRouQB2R59RmAXHMjYlNTDnssJD3pNu4b4/qOrOIsjAKetw9hvVlwj7du/O17iw6JcHJtPx0PmgtAW0/y/jd/d0Z7fsE/KorEcUZBWrAqkcnWQ3NMzlviiC438O/0xRyLjXW7LcuVmkBdOfGvzCwi5Xi1Q+RtIfoC82/RXsWM5sTkHRX7aQesw9m5EoLMl+WhEYU1GktVa1ADvSdUWaw+zCeNsX1+PfpWfHJQ== 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=snS5fN8oi9aiTthTdIdPGlIRsX9eNM23gcfkIqilAcc=; b=Cl6vKawYcBJpbRmJP5/RnuQIrjRCFf1hP1bqWTpNUNIGI8TO06t0CWE6jTyGlNZAW/+eFetd6Hn5vGSlAXS3WhWBiNbIPS5F5e/LjMhVgN/AoiWUpDz5ju7MbyvKQMb3CIPhOjoBBIhsETYqw2sSoBgTQIGTj1QKsvYTNMw+DVtPknd0Ys5eyrv2pqw/rNssvBduyRHtrDuuIFzIbKycvgnBKQN4jy/pDKkclx4E9E73m1y6c3Zb3IpmVEKBwXRixrhBw5dJCvIfrudTfjp+VGph+4lS3ZZsAYopfQS5eIcrbStYXPs0LafkNbq5B5iTYKSqViN3GFh0l+05jExthg== 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=snS5fN8oi9aiTthTdIdPGlIRsX9eNM23gcfkIqilAcc=; b=mfwBILJC/XO8v5iKD2jDfcUO6eiEIqMiSILeuhkpJW1yRTFpH2D1MXrP+TtL8220Te7XMK4EPZeNf0oY+meKTvZhshHjyamE6aU0zZQDC4/UcHjuPBc690pxTOaFqI5MDl6359d7Xg3GUZnxTz+KK5RST+apweS+xw657Is3o/I= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:06 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:06 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 08/22] xfs: Hoist xfs_attr_node_addname Date: Thu, 18 Feb 2021 09:53:34 -0700 Message-Id: <20210218165348.4754-9-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 928f602a-015b-4699-922d-08d8d42dcdd5 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: Ka4XzLlAJyAscD5NbRqOtVZDzeek/y6osc/akzul8h2WIRjE2gCxt9g+OYNIM0vXIJm5f7Cp80PMu/R+LZrj/TxpVQafjeu217CGFHAGi5Tszr9qG08VEfmCXJc1TNHgIcjPYoIOuY1gdo/ofe+dbVHI0cvZOHX6I+FZ4bqWXwFgxTJL9Hd+2+CZ8GSg2fgNtv7LSRkIu7AP0/fApIILMRjUHfywg7iLgkpyhiPo/r0CX+5Av3js1Ttny96Db5UCpHpfeIq8ZvZloUZTDS0079QoHqhXtVKuQQ05TlwUIMASyv3W1L1SXy+pYnDkzmOzromLKLUex1gxCB6UYPuBpkV6TuQ3mehY1PLNJXywLnVGMwxUdIvu4vO6GN047HKuhGZ4IIfRDqK6utysCg0vfTHg0BLsY6CxnkhBT1Q6+wA1sUBNBzClAlYJvvxyt4+NvIYgti1h9D1Tp0eSminBfboKZd56hpIxieB1UzvC7227ymVaWhrq9LzQ6EsJV9FMNDdShU8qT117nGb+OnMlLZC2e8IeMgPCORx4e5N7hO9bhCzDL7V1Tn4AaNWAQMLFsDv1FstJ0wbSk5KniMYyHA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dTL8AhspFwWQ0WngwaNHoK3ciY0gZuKOK1QmYhv4JeMDyQ0ZKSjA63BIwp8leyxwn+l8HUyBFEqJRW2Snsf9yuly+Zd8OCbfuqGEnuFTjlQ+M7As5u0lLknyHQY3kypVIoIY0BCJj8zBhH8vUs7SX3sFJ+hPbqo/KbLO/oooW2LxfMyYHqevPJKgYJxa+SID7dBw2XRePtwQSwqAnnoR1CI1qeaGnVMpaC2ntGYEvBDa9K0HlilFAWqYAUz9xP82VMUO3BKYWSl0tVqIGwT/my9UNWCbl8LO6vGlV9xiIz7nNwWA+HKlRIfQ2bccbJRbZN3h8Vd1wNg/o9zJkJJEMHPi+fHv0aunyzGbe7dpEhdGLrjyFSr5UJ+aYifJMJH+4ZhgW8RSp6L4NaBycNie3HI15oJcYu4kXgxJl3nvXPDeiaj+7n8MoOTPFxq/Rvuq28nZgbdu8IZ0vfYfVA99IYB+sUwZibZLgI7Mi7JHaRTfsJeP4Cgvq1jAfrh6XN+s9tpwpwanGdrD6712ORrFZ9GSeiBH3G9CQLkorM50p5E/HfuAzd2chmGlxfkrevAYDsBHx4R8h3OorVptlJ+VQMzTZ8nf25vwFgodKeBWMUcGyoJitsuw7wRc658Ab1imGwjAvUvUOu2RnUp3RXp0JVxRREHia0BKUekosQ4GmnQW6XqvtAUB/DIReWKVlugu8TeQVO/3SBrE2RhuMj3SBcAWuDQxZWQFrvR5204B8kr4yjV9MbCpjqaPr6V5JKVDMsjCfbUnhQ8w3uBPWQcA88mTIRuk7Q0SdFYgMwMO1uxOL7aU1OFrhTXhtiTulzIzkx1zVpV1V7XlI9U4JmgLYhrkkFz78KPOu8JiTdJDBrgDKiN1SRYLCu+y606Sr5Or6vMWa2sEC6q6qutuQMt4j0veBxYTBVMcWVxoM35UR6HJ927kLnIuh6ms2VNJK3bfDhDMczNt0rMaZu9SAWTzGHZzoZfIRxJr44kyvDkKfeV7peRymXZq6fvsEei+XgyoVTGr4wDwsfjZGME1PKE6+k6u7HI0zUbE/gEg5uA2xo8SWwy7haP2mOqB7640ZGPwxVutHUOA+Tm6tzUbPWTyS2ggEa2Bvr9RyI/vq4bBlUmKDb7UosyjJs/UY5PKiPexQeU1Q926ULKyS9NAGKrpzpO8DohGyQL3CX8BaDzwqG5mz0xW63Epv6U6OvQEMUR+lAIZJ89Qe/HXefhqjJQVnw7uUoNVEisSm/E9kh4FcCf6HBuIolUjzcMIrEyoZAOSt1uOFZm5kCyeCjK84lCwnmL5vFhQVy8ie6mewA21zaae+MMNRr1orqKpjwKM0fP0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 928f602a-015b-4699-922d-08d8d42dcdd5 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:06.5943 (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: DNASc8ppE80QhaRF3NvgIJapsQLLREQBwryihfAj0Op8Vk6Ymmey79YubtAgQv5alqYqmgw07w3c0+MzEqybVfIhIwzIQ3gsQEzWfQbQSlM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 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 --- fs/xfs/libxfs/xfs_attr.c | 165 ++++++++++++++++++++++++----------------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 4333b61..19a532a 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, @@ -268,8 +269,9 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; - struct xfs_da_state *state; - int error; + struct xfs_da_state *state = NULL; + int error = 0; + int retval = 0; /* * If the attribute list is already in leaf format, jump straight to @@ -320,8 +322,82 @@ xfs_attr_set_args( return error; error = xfs_attr_node_addname(args, state); } while (error == -EAGAIN); + if (error) + return error; + + /* + * Commit the leaf addition or btree split and start the next + * trans in the chain. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + goto out; + + /* + * If there was an out-of-line value, allocate the blocks we + * identified for its storage and copy the value. This is done + * after we create the attribute so that we don't overflow the + * maximum size of a transaction and/or hit a deadlock. + */ + if (args->rmtblkno > 0) { + error = xfs_attr_rmtval_set(args); + if (error) + return error; + } + + if (!(args->op_flags & XFS_DA_OP_RENAME)) { + /* + * Added a "remote" value, just clear the incomplete flag. + */ + if (args->rmtblkno > 0) + error = xfs_attr3_leaf_clearflag(args); + retval = error; + goto out; + } + + /* + * If this is an atomic rename operation, we must "flip" the incomplete + * flags on the "new" and "old" attribute/value pairs so that one + * disappears and one appears atomically. Then we must remove the "old" + * attribute/value pair. + * + * In a separate transaction, set the incomplete flag on the "old" attr + * and clear the incomplete flag on the "new" attr. + */ + error = xfs_attr3_leaf_flipflags(args); + if (error) + goto out; + /* + * Commit the flag value change and start the next trans in series + */ + error = xfs_trans_roll_inode(&args->trans, args->dp); + if (error) + goto out; + + /* + * Dismantle the "old" attribute/value pair by removing a "remote" value + * (if it exists). + */ + xfs_attr_restore_rmt_blk(args); + + if (args->rmtblkno) { + error = xfs_attr_rmtval_invalidate(args); + if (error) + return error; + + error = xfs_attr_rmtval_remove(args); + if (error) + return error; + } + + error = xfs_attr_node_addname_work(args); +out: + if (state) + xfs_da_state_free(state); + if (error) + return error; + return retval; - return error; } /* @@ -955,7 +1031,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); @@ -963,8 +1039,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 @@ -1010,85 +1086,10 @@ xfs_attr_node_addname( xfs_da3_fixhashpath(state, &state->path); } - /* - * Kill the state structure, we're done with it and need to - * allow the buffers to come back later. - */ - xfs_da_state_free(state); - state = NULL; - - /* - * Commit the leaf addition or btree split and start the next - * trans in the chain. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - goto out; - - /* - * If there was an out-of-line value, allocate the blocks we - * identified for its storage and copy the value. This is done - * after we create the attribute so that we don't overflow the - * maximum size of a transaction and/or hit a deadlock. - */ - if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_set(args); - if (error) - return error; - } - - if (!(args->op_flags & XFS_DA_OP_RENAME)) { - /* - * Added a "remote" value, just clear the incomplete flag. - */ - if (args->rmtblkno > 0) - error = xfs_attr3_leaf_clearflag(args); - retval = error; - goto out; - } - - /* - * If this is an atomic rename operation, we must "flip" the incomplete - * flags on the "new" and "old" attribute/value pairs so that one - * disappears and one appears atomically. Then we must remove the "old" - * attribute/value pair. - * - * In a separate transaction, set the incomplete flag on the "old" attr - * and clear the incomplete flag on the "new" attr. - */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - goto out; - /* - * Commit the flag value change and start the next trans in series - */ - error = xfs_trans_roll_inode(&args->trans, args->dp); - if (error) - goto out; - - /* - * Dismantle the "old" attribute/value pair by removing a "remote" value - * (if it exists). - */ - xfs_attr_restore_rmt_blk(args); - - if (args->rmtblkno) { - error = xfs_attr_rmtval_invalidate(args); - if (error) - return error; - - error = xfs_attr_rmtval_remove(args); - if (error) - return error; - } - - error = xfs_attr_node_addname_work(args); out: if (state) xfs_da_state_free(state); - if (error) - return error; - return retval; + return error; } From patchwork Thu Feb 18 16:53:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093957 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 B9CBBC433E6 for ; Thu, 18 Feb 2021 18:48:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79E6664EB8 for ; Thu, 18 Feb 2021 18:48:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233054AbhBRSr4 (ORCPT ); Thu, 18 Feb 2021 13:47:56 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45896 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234028AbhBRQyv (ORCPT ); Thu, 18 Feb 2021 11:54:51 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGng84069662 for ; Thu, 18 Feb 2021 16:54:09 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=l6b16MAQbxMsiJhEoTskf+iZK7WIOMVBXVOUwYmPxVo=; b=URiO8OarmpqSqrRrdg2PTbQbM2Fq9rVX0QzdbqvNiQB65jkIk00FZ0VZIaJN5nrlzhyw b0PlSUeqvvCyv1ARinPJ2JEFQGJD4cul+yMIM1FTrEnEPfvy3wBIOWZZaOCPDC44xcEZ dPvdGCZP4SsMMDKjYi2T4Pof6IcORj27YjKHcFpvc1XJA/4/Dkn/6NNN1JfXNvnpdsJE cnpfSSWONhAJTesLJ9nuCT3fNHQCdQjVwtl3gk2odawyFfL1KrZVa+hcoFmhYkDVaccY aPaBCQIgVot+HKdFmwswwGU2rJS8P58mlNG00eXZd6p8FOfEQ0XCXJPeoFl4Vov6x4az wg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 36pd9ae4pv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:09 +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 11IGoG3T155234 for ; Thu, 18 Feb 2021 16:54:09 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 36prp1ruuc-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/93qc4YX5GSFXYgh/fX+YnIDB851zxvOHXNKQz6GA4Diyvwh77vqDCAWZsvVQsFmN4hh/6lECJKAJcLaVI65ksMbsbHTegfsPDqmQDh3yqM+/CuVSn1VoC00bvU0kWjlGbgj/iyLEyvboAD1cmgc7CTTkJ2OviHBo7fXzmkq637fxFBSzpyrGlaw8MM12K84cyz8rRt1sVjxJO9KOgsukiYBd+a2ZML/vuQZnGrrCFTLQyZ6ZC64a8Gbl1nPKd8NGJgA3HzCS3r6v5D8BWACWj1dY6gVx/DD270jSi3m7FKIq6UvQTxgNUNAnSDefwJuW0uSJQfUHCve6PoP+D1xQ== 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=l6b16MAQbxMsiJhEoTskf+iZK7WIOMVBXVOUwYmPxVo=; b=QagbiP6Ec7AS/xvZXcYqdCD2TRBq9Y50ypHwlAENEEqoJpFSpELx6MPs7aQR8Ezwtusr+BbWhxoqY78Nrdb8oLxJA+UccC6Fk48mLdOCbCA06tPtUhaldZeLVfRyKUURQWpOyQriDIPHnBuBmbTBh60RK7dVViHihvZcg5QHGpwduc5FlVM782Po6WFf+5mnQlji1shAT5kjT8aoUsi6llVyHHAESLYK1xgiswjPtvs3hIPIfQ1+fGk+dkpn/J+vqHwi9HVxdjrZ5WYZWLOOrYjLkqft3XibQQF3OUL5h6SspKhDzzLWP+aZ4FuV38tw7q51z2VgtTHrnxEeq8FHPA== 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=l6b16MAQbxMsiJhEoTskf+iZK7WIOMVBXVOUwYmPxVo=; b=VscIFKZEF01BBYM0g/pv+Dni2te98fwSiX3EPnr5vmGBrf8IX7x/GpjLhzyvZv+tS1AZCpDU8HpM6vsTcSiBwws0L+TUXNsqKsZpm6EJTDawxZR6i3E5YkShOMjF5n7D5o+FZ7rsMbmFm6h3p/FibmSLoXUTi9BKdmBPCZtSoEM= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:07 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:07 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 09/22] xfs: Hoist xfs_attr_leaf_addname Date: Thu, 18 Feb 2021 09:53:35 -0700 Message-Id: <20210218165348.4754-10-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87d9bced-45c7-4d2a-1cce-08d8d42dce18 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: TtI/M73zZWYZHzXXzKJNp+2VbouN4MfDR8XUlqzq+myEL1EioktepBeGAO2zTwlZHN6ywZ5UrjZ1hD1ACrDmmIEPBfSMn23PGEBiarxCL+6EpZndXBglsTkiRTbp6ogI0UGfOQpRtu/06nqgvrOUB9KuuHhy08cdjzRyzt4l88wbGFN0pRTMVuJtZ5Q0SPlOs4E/3qRpDEd1ljN9r2/dwEJAVLX74ILN7kChraA9Khp8SA5DpONqdn5PCu4MZYOSVweGcJyzd41rfibfwYQ9t6dtIQgxKQeCyRCEBbpe4/xUY5Os/qojNev848SUfTvOvgxkmiXW0v2YwQEsUwHdSysANimMU5RsOU3IG4NR+PA/UmSCA8PghMVp/YpO8uOrTg2pu3bJMWLD6vEO5suWnr3YjLFqQP9dgclrWgAonx0gdMZQnfW5+oBcV2R6fKmUmCv6ClV9rnyE9HEHEBSZAHpMJ6qPyvEpb39eBaeqtl6FuLchTvBFunMfqYrPAtSWfG+IwE/JHgEcJaZrQEadtP33YPZcqD4SVKNpXtmtb2PdGeVy0i6hWbYqfYEfsgpK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nvR7/9r+uFbEalwk5VXgbPXUqOWnHpcIKtXI+mcT9IjugSF2ZZ8WRbvnHYfINXikqBv4cCBNRGon4fqDUnTCgT6ArjpvJyGyC2Lv1KHKt8Ao9lTih9IKSjBUcgQjNzxAZf7tVpQLiHCQppP7HFdhqYyo4IFIRhzpc8NLmwgLJa+mHJSq0ABAzGl6729j2apE28ACUi3mXd3B9B+PQkm0lxeacZTUeaRCz7NrcVGgJYjQgfDcNk5Wrzne8bOIq6LsCdJdJfLixv2mGMXsCKaet1LrludPbX8bm7hRAzQzzwQV9i3Tpa/YyD6NwBx1x2TC/Ov2F3bUli1SFyzd31/X7yKKGBqxbMxlMnH94LugzmVGC48Y+rbp4F4hDfCpJUc/nMSa03+DQPK1OIB7aRg3A9SWMt5HHQm/3KeinyNZhEw7HCNmWfB3ouI6OC1YLGjzszbwUE3J/RQcDOYy+rynksV25Z3K6pcRlGXlqmXZr9bxUTWt/oeEic7gZXJ4ngKE1kZEkcYYtwWuYD3RxAGEzYR+CoBWcYRCMxrJgRxo/TixnJeimXUIvA4lULy83aWqJjh/lHk6GSDho1VhzvstZmAoACjqxZLIBDKy8JOJSy++MDO3tSA+evB5mjgAsy6/AxhvBe5YCnUu8XduUaEjDyZ/Qs4YGSOhm+Dxd/JD3Qo86Wgj9A5OsmhwlzFMRfEyVoUBMvjdZGckpMiSn09qys0q9H9QKqOdGr9/xZgx+wuBqkLaEP/EcAcr8FMNky6cp36S7gVh+UKmE8N6LPVaGGhWbpeY+1js7jn3Rec+gluA1nIjOp1xFR5wEKdZNCP660kFVK8l3y+9he4uW4snP3YnsYdrcmqwKrMXo/+pAKl0gZUDc9niWBcwTxKX0vrrjIO9d42fLx3si3bIduXxmxrRNM6iRhgoy7Y/ZXvFubDS8HPEie9DA3eFKKwZ/dSlO1B8hJ/n5rKqQe6MiYlLhXWeQNgfdwnBBUwze216lQryyQMqxeWqLCzaiSzjElIn0YsxVEa5Wc4UX1WR1MBESAwZF17Bcvww4lvtA1xAO/IB7j9Qh4exFTGTK/CP3iOaYs3YNK+T6ABLdExO6GDayBv6J1c7GhYIvvobWKSeQZdUAbcblNNGp5o64X/1JHGWu1suEOkJxmt/ZZbqC8xgfHCCbVG1zUXbj/2Hs2HEGdY6ORBa/2vGaBIpU6ZjmX9N0GYf1Ab+cE4T8VFDxoxeQpjpNteuDUpsxdUotxUxSnySOeDOvM2oWkrCYPGo2rsJanYNx88MIK1DW5pkHnqJ11C9aMEkNtAAKdxzLdOBmMSJ0ia0kr2FAcLAZvPQNe3N X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87d9bced-45c7-4d2a-1cce-08d8d42dce18 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:07.0642 (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: kUjY7HVxmU2nGRKT80dh2wlJKLwcyCvIbJHDFDCane6kYnjAd9KyvRwnffeeDDwXwvwsVoxj2/n8EaavO5jsO++L+ROc+uBpYUiFSC67J3k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 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 particuarly asetheic right away, but it is a preliminary step to to manageing the state machine code. Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 209 ++++++++++++++++++++++------------------------- 1 file changed, 96 insertions(+), 113 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 19a532a..bfd4466 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. @@ -269,8 +269,9 @@ xfs_attr_set_args( struct xfs_da_args *args) { struct xfs_inode *dp = args->dp; + struct xfs_buf *bp = NULL; struct xfs_da_state *state = NULL; - int error = 0; + int forkoff, error = 0; int retval = 0; /* @@ -286,10 +287,101 @@ xfs_attr_set_args( } if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { - error = xfs_attr_leaf_addname(args); - if (error != -ENOSPC) + error = xfs_attr_leaf_try_add(args, bp); + if (error == -ENOSPC) + goto node; + else if (error) + return error; + + /* + * Commit the transaction that added the attr name so that + * later routines can manage their own transactions. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + return error; + + /* + * If there was an out-of-line value, allocate the blocks we + * identified for its storage and copy the value. This is done + * after we create the attribute so that we don't overflow the + * maximum size of a transaction and/or hit a deadlock. + */ + if (args->rmtblkno > 0) { + error = xfs_attr_rmtval_set(args); + if (error) + return error; + } + + if (!(args->op_flags & XFS_DA_OP_RENAME)) { + /* + * Added a "remote" value, just clear the incomplete + *flag. + */ + if (args->rmtblkno > 0) + error = xfs_attr3_leaf_clearflag(args); + + return error; + } + + /* + * If this is an atomic rename operation, we must "flip" the + * incomplete flags on the "new" and "old" attribute/value pairs + * so that one disappears and one appears atomically. Then we + * must remove the "old" attribute/value pair. + * + * In a separate transaction, set the incomplete flag on the + * "old" attr and clear the incomplete flag on the "new" attr. + */ + + error = xfs_attr3_leaf_flipflags(args); + if (error) + return error; + /* + * Commit the flag value change and start the next trans in + * series. + */ + error = xfs_trans_roll_inode(&args->trans, args->dp); + if (error) + return error; + + /* + * Dismantle the "old" attribute/value pair by removing a + * "remote" value (if it exists). + */ + xfs_attr_restore_rmt_blk(args); + + if (args->rmtblkno) { + error = xfs_attr_rmtval_invalidate(args); + if (error) + return error; + + error = xfs_attr_rmtval_remove(args); + if (error) + return error; + } + + /* + * Read in the block containing the "old" attr, then remove the + * "old" attr from that block (neat, huh!) + */ + error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, + &bp); + if (error) return error; + xfs_attr3_leaf_remove(bp, args); + + /* + * If the result is small enough, shrink it all into the inode. + */ + forkoff = xfs_attr_shortform_allfit(bp, dp); + if (forkoff) + error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); + /* bp is gone due to xfs_da_shrink_inode */ + + return error; +node: /* * Promote the attribute list to the Btree format. */ @@ -731,115 +823,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 */ From patchwork Thu Feb 18 16:53:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093961 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 1AD3FC43381 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C74F564EC0 for ; Thu, 18 Feb 2021 18:48:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233068AbhBRSr6 (ORCPT ); Thu, 18 Feb 2021 13:47:58 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:53596 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234029AbhBRQyx (ORCPT ); Thu, 18 Feb 2021 11:54:53 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGnCY5185493 for ; Thu, 18 Feb 2021 16:54:11 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=FQn3udCKPfejLb4mQYcU0WpTDXjzEA9MqxMMyJ+Z2A4=; b=hbyIVs23doFqZYmDbSZCOWbPyzpLuJTTgJHOX36NAUr6fomosuxSdjNvehKipmenbcPH ynpToqiAS2mMMj+SkINWCLT2e7nZdv4/2+zq7B/NeHaqBWDA+zSVA0M485RY3v/dJzgg gdcwmCaxWtIKV9vx0DUZ6zuHBHXY/fLhAECa8oScOSjKC7yGaz15l2Z623brrkLzagfy wsHLYqB36NDABp3MS1uMRe9pk72ZczjMILS3tqeiI6pp8oHo1XVDwWsi8ErvDkzqIVKr ymAFewCozp9UX1jXXe8bZg3usmp8xJ+w2JGZgtH3Z44nHD6sZcLQRWCC4Qctap/UAAsd mQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36p66r6n8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:10 +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 11IGng2q162351 for ; Thu, 18 Feb 2021 16:54:10 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3020.oracle.com with ESMTP id 36prhufdmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GI3/WKsWWJBIqEBPoBPaN18qy6x8J4QhDSplQDNVZXzohwN5voVk100T/obnnlrH+0qtWD/akpOlw49MZWexbsmHRhzSZ1Uy48/MkWx2DPI7COlNLBnmqEQiWPBAVd4bDg5Y/Td93v/29Xo+76tV8yYiGFdcN1K+zzTVQ/o5Wu9Y2VKnbqAEwpz8ax8rfZ4LORy81+Nyw+a6qfPLU3fVSsh2dp/Kh76Cqg8n4xOow5xTtmUEaawvkwc8UmZj19qL/c3zfsIMefC3dwBMM29pUSltRu7gjj/uGUyjBq8OGFEAmHtCgPxY6l0pBEEsgu98m0+ONNG5zP3rM4J+cc90XA== 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=FQn3udCKPfejLb4mQYcU0WpTDXjzEA9MqxMMyJ+Z2A4=; b=CAsj5XwaekkAxas4/X7VDcUgDNCe3L2LwhXCkAodmXI6e/1YkSbnmfFvcVICA03nb3HiJHhRwRedMOQGZ8dXxVzx+lLe2fDpa8l0D9jFGhr9doepcyp7abXLzDu3tiCo6RYlI09DcsBBdpmmi/QOKyA5LDfi/qHS++ar8wYhpewJuXk7NWXyS42s6iKeAFAMIc+kyrRluRMmCH/4dOFueCvBun7GfITpYYzEjHFBKjFZEOnAcwW5Qf3VHKU7ZkKy0HTSCWlc6m7yiZozyBGoIgFVRVcxja26FQ07njUkXegYPWZkMzqL4p8FvFz9QKT+Ls5JUbwpowfo7GeDVINKSA== 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=FQn3udCKPfejLb4mQYcU0WpTDXjzEA9MqxMMyJ+Z2A4=; b=cHW2o6nn3tEhFtCmA5D7AuQfWiJd0exYNzkrcQyo1QU3FpTxd3HaACxbKNvf+blu0fiXL/JrBb5h94jZtw9MqUyDdFny2xR/1iajI72qjMgBhoaYk72C4hhoikJfKvjBn9N8FAwzitfGRtQWJJG8LjEZkMDlwx7MbiWb0pteD1s= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:07 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:07 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 10/22] xfs: Hoist node transaction handling Date: Thu, 18 Feb 2021 09:53:36 -0700 Message-Id: <20210218165348.4754-11-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 853aec3c-c2ee-4f21-2964-08d8d42dce63 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: 9dSG27bRlprOyrL+f+kuWp0fY/JUahkp7Jv6esScojm3bl4Z6qfPwJuGRRERtNNQvl5Y1+nWYNz4szmdpunEqRJNlGaScGvv1P6g/ICjKQZxuUcrco3V4Gdunk+cASeUGtPpVlY0VaAEKem7ircf6d7E2mfN2j2TKr5XGw7if/lNZRGW3Qaz5aoxemcI1qv2p7smO5vy87wBurQ07XbG+OHOs/sC6rVa/HHA6YZO/FoVD1zxKOSErusMjCVDAwsSicLu1GSAjsMgm+zeATOvtqQM4hsPyOw2qhPwdq1dpa0QTVoPgXGqugDXNFyvPz0+4MVoxhBEOz1udtqS4SnhZOyh7ENPFzqHJ0fmb7fUsj05w2ZDnnMn+lOiASzHHbGxM2mBgRmX/6un8HW5tEq85MufqRWnrcOC/1B/1+Vi7Gl6v1OYNucVTdGoXSZ0C3n+Cq7/Yd+uKiP4buyt8P7o499OIg5GT9ciIBbcczU+UhnJA35RKbI28DfQpH7qEFciTgDMuiGzdd6GV19V6aTE5KkpK2iqHPaVS13RsGH2+bWzPVMNsJf9t6v0GExY5NmaSjTeZZZ7YXqtxh01odSWww== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: p2oFluaY6+YKQSwZSOrYUgfSS3Q5ZQ7WsKhtgsFOjQoQWOcZSAy9pify/ee+Oh33cs6yD71LLgBJm+fWa2Pda4dR9YiHUM2wF94FnVEMHWVPGLEldJsraLzfR6sgFfbgHuM3FCseJggurihBzD7qn1ZgBFnYwSItKwQTimUjjSywDrOari79P/DcnSzCxYuhYmRc+kLF5xgjVOriAG4WfkHT+7MjJOnwXGC7TBba1zw2AKF+DGxaxjpCB9HezoiPtXA2wEkbwpu8vZIdESKjia5a1RRZzljc85oELp033F5/7IZu61RUMs5o7UZ6gSLZzDh3GUVIi6CnsiEpVn0u8tjdjjqDW3cjkH/unas1v5W9pN32P/g1lOzxdX1xWGypmWdhE+nrRrLB9doZZrNucv9qyzFii2mvJ37xE9F8kq/t3nR3lxG1JGHHOiRBeZlqpRKCMyjEo+B/FqfFrHAh7oMh27sEglFY+bSbgzcLpjugLaa6xKudRoFimR5tvhMTCDIgWJWZMt6BJK6I+/ZNrD/LmT7l6WN67yBujlka0KCEJCKkXbOyotsdZLbLqsf3Vl14xtUbSKB78k4f5z0v+f5wFkxjNZr60pvcryt3Pd2s6iGkC4lNSLi5SGLGu3GIdn/bY1OBseonify+mOrLsO/D+Kn7SdDcxjbH/Zb5oMhum+mhzEws0AlST/2/4kAjXFVNDEy/2ltHspf0Fe5BsVF4Yj8N1VNC3MAHVcMBnv36iqhCQKZIIEU6XXfA12M2jFLWGWrh11e4NXavhIHNaeyrQSz4IhMu2seDEAwca/lZgeC1YCQ1eJ4I8aYmpr/NseidOO+CGdzYqewQWMebjkeLIZ61wUjvtSdKBGCMUOb0mQQBBi+ud9C9UwZFddJAwR3XrYUZMBba1qUgN02UjUSYzdBU3j0Uvzuw/Wm/ZcBFFuUQlujwTVSRK/R4Z/K3l78kdk77hKqBnY7HWMzVMc0xc0udJTn1VFtVEK9kOQAvEspAKIzrt+x4+5c4KT04QBZQuXfXCJjkYX9FpUF/NaU7Cd6fRaxzE2TI9PaaReVQmleOeeQluxAaZ7o5kB/kOsoMBqTATz8dgqRLn/OkJgZrvjzNb3O0FPgr45Ab/pisflLoyVKR1VnbLu6DKiOwIbnDuGlTa3gQY8x0Uqd8L+AW8HJgBWs+8LBlLXWg1c88VQQBJ33WTsoTt9netA5IJyAzyMSO+23ImfxyouF8Be0sY7eRyCM11KGiZaOFLMURIJFgFJpWwMJSDkjQVh7OTK86W2tI9td+No5Vn8eswsFoPz2oB9FWEg8sw27jdeuBcgDm6OXsNNhKiEhDTmX7 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 853aec3c-c2ee-4f21-2964-08d8d42dce63 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:07.5949 (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: XtOrqCwyXzWODD/2zQLd8X15uK8awznEXdFvH2jEdJuyLAOfjFIgRZvXUmKJFfVJBvhL4e9XTcPWifGmk3tHMK/pTsAj27Agq2Q0VF71LFk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 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 --- fs/xfs/libxfs/xfs_attr.c | 53 +++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index bfd4466..56d4b56 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -288,8 +288,34 @@ xfs_attr_set_args( if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { error = xfs_attr_leaf_try_add(args, bp); - if (error == -ENOSPC) + if (error == -ENOSPC) { + /* + * Promote the attribute list to the Btree format. + */ + error = xfs_attr3_leaf_to_node(args); + if (error) + return error; + + /* + * Finish any deferred work items and roll the transaction once + * more. The goal here is to call node_addname with the inode + * and transaction in the same state (inode locked and joined, + * transaction clean) no matter how we got to this step. + */ + error = xfs_defer_finish(&args->trans); + if (error) + return error; + + /* + * Commit the current trans (including the inode) and + * start a new one. + */ + error = xfs_trans_roll_inode(&args->trans, dp); + if (error) + return error; + goto node; + } else if (error) return error; @@ -381,32 +407,9 @@ xfs_attr_set_args( /* bp is gone due to xfs_da_shrink_inode */ return error; + } node: - /* - * Promote the attribute list to the Btree format. - */ - error = xfs_attr3_leaf_to_node(args); - if (error) - return error; - - /* - * Finish any deferred work items and roll the transaction once - * more. The goal here is to call node_addname with the inode - * and transaction in the same state (inode locked and joined, - * transaction clean) no matter how we got to this step. - */ - error = xfs_defer_finish(&args->trans); - if (error) - return error; - /* - * Commit the current trans (including the inode) and - * start a new one. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; - } do { error = xfs_attr_node_addname_find_attr(args, &state); From patchwork Thu Feb 18 16:53:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093979 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 B9FEBC43217 for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89EDA64EC2 for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232971AbhBRSsS (ORCPT ); Thu, 18 Feb 2021 13:48:18 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53482 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbhBRQzW (ORCPT ); Thu, 18 Feb 2021 11:55:22 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGsCoP016460 for ; Thu, 18 Feb 2021 16:54:12 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=k89aHfpJ+hmy+EuDiAe0IndbGhoF6nEKFvWe9tlW7Ak=; b=GtbPo9rrIAUjhXSgyoJoSM8wYBZTLrPakjx4RPtz49BaYwKtEk3eK0nJUyFSfAqBwOs3 8ntvC5F5YlKAXrr0N92V6VVY2VllfVDKw1Z7OTo0dDKAemBO7jOxfYXrqBBb6mJXpMRo NNMt85X94MQ+1XgNvk2Zdhs+ZSKNsMsbyJdxFYMf4P3j4PqjRXN87G7PnzXLicl3Dj0F 45Ufs/atmGmPm7oLIhLiXhz6mPI78xxyQ95VN26hEUaX+4WHbC7Da6N3OSD/i59ZgDBO YQfPpMBtJaBdfzvWsenG1cIL5qWooQxpk12u6MCul2l2dEj64qSL11KJlrUbFUc+F3/8 MA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36p7dnpj6e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:12 +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 11IGng2r162351 for ; Thu, 18 Feb 2021 16:54:11 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3020.oracle.com with ESMTP id 36prhufdmr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VjnDYM5h1AdF7dQfftz6plVdjB2jjVjm6YGgUo0m6X7qaUutmd7P7/xgJy6NwDSU9nT6NKFakjRrNM4HFfM3MMRZeoz9wvEELSrSFgl0NbsZXQrZQIo/CIoXc302iFmEnqpz1vkpKUbBGSS2ER+khktwTta1shyNb9RPqQ8r7uDxBlDLGTC2n7TmzgmY28eznbJ08PXOp/VETEjVTusmHpzTuDE2WIv6naKY1NdwUfDm0eO+PvJUFbPCQZACmWCRx9IdZYaOKgIiWLqa09S1GOwKHxyFhDWtdbLYSW/6DIt6PgtWFwU9Cdb7uk3mC2IdiQpmC/ac8vMfla7kn2tyXg== 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=k89aHfpJ+hmy+EuDiAe0IndbGhoF6nEKFvWe9tlW7Ak=; b=AW+mZ91FXjwQF1DscK08crzIP10Rmf1jUUcKu1k9zkvUB+B1Ow1W4T9vrSIg+/NpKFnDV8n5519kDUqILPB1pdngxp/UJIJ8XfXi2qnswJPny/WQv/Qte1I5XeN3Df4syIhIJj3JR/kzYU7Wf+iRHgUefTuw16ZH4DfVSXBfPON3KFSqyF2zkMAOe/TSJqe0koc34bdCWodgBwjm1wx7vtxxvnTGK+h062nxyuHAA1Ez0ruK7l3kAcdyxIikseMSO6cUB5Nr0rkW6XHmJVcnkyAnJowtA7YqKnPBo/euaD/MHofBI3aC2s+6vIEU3tAAiApsOYL1h1n+5Xo/6RcInA== 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=k89aHfpJ+hmy+EuDiAe0IndbGhoF6nEKFvWe9tlW7Ak=; b=b6hEBjmkJWlsnPEpTP9h/ZfoQur2gG4c6wu/MJ2DFK38PpNZVhEBbsWbMgqkw9bGEqq4UYd1QOvroao2F4qhYGCuPs4s2Et+G1pDticMHL6B/jUA74Cp9u++OY2n+rsvCcLOSW6Qr5sy8WHpw2auY5DaccTBcbWCGWDylLQ2OE4= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:08 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:08 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 11/22] xfs: Add delay ready attr remove routines Date: Thu, 18 Feb 2021 09:53:37 -0700 Message-Id: <20210218165348.4754-12-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 401cf0d9-47d0-4255-1c5b-08d8d42dceb6 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: iGdrF3cwfxg7Q0Kb3fckwNouFGUORKMso0wRYvoK0FJR6Cjns6cQsavBzV6ARJX7DeYE6a6C9Afka51UQHzeKGVkQM6DW5dk2CdZ7TCSUjcPNV7n8eaYN9bn4LW9OxezSj/o0ROX2TGN0SZk/qOzzUmMSXk6aK2eiRO8Dhf5bn9646TUyWlXjb2h8KZ8r03Jh2GDgfY9orbJdCr2xp5QJ/UxwFMQFnZxpRoMqBDq8aSSld+D9I1XG1yFCawgtVbMYFAMHNmtVsR0jrDp9TGOulc5eDgzGo/5WjrqbnAWLVpMuChSlPYQskmq4RtVuZuVcZtQTYXrZ4Js2bLs7MvACPR3Mv7fwVqoG45b7vq217DfXZO/KEDf3BmbzLSUKhWqRboG0j14nKiWuMDVuP6xokJm4TE373B+MpDU6zFaW/BhxmREGLxoatdPnqvB6qxrhq16wbJdieqDwD2KmyagZ8Dd0ONLPIIyaLWooYBWSIEVSA74CAVdOcLuwhiOOoD/KHDd9pvCb/2BXtGVdtWL3w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(36756003)(6512007)(66946007)(6916009)(6666004)(30864003)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: GovWGLtyMJ/P+gdjZJmQyQUgwG0k4uIXyFsib1FSzZEX0aOvUS3Xi5cW3c9+7GhpyxlTIrCSX/RETVSFYzrJanXKf9K+TLVffLctPUj0/3wL9lxkOgDKmHlU8Dkxwy2CJMcC9pqyXOxFgnF412xVwZWzZJw3dl55sLAIiUbZm5Z58gGQKdGBuerGU1njZKCMR276AGPzItjsiJhf3uRiActrl8TNZf9TqYQs5VUUTYJOPHi21iDJzIzk/WIedq86wYxpHMC0ze/yshF9QMpEmfoENxZvGChmu6S5hg4EWF52rErVN2ZTg9XP6hT/RmEDgofYnyiH3zv8ors3xu1wmMoTk/Ky0nVZbXoR2YwlcjDJsIdVPvJ6Ta0/RoaolAHTaGNkfXJ4GLwT/641l/xPqJCI4QDk3RXO1B9o+hVy3IDVT9digcPkLy+51k+iZaUlRT/A5dy1fvtwMLz9wPezyrbziSk8reVq36JPtr98UKj8ZP426ZbRwmG1cqhjib7w0I5mlydw0pDqvgwZS23QAuCu5JmGnE7y6CR4S59KFfIeQoWDF+sMj1GV5OR7tG8du3mSb6nwgS1IyFFHDN4d7WaQG1ne1RoAbw98qeSI/ppvJnt3MGYK6vB7Ppj98LpInsFDk9dsKr0c+YjCs8eD5GH3EAhokt57xx4LpqHpqwXrJRBaZv1lJxaQSUa0iArtnfuYOiXaziC5WV8EBBNEirqoWq4bFZSCvSE5cHJH7o2lx1VoRRsmYvkW+YWK4U76iYGkCSxR9cwsGF9nay4bGh/GO2nCJ7hQ1/F8xqXFmtlJjnCJlJff3GHRSgvjmiW5jdAbh17KOpwbAP06BwaV821uIRbjk/DUWg/uwOubbfknuN1H0gjPQIeVnUQZRsKdsHLm+Q86yB5I7jL9rWwIj4zy6yDJFtE2N7Y8kdGyEd8YV83xL5YRSDNmwQOy+BYCijSxZ2jUw7ahgzAc/l1scYKJyzbsWPerywGv8IGkjM6rTqt+8nJ5KwiUGzTtd7E6J6c8dGVMCaFLO7OaGp9TqjK15r6PbmVuHAwYPG/qBaTFEkjO/bt8ShcXB+fEpdJsYwj8pbQFHWQrjDQuWmXoBlJvaTitrTTaUhie/9POLAiXHD3MSe3B2kUMu1TbRYB5LIjTFfbitiyAXAc9NhdW+99Ttc/rSogqgHYhlEM4GZWjT0psM4VQuRCLGDHHLz0heN/pII3zDPtR+WNa3QpkkbKkrAjq2HSrjOAjiBCgoiLSSovf+dkGSMVqy1540nBcPQKUjhwy9x5nveRYALFRzoKgkaCO2jyuQAMVsMGOiqN9bbKTcKC/VTHl0OyVOZgF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 401cf0d9-47d0-4255-1c5b-08d8d42dceb6 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:08.1654 (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: MnqWpFLYi5C57lmq6iz1h+EBJ2p9VU5oRi2VlQeKVPzAjspv7MJ0roywbEh5Nyu0V7t16+L/1tcQ6Ad8zkKKOEePCkmDPDpZswb8TFLbBAY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180143 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch modifies the attr remove routines to be delay ready. This means they no longer roll or commit transactions, but instead return -EAGAIN to have the calling routine roll and refresh the transaction. In this series, xfs_attr_remove_args has become xfs_attr_remove_iter, which uses a sort of state machine like switch to keep track of where it was when EAGAIN was returned. xfs_attr_node_removename has also been modified to use the switch, and a new version of xfs_attr_remove_args consists of a simple loop to refresh the transaction until the operation is completed. A new XFS_DAC_DEFER_FINISH flag is used to finish the transaction where ever the existing code used to. Calls to xfs_attr_rmtval_remove are replaced with the delay ready version __xfs_attr_rmtval_remove. We will rename __xfs_attr_rmtval_remove back to xfs_attr_rmtval_remove when we are done. xfs_attr_rmtval_remove itself is still in use by the set routines (used during a rename). For reasons of preserving existing function, we modify xfs_attr_rmtval_remove to call xfs_defer_finish when the flag is set. Similar to how xfs_attr_remove_args does here. Once we transition the set routines to be delay ready, xfs_attr_rmtval_remove is no longer used and will be removed. This patch also adds a new struct xfs_delattr_context, which we will use to keep track of the current state of an attribute operation. The new xfs_delattr_state enum is used to track various operations that are in progress so that we know not to repeat them, and resume where we left off before EAGAIN was returned to cycle out the transaction. Other members take the place of local variables that need to retain their values across multiple function recalls. See xfs_attr.h for a more detailed diagram of the states. Signed-off-by: Allison Henderson --- fs/xfs/libxfs/xfs_attr.c | 223 +++++++++++++++++++++++++++++----------- fs/xfs/libxfs/xfs_attr.h | 100 ++++++++++++++++++ fs/xfs/libxfs/xfs_attr_leaf.c | 2 +- fs/xfs/libxfs/xfs_attr_remote.c | 48 +++++---- fs/xfs/libxfs/xfs_attr_remote.h | 2 +- fs/xfs/xfs_attr_inactive.c | 2 +- 6 files changed, 294 insertions(+), 83 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 56d4b56..d46b92a 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -57,8 +57,8 @@ STATIC int xfs_attr_node_addname(struct xfs_da_args *args, struct xfs_da_state *state); STATIC int xfs_attr_node_addname_find_attr(struct xfs_da_args *args, struct xfs_da_state **state); -STATIC int xfs_attr_node_removename(xfs_da_args_t *args); STATIC int xfs_attr_node_addname_work(struct xfs_da_args *args); +STATIC int xfs_attr_node_removename_iter(struct xfs_delattr_context *dac); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); @@ -221,6 +221,34 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } +/* + * Checks to see if a delayed attribute transaction should be rolled. If so, + * also checks for a defer finish. Transaction is finished and rolled as + * needed, and returns true of false if the delayed operation should continue. + */ +int +xfs_attr_trans_roll( + struct xfs_delattr_context *dac) +{ + struct xfs_da_args *args = dac->da_args; + int error; + + if (dac->flags & XFS_DAC_DEFER_FINISH) { + /* + * The caller wants us to finish all the deferred ops so that we + * avoid pinning the log tail with a large number of deferred + * ops. + */ + dac->flags &= ~XFS_DAC_DEFER_FINISH; + error = xfs_defer_finish(&args->trans); + if (error) + return error; + } else + error = xfs_trans_roll_inode(&args->trans, args->dp); + + return error; +} + STATIC int xfs_attr_set_fmt( struct xfs_da_args *args) @@ -531,23 +559,58 @@ xfs_has_attr( */ int xfs_attr_remove_args( - struct xfs_da_args *args) + struct xfs_da_args *args) { - struct xfs_inode *dp = args->dp; - int error; + int error; + struct xfs_delattr_context dac = { + .da_args = args, + }; + + do { + error = xfs_attr_remove_iter(&dac); + if (error != -EAGAIN) + break; + + error = xfs_attr_trans_roll(&dac); + if (error) + return error; + + } while (true); + + return error; +} + +/* + * Remove the attribute specified in @args. + * + * This function may return -EAGAIN to signal that the transaction needs to be + * rolled. Callers should continue calling this function until they receive a + * return value other than -EAGAIN. + */ +int +xfs_attr_remove_iter( + struct xfs_delattr_context *dac) +{ + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; - if (!xfs_inode_hasattr(dp)) { - error = -ENOATTR; - } else if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) { + /* If we are shrinking a node, resume shrink */ + if (dac->dela_state == XFS_DAS_RM_SHRINK) + goto node; + + if (!xfs_inode_hasattr(dp)) + return -ENOATTR; + + if (dp->i_afp->if_format == XFS_DINODE_FMT_LOCAL) { ASSERT(dp->i_afp->if_flags & XFS_IFINLINE); - error = xfs_attr_shortform_remove(args); - } else if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { - error = xfs_attr_leaf_removename(args); - } else { - error = xfs_attr_node_removename(args); + return xfs_attr_shortform_remove(args); } - return error; + if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) + return xfs_attr_leaf_removename(args); +node: + /* If we are not short form or leaf, then proceed to remove node */ + return xfs_attr_node_removename_iter(dac); } /* @@ -1191,14 +1254,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 == @@ -1207,22 +1272,28 @@ int xfs_attr_node_removename_setup( if (args->rmtblkno > 0) { error = xfs_attr_leaf_mark_incomplete(args, *state); if (error) - return error; + goto out; - return xfs_attr_rmtval_invalidate(args); + error = xfs_attr_rmtval_invalidate(args); } +out: + if (error) + xfs_da_state_free(*state); return 0; } STATIC int -xfs_attr_node_remove_rmt( - struct xfs_da_args *args, - struct xfs_da_state *state) +xfs_attr_node_remove_rmt ( + struct xfs_delattr_context *dac, + struct xfs_da_state *state) { - int error = 0; + int error = 0; - error = xfs_attr_rmtval_remove(args); + /* + * May return -EAGAIN to request that the caller recall this function + */ + error = __xfs_attr_rmtval_remove(dac); if (error) return error; @@ -1253,18 +1324,24 @@ xfs_attr_node_remove_cleanup( } /* - * Remove a name from a B-tree attribute list. + * Step through removeing a name from a B-tree attribute list. * * This will involve walking down the Btree, and may involve joining * leaf nodes and even joining intermediate nodes up to and including * the root node (a special case of an intermediate node). + * + * This routine is meant to function as either an inline or delayed operation, + * and may return -EAGAIN when the transaction needs to be rolled. Calling + * functions will need to handle this, and recall the function until a + * successful error code is returned. */ STATIC int xfs_attr_node_remove_step( - struct xfs_da_args *args, - struct xfs_da_state *state) + struct xfs_delattr_context *dac) { - int error = 0; + struct xfs_da_args *args = dac->da_args; + struct xfs_da_state *state = dac->da_state; + int error = 0; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1272,7 +1349,10 @@ xfs_attr_node_remove_step( * overflow the maximum size of a transaction and/or hit a deadlock. */ if (args->rmtblkno > 0) { - error = xfs_attr_node_remove_rmt(args, state); + /* + * May return -EAGAIN. Remove blocks until args->rmtblkno == 0 + */ + error = xfs_attr_node_remove_rmt(dac, state); if (error) return error; } @@ -1285,51 +1365,74 @@ xfs_attr_node_remove_step( * * This routine will find the blocks of the name to remove, remove them and * shrink the tree if needed. + * + * This routine is meant to function as either an inline or delayed operation, + * and may return -EAGAIN when the transaction needs to be rolled. Calling + * functions will need to handle this, and recall the function until a + * successful error code is returned. */ STATIC int -xfs_attr_node_removename( - struct xfs_da_args *args) +xfs_attr_node_removename_iter( + struct xfs_delattr_context *dac) { - struct xfs_da_state *state = NULL; - int retval, error; - struct xfs_inode *dp = args->dp; + struct xfs_da_args *args = dac->da_args; + struct xfs_da_state *state = NULL; + int retval, error; + struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); - error = xfs_attr_node_removename_setup(args, &state); - if (error) - goto out; - - error = xfs_attr_node_remove_step(args, state); - if (error) - goto out; - - retval = xfs_attr_node_remove_cleanup(args, state); - - /* - * Check to see if the tree needs to be collapsed. - */ - if (retval && (state->path.active > 1)) { - error = xfs_da3_join(state); - if (error) - goto out; - error = xfs_defer_finish(&args->trans); + if (!dac->da_state) { + error = xfs_attr_node_removename_setup(dac); if (error) goto out; + } + state = dac->da_state; + + switch (dac->dela_state) { + case XFS_DAS_UNINIT: /* - * Commit the Btree join operation and start a new trans. + * repeatedly remove remote blocks, remove the entry and join. + * returns -EAGAIN or 0 for completion of the step. */ - error = xfs_trans_roll_inode(&args->trans, dp); + error = xfs_attr_node_remove_step(dac); if (error) - goto out; - } + break; - /* - * If the result is small enough, push it all into the inode. - */ - if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) - error = xfs_attr_node_shrink(args, state); + retval = xfs_attr_node_remove_cleanup(args, state); + /* + * Check to see if the tree needs to be collapsed. Set the flag + * to indicate that the calling function needs to move the + * shrink operation + */ + if (retval && (state->path.active > 1)) { + error = xfs_da3_join(state); + if (error) + goto out; + + dac->flags |= XFS_DAC_DEFER_FINISH; + dac->dela_state = XFS_DAS_RM_SHRINK; + return -EAGAIN; + } + + /* fallthrough */ + case XFS_DAS_RM_SHRINK: + /* + * If the result is small enough, push it all into the inode. + */ + if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) + error = xfs_attr_node_shrink(args, state); + + break; + default: + ASSERT(0); + error = -EINVAL; + goto out; + } + + if (error == -EAGAIN) + return error; out: if (state) xfs_da_state_free(state); diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 3e97a93..3154ef4 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -74,6 +74,102 @@ struct xfs_attr_list_context { }; +/* + * ======================================================================== + * Structure used to pass context around among the delayed routines. + * ======================================================================== + */ + +/* + * Below is a state machine diagram for attr remove operations. The XFS_DAS_* + * states indicate places where the function would return -EAGAIN, and then + * immediately resume from after being recalled by the calling function. States + * marked as a "subroutine state" indicate that they belong to a subroutine, and + * so the calling function needs to pass them back to that subroutine to allow + * it to finish where it left off. But they otherwise do not have a role in the + * calling function other than just passing through. + * + * xfs_attr_remove_iter() + * │ + * v + * found attr blks? ───n──┐ + * │ v + * │ find and invalidate + * y the blocks. mark + * │ attr incomplete + * ├────────────────┘ + * │ + * v + * remove a block with + * xfs_attr_node_remove_step <────┐ + * │ │ + * v │ + * still have blks ──y──> return -EAGAIN. + * to remove? re-enter with one + * │ less blk to remove + * n + * │ + * v + * remove leaf and + * update hash with + * xfs_attr_node_remove_cleanup + * │ + * v + * need to + * shrink tree? ─n─┐ + * │ │ + * y │ + * │ │ + * v │ + * join leaf │ + * │ │ + * v │ + * XFS_DAS_RM_SHRINK │ + * │ │ + * v │ + * do the shrink │ + * │ │ + * v │ + * free state <──┘ + * │ + * v + * done + * + */ + +/* + * Enum values for xfs_delattr_context.da_state + * + * These values are used by delayed attribute operations to keep track of where + * they were before they returned -EAGAIN. A return code of -EAGAIN signals the + * calling function to roll the transaction, and then recall the subroutine to + * finish the operation. The enum is then used by the subroutine to jump back + * to where it was and resume executing where it left off. + */ +enum xfs_delattr_state { + XFS_DAS_UNINIT = 0, /* No state has been set yet */ + XFS_DAS_RM_SHRINK, /* We are shrinking the tree */ +}; + +/* + * Defines for xfs_delattr_context.flags + */ +#define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */ + +/* + * Context used for keeping track of delayed attribute operations + */ +struct xfs_delattr_context { + struct xfs_da_args *da_args; + + /* Used in xfs_attr_node_removename to roll through removing blocks */ + struct xfs_da_state *da_state; + + /* Used to keep track of current state of delayed operation */ + unsigned int flags; + enum xfs_delattr_state dela_state; +}; + /*======================================================================== * Function prototypes for the kernel. *========================================================================*/ @@ -91,6 +187,10 @@ int xfs_attr_set(struct xfs_da_args *args); int xfs_attr_set_args(struct xfs_da_args *args); int xfs_has_attr(struct xfs_da_args *args); int xfs_attr_remove_args(struct xfs_da_args *args); +int xfs_attr_remove_iter(struct xfs_delattr_context *dac); +int xfs_attr_trans_roll(struct xfs_delattr_context *dac); bool xfs_attr_namecheck(const void *name, size_t length); +void xfs_delattr_context_init(struct xfs_delattr_context *dac, + struct xfs_da_args *args); #endif /* __XFS_ATTR_H__ */ diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index d6ef69a..3780141 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..f09820c 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,29 @@ xfs_attr_rmtval_remove( * Keep de-allocating extents until the remote-value region is gone. */ do { - retval = __xfs_attr_rmtval_remove(args); - if (retval && retval != -EAGAIN) - return retval; + error = __xfs_attr_rmtval_remove(&dac); + if (error != -EAGAIN) + break; - /* - * Close out trans and start the next one in the chain. - */ - error = xfs_trans_roll_inode(&args->trans, args->dp); + error = xfs_attr_trans_roll(&dac); if (error) return error; - } while (retval == -EAGAIN); + } while (true); - return 0; + return error; } /* * Remove the value associated with an attribute by deleting the out-of-line - * buffer that it is stored on. Returns EAGAIN for the caller to refresh the + * buffer that it is stored on. Returns -EAGAIN for the caller to refresh the * transaction and re-call the function */ int __xfs_attr_rmtval_remove( - struct xfs_da_args *args) + struct xfs_delattr_context *dac) { - int error, done; + struct xfs_da_args *args = dac->da_args; + int error, done; /* * Unmap value blocks for this attr. @@ -719,12 +719,20 @@ __xfs_attr_rmtval_remove( if (error) return error; - error = xfs_defer_finish(&args->trans); - if (error) - return error; - - if (!done) + /* + * We dont need an explicit state here to pick up where we left off. We + * can figure it out using the !done return code. Calling function only + * needs to keep recalling this routine until we indicate to stop by + * returning anything other than -EAGAIN. The actual value of + * attr->xattri_dela_state may be some value reminicent of the calling + * function, but it's value is irrelevant with in the context of this + * function. Once we are done here, the next state is set as needed + * by the parent + */ + if (!done) { + dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; + } return error; } diff --git a/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 Thu Feb 18 16:53:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093983 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 0BE69C433E9 for ; Thu, 18 Feb 2021 18:48:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B31BA64EBB for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233155AbhBRSsT (ORCPT ); Thu, 18 Feb 2021 13:48:19 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:41250 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234030AbhBRQzW (ORCPT ); Thu, 18 Feb 2021 11:55:22 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGoXBA088906 for ; Thu, 18 Feb 2021 16:54:12 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=tBZi8JPeMhzGqYZeUiHxhF3dJKw8abwrF1+MDXD/L7M=; b=tRNqAfNYrIDnO8LK+jehlWb/UuUoJOYbxxIk5ux16d4wvcF+xZXdbL/k88Uhxto1yanx wcweQiYusw0GJ6vVVFvvSOIK+4FMbrwfORPTZQtaVDtZeIKfQLEXMtA3HZbTGRAYaDcZ eax8VwYnWb3C/Qj6PXoLF0SGw0mE4GRnEng6Jwq7bImSfS48lNCIC07++OuiYTZD2A9y BjnySXyui28/nW+00GS6drOugbxI/NnOUnrjGlUdcXKGn9X86Z+YGh188+/BLA/U7zKi 8mNvsZ2fYGbKrCtrgMfGN0uabxQ/PIpDmjLt0Ql2o3hp0jTVUpRFhegpPkarHwNjn291 0w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36p49besy0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:11 +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 11IGoBeV119811 for ; Thu, 18 Feb 2021 16:54:11 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by userp3030.oracle.com with ESMTP id 36prq0qedx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bDi0v8y3682mlcGk8zbrrAHJ/HZCk9//s4/x9n6uv1VBNkJL6nPedxmGJTW/+rIZ2y0knol4gyofGSU0whdduMwDH7rNETECJ2SHek9w0FooOUr5S6KZYYQaMHRJOpf0Bmy4uCv94+akTTS9lRLd2eoksViYXY6po+D/NTthmQ4CO3G6GH2z/Kuda0HZHLrB6caL6cGvP1kmNL3HgE/8hKw3+5jhMLTA4v6QJLGTpniwLfzT/5GtslDHP753mn2KGW3dj6M58zUiFsQG3fi4RZnedGM8vsjiQx5jHAxzMEoXRwUmNwocU/I75nmmmF1FPcjV+3f+yV6TejhhwI6x2w== 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=tBZi8JPeMhzGqYZeUiHxhF3dJKw8abwrF1+MDXD/L7M=; b=LaQAdCicOuDthOz9pkfAOs8IayuQFTxlkpkET8E/21rGUNzR2fIAapEsBfSs7DLvfZuUsiX1F1oJrQh2ptnyOTmADkRNU0n71PcvONZTadC16Q6eOq062oJLl76fdclwYcXNYYEnB6Diti3udnLjkVUoK1WIiFGfV+UzH6LshEdKv8On3iSrvZY2A+OoCFlXOy89TU+rOhKLypSpXGtlXJygJpqY7hEt62yEMY7z6/ifQenuI9TH2nw90U3lvi+XBLXVH53AdGXew/Sz1tLCtPCzWV1b9Op3y6nrRnTQm2HHKNudTN8tOGCe6HRh5774wmBmPin5P0X0l9lZg8lRNw== 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=tBZi8JPeMhzGqYZeUiHxhF3dJKw8abwrF1+MDXD/L7M=; b=B2CVklrDKUs8ZJFQ3mFYlj3MdnVTw9sTGjYLdkniiKXAmwzd3QnKAlNIFz09dR2E31ccu/3Sbf0/UK0X/8WpNFIFcU8/uehvWnxGrnCXTiB24vSHmIFDgY/JJZ8UOf4ZJVmiLOob3FQrv2KCO4NGwHsicTcBnlwC82QDSddUEE0= 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 BY5PR10MB4161.namprd10.prod.outlook.com (2603:10b6:a03:213::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:54:08 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:08 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 12/22] xfs: Add delay ready attr set routines Date: Thu, 18 Feb 2021 09:53:38 -0700 Message-Id: <20210218165348.4754-13-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a650b587-3ce5-4f16-3936-08d8d42dcf02 X-MS-TrafficTypeDiagnostic: BY5PR10MB4161: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6UkzUgDjGk7vy/S589TIv5NtfWwJLcP+Sf+OeTRL5Ch7z1rZ/Iw/oHmmC2N974ye4aDMeyqvvHDZ3db2TTVytmkF2L3yy/N0dGHN54yDt9+13PjfbeTyzhu9VadLEkKmtswhz+uFHie1CUE+gt1rTdunONsT0fQDvcGHAUnAQjHDpUMkAco6K2NgS0gMmDq2e0RQNCZxRa+EYB2CGzkIUmRWPCdJu2ysEX9oGRKhKxShBYgn4Yg+l8x7rCZGfugHeL1l0TzDBmaSZqTsyn5omTQGEFzXoINEYSWTxeogmGHZS7DEdseYf4U/bl03UfNBdVqTISIFipf4VZ0diqCMvwUGBxyiz82RP7u96FeM/9T3mh5orNQHY2PGJ48dkG7NI5rrPUpexe79JHrJY3OiHuJbB8lY2NzBUVAfhnq0RtfD91RMXRBrDQAronJc8brecB70RXc0g7eOU1QxVBqXfMPUYwe13OcREaOiTPcO6belg8QWLuDha8TvJwlthchMRsZ7HzGIZYnHbyM5u0DH4w== 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)(376002)(396003)(366004)(136003)(346002)(16526019)(66556008)(6506007)(478600001)(5660300002)(956004)(26005)(6486002)(83380400001)(66476007)(186003)(66946007)(2616005)(52116002)(6512007)(1076003)(6666004)(316002)(30864003)(8676002)(8936002)(6916009)(36756003)(2906002)(86362001)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: e2euvpWNA5lPfiyxjvgDp1bBql6kJ+Orz1SjvAkexCRflzQ8Za7Hwt7QtKhZ7sbltEvFeAOfoAzz4zWA4g9VeqBtc2aY3OjwS6EDdpi2q8Jm9WIT/e/+awJtjTv/bw6MoZXY5v6AxEetmKgpxvn+0FWkGHpYme8hhfAUqWlYPpl4WdDcVqpFwesKl89vN370ny8Th+2lgqEE7pA5JsS5ilI9Gp8XZ+Qb2TfYXgurJ3YUoep2UatYnL63OCXGxq+AbSveKLU0FyW1RVknOwzdWKVJyRoBFVgZwIhwYy9JRA0C6kHqdALyO3pavObRTWQcDBQfac7kCudXhlEIGu7LUaCgeB6Y1O6UualiJ4cb9TbUIR8QWt+ivJ/qoxzDvpO/1ZVqyD/rT3nd7OXaPC3MgF1j407dBEnrUDs2qD8bgUSrPWrzzd7yGjykleS+msUfZpJAfetd+BxJhSqkM2KWURJV/uWbRjd1PWaXVreckl7Nnrstx5i5L7yWum19EOOT5KZUmn30xh4KrYm81HxygY/slZZdXVtv8ZzdtlyIEZ0x6CbyobvG+ftrRQTMmqDkQYA1UZEFA9lEyUYyjOO3Mk+RqI/AoRQyvCv3/cL/DOUfsx5dED9l1mgsQ1BNxr+1fcWB9acqZKk7mNPi14+0MSIi1V41+qbcUQNVYcX+b+TKKc4TdXG8UL4LSu2q4nNP37I89ry7KIZcCzH5AC2m3xk9+pjgUeIM+qThYeYG6UeYh36xRRzS0F/9OwuOKx38x/h0QH7vk+tTgtca3AxT7MaMsWpWGKh0nXsfxRAWJqD0q0zaLg2p0ab4n5ZR2Vnl6bOURERGDPgG0/+4Xo0IuGKyynj8PTzWNVqy/MrJMgxcnDW9F7pAXOoz37FWv8yBatCiM803UltQstYfiNxeb9S0fS/xitaDd/mtsozlnhT2xhKUQqvZbbgj65rhyD450KPJH87utSEi7I3zuq77IL/awxIZEiqYNMd6hbWhUnP3Ye/3rX+L8byqkxGzG3NUikHdYj0NO8fThU7/2CepnpnvwsMnk2MsbW0TDiWxkGtWq8ttTmLGtjQkW8tQu2yvkPHQdsEslLeEqoIx2v32XJCxXQa7WTgd2Qod5LCj7m2/5FUG/maC2Ln4XOY8p57OBcqxk0SxO/Or2b6U5SR0aWFOJy5Q8P/ctBjMNtZZMZgxcdi/FBxxYC2gAu2AluGk73fMNgpHEP5OkBSchrn76V6uTIm/NdnAFgJbP0QJBiCGFHoZ5hAKOv7eLjN1JB3KlLPD82TptHtMZ5yXFyqyRPqkpE60HwaAF6/J0tm0HshEdWA1+WnkXC7C3cqHBnSa X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a650b587-3ce5-4f16-3936-08d8d42dcf02 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:08.6821 (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: +pN/qtZN1EN0VsXR8MnD/DjUdglOUnfIfW0trLmJ4N1Wl4qbOD0pZ5iTZO2Tgd/l8IFYcHTBhFW1ZOGpuEmN/A4Cp246Subk+Ftdq9g69/U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4161 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 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 --- fs/xfs/libxfs/xfs_attr.c | 448 ++++++++++++++++++++++++---------------- fs/xfs/libxfs/xfs_attr.h | 241 ++++++++++++++++++++- fs/xfs/libxfs/xfs_attr_remote.c | 98 ++++++--- fs/xfs/libxfs/xfs_attr_remote.h | 5 +- fs/xfs/xfs_trace.h | 1 - 5 files changed, 583 insertions(+), 210 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index d46b92a..c7b86d5 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -53,16 +53,16 @@ STATIC int xfs_attr_leaf_try_add(struct xfs_da_args *args, struct xfs_buf *bp); */ STATIC int xfs_attr_node_get(xfs_da_args_t *args); STATIC void xfs_attr_restore_rmt_blk(struct xfs_da_args *args); -STATIC int xfs_attr_node_addname(struct xfs_da_args *args, - struct xfs_da_state *state); -STATIC int xfs_attr_node_addname_find_attr(struct xfs_da_args *args, - struct xfs_da_state **state); -STATIC int xfs_attr_node_addname_work(struct xfs_da_args *args); +STATIC int xfs_attr_node_addname(struct xfs_delattr_context *dac); +STATIC int xfs_attr_node_addname_find_attr(struct xfs_delattr_context *dac); +STATIC int xfs_attr_node_addname_work(struct xfs_delattr_context *dac); STATIC int xfs_attr_node_removename_iter(struct xfs_delattr_context *dac); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); STATIC int xfs_attr_refillstate(xfs_da_state_t *state); +STATIC int xfs_attr_set_iter(struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp); int xfs_inode_hasattr( @@ -226,7 +226,7 @@ xfs_attr_is_shortform( * also checks for a defer finish. Transaction is finished and rolled as * needed, and returns true of false if the delayed operation should continue. */ -int +STATIC int xfs_attr_trans_roll( struct xfs_delattr_context *dac) { @@ -249,29 +249,55 @@ xfs_attr_trans_roll( return error; } +/* + * Set the attribute specified in @args. + */ +int +xfs_attr_set_args( + struct xfs_da_args *args) +{ + struct xfs_buf *leaf_bp = NULL; + int error = 0; + struct xfs_delattr_context dac = { + .da_args = args, + }; + + do { + error = xfs_attr_set_iter(&dac, &leaf_bp); + if (error != -EAGAIN) + break; + + error = xfs_attr_trans_roll(&dac); + if (error) + return error; + } while (true); + + return error; +} + STATIC int xfs_attr_set_fmt( - struct xfs_da_args *args) + struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp) { - struct xfs_buf *leaf_bp = NULL; - struct xfs_inode *dp = args->dp; - int error2, error = 0; + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; + int error = 0; /* * Try to add the attr to the attribute list in the inode. */ error = xfs_attr_try_sf_addname(dp, args); - if (error != -ENOSPC) { - error2 = xfs_trans_commit(args->trans); - args->trans = NULL; - return error ? error : error2; - } + + /* Should only be 0, -EEXIST or -ENOSPC */ + if (error != -ENOSPC) + return error; /* * It won't fit in the shortform, transform to a leaf block. * GROT: another possible req'mt for a double-split btree op. */ - error = xfs_attr_shortform_to_leaf(args, &leaf_bp); + error = xfs_attr_shortform_to_leaf(args, leaf_bp); if (error) return error; @@ -280,93 +306,140 @@ xfs_attr_set_fmt( * concurrent AIL push cannot grab the half-baked leaf buffer * and run into problems with the write verifier. */ - xfs_trans_bhold(args->trans, leaf_bp); - error = xfs_defer_finish(&args->trans); - xfs_trans_bhold_release(args->trans, leaf_bp); - if (error) - xfs_trans_brelse(args->trans, leaf_bp); + xfs_trans_bhold(args->trans, *leaf_bp); + /* + * We're still in XFS_DAS_UNINIT state here. We've converted + * the attr fork to leaf format and will restart with the leaf + * add. + */ + dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } /* * Set the attribute specified in @args. + * This routine is meant to function as a delayed operation, and may return + * -EAGAIN when the transaction needs to be rolled. Calling functions will need + * to handle this, and recall the function until a successful error code is + * returned. */ int -xfs_attr_set_args( - struct xfs_da_args *args) +xfs_attr_set_iter( + struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp) { - struct xfs_inode *dp = args->dp; - struct xfs_buf *bp = NULL; - struct xfs_da_state *state = NULL; - int forkoff, error = 0; - int retval = 0; + struct xfs_da_args *args = dac->da_args; + struct xfs_inode *dp = args->dp; + struct xfs_buf *bp = NULL; + struct xfs_da_state *state = NULL; + int forkoff, error = 0; + int retval = 0; - /* - * If the attribute list is already in leaf format, jump straight to - * leaf handling. Otherwise, try to add the attribute to the shortform - * list; if there's no room then convert the list to leaf format and try - * again. - */ - if (xfs_attr_is_shortform(dp)) { - error = xfs_attr_set_fmt(args); - if (error != -EAGAIN) - return error; - } + /* State machine switch */ + switch (dac->dela_state) { + case XFS_DAS_UNINIT: + if (xfs_attr_is_shortform(dp)) + return xfs_attr_set_fmt(dac, leaf_bp); - if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { - error = xfs_attr_leaf_try_add(args, bp); - if (error == -ENOSPC) { - /* - * Promote the attribute list to the Btree format. - */ - error = xfs_attr3_leaf_to_node(args); + /* + * After a shortform to leaf conversion, we need to hold the + * leaf and cycle out the transaction. When we get back, + * we need to release the leaf to release the hold on the leaf + * buffer. + */ + if (*leaf_bp != NULL) { + xfs_trans_bhold_release(args->trans, *leaf_bp); + *leaf_bp = NULL; + } + + if (xfs_bmap_one_block(dp, XFS_ATTR_FORK)) { + error = xfs_attr_leaf_try_add(args, *leaf_bp); + if (error == -ENOSPC) { + /* + * Promote the attribute list to the Btree + * format. + */ + error = xfs_attr3_leaf_to_node(args); + if (error) + return error; + + /* + * Finish any deferred work items and roll the + * transaction once more. The goal here is to + * call node_addname with the inode and + * transaction in the same state (inode locked + * and joined, transaction clean) no matter how + * we got to this step. + * + * At this point, we are still in + * XFS_DAS_UNINIT, but when we come back, we'll + * be a node, so we'll fall down into the node + * handling code below + */ + dac->flags |= XFS_DAC_DEFER_FINISH; + return -EAGAIN; + } + else if (error) + return error; + } + else { + error = xfs_attr_node_addname_find_attr(dac); if (error) return error; - /* - * Finish any deferred work items and roll the transaction once - * more. The goal here is to call node_addname with the inode - * and transaction in the same state (inode locked and joined, - * transaction clean) no matter how we got to this step. - */ - error = xfs_defer_finish(&args->trans); + error = xfs_attr_node_addname(dac); if (error) return error; /* - * Commit the current trans (including the inode) and - * start a new one. + * If addname was sucesfull, and we dont need to alloc + * anymore blks, we're done. */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) + if (!args->rmtblkno && !args->rmtblkno2) return error; - goto node; + dac->dela_state = XFS_DAS_FOUND_NBLK; + return -EAGAIN; } - else if (error) - return error; - /* - * Commit the transaction that added the attr name so that - * later routines can manage their own transactions. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - return error; + dac->dela_state = XFS_DAS_FOUND_LBLK; + return -EAGAIN; + case XFS_DAS_FOUND_LBLK: /* * If there was an out-of-line value, allocate the blocks we * identified for its storage and copy the value. This is done * after we create the attribute so that we don't overflow the * maximum size of a transaction and/or hit a deadlock. */ - if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_set(args); + + /* Open coded xfs_attr_rmtval_set without trans handling */ + if ((dac->flags & XFS_DAC_LEAF_ADDNAME_INIT) == 0) { + dac->flags |= XFS_DAC_LEAF_ADDNAME_INIT; + if (args->rmtblkno > 0) { + error = xfs_attr_rmtval_find_space(dac); + if (error) + return error; + } + } + + /* + * Roll through the "value", allocating blocks on disk as + * required. + */ + if (dac->blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(dac); if (error) return error; + + return -EAGAIN; } + error = xfs_attr_rmtval_set_value(args); + if (error) + return error; + if (!(args->op_flags & XFS_DA_OP_RENAME)) { /* * Added a "remote" value, just clear the incomplete @@ -395,22 +468,26 @@ xfs_attr_set_args( * Commit the flag value change and start the next trans in * series. */ - error = xfs_trans_roll_inode(&args->trans, args->dp); - if (error) - return error; - + dac->dela_state = XFS_DAS_FLIP_LFLAG; + return -EAGAIN; + case XFS_DAS_FLIP_LFLAG: /* * Dismantle the "old" attribute/value pair by removing a * "remote" value (if it exists). */ xfs_attr_restore_rmt_blk(args); - if (args->rmtblkno) { - error = xfs_attr_rmtval_invalidate(args); - if (error) - return error; + error = xfs_attr_rmtval_invalidate(args); + if (error) + return error; - error = xfs_attr_rmtval_remove(args); + /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ + dac->dela_state = XFS_DAS_RM_LBLK; + + /* fallthrough */ + case XFS_DAS_RM_LBLK: + if (args->rmtblkno) { + error = __xfs_attr_rmtval_remove(dac); if (error) return error; } @@ -435,94 +512,117 @@ xfs_attr_set_args( /* bp is gone due to xfs_da_shrink_inode */ return error; - } -node: + case XFS_DAS_FOUND_NBLK: + /* + * If there was an out-of-line value, allocate the blocks we + * identified for its storage and copy the value. This is done + * after we create the attribute so that we don't overflow the + * maximum size of a transaction and/or hit a deadlock. + */ + if (args->rmtblkno > 0) { + /* + * Open coded xfs_attr_rmtval_set without trans + * handling + */ + error = xfs_attr_rmtval_find_space(dac); + if (error) + return error; - do { - error = xfs_attr_node_addname_find_attr(args, &state); - if (error) - return error; - error = xfs_attr_node_addname(args, state); - } while (error == -EAGAIN); - if (error) - return error; + /* + * Roll through the "value", allocating blocks on disk + * as required. Set the state in case of -EAGAIN return + * code + */ + dac->dela_state = XFS_DAS_ALLOC_NODE; + } - /* - * Commit the leaf addition or btree split and start the next - * trans in the chain. - */ - error = xfs_trans_roll_inode(&args->trans, dp); - if (error) - goto out; + /* fallthrough */ + case XFS_DAS_ALLOC_NODE: + if (args->rmtblkno > 0) { + if (dac->blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(dac); + if (error) + return error; - /* - * If there was an out-of-line value, allocate the blocks we - * identified for its storage and copy the value. This is done - * after we create the attribute so that we don't overflow the - * maximum size of a transaction and/or hit a deadlock. - */ - if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_set(args); - if (error) - return error; - } + return -EAGAIN; + } + + error = xfs_attr_rmtval_set_value(args); + if (error) + return error; + } + + if (!(args->op_flags & XFS_DA_OP_RENAME)) { + /* + * Added a "remote" value, just clear the incomplete + * flag. + */ + if (args->rmtblkno > 0) + error = xfs_attr3_leaf_clearflag(args); + retval = error; + goto out; + } - if (!(args->op_flags & XFS_DA_OP_RENAME)) { /* - * Added a "remote" value, just clear the incomplete flag. + * If this is an atomic rename operation, we must "flip" the + * incomplete flags on the "new" and "old" attribute/value pairs + * so that one disappears and one appears atomically. Then we + * must remove the "old" attribute/value pair. + * + * In a separate transaction, set the incomplete flag on the + * "old" attr and clear the incomplete flag on the "new" attr. */ - if (args->rmtblkno > 0) - error = xfs_attr3_leaf_clearflag(args); - retval = error; - goto out; - } - - /* - * If this is an atomic rename operation, we must "flip" the incomplete - * flags on the "new" and "old" attribute/value pairs so that one - * disappears and one appears atomically. Then we must remove the "old" - * attribute/value pair. - * - * In a separate transaction, set the incomplete flag on the "old" attr - * and clear the incomplete flag on the "new" attr. - */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - goto out; - /* - * Commit the flag value change and start the next trans in series - */ - error = xfs_trans_roll_inode(&args->trans, args->dp); - if (error) - goto out; + error = xfs_attr3_leaf_flipflags(args); + if (error) + goto out; + /* + * Commit the flag value change and start the next trans in + * series + */ + dac->dela_state = XFS_DAS_FLIP_NFLAG; + return -EAGAIN; - /* - * Dismantle the "old" attribute/value pair by removing a "remote" value - * (if it exists). - */ - xfs_attr_restore_rmt_blk(args); + case XFS_DAS_FLIP_NFLAG: + /* + * Dismantle the "old" attribute/value pair by removing a + * "remote" value (if it exists). + */ + xfs_attr_restore_rmt_blk(args); - if (args->rmtblkno) { error = xfs_attr_rmtval_invalidate(args); if (error) return error; - error = xfs_attr_rmtval_remove(args); + /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ + dac->dela_state = XFS_DAS_RM_NBLK; + + /* fallthrough */ + case XFS_DAS_RM_NBLK: + if (args->rmtblkno) { + error = __xfs_attr_rmtval_remove(dac); + if (error) + return error; + } + + error = xfs_attr_node_addname_work(dac); + +out: + if (state) + xfs_da_state_free(state); if (error) return error; - } + return retval; - error = xfs_attr_node_addname_work(args); -out: - if (state) - xfs_da_state_free(state); - if (error) - return error; - return retval; + default: + ASSERT(dac->dela_state != XFS_DAS_RM_SHRINK); + break; + } + return error; } + /* * Return EEXIST if attr is found, or ENOATTR if not */ @@ -1021,18 +1121,18 @@ xfs_attr_node_hasname( STATIC int xfs_attr_node_addname_find_attr( - struct xfs_da_args *args, - struct xfs_da_state **state) + struct xfs_delattr_context *dac) { - int retval; + struct xfs_da_args *args = dac->da_args; + int retval; /* * Search to see if name already exists, and get back a pointer * to where it should go. */ - retval = xfs_attr_node_hasname(args, state); + retval = xfs_attr_node_hasname(args, &dac->da_state); if (retval != -ENOATTR && retval != -EEXIST) - goto out; + return retval; if (retval == -ENOATTR && (args->attr_flags & XATTR_REPLACE)) goto out; @@ -1058,8 +1158,8 @@ xfs_attr_node_addname_find_attr( return 0; out: - if (*state) - xfs_da_state_free(*state); + if (dac->da_state) + xfs_da_state_free(dac->da_state); return retval; } @@ -1072,20 +1172,24 @@ 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]; + blk = &state->path.blk[ state->path.active-1 ]; ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); error = xfs_attr3_leaf_add(blk->bp, state->args); @@ -1101,18 +1205,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; } @@ -1125,9 +1226,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. @@ -1144,8 +1243,9 @@ xfs_attr_node_addname( STATIC int xfs_attr_node_addname_work( - struct xfs_da_args *args) + struct xfs_delattr_context *dac) { + struct xfs_da_args *args = dac->da_args; struct xfs_da_state *state = NULL; struct xfs_da_state_blk *blk; int retval = 0; diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 3154ef4..603887e 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -135,6 +135,233 @@ struct xfs_attr_list_context { * v * done * + * + * Below is a state machine diagram for attr set operations. + * + * It seems the challenge with undertanding this system comes from trying to + * absorb the state machine all at once, when really one should only be looking + * at it with in the context of a single function. Once a state sensitive + * function is called, the idea is that it "takes ownership" of the + * statemachine. It isn't concerned with the states that may have belonged to + * it's calling parent. Only the states relevant to itself or any other + * subroutines there in. Once a calling function hands off the statemachine to + * a subroutine, it needs to respect the simple rule that it doesn't "own" the + * statemachine anymore, and it's the responsibility of that calling function to + * propagate the -EAGAIN back up the call stack. Upon reentry, it is committed + * to re-calling that subroutine until it returns something other than -EAGAIN. + * Once that subroutine signals completion (by returning anything other than + * -EAGAIN), the calling function can resume using the statemachine. + * + * xfs_attr_set_iter() + * │ + * v + * ┌─y─ has an attr fork? + * │ | + * │ n + * │ | + * │ V + * │ add a fork + * │ │ + * └──────────┤ + * │ + * V + * ┌─y─ is shortform? + * │ │ + * │ V + * │ xfs_attr_set_fmt + * │ | + * │ V + * │ xfs_attr_try_sf_addname + * │ │ + * │ V + * │ had enough ──y──> done + * │ space? + * n │ + * │ n + * │ │ + * │ V + * │ transform to leaf + * │ │ + * │ V + * │ hold the leaf buffer + * │ │ + * │ V + * │ return -EAGAIN + * │ Re-enter in + * │ leaf form + * │ + * └─> release leaf buffer + * if needed + * │ + * V + * ┌───n── fork has + * │ only 1 blk? + * │ │ + * │ y + * │ │ + * │ v + * │ xfs_attr_leaf_try_add() + * │ │ + * │ v + * │ had enough ──────────────y───────────────┐ + * │ space? │ + * │ │ │ + * │ n │ + * │ │ │ + * │ v │ + * │ return -EAGAIN │ + * │ re-enter in │ + * │ node form │ + * │ │ │ + * └──────────┤ │ + * │ │ + * V │ + * xfs_attr_node_addname_find_attr │ + * determines if this │ + * is create or rename │ + * find space to store attr │ + * │ │ + * v │ + * xfs_attr_node_addname │ + * │ │ + * v │ + * fits in a node leaf? ────n─────┐ │ + * │ ^ v │ + * │ │ single leaf node? │ + * │ │ │ │ │ + * y │ y n │ + * │ │ │ │ │ + * v │ v v │ + * update │ grow the leaf split if │ + * hashvals └─── return -EAGAIN needed │ + * │ retry leaf add │ │ + * │ on reentry │ │ + * ├─────────────────────────────┘ │ + * │ │ + * v │ + * need to alloc │ + * ┌─y── or flip flag? │ + * │ │ │ + * │ n │ + * │ │ │ + * │ v │ + * │ done │ + * │ │ + * │ │ + * │ XFS_DAS_FOUND_LBLK <──────────────────┘ + * │ │ + * │ V + * │ xfs_attr_leaf_addname() + * │ │ + * │ v + * │ ┌──first time through? + * │ │ │ + * │ │ y + * │ │ │ + * │ n v + * │ │ if we have rmt blks + * │ │ find space for them + * │ │ │ + * │ └──────────┤ + * │ │ + * │ v + * │ still have + * │ ┌─n─ blks to alloc? <──┐ + * │ │ │ │ + * │ │ y │ + * │ │ │ │ + * │ │ v │ + * │ │ alloc one blk │ + * │ │ return -EAGAIN ──┘ + * │ │ re-enter with one + * │ │ less blk to alloc + * │ │ + * │ │ + * │ └───> set the rmt + * │ value + * │ │ + * │ v + * │ was this + * │ a rename? ──n─┐ + * │ │ │ + * │ y │ + * │ │ │ + * │ v │ + * │ flip incomplete │ + * │ flag │ + * │ │ │ + * │ v │ + * │ XFS_DAS_FLIP_LFLAG │ + * │ │ │ + * │ v │ + * │ remove │ + * │ ┌───> old name │ + * │ │ │ │ + * │ XFS_DAS_RM_LBLK │ │ + * │ ^ │ │ + * │ │ v │ + * │ └──y── more to │ + * │ remove │ + * │ │ │ + * │ n │ + * │ │ │ + * │ v │ + * │ done <──────┘ + * │ + * └──────> XFS_DAS_FOUND_NBLK + * │ + * v + * ┌─────n── need to + * │ alloc blks? + * │ │ + * │ y + * │ │ + * │ v + * │ find space + * │ │ + * │ v + * │ ┌─>XFS_DAS_ALLOC_NODE + * │ │ │ + * │ │ v + * │ │ alloc blk + * │ │ │ + * │ │ v + * │ └──y── need to alloc + * │ more blocks? + * │ │ + * │ n + * │ │ + * │ v + * │ set the rmt value + * │ │ + * │ v + * │ was this + * └────────> a rename? ──n─┐ + * │ │ + * y │ + * │ │ + * v │ + * flip incomplete │ + * flag │ + * │ │ + * v │ + * XFS_DAS_FLIP_NFLAG │ + * │ │ + * v │ + * remove │ + * ┌────────> old name │ + * │ │ │ + * XFS_DAS_RM_NBLK │ │ + * ^ │ │ + * │ v │ + * └──────y── more to │ + * remove │ + * │ │ + * n │ + * │ │ + * v │ + * done <──────┘ + * */ /* @@ -149,12 +376,20 @@ struct xfs_attr_list_context { enum xfs_delattr_state { XFS_DAS_UNINIT = 0, /* No state has been set yet */ XFS_DAS_RM_SHRINK, /* We are shrinking the tree */ + XFS_DAS_FOUND_LBLK, /* We found leaf blk for attr */ + XFS_DAS_FOUND_NBLK, /* We found node blk for attr */ + XFS_DAS_FLIP_LFLAG, /* Flipped leaf INCOMPLETE attr flag */ + XFS_DAS_RM_LBLK, /* A rename is removing leaf blocks */ + XFS_DAS_ALLOC_NODE, /* We are allocating node blocks */ + XFS_DAS_FLIP_NFLAG, /* Flipped node INCOMPLETE attr flag */ + XFS_DAS_RM_NBLK, /* A rename is removing node blocks */ }; /* * Defines for xfs_delattr_context.flags */ #define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */ +#define XFS_DAC_LEAF_ADDNAME_INIT 0x02 /* xfs_attr_leaf_addname init*/ /* * Context used for keeping track of delayed attribute operations @@ -162,6 +397,11 @@ enum xfs_delattr_state { struct xfs_delattr_context { struct xfs_da_args *da_args; + /* Used in xfs_attr_rmtval_set_blk to roll through allocating blocks */ + struct xfs_bmbt_irec map; + xfs_dablk_t lblkno; + int blkcnt; + /* Used in xfs_attr_node_removename to roll through removing blocks */ struct xfs_da_state *da_state; @@ -188,7 +428,6 @@ int xfs_attr_set_args(struct xfs_da_args *args); int xfs_has_attr(struct xfs_da_args *args); int xfs_attr_remove_args(struct xfs_da_args *args); int xfs_attr_remove_iter(struct xfs_delattr_context *dac); -int xfs_attr_trans_roll(struct xfs_delattr_context *dac); bool xfs_attr_namecheck(const void *name, size_t length); void xfs_delattr_context_init(struct xfs_delattr_context *dac, struct xfs_da_args *args); diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index f09820c..6af86bf 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -441,7 +441,7 @@ xfs_attr_rmtval_get( * Find a "hole" in the attribute address space large enough for us to drop the * new attribute's value into */ -STATIC int +int xfs_attr_rmt_find_hole( struct xfs_da_args *args) { @@ -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 != -EAGAIN) - break; - - error = xfs_attr_trans_roll(&dac); - if (error) - return error; - } while (true); - - return error; -} - -/* * Remove the value associated with an attribute by deleting the out-of-line * buffer that it is stored on. Returns -EAGAIN for the caller to refresh the * transaction and re-call the function diff --git a/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 63ecbc6..363e1bf 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -1942,7 +1942,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 Thu Feb 18 16:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093977 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 355ABC4332B for ; Thu, 18 Feb 2021 18:48:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C791764EB9 for ; Thu, 18 Feb 2021 18:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233178AbhBRSs1 (ORCPT ); Thu, 18 Feb 2021 13:48:27 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45920 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234033AbhBRQzW (ORCPT ); Thu, 18 Feb 2021 11:55:22 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGnhFU069702 for ; Thu, 18 Feb 2021 16:54:12 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=Vl9eDKa5S1raQvDKRxamKSxRV2qq5u41mjrz4kT1pOY=; b=omI0yrK0JCiCxgE+4J9w/waumEZEHOffVQEtLVoq7crIecg2b2DYCdSOxCJxlckd/fo+ IScAk1mjhbpYOwwjTwHhexXcGE9Cqc99J5hN86ixGoznNJU4yMPb1a4LLKFqv/RzeBcp w/mCJe36QG5SyST5D3K2E1TGbHZ/k2e3Cdv8gEaB/myMvB26RSGrLcsyZfQiEzbXTA46 x1vs3jBbAOxy72NezlzhdbLmL1rFjS13sRppyxLW0Un/7Pvlqo9yJqP9ev4mxTDGJAA7 V48hXM3zE+Hr6Tt/zLWhUZHhYggSNc22qCSPERIdBfwxbtn2U83cJLr0DDJm50k8/DYO gA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ae4q1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:12 +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 11IGng2s162351 for ; Thu, 18 Feb 2021 16:54:11 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3020.oracle.com with ESMTP id 36prhufdmr-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MnA6g3V9InqGfuKowJ8THwKn197K4+ebExZ3EmbiE9I3NpD/Zu0yzUHQKMl1b9on1kzVIeZf7W3kac++UGDiWkTkTLFMnDEER2ywFC4HDi5W0cwSGbJsE1NW97sFuxG2axR76VO2JzpJtG4gQHcaYYecokUTNXvNTnDz6jMiua6kqtSXtOth7G+7ja984WcUgzhrJUtN0ImCkH8AT7HH5X5I16r/Wp+yA4DxVZAxxAzev0FPyuVOna+l3q1jTXdLhzGfKqHINnxH6sw1QBVyJ9ataO8RKrVfzZ8xqoMn/1S7Qz8j1U3Beuf5vwCkGO70cybGVrucz3zidGPP+IX45A== 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=Vl9eDKa5S1raQvDKRxamKSxRV2qq5u41mjrz4kT1pOY=; b=U3HCE8d7GY0vRpuVxy6Dwy6igLMkvCYLmo3pQx4ZCxPOsBf/7O1h7DK+4nR4ijgd86qQZcOOr4LHhZ1lRZGePyZQQEV2O0DaSHWBOkyWoFJi4h/Og44KeaN0akXNErULPXxaI68s+MeXed+irp5u+Jb+XY42t71E3rGF/MWYfvoh3uudALwxjGWjJQFBMmAv+IbRHUjtQ6ceTX2qM0S/jZNIBgVDpG8ROsnOE3D+qa03H+E0L4UEvwaeXrF/h0svcZ/ebwEJF7a5k76GAVVCia9HIHU1tCWZSCb/t2uOmxWWIRQ09FOytmXpgtr/5xQ4GeAgx0rGvlTB3i1pAI+5gA== 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=Vl9eDKa5S1raQvDKRxamKSxRV2qq5u41mjrz4kT1pOY=; b=TXQwe38xNdCWjIOsIiKBFX7T/20zXS9JwgCPs9/OlxZyLWkDg5vhUDLAu0ffFLLETVWcmp/DR2ouKPdzfd5N6hRcLpm6YZv+vZOzel8v/NlVMlfwD8sIpwDnuXxGMbV/oiNeKvH9yx6uhFFw9kNc/PhW+Cd895T22JXet2aqC1s= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:09 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:09 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 13/22] xfs: Add state machine tracepoints Date: Thu, 18 Feb 2021 09:53:39 -0700 Message-Id: <20210218165348.4754-14-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c7946b9a-94b4-4013-79f2-08d8d42dcf55 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zrfJUAQ7GVxqWr3cvuuH7t9pJ/yXbIqFJY93k1wdMrqULhyu7rPaibJVyhmq4JprQC6PEo3kEYVEyAI/X9LxMiqISysoMEkUIsnIHBuFcysYXwEEqgpEFAezMKqFVUnYOFDr4y+HMueiFiaut0/FV7E4wc75PAcxvEXSOOFiGwcGxWxry0ukAwlPhZzXBcxj2DSfVoLbKMyrO5qWHzXhj0QcWDy4gpy5SijIvT1zOUCLSyZQHLv+34Tmh+zh2ATtLyTC31E9eDPt6803A76XpQbqBVpZBCwrx8LoRaQWdE/gAfjaeMjSwFikeaxvpIl5xQMs5g3y0jX1xfX9TqxTaPfG1jHyL3jfKKjCq7FjaH9q2VOzwvMYRPhTTPhuChdULu/HOe6YhZBDlekCK4XhhxodPkhFjxH7zPpF3xZwMdgh2oqUSJIZGi2W/ZoBa0fDBfUSEmn1DITr3DWQM4Axq0uxtNybUGahiEqL5mhoAxm6er3N53MA2jNDcxo8SysKSnfMh4mGYO0KiX2JAiS8KMaA2Ckper0Phw+ujMjOkeuJk+ALk157RQCBNCEWblP3gpixg5aohKGBKlplDL7eUg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: A3Rakw507ghIXujipsmpyk+ROSVopQRHx08HHRz4c1QdGpxCm8x2PAhY/OGGPTDHcOSZhT1+GJO+Pv4uQENZJGzxBhuExX5YVLDbUEpcTeJEkioxZHv7eNdqSdZ4D6wlBndbOagAutcy2a+AApRhShgsKPhDBz1SLdyJAyyhrCK2MpkjBy6wNL90Gfp3oNIo+qjcwXr2tiOsixIDJlnq8I2+GMuI0UDaSAPgIQvuQ7f3NNacyCWSOJue2sZmtj/H7HAS5yU6Wp2v6LlGszKDrvbRIt2OKv5GMgRbQTXdVhbEimfprMlp/JylhKF1vejYqmYfLgps7IsxvtS7RraOWuOemSw4YPul6rVqNNujhvsvqeK1XKjJdzwzH3HAaeX8vMXZ3cenukRsX/O/jo9qd0wHAGzrgEZ448K7g1vFPXrJtluw3kmrwuP+I1BUxQlytCEDMEw92AZ1xpmg1w+bRXfCgOo17NvVvP6rdGnRK44tJEbkzyCQIfmMUeA03siqXWMP7B944g4/IVcDvQn35pgWwk7rzTW1a06q5BWQWYBT5ymXA1anZJRQL85LtG7IacemBQ7KN1aFk9jwHUCtN99tdpmCXF/xZUGr7fWB8UIDHx9+SeEf+NNcI8ml+pkuk5p+wJjA41fIKtp2BgjRYqgk4peTbofnn664MO1XFgm3PiMRDJJB4JtU0LaFqxxXtGFp81i+CyBwaT216GNw0iq3cgbVWvHtWup4sgGxvcLRV84YA21nUdLm8L5KgTULOhBs8UF+ECAHT7hCVXiiCLBwMc646dptXjk3YpUzTqvIUJcyARpNfn4CWHOAPE8Jk1+LdvfhsT3dwa/jtnSaVueuxcCmTRzTqhpoik31JSFrJBajqjWm6hmoy7C6OMM/w2X3LuOLNjVHlusCoFKnhgmAs1wxjBRCCy4SL9Lt9GP+R11jpxkrAp94ntzWicpjhwYOxtd47Qou/cD7H6iK5WHheaYNBx5LtxBtxTFmsc3dSakO3Pw7HM9sVCiReM3uEOLvONyjLMW5o7L2r2lFPK9Mr3F8EUF5tGMcpnf/Q6/tMAnhemmFIFj4TmsPaIhbDXsy1YbJTw52ubsdsj8ZbQV/VVq9Pdvtpq6Ak16ZBKiZKrwUsMfbdnLHZAW6JYEV5xE2V0dTGaliyavahNLt2REhq58EyS2NkTcPAmvBTQkqeB2s23YHuT/iR84yWPAUuT/v5H7KM6TxbGIercbUSFb4LpLolBHzCpCfMNjS2amxP0LWxEnYseLqNaNbtMI60SglyDnYXLyPRXyDijQc2ULMf5G5FtK6YkGuXSIX93IF8zBRMuab7nqElOaoyEU8 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7946b9a-94b4-4013-79f2-08d8d42dcf55 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:09.1182 (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: LeAb2uMYWlnBHerndnAGJ8GbGbv9lzKYlq0D4QEMWgmp2INEyKyh/k02OUzCTOczAqk3VFO3f2ug97B4Dk6KxrG+9xRe62gMSWtuN7UYbIQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This is a quick patch to add a new tracepoint: xfs_das_state_return. We use this to track when ever a new state is set or -EAGAIN is returned Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 31 ++++++++++++++++++++++++++++++- fs/xfs/libxfs/xfs_attr_remote.c | 1 + fs/xfs/xfs_trace.h | 25 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index c7b86d5..ba21475 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -313,6 +313,7 @@ xfs_attr_set_fmt( * the attr fork to leaf format and will restart with the leaf * add. */ + trace_xfs_attr_set_fmt_return(XFS_DAS_UNINIT, args->dp); dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } @@ -378,6 +379,8 @@ xfs_attr_set_iter( * handling code below */ dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } else if (error) @@ -400,10 +403,13 @@ xfs_attr_set_iter( return error; dac->dela_state = XFS_DAS_FOUND_NBLK; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); return -EAGAIN; } dac->dela_state = XFS_DAS_FOUND_LBLK; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FOUND_LBLK: @@ -433,6 +439,8 @@ xfs_attr_set_iter( if (error) return error; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); return -EAGAIN; } @@ -469,6 +477,7 @@ xfs_attr_set_iter( * series. */ dac->dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FLIP_LFLAG: /* @@ -488,6 +497,9 @@ xfs_attr_set_iter( case XFS_DAS_RM_LBLK: if (args->rmtblkno) { error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); if (error) return error; } @@ -545,6 +557,8 @@ xfs_attr_set_iter( if (error) return error; + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -581,6 +595,7 @@ xfs_attr_set_iter( * series */ dac->dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); return -EAGAIN; case XFS_DAS_FLIP_NFLAG: @@ -601,6 +616,10 @@ xfs_attr_set_iter( case XFS_DAS_RM_NBLK: if (args->rmtblkno) { error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_set_iter_return( + dac->dela_state, args->dp); + if (error) return error; } @@ -1214,6 +1233,8 @@ xfs_attr_node_addname( * this point. */ dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_node_addname_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -1394,6 +1415,9 @@ xfs_attr_node_remove_rmt ( * May return -EAGAIN to request that the caller recall this function */ error = __xfs_attr_rmtval_remove(dac); + if (error == -EAGAIN) + trace_xfs_attr_node_remove_rmt_return(dac->dela_state, + dac->da_args->dp); if (error) return error; @@ -1513,6 +1537,8 @@ xfs_attr_node_removename_iter( dac->flags |= XFS_DAC_DEFER_FINISH; dac->dela_state = XFS_DAS_RM_SHRINK; + trace_xfs_attr_node_removename_iter_return( + dac->dela_state, args->dp); return -EAGAIN; } @@ -1531,8 +1557,11 @@ xfs_attr_node_removename_iter( goto out; } - if (error == -EAGAIN) + if (error == -EAGAIN) { + trace_xfs_attr_node_removename_iter_return( + dac->dela_state, args->dp); return error; + } out: if (state) xfs_da_state_free(state); diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index 6af86bf..b242e1a 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -763,6 +763,7 @@ __xfs_attr_rmtval_remove( */ if (!done) { dac->flags |= XFS_DAC_DEFER_FINISH; + trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); return -EAGAIN; } diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 363e1bf..7993f55 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -3927,6 +3927,31 @@ DEFINE_EVENT(xfs_eofblocks_class, name, \ DEFINE_EOFBLOCKS_EVENT(xfs_ioc_free_eofblocks); DEFINE_EOFBLOCKS_EVENT(xfs_blockgc_free_space); +DECLARE_EVENT_CLASS(xfs_das_state_class, + TP_PROTO(int das, struct xfs_inode *ip), + TP_ARGS(das, ip), + TP_STRUCT__entry( + __field(int, das) + __field(xfs_ino_t, ino) + ), + TP_fast_assign( + __entry->das = das; + __entry->ino = ip->i_ino; + ), + TP_printk("state change %d ino 0x%llx", + __entry->das, __entry->ino) +) + +#define DEFINE_DAS_STATE_EVENT(name) \ +DEFINE_EVENT(xfs_das_state_class, name, \ + TP_PROTO(int das, struct xfs_inode *ip), \ + TP_ARGS(das, ip)) +DEFINE_DAS_STATE_EVENT(xfs_attr_set_fmt_return); +DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return); +DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return); +DEFINE_DAS_STATE_EVENT(xfs_attr_node_removename_iter_return); +DEFINE_DAS_STATE_EVENT(xfs_attr_node_remove_rmt_return); +DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return); #endif /* _TRACE_XFS_H */ #undef TRACE_INCLUDE_PATH From patchwork Thu Feb 18 16:53:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093971 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 910C7C43219 for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 603A864EB9 for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbhBRSsR (ORCPT ); Thu, 18 Feb 2021 13:48:17 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:53640 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234035AbhBRQzV (ORCPT ); Thu, 18 Feb 2021 11:55:21 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGn3nI185407 for ; Thu, 18 Feb 2021 16:54:12 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=g3h35iPdn6wcTjoeIvuF3jV92mAfDJtAPid4Tjrfga8=; b=VDl3L3iuScGnt2DxpRABMu0D5TyunT5dP+3vTMhx+qMxzj6hlQVnpYHLUn7MwAVl0TD7 As1Fd+3P3eek0gJRt9p+nDsiBsxwur/W8zGEA1aONl0Og9QcL/mvbS/XOoddf1HdjJc3 29vJ73vda+jLoGy4eDvK9Ghk65Q5of691Dzo4gnhfxPxYx627Z1oLrD1pslyyFE8qsND oWHpzgd7jHo3pVLONNZg2IwH7O98Vu/NJ3GEZo8SCdpwj+4TIZWP86z7Gp7syzkrGplG OleXcoT0xh2zAKrGKJ72JxDD3giigdEmVvWviOOj9W0dKUdp+i7oUEtJUkukwZsoqG/G PA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 36p66r6n91-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:12 +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 11IGng2t162351 for ; Thu, 18 Feb 2021 16:54:12 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3020.oracle.com with ESMTP id 36prhufdmr-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ifMggNjSuHGOvV8aCu5RgBUlgTZfANgVDtvNuhjmGS/gYLuQMlr7pO7qfXDvHwNBHt/VDK7xNM5kds45WMahPaYkJAdKAtaDHAUIWyT5Y/gb5iIr2swY0hW4OKfeuh036dd+8IgN7FT+QPL6AMtQehTYcQcdu+QTgX4auvPFnlQn6vit+8UT/5YF3Wcqad8B/ZgQdlUShxvUyJxPry2366WGpJBR76O1Xw6ZdHWxPK0tYkGoRjRziJBaA4yroAy3b8rici41H78r8LfuYbj8vxAEVkHCpbPXT1VYRWM49WQkGbQpnlYwuojgUHQkx7smQHwfFwHJ9b80RvLF1cR7Uw== 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=g3h35iPdn6wcTjoeIvuF3jV92mAfDJtAPid4Tjrfga8=; b=PjUzinKjTaKpPkplaJqWG77iyfVP7nEsiPHJ+GVK6oXbxe4pIqvm8TGsXBi1FjaWq9cF89kzeon71DtYR9PiMVRra4WZQ2hW9X+f3aT1ehYSjW4x775EFbbQD51xodb0jyX8WBcDLQub+T4evEz14fllriPkbwQ0dw/lNqezP6a21qw1mx7v2YcokKNwlhn72QqRLfzzkHOQh4oY/edLGQXoJSU3fiwiWeJB8g2lEjSmDQyUgeHXI6ccBltXPAZ7vg1/qGcSrl7Q7lO+jfr2ZqLQXy5Xb3mbB3zWiNGY0c1DBRbz2MwhplrLXr+PyYPxSfbW/s+xM2TFmVp3jxfBcQ== 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=g3h35iPdn6wcTjoeIvuF3jV92mAfDJtAPid4Tjrfga8=; b=jKCRLHxK+AJwGqsWzqjzN0QbR52mo14q3CZDifMUnJxIa1FuuB+Ew5tNKIMUOtf4L+mwg5yqoGBfLL+zBdmYfupl2q6YP3dE4PC/zT8TYuwHCNJIveMp+hO1itWk+9F37wsH8vIeRo7UtHQ3MxKX79q3lzB3u+JMCLzvpV0liB4= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:09 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:09 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 14/22] xfs: Rename __xfs_attr_rmtval_remove Date: Thu, 18 Feb 2021 09:53:40 -0700 Message-Id: <20210218165348.4754-15-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1dda8f19-adde-48bb-258e-08d8d42dcfa6 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cDp0grS0cmHL0lj+hmOeH4hDxHmSVCn0xZZ/VQtT50XKCkautAi/whUoiamLL6/gLh6hvuAkuRaIwU4sgmmvXOozFpwYpp+sfajaRCXTAYaMQUVhsNhtlZAaCUifkVo2dRXwGkO05t+gxoLZqqdGcjeKyAvBSOck1HI8A7UlU3YApmtlJ/3benYKMQAXXNvAWqbDvA/gFsUA8SuTWL00vPuSn2ZVhzSdbUOEfpdge3/RLoA/ySbfP37n9xmshsUpuGnvdemKbZRYhr8rHRBLLhMKNVSelCYcPhQSxnzyShRfCSBFyeNEJwuUImXn2i2tKP+6rESeMVK67UkYNjGBNGREhbPmT1pe4VAIozuZxsCP3vQ13Tcg0/cFbtEACMV15KiuZ+pOFYiF9PndrZO4yuzL/B4z7wD6uKfGvs95k4XlMf/XpKQWMWOP7IVGuM1Jidm+qgdU9BBQRpoQGc69m7z4W/PMpnUMWZB69vYCYk+D4RLBvefxf3oz0Ckaht4kiDbmqu9V6LwtvAPhE3uB5SULSJidjumSCDP1Ocg5v3HxKdHgbChPIfNg+pqVqHqfrSgWMboexaR6PZ23FWnlKQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KpE5ZNV2vCnEgdlmLiuhMDoN4I56SbvN9xj1mR7gY7HGVTwf+v9Ti9hRZ37HJcTBfUUsbiJU3wmqtL6za1rVIljIxhKUoh26kjMrdC3v4P2zIgTMct73F89mbECId6g89+BVSBpi9v5tHeVIkkI9xOoZwBFFkIVxTDRS+ir7t5YWsVaj3DbCLLiryyZCEQuJR0eXZ6wrVbIh5gJQSI2Pi/x1mKeDXdV+R2jeYUAOaX3xiRicx7niPd3YOEgRUGaKIB56N1agvstVfleYKoFxKeYAyH7ncKX+FTVq9itbtbgSvJNEXIUlUsbtAtK+tozpxUOK8opxx2UN0GgJ8zF/aPaHTH1Tp7YoFgTDaeIMjyGKsA/2kaQSGeRSqfWkgalDOrK6xnODIrdacRKrJjjNQt15zJbUG6ItcQ8G+d/reRrtdFGJEuiWcFpdeC7ByEv5EdHqbNW0eQdaYwj/qojze5w8TIZN72yrhIUoiAuo/UyMWNRN8swaPNnwhEn8Q12C2dzw07mRsuCb8t+t01j6Km01NubQ2gB7Gfno5+h4HWx20behZ8Vb9NF2sEi5eVP2c2ijSiqSCgAWERbE3wtqSijefnj1ZpDbJtbXUzEN4VjhdWDJstL3d5KSRVLFNAi8lq3qe0o7iAJ19Ji44i7IPsL5NFVIyyX660jLccDFRUNqhwq6u67DZhSpJ9DS9IbLCu+DQyKYotmbdjTbwdVP31xxbCudF4XoObo7iI8/nW1/VwHqqyJILC35LHVsDwqTm6G0p/N2bOWfMHtYG2DMUnDx87Kb6zuqadRQZPKm6ol+NyOtyFGjsZENoIKEcYFvqFwtvwx3kyMkOc8XS2uOVMQBUpzYJZWOWWEop72eSt1qhHD2vceY4fj3KMymTLuTEzhsL/eh+KTzXRzgNK1uamIh/PhKFEhxJRNF+aPBWjSfs+foEpuKA5kKL1q3itsyambR4HDUXTg4Q6IoOvK+Rp/JleSectOJzKXVO7+6qFipCE6IsAM8n6mh3W3OImdMc0XSAKUSc8EH6rwJHsr+bT/r77XG97tWvR/lB3kbyh7AfNDX8Tz7m2sQVvGcSQs71+dEB+qgcaCCy9zUlXBUYG8dakTXTjd54rCh3ouVIiyOhuK9pxOq6fxKviaIX72gGfjBN4+zRV9ieJrgVikKcnlZaSO66ri8YCjESfLCQyFbWZVZl6qT+utRUaqpTuAFsGyqbbroYGUQfT4LWdW/LelXtvdziKjBU8T01mxBZY4NY973r+uk7UMIWvokwvB3x1vXhSR1LGp2r/vijsCi/w7cEYLPC4mamb+tdNWQEpoJCeEFi8dTnGdEQMwSrgZD X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1dda8f19-adde-48bb-258e-08d8d42dcfa6 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:09.6319 (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: 8Ia1wmyv26kcJhD34YCZHY7DpsrczEnHs/4xaBAO0zbwooqvmA9TuC9Ci9I4jc37hmWPQ7tdT6KPloyEGQHMRZn3/tXCkevum/lGiAu0uuc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Now that xfs_attr_rmtval_remove is gone, rename __xfs_attr_rmtval_remove to xfs_attr_rmtval_remove Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 6 +++--- fs/xfs/libxfs/xfs_attr_remote.c | 2 +- fs/xfs/libxfs/xfs_attr_remote.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index ba21475..2b8e481 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -496,7 +496,7 @@ xfs_attr_set_iter( /* fallthrough */ case XFS_DAS_RM_LBLK: if (args->rmtblkno) { - error = __xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(dac); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( dac->dela_state, args->dp); @@ -615,7 +615,7 @@ xfs_attr_set_iter( /* fallthrough */ case XFS_DAS_RM_NBLK: if (args->rmtblkno) { - error = __xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(dac); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( dac->dela_state, args->dp); @@ -1414,7 +1414,7 @@ xfs_attr_node_remove_rmt ( /* * May return -EAGAIN to request that the caller recall this function */ - error = __xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(dac); if (error == -EAGAIN) trace_xfs_attr_node_remove_rmt_return(dac->dela_state, dac->da_args->dp); diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index b242e1a..b6554a3 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -737,7 +737,7 @@ xfs_attr_rmtval_invalidate( * transaction and re-call the function */ int -__xfs_attr_rmtval_remove( +xfs_attr_rmtval_remove( struct xfs_delattr_context *dac) { struct xfs_da_args *args = dac->da_args; diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h index 8ad68d5..6ae91af 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.h +++ b/fs/xfs/libxfs/xfs_attr_remote.h @@ -13,7 +13,7 @@ int xfs_attr_rmtval_set(struct xfs_da_args *args); int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map, xfs_buf_flags_t incore_flags); int xfs_attr_rmtval_invalidate(struct xfs_da_args *args); -int __xfs_attr_rmtval_remove(struct xfs_delattr_context *dac); +int xfs_attr_rmtval_remove(struct xfs_delattr_context *dac); int xfs_attr_rmt_find_hole(struct xfs_da_args *args); int xfs_attr_rmtval_set_value(struct xfs_da_args *args); int xfs_attr_rmtval_set_blk(struct xfs_delattr_context *dac); From patchwork Thu Feb 18 16:53:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093959 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 2E01FC4332B for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEF8C64EB8 for ; Thu, 18 Feb 2021 18:48:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233076AbhBRSsA (ORCPT ); Thu, 18 Feb 2021 13:48:00 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:41274 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234037AbhBRQzU (ORCPT ); Thu, 18 Feb 2021 11:55:20 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGoiEE088991 for ; Thu, 18 Feb 2021 16:54:13 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=nijqi6c/49iEyBMvZW31ntMapQNoFaEQIbre+GnRiPc=; b=ysqTD+fDsSNiRFlquVTE40YtQxzo25iStxNlsBJhAZdG7xFwBGJFzM5k2EYYGeR0HHHO fCwjzwZtmEGXw9SSVmUaeROT7/ksVlPF4QL1V4D4PUEa1H5XdWpM3ZeezXU5yN/qQPFh iWby7HSczZKKqVwLGwY9G554YFqeVyx2x4wICMvJbyY2RDF/jxEGDE0P8jM2ia3lAWnr IfIILs3tpi/mpLmsOD9jGJEosgcjbDzukTbUEog+Rd0GZWaY+AKWaEK2kmfaDccfTcmc Tabt4bGfqdJ4qLUKRFa3hW3OTCmuo85JcIy/3V3f7TMIcKesjhi8tEF2VvoZfKDt85gY 8A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 36p49besy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:13 +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 11IGng2u162351 for ; Thu, 18 Feb 2021 16:54:12 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3020.oracle.com with ESMTP id 36prhufdmr-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gmwU3erEqv03TqxnPwgcqPeOPAoOKTmoXvQpRDNV8pnwKd0s0TxX8xfK3WNzLWtsd/oVvqd8WKz7iZejrZdhtotA9Xv71xDFgjcg7kp9tdGEQMemPhMKWwZ7ZoasEZ5vTUJFdJwmW8go5WsNo+yHHe9ig7MTP9O9d6shWQQzFwNKeHrKSTSPvLtwegOSYcPuzMfnNP4blYN3XPRMo72i6c3kwvNcyJ0+bOsj6Z7w+nBM4OIPnLrXemjGv+arwYQneJOQJbeq9RH49nGSAiilJGp1IaeI24JNTZWV5YjdHekIFnHpEwN0lysdY8LmgZRS7L8pE/7s7//bAZsdwaC86w== 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=nijqi6c/49iEyBMvZW31ntMapQNoFaEQIbre+GnRiPc=; b=LdGE+aI7AGCq9cYGH6/t6dvrh4ECRfYnKNgBLLqrUBB4iJXPcr3cmx2wXZylOMEBZs72FZRS+zV1RkqVVTszFcqVsjQzPYRZjtZEpZ0BeIRN9UYSMcJMbY/Shdg3jaeMB52hFyC4Trfha6nXOkk2CDg2nWMon4SIzpRUtWl8gdHtpQWzxfGB1CkYCrFpL8PYJdiIhSZNs4Izp/cNqAzcKAKPTvUhpMYg68KiEtob84uurUXoANtp/0eUz5tanN+SNSTqzDZrdivD+GdvEmjsZIFZV9uwO/UYzT4dIP6Dm0Al3VqDCeDn3Ehxb2iVcgROXAQ/beRFfm1Q5Z8h/sONsA== 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=nijqi6c/49iEyBMvZW31ntMapQNoFaEQIbre+GnRiPc=; b=NH5/wuPp4WG5ccb31qqyhx+/hVSd/oBuFRH4N3MeMRiJm89gzTImZ1HZ/9glPKCXL5GCEsfaF+v8OHthj1yQsuLUGHWycZVOOtKCSkr9cYJ3BhWcvDRrRpxKT2qhYjEZHwtxjxwnzakDkFozbyLPQXuVtFZWi4b9g62xuHkBIWU= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:11 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:10 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 15/22] xfs: Handle krealloc errors in xlog_recover_add_to_cont_trans Date: Thu, 18 Feb 2021 09:53:41 -0700 Message-Id: <20210218165348.4754-16-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c1c5475-c831-4cf0-e3e4-08d8d42dcfe4 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: c2Zx4pweYYElzh/eE0uWLK2DOP2CFs593t6yR8lmA1CRfwKysHDJE7udhWXbrXkrVV1BLTOnQb+g98dP48kNLf/L5EKyEI0FfQH8+8ytjPRb1voAXwHM66+/hGLrmsrjDkK54AZPqWgBPLkeTYyLYoPAvIuw2cJuTiYYxnwdHfNiBdy2j2oKc6iLMZXQiOnALAMZa8KmaCcrdjC+S4qrKzFvdsXkB5umz0hr+Xsp82mPvQWU9mWlPsqjE8pZNFHDWB+lk79Srsc35yNTxsoOia3sFar1zdlYZ5+JEVUmU8MPXBbLRmaTAwrP8QCLBWKcuTDjkVK8fJllGatJPC2xKuuE3GTNpN966kecYBUgU6CsrxEsosfkmH0+yvu0NaHvKDTvalvEJd+hqeEaXYyKYEzwICShCUx/3Fn5jX7CULS6jIWuyelv1wS+1asr4SXgLIVccLVUpkE/l6ZcFIlzEwJAH4HwSHzlYgbv5hW8RsCcV7S7+Sla0bCP5V9nJpNhXIshQgMnjTJvndjTP0mva3rbG3RyaA4AGmkvrmpQl3asWIZgUsUqGSS6B6NHddC4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CL+38KhYJmcph4nHhL8sfqp49YP8vB2KAVRsVrQ2PyG3VSZSERqcsClPd/osYKX4Fby2TA0YbaLusVR2iFAkjKo/cI8FUPcFkEGepwPQkctrKgVWpiKOK5sCGPtGiJojIc/5weOp63JnXlkbnun/XLjvkXA783cODT5j0ToztnbK/pI/X+j5zQaeDPoopWCdOmb6ZGm6XWAMppg7en+VhDRrfM1gMFi1kbNid2r4G3Vz6OcVlPWZTOphZuNrKZ5T2CrS1xSdl50c6RXueXNHyjBuCvM+XwZRvPjO5DdPKNdapa1h+mbvMM83cNJSwWwTL4I8nh3MTl/OChZ/C5GkIMVYp951gt7grGL3VDCJBnayhkKQNAbp0fBstCGR/0DDgOcPtfqH3HkjW6xiweMqHCtG+2Z6MInG3rT5kt56jGcSHEBxuEn/ddadYGUV8vS/gp9XkkgYq64u34xkz9GKvi1QWHSgY/zRhXBTrEc32b8wtxK/a+VZJWeiiy0IwiYSC7bbmPxAz53ZAuQJ6I6MklkNwofkvRTGLashVLuJjOok3DI+dduyZT1xU69wWxpmfiihkY2v9TaQ5p1hUMxNFP2eMPRzwwQ3paoZM/6q73jBZIO8NaYHbkn3BszNUOs284B57vP0yyOxETQa7GmxuqQ4S87kjKYc7K9cb1V+Wdmfza7ntQOCkryjUrUv4Mv1EJX4M5lGnl6ZDQLc5MP798KmJ/ypN1X4ly79EffTbJ0ifAJ5lIFJDGLF2vVPHXpJ1LsT8aL8eW4N1O1zp8aa1jll7b2vsWU9B6YFnZAmKZ0Dw+BM7aDN4h4MPkYdvd700jgDolTtkglKXht5vjusAw1GGqkaMycPplo6wrd20AtxXNGY/iIU2PH5QYL2HjgEhU9F/WRpNjk+AtegUouXw/JYpaNRo1sxoiGsic7fiStXCS9OgnCyeEKwaVvfGTvqI6jjpEuQ2h4LAFpXJOkfX9mAY0MBC+Plmc0cwek7a1aQEUvAWrpgk5S0gtR78TAcgj98UVq0vAbcbHcmtgDZDE4RMOD1F8BjT0ENYHwkC+7IycBzqApXGQc3SAQNZBU4MqfZ6FQALqlTK6vNzKlF5jRJ7MHC4mfdGiypxknPkVnqvkBm+4LnjsIpkJEaYlOwhOfIVV2H9QDsQO19rSqcAinOTA+pHUjgcwtR7f4b/j7rW9/FbNeBtNV+/et1xDQPbcx2eiIw6iCjWLAPxTb/kuVb20BxXPab3OA3ddY9hPyfHTRPA8VkPB1lMk9InX15yoZhyrRi3dQDTZznAIgxCR8x5bmS8HQgL3Vcecgn8jBgKQ4hzyiOsy3XJ09WjixW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c1c5475-c831-4cf0-e3e4-08d8d42dcfe4 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:10.0830 (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: AAyK9T1prhtYmKoi0/jvRX+Z05X7+IHpM7n2V3Rbm7SlijnNmLhnw/0U8V3+sGVGngv2z4yF8tjvEWP0md/n+Si3GK8n/UViCtj9nCnrPQ8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Because xattrs can be over a page in size, we need to handle possible krealloc errors to avoid warnings The warning: WARNING: CPU: 1 PID: 20255 at mm/page_alloc.c:3446 get_page_from_freelist+0x100b/0x1690 is caused when sizes larger that a page are allocated with the __GFP_NOFAIL flag option. We encounter this error now because attr values can be up to 64k in size. So we cannot use __GFP_NOFAIL, and we need to handle the error code if the allocation fails. Signed-off-by: Allison Henderson --- fs/xfs/xfs_log_recover.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 97f3130..295a5c6 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -2061,7 +2061,10 @@ xlog_recover_add_to_cont_trans( old_ptr = item->ri_buf[item->ri_cnt-1].i_addr; old_len = item->ri_buf[item->ri_cnt-1].i_len; - ptr = krealloc(old_ptr, len + old_len, GFP_KERNEL | __GFP_NOFAIL); + ptr = krealloc(old_ptr, len + old_len, GFP_KERNEL); + if (ptr == NULL) + return -ENOMEM; + memcpy(&ptr[old_len], dp, len); item->ri_buf[item->ri_cnt-1].i_len += len; item->ri_buf[item->ri_cnt-1].i_addr = ptr; From patchwork Thu Feb 18 16:53:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63C52C4321A for ; Thu, 18 Feb 2021 18:48:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 091BE64EB8 for ; Thu, 18 Feb 2021 18:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233187AbhBRSs3 (ORCPT ); Thu, 18 Feb 2021 13:48:29 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45940 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234038AbhBRQz1 (ORCPT ); Thu, 18 Feb 2021 11:55:27 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGnmL7069815 for ; Thu, 18 Feb 2021 16:54:15 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=x49l8NjisgPrt1aF410Q05vlSNoSpX6DhzxWj14iiRg=; b=RRBcAlOsPywEvC9C4+kemdwo9UJwY90PeB1W5t1EuZ8xQIboYljckDl5zngOaC+SDoAl u+bRY+pXkFYuzthQIQeIty8ZjuiiUNMD5gUXug4ZsibEp3UIqwscw3gHUGZN5PDjfxdv gCzdvIjZaASFVpBY/QMVpPGknYfNg0E2VXTfR3Kwr0HU0DQIaXiULQ63kR7OcWxzocA9 4emDgNB/STgoXfTw1sIj4J4pyc4aXebKs22kZ8j4XPYlY07s16HjMR5Ske2B+qTUN6DU yDM+r9zfkGj7nCe43Ahommad9zFCnBh6GOsU/Cg+3AhqOuiwTd5qcUnEWuCq3yWC14Fc 4A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 36pd9ae4q6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:15 +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 11IGng2v162351 for ; Thu, 18 Feb 2021 16:54:14 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by userp3020.oracle.com with ESMTP id 36prhufdmr-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JaEi9750kcScMg7c0WOSwzR2e+WORKZ/s2Z7iTdZAJ9VIShkDSgvsJmpedsvI8stJo+Od+AySlyzLtZvWWRkkIHifh8ovak5L8mXLX4pKyhOKJlOEGSn7GreE6R8bmHm7iYa2UJhv5G8eFH4tmYpBX7UVQGZ/pszBM9WpiKMno7KrGpL/NthN+6UMF3ZQbJ4/h8qqaRFIOLUOypKrNMOJ3ZO/q9IvtOKqzQkAACz54kq3QGAeV4KZc8cdi18ChNlGJOgFT9bHNeK/Jij0RzW4pmv8Lha01bpLmHPpqEPWx23GUjGMO9erDPxoobelQaWA2eooPhWYTHUvUfeAnFzZg== 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=x49l8NjisgPrt1aF410Q05vlSNoSpX6DhzxWj14iiRg=; b=iIyMr7dxNgu9gdGrnbW3N0VAO6lFLmYWDbWdfd7dDd7aJX+CO6OxpfhsX/B2lJFUb3+HKIp70eCXALNW86LLr6dnKTfUK8GEs9vyPzVmPLbHUfBp3WcNicgDxL7Z38Iv/sZ/P/QMB3jsaBKu3e2rVASCFh2YB3yLO1z3YielpL8+vJzHHSVxqnlCwHjQ9nZWWdlHdA12U5H7vR3j0BjKQ9ziNeyLtM0hHxigsTE1ujrSBKDvEr/zjpjjgNC46tPjscXtIzRNMi6YExwfNw5dCp16TxCsWxhQ53MSAsH7wUaqwAMEcLIHG0GwB/9AXBq8UBpy79mYj1+3C8wShObWlQ== 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=x49l8NjisgPrt1aF410Q05vlSNoSpX6DhzxWj14iiRg=; b=i0kxw+FzLgS9lRssH4v5P9aOcaBzlYg/ZYtpnWp7oBBsFNiNZk+jbiWTMVGaPZFMraYGqAO+9DwAYc8kOAYrHALt/8SIsswrhhacOOjHXjatjBls8Dxa5IPGfSFSq0jvgXgWeDJsH9HqpSQm5sacbSkhwtBzg/oC8j/7uFUuPqI= 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 BYAPR10MB3381.namprd10.prod.outlook.com (2603:10b6:a03:15b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 16:54:11 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:11 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 16/22] xfs: Set up infastructure for deferred attribute operations Date: Thu, 18 Feb 2021 09:53:42 -0700 Message-Id: <20210218165348.4754-17-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49b4268c-3116-4887-64ae-08d8d42dd024 X-MS-TrafficTypeDiagnostic: BYAPR10MB3381: 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: J5PwqA0YUXyq6l9iUKDP6rMz5RQlYdHiCXcdOPAPpF4bQ8pxvLomPPkK3N5D+zHD3uY/d++4d96fE+y2WLBStFxD6mmkQ2OFhaHryFBfm9UhD/hjdh0tzbQfr86GPIay7DWCF5qd7PybuXoCC1x7IufoCxouXlu35tavuHUEVQEneiTLqhwgEnB1e0v3X9mKz15ljaf18Xl1IBo7U7ggRmtf4Leo80sO7OsyLjbthqLy6+VNRAGOO9P2jALRvMYciarcgfRc7u+BA1gbLXeOlhyGB4/mex7RMIKmYdtCYpZyEKiXSsTGUsgG9+E7YOoNojeMTgbpjOjWejPugKN0quABcc7dDZpxSbzOVayXQGAYQhFNP1Bg96cm6WNzuPnNcM9hjlQyv+6aC6fhUOSKtEN0x6WDFnzCobKu79Fqn/OlVReXhJjQvL4n9mjMh8h18vZg3Qp5iaRjrH0uiqbqpp+wHbSExE+mKV2Ax04N7uW+WHwK85H9VRtXc3MYw+JPjL94sV33WYNSorghrAvSJkySJapdtj2MI2DzoXxUeoeO4X/dNVo2BFvlgsO+pJJVRhc+G/qT7Az9FAOPr0eaBQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(39860400002)(136003)(346002)(396003)(186003)(26005)(1076003)(16526019)(66556008)(8936002)(69590400012)(36756003)(6512007)(66946007)(6916009)(6666004)(30864003)(86362001)(478600001)(52116002)(5660300002)(66476007)(8676002)(2616005)(2906002)(83380400001)(316002)(956004)(6506007)(44832011)(6486002)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BAJ99bK2w/nI0fWvVfs0nQTvWA15HJIcSIWjtK2uVdCqxAWpUKJ0OBSgNbVOvYZA6PFSsnXe8O4K8m7nSV8Tg7GKvW/Whlks4sHpX2cwKhYYllmuqQ9wrCdLluyisDNI4DBWVBOnu/XjNk77yZolNvAeg7TP7e4inUC8lmHpbxbDIsAVsZmLuco9j1aKAv2H1v4O8mj2WPg9Em8ZmcGOmcVIUrWU1qEi6mXjz947rHJyRCCN6P0PkEYsu+iogwDNQaCUQqlAvy3139Fvn0nLciE0ETfUkxRpUP4Qko9qnnfK9bvWoaY/01dmn2KxeLof0WU/KOfsJhEqq1Xz+OdaIzryv13jKVUuEsjhbOI7n26dA7LB3l2KwoaRT/Pmz3n4Xy723ypwcPJaBXsf4JsQMxjSVOYrLVTu++bgzbo7RGHsXsBALNWYsDlR2NxX75xtDDoOn7B5/obtTlZhFGcaE4AKkbdJqVAm+HgObvrjr5S2Ae1paqd4NW1YCICWDYXLfHEnf6aygOIh9HudMnXn4Qy1nH09OlFIOz0NalcOy6yFl0OY5u2qVxFVgUDNqiK717ueBI8d9d4die4bMrWHKc7ajWHGfKzV64F+cLHmcd4v5rltdGuM2BkGrpttcl/h4oOukt8W3d3lwSy5kseeA1+KqaCu6IH8jQKRl4+XCH0534Dlt332itIVCG3GGTI9pr8CI8agBO51GcGGL+qyZMjuFHBTzFu7kgXZMu4x07bOVN90uN5NlRTvyRQyeCitD0h2prnAkMwLwX3rZ9pr42mgKQnYHvPCVnnfOCIyAk2dbCzHlquC2GZ5ov7mcHfHV0BonUHJV3K7S/IyUcbTp8Kk28Va2sVYZP/BvoU+eeTyfyC75d8noWiumXliGKelL4+XgV5W6fCURiVIQ1eKVCAA3zLTMQ//UMrEWcyvt37oho1Up78E/Zi5x+jqPfDhi/EmSgJN1oHBRWTWwiabjSyFa4eb/7W5HJ4gv7McRYs1B/dk9BWqpy/rz2DO+Joa4sDbLFZLUupUFb3tgOUY242HIhDfE2zQmvUHmLKLtfu0elyX69rVMs2w3bU27r0azUqBy4pdFH74Jc1vhFre7Zf+dhtwrBcVB8DBGGdJIrX/267/140FzheaY4HNTp6sqIDQwd334YvdtzKoZySf4mxNRWyFLjwZVNjVYy2J9Ok2gw/+zMlre9jXNB9Sa2/hhuvGcq29TqLtpMPor94hTe9qYbzZ0pH5qfF7bVuvOkrj1dV8HSMGIn7jPkWPwLHd0vdRJRmzVkX34oql9wxmOFdVnemm0ErcZJcmFLcD0qB4l4WrReGNS/RIgXuwhxDF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49b4268c-3116-4887-64ae-08d8d42dd024 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:10.6236 (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: iwSTiszAkU14xy1atUk+ffxpuNrs0SFlO/gmXJKFpnufsbA/avV0AKMZkzuLoCXk6YK7sJkFEYaaKkSJIBrO91Euc5y2qv6J/rDZUctrA3o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3381 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Currently attributes are modified directly across one or more transactions. But they are not logged or replayed in the event of an error. The goal of delayed attributes is to enable logging and replaying of attribute operations using the existing delayed operations infrastructure. This will later enable the attributes to become part of larger multi part operations that also must first be recorded to the log. This is mostly of interest in the scheme of parent pointers which would need to maintain an attribute containing parent inode information any time an inode is moved, created, or removed. Parent pointers would then be of interest to any feature that would need to quickly derive an inode path from the mount point. Online scrub, nfs lookups and fs grow or shrink operations are all features that could take advantage of this. This patch adds two new log item types for setting or removing attributes as deferred operations. The xfs_attri_log_item logs an intent to set or remove an attribute. The corresponding xfs_attrd_log_item holds a reference to the xfs_attri_log_item and is freed once the transaction is done. Both log items use a generic xfs_attr_log_format structure that contains the attribute name, value, flags, inode, and an op_flag that indicates if the operations is a set or remove. Signed-off-by: Allison Henderson --- fs/xfs/Makefile | 1 + fs/xfs/libxfs/xfs_attr.c | 7 +- fs/xfs/libxfs/xfs_attr.h | 31 ++ fs/xfs/libxfs/xfs_defer.c | 1 + fs/xfs/libxfs/xfs_defer.h | 3 + fs/xfs/libxfs/xfs_log_format.h | 44 ++- fs/xfs/libxfs/xfs_log_recover.h | 2 + fs/xfs/scrub/common.c | 2 + fs/xfs/xfs_acl.c | 2 + fs/xfs/xfs_attr_item.c | 828 ++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_attr_item.h | 52 +++ fs/xfs/xfs_attr_list.c | 1 + fs/xfs/xfs_ioctl.c | 2 + fs/xfs/xfs_ioctl32.c | 2 + fs/xfs/xfs_iops.c | 2 + fs/xfs/xfs_log.c | 4 + fs/xfs/xfs_log_recover.c | 2 + fs/xfs/xfs_ondisk.h | 2 + fs/xfs/xfs_xattr.c | 1 + 19 files changed, 984 insertions(+), 5 deletions(-) diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index 04611a1..b056cfc 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile @@ -102,6 +102,7 @@ xfs-y += xfs_log.o \ xfs_buf_item_recover.o \ xfs_dquot_item_recover.o \ xfs_extfree_item.o \ + xfs_attr_item.o \ xfs_icreate_item.o \ xfs_inode_item.o \ xfs_inode_item_recover.o \ diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 2b8e481..e4c1b4b 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -24,6 +24,7 @@ #include "xfs_quota.h" #include "xfs_trans_space.h" #include "xfs_trace.h" +#include "xfs_attr_item.h" /* * xfs_attr.c @@ -61,8 +62,8 @@ STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); STATIC int xfs_attr_refillstate(xfs_da_state_t *state); -STATIC int xfs_attr_set_iter(struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp); +int xfs_attr_set_iter(struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp); int xfs_inode_hasattr( @@ -144,7 +145,7 @@ xfs_attr_get( /* * Calculate how many blocks we need for the new attribute, */ -STATIC int +int xfs_attr_calc_size( struct xfs_da_args *args, int *local) diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 603887e..ee79763 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -28,6 +28,11 @@ struct xfs_attr_list_context; */ #define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */ +static inline bool xfs_hasdelattr(struct xfs_mount *mp) +{ + return false; +} + /* * Kernel-internal version of the attrlist cursor. */ @@ -390,6 +395,7 @@ enum xfs_delattr_state { */ #define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */ #define XFS_DAC_LEAF_ADDNAME_INIT 0x02 /* xfs_attr_leaf_addname init*/ +#define XFS_DAC_DELAYED_OP_INIT 0x04 /* delayed operations init*/ /* * Context used for keeping track of delayed attribute operations @@ -397,6 +403,11 @@ enum xfs_delattr_state { struct xfs_delattr_context { struct xfs_da_args *da_args; + /* + * Used by xfs_attr_set to hold a leaf buffer across a transaction roll + */ + struct xfs_buf *leaf_bp; + /* Used in xfs_attr_rmtval_set_blk to roll through allocating blocks */ struct xfs_bmbt_irec map; xfs_dablk_t lblkno; @@ -410,6 +421,23 @@ struct xfs_delattr_context { enum xfs_delattr_state dela_state; }; +/* + * List of attrs to commit later. + */ +struct xfs_attr_item { + struct xfs_delattr_context xattri_dac; + + /* + * Indicates if the attr operation is a set or a remove + * XFS_ATTR_OP_FLAGS_{SET,REMOVE} + */ + uint32_t xattri_op_flags; + + /* used to log this item to an intent */ + struct list_head xattri_list; +}; + + /*======================================================================== * Function prototypes for the kernel. *========================================================================*/ @@ -425,11 +453,14 @@ int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_set(struct xfs_da_args *args); int xfs_attr_set_args(struct xfs_da_args *args); +int xfs_attr_set_iter(struct xfs_delattr_context *dac, + struct xfs_buf **leaf_bp); int xfs_has_attr(struct xfs_da_args *args); int xfs_attr_remove_args(struct xfs_da_args *args); int xfs_attr_remove_iter(struct xfs_delattr_context *dac); bool xfs_attr_namecheck(const void *name, size_t length); void xfs_delattr_context_init(struct xfs_delattr_context *dac, struct xfs_da_args *args); +int xfs_attr_calc_size(struct xfs_da_args *args, int *local); #endif /* __XFS_ATTR_H__ */ diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index eff4a12..e9caff7 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -178,6 +178,7 @@ static const struct xfs_defer_op_type *defer_op_types[] = { [XFS_DEFER_OPS_TYPE_RMAP] = &xfs_rmap_update_defer_type, [XFS_DEFER_OPS_TYPE_FREE] = &xfs_extent_free_defer_type, [XFS_DEFER_OPS_TYPE_AGFL_FREE] = &xfs_agfl_free_defer_type, + [XFS_DEFER_OPS_TYPE_ATTR] = &xfs_attr_defer_type, }; static void diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h index 05472f7..72a5789 100644 --- a/fs/xfs/libxfs/xfs_defer.h +++ b/fs/xfs/libxfs/xfs_defer.h @@ -19,6 +19,7 @@ enum xfs_defer_ops_type { XFS_DEFER_OPS_TYPE_RMAP, XFS_DEFER_OPS_TYPE_FREE, XFS_DEFER_OPS_TYPE_AGFL_FREE, + XFS_DEFER_OPS_TYPE_ATTR, XFS_DEFER_OPS_TYPE_MAX, }; @@ -63,6 +64,8 @@ extern const struct xfs_defer_op_type xfs_refcount_update_defer_type; extern const struct xfs_defer_op_type xfs_rmap_update_defer_type; extern const struct xfs_defer_op_type xfs_extent_free_defer_type; extern const struct xfs_defer_op_type xfs_agfl_free_defer_type; +extern const struct xfs_defer_op_type xfs_attr_defer_type; + /* * This structure enables a dfops user to detach the chain of deferred diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h index 8bd00da..19963b6 100644 --- a/fs/xfs/libxfs/xfs_log_format.h +++ b/fs/xfs/libxfs/xfs_log_format.h @@ -117,7 +117,12 @@ struct xfs_unmount_log_format { #define XLOG_REG_TYPE_CUD_FORMAT 24 #define XLOG_REG_TYPE_BUI_FORMAT 25 #define XLOG_REG_TYPE_BUD_FORMAT 26 -#define XLOG_REG_TYPE_MAX 26 +#define XLOG_REG_TYPE_ATTRI_FORMAT 27 +#define XLOG_REG_TYPE_ATTRD_FORMAT 28 +#define XLOG_REG_TYPE_ATTR_NAME 29 +#define XLOG_REG_TYPE_ATTR_VALUE 30 +#define XLOG_REG_TYPE_MAX 30 + /* * Flags to log operation header @@ -240,6 +245,8 @@ typedef struct xfs_trans_header { #define XFS_LI_CUD 0x1243 #define XFS_LI_BUI 0x1244 /* bmbt update intent */ #define XFS_LI_BUD 0x1245 +#define XFS_LI_ATTRI 0x1246 /* attr set/remove intent*/ +#define XFS_LI_ATTRD 0x1247 /* attr set/remove done */ #define XFS_LI_TYPE_DESC \ { XFS_LI_EFI, "XFS_LI_EFI" }, \ @@ -255,7 +262,9 @@ typedef struct xfs_trans_header { { XFS_LI_CUI, "XFS_LI_CUI" }, \ { XFS_LI_CUD, "XFS_LI_CUD" }, \ { XFS_LI_BUI, "XFS_LI_BUI" }, \ - { XFS_LI_BUD, "XFS_LI_BUD" } + { XFS_LI_BUD, "XFS_LI_BUD" }, \ + { XFS_LI_ATTRI, "XFS_LI_ATTRI" }, \ + { XFS_LI_ATTRD, "XFS_LI_ATTRD" } /* * Inode Log Item Format definitions. @@ -863,4 +872,35 @@ struct xfs_icreate_log { __be32 icl_gen; /* inode generation number to use */ }; +/* + * Flags for deferred attribute operations. + * Upper bits are flags, lower byte is type code + */ +#define XFS_ATTR_OP_FLAGS_SET 1 /* Set the attribute */ +#define XFS_ATTR_OP_FLAGS_REMOVE 2 /* Remove the attribute */ +#define XFS_ATTR_OP_FLAGS_TYPE_MASK 0x0FF /* Flags type mask */ + +/* + * This is the structure used to lay out an attr log item in the + * log. + */ +struct xfs_attri_log_format { + uint16_t alfi_type; /* attri log item type */ + uint16_t alfi_size; /* size of this item */ + uint32_t __pad; /* pad to 64 bit aligned */ + uint64_t alfi_id; /* attri identifier */ + uint64_t alfi_ino; /* the inode for this attr operation */ + uint32_t alfi_op_flags; /* marks the op as a set or remove */ + uint32_t alfi_name_len; /* attr name length */ + uint32_t alfi_value_len; /* attr value length */ + uint32_t alfi_attr_flags;/* attr flags */ +}; + +struct xfs_attrd_log_format { + uint16_t alfd_type; /* attrd log item type */ + uint16_t alfd_size; /* size of this item */ + uint32_t __pad; /* pad to 64 bit aligned */ + uint64_t alfd_alf_id; /* id of corresponding attri */ +}; + #endif /* __XFS_LOG_FORMAT_H__ */ diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h index 3cca2bf..b6e5514 100644 --- a/fs/xfs/libxfs/xfs_log_recover.h +++ b/fs/xfs/libxfs/xfs_log_recover.h @@ -72,6 +72,8 @@ extern const struct xlog_recover_item_ops xlog_rui_item_ops; extern const struct xlog_recover_item_ops xlog_rud_item_ops; extern const struct xlog_recover_item_ops xlog_cui_item_ops; extern const struct xlog_recover_item_ops xlog_cud_item_ops; +extern const struct xlog_recover_item_ops xlog_attri_item_ops; +extern const struct xlog_recover_item_ops xlog_attrd_item_ops; /* * Macros, structures, prototypes for internal log manager use. diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c index 53456f3..ac35121 100644 --- a/fs/xfs/scrub/common.c +++ b/fs/xfs/scrub/common.c @@ -24,6 +24,8 @@ #include "xfs_rmap_btree.h" #include "xfs_log.h" #include "xfs_trans_priv.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_reflink.h" #include "scrub/scrub.h" diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c index 779cb73..79f7bd2 100644 --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c @@ -10,6 +10,8 @@ #include "xfs_trans_resv.h" #include "xfs_mount.h" #include "xfs_inode.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_trace.h" #include "xfs_error.h" diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c new file mode 100644 index 0000000..8c8f72d --- /dev/null +++ b/fs/xfs/xfs_attr_item.c @@ -0,0 +1,828 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2021 Oracle. All Rights Reserved. + * Author: Allison Collins + */ + +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_format.h" +#include "xfs_log_format.h" +#include "xfs_trans_resv.h" +#include "xfs_bit.h" +#include "xfs_shared.h" +#include "xfs_mount.h" +#include "xfs_defer.h" +#include "xfs_da_format.h" +#include "xfs_log_format.h" +#include "xfs_trans.h" +#include "xfs_bmap.h" +#include "xfs_bmap_btree.h" +#include "xfs_trans_priv.h" +#include "xfs_buf_item.h" +#include "xfs_attr_item.h" +#include "xfs_log.h" +#include "xfs_btree.h" +#include "xfs_rmap.h" +#include "xfs_inode.h" +#include "xfs_icache.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" +#include "xfs_attr.h" +#include "xfs_shared.h" +#include "xfs_attr_item.h" +#include "xfs_alloc.h" +#include "xfs_bmap.h" +#include "xfs_trace.h" +#include "libxfs/xfs_da_format.h" +#include "xfs_inode.h" +#include "xfs_quota.h" +#include "xfs_trans_space.h" +#include "xfs_log_priv.h" +#include "xfs_log_recover.h" + +static const struct xfs_item_ops xfs_attri_item_ops; +static const struct xfs_item_ops xfs_attrd_item_ops; + +/* iovec length must be 32-bit aligned */ +static inline size_t ATTR_NVEC_SIZE(size_t size) +{ + return size == sizeof(int32_t) ? size : + sizeof(int32_t) + round_up(size, sizeof(int32_t)); +} + +static inline struct xfs_attri_log_item *ATTRI_ITEM(struct xfs_log_item *lip) +{ + return container_of(lip, struct xfs_attri_log_item, attri_item); +} + +STATIC void +xfs_attri_item_free( + struct xfs_attri_log_item *attrip) +{ + kmem_free(attrip->attri_item.li_lv_shadow); + kmem_free(attrip); +} + +/* + * Freeing the attrip requires that we remove it from the AIL if it has already + * been placed there. However, the ATTRI may not yet have been placed in the + * AIL when called by xfs_attri_release() from ATTRD processing due to the + * ordering of committed vs unpin operations in bulk insert operations. Hence + * the reference count to ensure only the last caller frees the ATTRI. + */ +STATIC void +xfs_attri_release( + struct xfs_attri_log_item *attrip) +{ + ASSERT(atomic_read(&attrip->attri_refcount) > 0); + if (atomic_dec_and_test(&attrip->attri_refcount)) { + xfs_trans_ail_delete(&attrip->attri_item, + SHUTDOWN_LOG_IO_ERROR); + xfs_attri_item_free(attrip); + } +} + +STATIC void +xfs_attri_item_size( + struct xfs_log_item *lip, + int *nvecs, + int *nbytes) +{ + struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); + + *nvecs += 1; + *nbytes += sizeof(struct xfs_attri_log_format); + + /* Attr set and remove operations require a name */ + ASSERT(attrip->attri_name_len > 0); + + *nvecs += 1; + *nbytes += ATTR_NVEC_SIZE(attrip->attri_name_len); + + /* + * Set ops can accept a value of 0 len to clear an attr value. Remove + * ops do not need a value at all. So only account for the value + * when it is needed. + */ + if (attrip->attri_value_len > 0) { + *nvecs += 1; + *nbytes += ATTR_NVEC_SIZE(attrip->attri_value_len); + } +} + +/* + * This is called to fill in the log iovecs for the given attri log + * item. We use 1 iovec for the attri_format_item, 1 for the name, and + * another for the value if it is present + */ +STATIC void +xfs_attri_item_format( + struct xfs_log_item *lip, + struct xfs_log_vec *lv) +{ + struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); + struct xfs_log_iovec *vecp = NULL; + + attrip->attri_format.alfi_type = XFS_LI_ATTRI; + attrip->attri_format.alfi_size = 1; + + /* + * This size accounting must be done before copying the attrip into the + * iovec. If we do it after, the wrong size will be recorded to the log + * and we trip across assertion checks for bad region sizes later during + * the log recovery. + */ + + ASSERT(attrip->attri_name_len > 0); + attrip->attri_format.alfi_size++; + + if (attrip->attri_value_len > 0) + attrip->attri_format.alfi_size++; + + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRI_FORMAT, + &attrip->attri_format, + sizeof(struct xfs_attri_log_format)); + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_NAME, + attrip->attri_name, + ATTR_NVEC_SIZE(attrip->attri_name_len)); + if (attrip->attri_value_len > 0) + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTR_VALUE, + attrip->attri_value, + ATTR_NVEC_SIZE(attrip->attri_value_len)); +} + +/* + * The unpin operation is the last place an ATTRI is manipulated in the log. It + * is either inserted in the AIL or aborted in the event of a log I/O error. In + * either case, the ATTRI transaction has been successfully committed to make + * it this far. Therefore, we expect whoever committed the ATTRI to either + * construct and commit the ATTRD or drop the ATTRD's reference in the event of + * error. Simply drop the log's ATTRI reference now that the log is done with + * it. + */ +STATIC void +xfs_attri_item_unpin( + struct xfs_log_item *lip, + int remove) +{ + xfs_attri_release(ATTRI_ITEM(lip)); +} + + +STATIC void +xfs_attri_item_release( + struct xfs_log_item *lip) +{ + xfs_attri_release(ATTRI_ITEM(lip)); +} + +/* + * Allocate and initialize an attri item. Caller may allocate an additional + * trailing buffer of the specified size + */ +STATIC struct xfs_attri_log_item * +xfs_attri_init( + struct xfs_mount *mp, + int buffer_size) + +{ + struct xfs_attri_log_item *attrip; + uint size; + + size = sizeof(struct xfs_attri_log_item) + buffer_size; + attrip = kmem_alloc_large(size, KM_ZERO); + if (attrip == NULL) + return NULL; + + xfs_log_item_init(mp, &attrip->attri_item, XFS_LI_ATTRI, + &xfs_attri_item_ops); + attrip->attri_format.alfi_id = (uintptr_t)(void *)attrip; + atomic_set(&attrip->attri_refcount, 2); + + return attrip; +} + +/* + * Copy an attr format buffer from the given buf, and into the destination attr + * format structure. + */ +STATIC int +xfs_attri_copy_format( + struct xfs_log_iovec *buf, + struct xfs_attri_log_format *dst_attr_fmt) +{ + struct xfs_attri_log_format *src_attr_fmt = buf->i_addr; + uint len; + + len = sizeof(struct xfs_attri_log_format); + if (buf->i_len != len) + return -EFSCORRUPTED; + + memcpy((char *)dst_attr_fmt, (char *)src_attr_fmt, len); + return 0; +} + +static inline struct xfs_attrd_log_item *ATTRD_ITEM(struct xfs_log_item *lip) +{ + return container_of(lip, struct xfs_attrd_log_item, attrd_item); +} + +STATIC void +xfs_attrd_item_free(struct xfs_attrd_log_item *attrdp) +{ + kmem_free(attrdp->attrd_item.li_lv_shadow); + kmem_free(attrdp); +} + +STATIC void +xfs_attrd_item_size( + struct xfs_log_item *lip, + int *nvecs, + int *nbytes) +{ + *nvecs += 1; + *nbytes += sizeof(struct xfs_attrd_log_format); +} + +/* + * This is called to fill in the log iovecs for the given attrd log item. We use + * only 1 iovec for the attrd_format, and we point that at the attr_log_format + * structure embedded in the attrd item. + */ +STATIC void +xfs_attrd_item_format( + struct xfs_log_item *lip, + struct xfs_log_vec *lv) +{ + struct xfs_attrd_log_item *attrdp = ATTRD_ITEM(lip); + struct xfs_log_iovec *vecp = NULL; + + attrdp->attrd_format.alfd_type = XFS_LI_ATTRD; + attrdp->attrd_format.alfd_size = 1; + + xlog_copy_iovec(lv, &vecp, XLOG_REG_TYPE_ATTRD_FORMAT, + &attrdp->attrd_format, + sizeof(struct xfs_attrd_log_format)); +} + +/* + * The ATTRD is either committed or aborted if the transaction is cancelled. If + * the transaction is cancelled, drop our reference to the ATTRI and free the + * ATTRD. + */ +STATIC void +xfs_attrd_item_release( + struct xfs_log_item *lip) +{ + struct xfs_attrd_log_item *attrdp = ATTRD_ITEM(lip); + + xfs_attri_release(attrdp->attrd_attrip); + xfs_attrd_item_free(attrdp); +} + +/* + * Performs one step of an attribute update intent and marks the attrd item + * dirty.. An attr operation may be a set or a remove. Note that the + * transaction is marked dirty regardless of whether the operation succeeds or + * fails to support the ATTRI/ATTRD lifecycle rules. + */ +int +xfs_trans_attr( + struct xfs_delattr_context *dac, + struct xfs_attrd_log_item *attrdp, + struct xfs_buf **leaf_bp, + uint32_t op_flags) +{ + struct xfs_da_args *args = dac->da_args; + int error; + + error = xfs_qm_dqattach_locked(args->dp, 0); + if (error) + return error; + + switch (op_flags) { + case XFS_ATTR_OP_FLAGS_SET: + args->op_flags |= XFS_DA_OP_ADDNAME; + error = xfs_attr_set_iter(dac, leaf_bp); + break; + case XFS_ATTR_OP_FLAGS_REMOVE: + ASSERT(XFS_IFORK_Q(args->dp)); + error = xfs_attr_remove_iter(dac); + break; + default: + error = -EFSCORRUPTED; + break; + } + + /* + * Mark the transaction dirty, even on error. This ensures the + * transaction is aborted, which: + * + * 1.) releases the ATTRI and frees the ATTRD + * 2.) shuts down the filesystem + */ + args->trans->t_flags |= XFS_TRANS_DIRTY; + + /* + * attr intent/done items are null when delayed attributes are disabled + */ + if (attrdp) + set_bit(XFS_LI_DIRTY, &attrdp->attrd_item.li_flags); + + return error; +} + +/* Log an attr to the intent item. */ +STATIC void +xfs_attr_log_item( + struct xfs_trans *tp, + struct xfs_attri_log_item *attrip, + struct xfs_attr_item *attr) +{ + struct xfs_attri_log_format *attrp; + + tp->t_flags |= XFS_TRANS_DIRTY; + set_bit(XFS_LI_DIRTY, &attrip->attri_item.li_flags); + + /* + * At this point the xfs_attr_item has been constructed, and we've + * created the log intent. Fill in the attri log item and log format + * structure with fields from this xfs_attr_item + */ + attrp = &attrip->attri_format; + attrp->alfi_ino = attr->xattri_dac.da_args->dp->i_ino; + attrp->alfi_op_flags = attr->xattri_op_flags; + attrp->alfi_value_len = attr->xattri_dac.da_args->valuelen; + attrp->alfi_name_len = attr->xattri_dac.da_args->namelen; + attrp->alfi_attr_flags = attr->xattri_dac.da_args->attr_filter; + + attrip->attri_name = (void *)attr->xattri_dac.da_args->name; + attrip->attri_value = attr->xattri_dac.da_args->value; + attrip->attri_name_len = attr->xattri_dac.da_args->namelen; + attrip->attri_value_len = attr->xattri_dac.da_args->valuelen; +} + +/* Get an ATTRI. */ +static struct xfs_log_item * +xfs_attr_create_intent( + struct xfs_trans *tp, + struct list_head *items, + unsigned int count, + bool sort) +{ + struct xfs_mount *mp = tp->t_mountp; + struct xfs_attri_log_item *attrip; + struct xfs_attr_item *attr; + + ASSERT(count == 1); + + if (!xfs_hasdelattr(mp)) + return NULL; + + attrip = xfs_attri_init(mp, 0); + if (attrip == NULL) + return NULL; + + xfs_trans_add_item(tp, &attrip->attri_item); + list_for_each_entry(attr, items, xattri_list) + xfs_attr_log_item(tp, attrip, attr); + return &attrip->attri_item; +} + +/* Process an attr. */ +STATIC int +xfs_attr_finish_item( + struct xfs_trans *tp, + struct xfs_log_item *done, + struct list_head *item, + struct xfs_btree_cur **state) +{ + struct xfs_attr_item *attr; + struct xfs_attrd_log_item *done_item = NULL; + int error; + struct xfs_delattr_context *dac; + + attr = container_of(item, struct xfs_attr_item, xattri_list); + dac = &attr->xattri_dac; + if (done) + done_item = ATTRD_ITEM(done); + + /* + * Corner case that can happen during a recovery. Because the first + * iteration of a multi part delay op happens in xfs_attri_item_recover + * to maintain the order of the log replay items. But the new + * transactions do not automatically rejoin during a recovery as they do + * in a standard delay op, so we need to catch this here and rejoin the + * leaf to the new transaction + */ + if (attr->xattri_dac.leaf_bp && + attr->xattri_dac.leaf_bp->b_transp != tp) { + xfs_trans_bjoin(tp, attr->xattri_dac.leaf_bp); + xfs_trans_bhold(tp, attr->xattri_dac.leaf_bp); + } + + /* + * Always reset trans after EAGAIN cycle + * since the transaction is new + */ + dac->da_args->trans = tp; + + error = xfs_trans_attr(dac, done_item, &dac->leaf_bp, + attr->xattri_op_flags); + if (error != -EAGAIN) + kmem_free(attr); + + return error; +} + +/* Abort all pending ATTRs. */ +STATIC void +xfs_attr_abort_intent( + struct xfs_log_item *intent) +{ + xfs_attri_release(ATTRI_ITEM(intent)); +} + +/* Cancel an attr */ +STATIC void +xfs_attr_cancel_item( + struct list_head *item) +{ + struct xfs_attr_item *attr; + + attr = container_of(item, struct xfs_attr_item, xattri_list); + kmem_free(attr); +} + +STATIC xfs_lsn_t +xfs_attri_item_committed( + struct xfs_log_item *lip, + xfs_lsn_t lsn) +{ + struct xfs_attri_log_item *attrip; + /* + * The attrip refers to xfs_attr_item memory to log the name and value + * with the intent item. This already occurred when the intent was + * committed so these fields are no longer accessed. Clear them out of + * caution since we're about to free the xfs_attr_item. + */ + attrip = ATTRI_ITEM(lip); + attrip->attri_name = NULL; + attrip->attri_value = NULL; + + /* + * The ATTRI is logged only once and cannot be moved in the log, so + * simply return the lsn at which it's been logged. + */ + return lsn; +} + +STATIC bool +xfs_attri_item_match( + struct xfs_log_item *lip, + uint64_t intent_id) +{ + return ATTRI_ITEM(lip)->attri_format.alfi_id == intent_id; +} + +/* + * This routine is called to allocate an "attr free done" log item. + */ +struct xfs_attrd_log_item * +xfs_trans_get_attrd(struct xfs_trans *tp, + struct xfs_attri_log_item *attrip) +{ + struct xfs_attrd_log_item *attrdp; + uint size; + + ASSERT(tp != NULL); + + size = sizeof(struct xfs_attrd_log_item); + attrdp = kmem_zalloc(size, 0); + + xfs_log_item_init(tp->t_mountp, &attrdp->attrd_item, XFS_LI_ATTRD, + &xfs_attrd_item_ops); + attrdp->attrd_attrip = attrip; + attrdp->attrd_format.alfd_alf_id = attrip->attri_format.alfi_id; + + xfs_trans_add_item(tp, &attrdp->attrd_item); + return attrdp; +} + +static const struct xfs_item_ops xfs_attrd_item_ops = { + .flags = XFS_ITEM_RELEASE_WHEN_COMMITTED, + .iop_size = xfs_attrd_item_size, + .iop_format = xfs_attrd_item_format, + .iop_release = xfs_attrd_item_release, +}; + + +/* Get an ATTRD so we can process all the attrs. */ +static struct xfs_log_item * +xfs_attr_create_done( + struct xfs_trans *tp, + struct xfs_log_item *intent, + unsigned int count) +{ + if (!intent) + return NULL; + + return &xfs_trans_get_attrd(tp, ATTRI_ITEM(intent))->attrd_item; +} + +const struct xfs_defer_op_type xfs_attr_defer_type = { + .max_items = 1, + .create_intent = xfs_attr_create_intent, + .abort_intent = xfs_attr_abort_intent, + .create_done = xfs_attr_create_done, + .finish_item = xfs_attr_finish_item, + .cancel_item = xfs_attr_cancel_item, +}; + +/* + * Process an attr intent item that was recovered from the log. We need to + * delete the attr that it describes. + */ +STATIC int +xfs_attri_item_recover( + struct xfs_log_item *lip, + struct list_head *capture_list) +{ + struct xfs_attri_log_item *attrip = ATTRI_ITEM(lip); + struct xfs_attr_item *new_attr; + struct xfs_mount *mp = lip->li_mountp; + struct xfs_inode *ip; + struct xfs_da_args args; + struct xfs_da_args *new_args; + struct xfs_trans_res tres; + bool rsvd; + struct xfs_attri_log_format *attrp; + int error; + int total; + int local; + struct xfs_attrd_log_item *done_item = NULL; + struct xfs_attr_item attr = { + .xattri_op_flags = attrip->attri_format.alfi_op_flags, + .xattri_dac.da_args = &args, + }; + + /* + * First check the validity of the attr described by the ATTRI. If any + * are bad, then assume that all are bad and just toss the ATTRI. + */ + attrp = &attrip->attri_format; + if (!(attrp->alfi_op_flags == XFS_ATTR_OP_FLAGS_SET || + attrp->alfi_op_flags == XFS_ATTR_OP_FLAGS_REMOVE) || + (attrp->alfi_value_len > XATTR_SIZE_MAX) || + (attrp->alfi_name_len > XATTR_NAME_MAX) || + (attrp->alfi_name_len == 0) || + xfs_verify_ino(mp, attrp->alfi_ino) == false || + !xfs_hasdelattr(mp)) { + return -EFSCORRUPTED; + } + + error = xfs_iget(mp, 0, attrp->alfi_ino, 0, 0, &ip); + if (error) + return error; + + if (VFS_I(ip)->i_nlink == 0) + xfs_iflags_set(ip, XFS_IRECOVERY); + + memset(&args, 0, sizeof(struct xfs_da_args)); + args.dp = ip; + args.geo = mp->m_attr_geo; + args.op_flags = attrp->alfi_op_flags; + args.whichfork = XFS_ATTR_FORK; + args.name = attrip->attri_name; + args.namelen = attrp->alfi_name_len; + args.hashval = xfs_da_hashname(args.name, args.namelen); + args.attr_filter = attrp->alfi_attr_flags; + + if (attrp->alfi_op_flags == XFS_ATTR_OP_FLAGS_SET) { + args.value = attrip->attri_value; + args.valuelen = attrp->alfi_value_len; + args.total = xfs_attr_calc_size(&args, &local); + + tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres + + M_RES(mp)->tr_attrsetrt.tr_logres * + args.total; + tres.tr_logcount = XFS_ATTRSET_LOG_COUNT; + tres.tr_logflags = XFS_TRANS_PERM_LOG_RES; + total = args.total; + } else { + tres = M_RES(mp)->tr_attrrm; + total = XFS_ATTRRM_SPACE_RES(mp); + } + error = xfs_trans_alloc(mp, &tres, total, 0, + rsvd ? XFS_TRANS_RESERVE : 0, &args.trans); + if (error) + return error; + + done_item = xfs_trans_get_attrd(args.trans, attrip); + + xfs_ilock(ip, XFS_ILOCK_EXCL); + xfs_trans_ijoin(args.trans, ip, 0); + + error = xfs_trans_attr(&attr.xattri_dac, done_item, + &attr.xattri_dac.leaf_bp, attrp->alfi_op_flags); + if (error == -EAGAIN) { + /* + * There's more work to do, so make a new xfs_attr_item and add + * it to this transaction. We dont use xfs_attr_item_init here + * because we need the info stored in the current attr to + * continue with this multi-part operation. So, alloc space + * for it and the args and copy everything there. + */ + new_attr = kmem_zalloc(sizeof(struct xfs_attr_item) + + sizeof(struct xfs_da_args), KM_NOFS); + new_args = (struct xfs_da_args *)((char *)new_attr + + sizeof(struct xfs_attr_item)); + + memcpy(new_args, &args, sizeof(struct xfs_da_args)); + memcpy(new_attr, &attr, sizeof(struct xfs_attr_item)); + + new_attr->xattri_dac.da_args = new_args; + memset(&new_attr->xattri_list, 0, sizeof(struct list_head)); + + xfs_defer_add(args.trans, XFS_DEFER_OPS_TYPE_ATTR, + &new_attr->xattri_list); + + /* Do not send -EAGAIN back to caller */ + error = 0; + } else if (error) { + xfs_trans_cancel(args.trans); + goto out; + } + + xfs_defer_ops_capture_and_commit(args.trans, ip, capture_list); + +out: + xfs_iunlock(ip, XFS_ILOCK_EXCL); + xfs_irele(ip); + return error; +} + +/* Relog an intent item to push the log tail forward. */ +static struct xfs_log_item * +xfs_attri_item_relog( + struct xfs_log_item *intent, + struct xfs_trans *tp) +{ + struct xfs_attrd_log_item *attrdp; + struct xfs_attri_log_item *old_attrip; + struct xfs_attri_log_item *new_attrip; + struct xfs_attri_log_format *new_attrp; + struct xfs_attri_log_format *old_attrp; + int buffer_size; + + old_attrip = ATTRI_ITEM(intent); + old_attrp = &old_attrip->attri_format; + buffer_size = old_attrp->alfi_value_len + old_attrp->alfi_name_len; + + tp->t_flags |= XFS_TRANS_DIRTY; + attrdp = xfs_trans_get_attrd(tp, old_attrip); + set_bit(XFS_LI_DIRTY, &attrdp->attrd_item.li_flags); + + new_attrip = xfs_attri_init(tp->t_mountp, buffer_size); + new_attrp = &new_attrip->attri_format; + + new_attrp->alfi_ino = old_attrp->alfi_ino; + new_attrp->alfi_op_flags = old_attrp->alfi_op_flags; + new_attrp->alfi_value_len = old_attrp->alfi_value_len; + new_attrp->alfi_name_len = old_attrp->alfi_name_len; + new_attrp->alfi_attr_flags = old_attrp->alfi_attr_flags; + + new_attrip->attri_name_len = old_attrip->attri_name_len; + new_attrip->attri_name = ((char *)new_attrip) + + sizeof(struct xfs_attri_log_item); + memcpy(new_attrip->attri_name, old_attrip->attri_name, + new_attrip->attri_name_len); + + new_attrip->attri_value_len = old_attrip->attri_value_len; + if (new_attrip->attri_value_len > 0) { + new_attrip->attri_value = new_attrip->attri_name + + new_attrip->attri_name_len; + + memcpy(new_attrip->attri_value, old_attrip->attri_value, + new_attrip->attri_value_len); + } + + xfs_trans_add_item(tp, &new_attrip->attri_item); + set_bit(XFS_LI_DIRTY, &new_attrip->attri_item.li_flags); + + return &new_attrip->attri_item; +} + +static const struct xfs_item_ops xfs_attri_item_ops = { + .iop_size = xfs_attri_item_size, + .iop_format = xfs_attri_item_format, + .iop_unpin = xfs_attri_item_unpin, + .iop_committed = xfs_attri_item_committed, + .iop_release = xfs_attri_item_release, + .iop_recover = xfs_attri_item_recover, + .iop_match = xfs_attri_item_match, + .iop_relog = xfs_attri_item_relog, +}; + + + +STATIC int +xlog_recover_attri_commit_pass2( + struct xlog *log, + struct list_head *buffer_list, + struct xlog_recover_item *item, + xfs_lsn_t lsn) +{ + int error; + struct xfs_mount *mp = log->l_mp; + struct xfs_attri_log_item *attrip; + struct xfs_attri_log_format *attri_formatp; + char *name = NULL; + char *value = NULL; + int region = 0; + int buffer_size; + + attri_formatp = item->ri_buf[region].i_addr; + + /* Validate xfs_attri_log_format */ + if (attri_formatp->__pad != 0 || attri_formatp->alfi_name_len == 0 || + (attri_formatp->alfi_op_flags == XFS_ATTR_OP_FLAGS_REMOVE && + attri_formatp->alfi_value_len != 0)) + return -EFSCORRUPTED; + + buffer_size = attri_formatp->alfi_name_len + + attri_formatp->alfi_value_len; + + attrip = xfs_attri_init(mp, buffer_size); + if (attrip == NULL) + return -ENOMEM; + + error = xfs_attri_copy_format(&item->ri_buf[region], + &attrip->attri_format); + if (error) { + xfs_attri_item_free(attrip); + return error; + } + + attrip->attri_name_len = attri_formatp->alfi_name_len; + attrip->attri_value_len = attri_formatp->alfi_value_len; + region++; + name = ((char *)attrip) + sizeof(struct xfs_attri_log_item); + memcpy(name, item->ri_buf[region].i_addr, attrip->attri_name_len); + attrip->attri_name = name; + + if (attrip->attri_value_len > 0) { + region++; + value = ((char *)attrip) + sizeof(struct xfs_attri_log_item) + + attrip->attri_name_len; + memcpy(value, item->ri_buf[region].i_addr, + attrip->attri_value_len); + attrip->attri_value = value; + } + + /* + * The ATTRI has two references. One for the ATTRD and one for ATTRI to + * ensure it makes it into the AIL. Insert the ATTRI into the AIL + * directly and drop the ATTRI reference. Note that + * xfs_trans_ail_update() drops the AIL lock. + */ + xfs_trans_ail_insert(log->l_ailp, &attrip->attri_item, lsn); + xfs_attri_release(attrip); + return 0; +} + +const struct xlog_recover_item_ops xlog_attri_item_ops = { + .item_type = XFS_LI_ATTRI, + .commit_pass2 = xlog_recover_attri_commit_pass2, +}; + +/* + * This routine is called when an ATTRD format structure is found in a committed + * transaction in the log. Its purpose is to cancel the corresponding ATTRI if + * it was still in the log. To do this it searches the AIL for the ATTRI with + * an id equal to that in the ATTRD format structure. If we find it we drop + * the ATTRD reference, which removes the ATTRI from the AIL and frees it. + */ +STATIC int +xlog_recover_attrd_commit_pass2( + struct xlog *log, + struct list_head *buffer_list, + struct xlog_recover_item *item, + xfs_lsn_t lsn) +{ + struct xfs_attrd_log_format *attrd_formatp; + + attrd_formatp = item->ri_buf[0].i_addr; + ASSERT((item->ri_buf[0].i_len == + (sizeof(struct xfs_attrd_log_format)))); + + xlog_recover_release_intent(log, XFS_LI_ATTRI, + attrd_formatp->alfd_alf_id); + return 0; +} + +const struct xlog_recover_item_ops xlog_attrd_item_ops = { + .item_type = XFS_LI_ATTRD, + .commit_pass2 = xlog_recover_attrd_commit_pass2, +}; diff --git a/fs/xfs/xfs_attr_item.h b/fs/xfs/xfs_attr_item.h new file mode 100644 index 0000000..27c6bae --- /dev/null +++ b/fs/xfs/xfs_attr_item.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * + * Copyright (C) 2019 Oracle. All Rights Reserved. + * Author: Allison Collins + */ +#ifndef __XFS_ATTR_ITEM_H__ +#define __XFS_ATTR_ITEM_H__ + +/* kernel only ATTRI/ATTRD definitions */ + +struct xfs_mount; +struct kmem_zone; + +/* + * Define ATTR flag bits. Manipulated by set/clear/test_bit operators. + */ +#define XFS_ATTRI_RECOVERED 1 + + +/* + * This is the "attr intention" log item. It is used to log the fact that some + * attribute operations need to be processed. An operation is currently either + * a set or remove. Set or remove operations are described by the xfs_attr_item + * which may be logged to this intent. + * + * During a normal attr operation, name and value point to the name and value + * feilds of the calling functions xfs_da_args. During a recovery, the name + * and value buffers are copied from the log, and stored in a trailing buffer + * attached to the xfs_attr_item until they are committed. They are freed when + * the xfs_attr_item itself is freed when the work is done. + */ +struct xfs_attri_log_item { + struct xfs_log_item attri_item; + atomic_t attri_refcount; + int attri_name_len; + int attri_value_len; + void *attri_name; + void *attri_value; + struct xfs_attri_log_format attri_format; +}; + +/* + * This is the "attr done" log item. It is used to log the fact that some attrs + * earlier mentioned in an attri item have been freed. + */ +struct xfs_attrd_log_item { + struct xfs_attri_log_item *attrd_attrip; + struct xfs_log_item attrd_item; + struct xfs_attrd_log_format attrd_format; +}; + +#endif /* __XFS_ATTR_ITEM_H__ */ diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c index 8f8837f..d7787a5 100644 --- a/fs/xfs/xfs_attr_list.c +++ b/fs/xfs/xfs_attr_list.c @@ -15,6 +15,7 @@ #include "xfs_inode.h" #include "xfs_trans.h" #include "xfs_bmap.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_attr_sf.h" #include "xfs_attr_leaf.h" diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 248083e..6682936 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -15,6 +15,8 @@ #include "xfs_iwalk.h" #include "xfs_itable.h" #include "xfs_error.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_bmap.h" #include "xfs_bmap_util.h" diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index c1771e7..62e1534 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c @@ -17,6 +17,8 @@ #include "xfs_itable.h" #include "xfs_fsops.h" #include "xfs_rtalloc.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_ioctl.h" #include "xfs_ioctl32.h" diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 00369502f..ce04721 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -13,6 +13,8 @@ #include "xfs_inode.h" #include "xfs_acl.h" #include "xfs_quota.h" +#include "xfs_da_format.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_trans.h" #include "xfs_trace.h" diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 0604183..290e57b 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -2070,6 +2070,10 @@ xlog_print_tic_res( REG_TYPE_STR(CUD_FORMAT, "cud_format"), REG_TYPE_STR(BUI_FORMAT, "bui_format"), REG_TYPE_STR(BUD_FORMAT, "bud_format"), + REG_TYPE_STR(ATTRI_FORMAT, "attri_format"), + REG_TYPE_STR(ATTRD_FORMAT, "attrd_format"), + REG_TYPE_STR(ATTR_NAME, "attr_name"), + REG_TYPE_STR(ATTR_VALUE, "attr_value"), }; BUILD_BUG_ON(ARRAY_SIZE(res_type_str) != XLOG_REG_TYPE_MAX + 1); #undef REG_TYPE_STR diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 295a5c6..c0821b6 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -1775,6 +1775,8 @@ static const struct xlog_recover_item_ops *xlog_recover_item_ops[] = { &xlog_cud_item_ops, &xlog_bui_item_ops, &xlog_bud_item_ops, + &xlog_attri_item_ops, + &xlog_attrd_item_ops, }; static const struct xlog_recover_item_ops * diff --git a/fs/xfs/xfs_ondisk.h b/fs/xfs/xfs_ondisk.h index 0aa87c21..bc9c25e 100644 --- a/fs/xfs/xfs_ondisk.h +++ b/fs/xfs/xfs_ondisk.h @@ -132,6 +132,8 @@ xfs_check_ondisk_structs(void) XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format, 56); XFS_CHECK_STRUCT_SIZE(struct xfs_qoff_logformat, 20); XFS_CHECK_STRUCT_SIZE(struct xfs_trans_header, 16); + XFS_CHECK_STRUCT_SIZE(struct xfs_attri_log_format, 40); + XFS_CHECK_STRUCT_SIZE(struct xfs_attrd_log_format, 16); /* * The v5 superblock format extended several v4 header structures with diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c index bca48b3..9b0c790 100644 --- a/fs/xfs/xfs_xattr.c +++ b/fs/xfs/xfs_xattr.c @@ -10,6 +10,7 @@ #include "xfs_log_format.h" #include "xfs_da_format.h" #include "xfs_inode.h" +#include "xfs_da_btree.h" #include "xfs_attr.h" #include "xfs_acl.h" #include "xfs_da_btree.h" From patchwork Thu Feb 18 16:53:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093975 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 144B0C4332E for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D623064ED7 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233135AbhBRSsP (ORCPT ); Thu, 18 Feb 2021 13:48:15 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53528 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234042AbhBRQzV (ORCPT ); Thu, 18 Feb 2021 11:55:21 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGsCvt016465 for ; Thu, 18 Feb 2021 16:54:14 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=0HL3fM2BkIp4sskfMBKSs4aUSA3rU1fVRiphof0SDrU=; b=qJvAjceZbdMp6QmQeSmJLSRHJaSJOaVPyzfg1LFLoO7BlH+SKtH3PDukM7orUxzuh5aj 57HQirO2lvZEme32LBOEsBdJGH5YLoqefMo8zLABwlwt5yimg6KviSofeJ8hBuq5lsiJ hJYbUEn5AYnTZwugunEX8Ta1NKoR6Vm0Pda7au/UsAub0tO4SytW75r41LqmQKhYnmcZ UR0jFUAxSGwKx1s/1KeamgtF6PVjsxWjKNrbp7WQQFye3LdoKUQaa4i3jpkAJK9mLW0h 8YsOsseDeGn3Ff0ylSNSdVhq3jP0sREbbUv3/ukRTJd3S1PcE4gwN3v+yaGTgk9VMR8J Xw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 36p7dnpj6k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:13 +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 11IGngH1162448 for ; Thu, 18 Feb 2021 16:54:13 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by userp3020.oracle.com with ESMTP id 36prhufdpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fHbk9Z03J3GRXXEQ39DfSG6OK/H2ISP61hKGGIv2ByRMS4ZHJ3ONE3aysBEaa8dcQCpq/KuDsfcHdaxhGlTSC3mXLMgAVcqc+lqueax0qslkp3CTy1j7RbAPu08sZ5bNE3Ms1u0AAqc0ct+QOxcYDkBa9Pf4sPZ1qL9a6ceXpqRsCwcO/3ovnSLiOA+C4YG3/ryS+LSkEZnaNc1VMW4tWURlbi1tbZILptfpuz886dgwFB/UluZSVuSY0B+Utl/YdcURWmhKhYIPz7ywwxowCAfo4JBRpuH4pC6I616dGQoSWrQH934aYbhYAJu/0z3u1X9EWAiIicNw5vy3x+oa9g== 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=0HL3fM2BkIp4sskfMBKSs4aUSA3rU1fVRiphof0SDrU=; b=I8kF30pv/qgoyr5bFD5e0qogel+6jhPl/UxAJwAGrDO6aolC/mZK+bpp4PfNGCN+9v5GQxwWg0XQZhqUEp1hC/boTV1PGU9Hml0A4quF2DpXBpDaPYJfp8SNLThlhYGkCKHubJzYH7B/YP2z7TgGNyzTJxSqfOxkk2KMoAORh6hyRKM1lKc7FnIZy8u9230xQvSJz7D8B/fkmNJD2UAVKgVlnfjQwe5jsYsSqe8/ssVl7WUsX8WQG/6EowQvPRahyPWV5Sk7JvpGsJv8ngO3skeASk2SC3+fH5MxbeP5myL0tvuvjXG+XDLXuIlA6sy4FmmDXcKLytf/EJ1HVr7A7w== 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=0HL3fM2BkIp4sskfMBKSs4aUSA3rU1fVRiphof0SDrU=; b=QX0y9AARijlJFWc/lVLW696y8XAFgJoMji33rfhpL240kY7SglIK4tgBE/r+rRwfercbi32SVe10ulqulPxaslikh5MrObpx84t4uYFW8cDN9VRO+qoDL2EK1kLhLJpeo9vF0xwIF8RR/YG0ltd52lqdHQxS2jBmvBBaDI1Eljk= 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 BY5PR10MB4161.namprd10.prod.outlook.com (2603:10b6:a03:213::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Thu, 18 Feb 2021 16:54:11 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:11 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 17/22] xfs: Skip flip flags for delayed attrs Date: Thu, 18 Feb 2021 09:53:43 -0700 Message-Id: <20210218165348.4754-18-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82f2782b-d43d-42bc-cfca-08d8d42dd07c X-MS-TrafficTypeDiagnostic: BY5PR10MB4161: 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: w74pyKnRyYDSB3g2FwJyMy1ytjCst6kzb6FpVQreyXUkEmH+Gk0xu7ycG3Vx9hf4dmKg4Z8JSVUQDuK94Zn/FhOyssdH8RVuxlN23LoyjU5JJso4uzjIf31BoXwDLtGPHkWIqbxoZLNHcczIPbxF637SmGP2EhBCD0T+W+EfIF2SWZo1MO4GUxxFyjKtCeAFuzTK/1moLIwfkolcYSH7+FYVhuTcgn+YYCUOu16mwzEC6vp7EmqbaYAvvRSp5w/R9SsNwZth1ZAQ/QONpRqnOW16fvkWlDt8eUvfERMhSHN7g3Rkce44O0fpSMZNk8DRpCOn5r5YOFlisgunHH7ixJumt23kPfk9eWZSpsfE3xIHo2RgTRDKfb8OrrZ92hPbH3cS+iYovrU0dciKQgCmQvsQEazIfY0xWpFeCrnhEWs/pjaLMDHNzrBWvcVTL0XoSw4fh5UWSGaKtYvKF6Tm7bG7fsFr9XyLdEsbj5h3PwYIB9ASkl0ZVopN4laKmAc7NAhTSiBYxN+HSV1s6yQ9tdVgQoKQTxxpLXeNVciVRFB5i69NCre5LMcLPfPWjlhEtcQ2MRcs+J4RykNxjpI4Hg== 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)(376002)(396003)(366004)(136003)(346002)(16526019)(66556008)(6506007)(478600001)(5660300002)(956004)(69590400012)(26005)(6486002)(83380400001)(66476007)(186003)(66946007)(2616005)(52116002)(6512007)(1076003)(6666004)(316002)(8676002)(8936002)(6916009)(36756003)(2906002)(86362001)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1HDrnPKbn+z8KWd9gMqlFnn4DDs3LKr27Me7LoSpHCLoU/N8gU38D/TJf+8oZyAdCvzq9VInATXeV+eUUz3FMSh1rqTUuikuIyBx+h4VnwvB7B/anwmcb0XOf1aagsHOjdmbK876L5Tf694rJoG90QTE9Qyqk+TADc+WQBlAg1Nau3jOWuf9ljDVVIGhTmcq64pM9Q/5xYeujCl0RhTDfWeyr4NkBdVOgIwINv4GjNg0mnOO1kG0Tn0p+O9JXX6oOrCDHeWzEI7hZgWda2j52/rLEZT23g2Hmxm0sy8AzdtYXp+Z5OgdaVA/3huGM7I4pGe4wdKKMmok+3pxnCYKoWd2LfuInGYSu9eDF5lXKwuYKRlj3LziSilox+PdKaUCgiUxnwfsUrHWT71Aj0CRC5mD7ghECLRsdSYAZH2KqaAa74dI76eWx45f3EXi9skJhYFaPBlX8zjoqrXdQc98MqvUISUm7ALL1g8hTntih/LFlZbPIqUwR9osad01e88ywB7UOVABnbM/xdmk/0OnCZDx1vhAFRxGxPKWuXd2BEkKP8YZZUk0uON2ooDTEgbPp8Sf9Iw2QzqTMYaNA3zV6i3GcqTd0hSHKPgTQg1kYz3H5eGDd3ZaqJsMlyJoIZ2s5+OeGuqY+gOR6QdDjt3qGt9n6ievo0NGh6EoXGRRnWEY0Vw6WY1U6ausYSet57SQk1al8w3oaIOXSxwg/OLPz7oJpv/2NOoJth9SlLL2hVSG5doKp+LjKgOGhIdbfEexEqsc/KCGYAskp1Asl2Tw/twvgfRPQrWe2bL/paGowEZHdSr4tBzcc+qv57LJw+lunV96y7sz3GXCs1pJEcvZ5dcM1s/CrxoSYN+FD3dtIu5Xu9vYMHxLHmU+DPhPkOXQ0LsR/2L0Vh9JXKtHoiROgOUEN/jXX/TBaUlOldlyvZW+/LqHBQwmqxQOr6CSq7eqSq5Ea4i2XLlHkwoqvxyk8RwB+xyjcpLeretykHCnLUI9i4kPMht/icOJA3DoOop/TcybMOIw8uKmv9hcJ68zfx+kreFNjkxbXfJCc29qDN4ULQArQJlqVZCDfWjZcxl6Fl8Mep+H4UfaEhYG1aUnofxjcaoTtOT29ocWJI7ZmMJwjxtF7W8x6U+4jAKyAWoo0gyPpr4Rr/7ntKuT9M364sfuYYQSdQdHFVMs+RN1pSl0Xg3z/IHXsg8gr3czsuHd09pkwjVRT2mAPTa8KARt5pKwR6/urpZpSqLoTRMqTiPpPDQP52t6G4CUZJwmBASYd6VkJnKi+Io0OjBXMoHMb1zhLjEaCt6J4I0gDwj0EJ19xRmsdMsLZ1Zn2WYfGqoi X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82f2782b-d43d-42bc-cfca-08d8d42dd07c X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:11.0786 (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: nBaj8/+uKstSnDX43OD8p2MzUy/R1HW+yQeWcZUxhJ6DUlAd649UCnGiVp6pqJdjyFsBY2qpgfgtX+UriG6ZHivIwhj8hmjFMim7GZJRkvE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4161 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180143 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This is a clean up patch that skips the flip flag logic for delayed attr renames. Since the log replay keeps the inode locked, we do not need to worry about race windows with attr lookups. So we can skip over flipping the flag and the extra transaction roll for it Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 51 +++++++++++++++++++++++++------------------ fs/xfs/libxfs/xfs_attr_leaf.c | 3 ++- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index e4c1b4b..666cc69 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -337,6 +337,7 @@ xfs_attr_set_iter( struct xfs_da_state *state = NULL; int forkoff, error = 0; int retval = 0; + struct xfs_mount *mp = args->dp->i_mount; /* State machine switch */ switch (dac->dela_state) { @@ -470,16 +471,21 @@ xfs_attr_set_iter( * "old" attr and clear the incomplete flag on the "new" attr. */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - return error; - /* - * Commit the flag value change and start the next trans in - * series. - */ - dac->dela_state = XFS_DAS_FLIP_LFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); - return -EAGAIN; + if (!xfs_hasdelattr(mp)) { + error = xfs_attr3_leaf_flipflags(args); + if (error) + return error; + /* + * Commit the flag value change and start the next trans + * in series. + */ + dac->dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); + return -EAGAIN; + } + + /* fallthrough */ case XFS_DAS_FLIP_LFLAG: /* * Dismantle the "old" attribute/value pair by removing a @@ -588,17 +594,21 @@ xfs_attr_set_iter( * In a separate transaction, set the incomplete flag on the * "old" attr and clear the incomplete flag on the "new" attr. */ - error = xfs_attr3_leaf_flipflags(args); - if (error) - goto out; - /* - * Commit the flag value change and start the next trans in - * series - */ - dac->dela_state = XFS_DAS_FLIP_NFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); - return -EAGAIN; + if (!xfs_hasdelattr(mp)) { + error = xfs_attr3_leaf_flipflags(args); + if (error) + goto out; + /* + * Commit the flag value change and start the next trans + * in series + */ + dac->dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_attr_set_iter_return(dac->dela_state, + args->dp); + return -EAGAIN; + } + /* fallthrough */ case XFS_DAS_FLIP_NFLAG: /* * Dismantle the "old" attribute/value pair by removing a @@ -1277,7 +1287,6 @@ int xfs_attr_node_addname_work( * Re-find the "old" attribute entry after any split ops. The INCOMPLETE * flag means that we will find the "old" attr, not the "new" one. */ - args->attr_filter |= XFS_ATTR_INCOMPLETE; state = xfs_da_state_alloc(args); state->inleaf = 0; error = xfs_da3_node_lookup_int(state, &retval); diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 3780141..ec707bd 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c @@ -1486,7 +1486,8 @@ xfs_attr3_leaf_add_work( if (tmp) entry->flags |= XFS_ATTR_LOCAL; if (args->op_flags & XFS_DA_OP_RENAME) { - entry->flags |= XFS_ATTR_INCOMPLETE; + if (!xfs_hasdelattr(mp)) + entry->flags |= XFS_ATTR_INCOMPLETE; if ((args->blkno2 == args->blkno) && (args->index2 <= args->index)) { args->index2++; From patchwork Thu Feb 18 16:53:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093973 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 679E0C432C3 for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3344064ECC for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233140AbhBRSsQ (ORCPT ); Thu, 18 Feb 2021 13:48:16 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53556 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234039AbhBRQzV (ORCPT ); Thu, 18 Feb 2021 11:55:21 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGsFde016488 for ; Thu, 18 Feb 2021 16:54:15 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=ZnBZHNlspHmq8o5LaF7dfujX6JsYyOFJVSyqQr7EK2Q=; b=uI6W/RfHyfGvKmFJ7ZARZ6MhOkzhzq+b17Xg/8cFm8nl/uP1g3/PBOXThN8FMiDYvYKs j+sNkW6nXChLspUcYoOWycBIjBRdtxooW8oTTLHroeAag/AyyaezimfCgYVaDDBhOZ3g 7loWvl6HHEoMnd89jpv0tuo8cBhTF3TcDuupYRptsD16DX4MRBldpHmHa5/71VbxKC0J 9qom7h2qD6huL2duDFabwFTiC5jS94nS0KITSyRCpfVtEEoBXiUAWlJ8tsp60AlVHh/m NqvTnqTaCEkkClYnymKCDKyXKnxlm+584mP2EvZAXO804gwkasyaWEqib5tn5LQumkvr bg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnpj6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:15 +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 11IGoALJ119728 for ; Thu, 18 Feb 2021 16:54:15 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by userp3030.oracle.com with ESMTP id 36prq0qeh7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gD4QkrdI8pW5Q/7KpXSAUWcGyCofMiKa6HOISHfRyePk9hvp6gifz5bIDCX+xJaRBkZ7zKYLsnxtIPBMnxy2WWyruole4EGjlmtYXeyP/93K1Lc+06eqmZZ9Zk9kqc4aiUNilhTfHl6BnwEgJdAEze5XKYSdpFKb4Y0TJvMjbtscEZyMlMMlPcQgiDCS6Er/ewZRf/XXs4MNB/0UNY936+GhpJVLMPIOxnLUv0aLwClO4aKzjr2XIq3zk0WtiSncaT4rKsA+F/u2oiihFwK+u8/B7Dd6whMZ3oyd3ZIdU2bTHzr9BPKh3dCxjgRDG/Eez1vHXaFTlK8EpJJIJ20x7w== 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=ZnBZHNlspHmq8o5LaF7dfujX6JsYyOFJVSyqQr7EK2Q=; b=lFJVksRFSchgciSsjog2UOGyfYRMRTQpnEgmhBcbikpp1W5nv0bArEJxdGV0Z0dAyVnJIjZBS59R6k6SuWspuhP8f+4MExz+hxFQvfBakbof6C2VcgiCK7ppCYK2NAlIbLM4Wb6HrMqOUI+X2GYeaOrgGhHfgRxX6Zbc5KG+FlP+WFIBDrlBcpgtWDtm0Np99Bag+o6zkCrRyQBGaf6xK6uSeK/yQqZnbAXll0KkNfkcso9QGpDNieASAlKfzsqf6u9yW9DAFjqcrYZ1Z+pJKkBNO+QOPDVddldHcx4tK/Z4J2HUIqjdC2Gp27dHWsKImhDXL0g6jW3PUQMYaffElw== 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=ZnBZHNlspHmq8o5LaF7dfujX6JsYyOFJVSyqQr7EK2Q=; b=p/85Q+Z7BlLehO3Zhr6t3uPQVXxxCZYMHI82ww7BtDy2wWDg19h9c8R0C6aEoZ9w0BH6Y9zaWs5tRs/9NOyz/5+6gChMkUrAyN161ayQH1m4sBHUUQ/IQJmyvkk4UvFnRaIY2bgiU0cl89gGXpTvX6TlSZkRcvjwMs8eYNjjFAI= 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 BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:54:12 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:12 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 18/22] xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Date: Thu, 18 Feb 2021 09:53:44 -0700 Message-Id: <20210218165348.4754-19-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8bb4a30-429f-4211-443e-08d8d42dd0cc X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: 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: w6ZOLGitbxiUx+z85x0AR9lj6BOzt6bReOzofGkcrstonopySfbXxBmUZCB7sNrXlak+sUOFr0yPKDv3BjXX/Mu+moZNKv/JdaUXmLDHI1EIGS82/mhdQ00i5S5JuUjtCv9zM+1lOt+UWWgZFWI05qd/wRJintbNhMfGxyELlNuwfGxnoLF3XuC8CS0twbSWAiCd2iM9oTQBG3V9B8XiB4pCD8jgcHGbCSLaAAvh40m1JtaxG091q+CcSN/NIGaOTTc32/u1np1SxCfhna/2AWvwQ3HuPxskPrzGqHy4yQ5puzIFZC+kFSWjZzawjyejYxQMQw891fVGINpQVXzNFNva9VEEmRxYww/q9z3tB9Rte5A/qhBLozuetlby3LUt7E5sI+T4GPTj0ybPA9z0PmD8ykvuiFpiFcx8F3qvum7KmrIBFPTbYjWgwDxOGR+AulfCmIPHN7URjCNt+coB5pKIGG+KyO/goekPleDZwkoXlzB67DCYgq0xT0QHG3eK8Tyvd99CMal9ko9DUiAym1gB2SAdCeZ5MBsSihgAtjW9Vhfwi3uKp/nnYV+V3QodzNM5n1v+kaGSiOMTc/xOww== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(39860400002)(366004)(136003)(376002)(396003)(5660300002)(52116002)(8936002)(6916009)(69590400012)(1076003)(478600001)(956004)(6512007)(26005)(16526019)(6486002)(186003)(2906002)(6506007)(2616005)(36756003)(83380400001)(66946007)(86362001)(44832011)(6666004)(66476007)(66556008)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: BceLw4fz9EPsWSoMDyuPGGR8GHKz860ABujvsviEK56EC95fQ0Gt7gRLE2/Qi074iN6rgDoBlCfoNet3rwlfi0PQmZxqoRBBlfa0e0SuUltP4hC+PZZ21xGK7r0tdV6aKeECAEmFUyhBBAVkifQabwU2zQpKrmv0mKGvOC1ZePD4M18ls9IwW+FSPLhg1FKWlIXZfTpPB5wZ8j6kyHyBPYbh3KG8oGtbOoQ7RYtl1k59/W24yXPJPoMxR8SPSSfi0GHUEpqLHn8omLIDC+BK9/URPUSWiWOQtQx8sxrcShqLsnzpBjn4BQ4SwNOEhUtixg29daRpGSwN74taiC94C0jNMO74/oXhlNDMFH+JP46hDuYFEeK1a92G5Zljjsy7gPN1CrhyvFUhRPdjC/IBLjiI2+ezLxR5UR+AJDue0VzWCCkA+R+ToxMpkzN9VArt2vPFqOuGu6ejURby+BBjeIBDD1AXKgc67auAoM6w6TZmIxGOhLC5wkrCWqku0K58CWkqwgzcdVkGFCWA+Z/YviCwgZy1XfpEPZPHaC6Tfyk34OIY/CnyGnqKgpS1NxHzF7lbD2aQnsia6EXo4oF5cKo1xT57TLxepqsTPtlw7Jvu3giznzD5VRuIaw0dj4BTpzWQ/oURdryv5xcnfLfejQun04IZJQDlVHSxCDRyhB6NwAwmlml+kR3eS0SHm9ZfwZ02jZhCTpHciMG09Du3bqEFR2VcWf1FACbgDD/wIuAkXqRnRRqT07bsS2RMGCxe0LawFIyOIOhjzONC5Jbc5tUNtaQqvRujqcf4zTYYlBDoHeTH/BOzLEGWzYRst2CiHEhe2JHbUb6kPS3hZxaVEXzFTTOGaBb3kmpxpB5iXQoa5GNdiHldjeziAGvgojRDNx3c098BSaQBQhEUb6FL6GnObzGUp3p4iTBeP0w0Q4FdHfrlVfRjudmCV56JuxZIUEitGdwd629izVWdgGJD2OktCCICdUbJDEmSXMLdQJ1exChGEkxukLsTcpRp1uy6Cdl/DudZqc7BGOBwOQ4EU9QquVbgCZQeb7XxnBx7NLkWsytmWktBuof5tpsco4WIhIHlAHJcAs703+2vkBXvW0mRtWC85j4/clsgU0YAkai8Sk77x44mEnAbLOC7/ZkxSliI/Y4ABtVV9eekPF9oivADU5scj1srSIP+DYrVB7XrljRTrVxUVefs/t7I1+kFnfoVLmePORNXW/TktLB04IqZBqb3RkG1BSnS1WcEwQnArjILIqu6Q/9yDrsCacWUXvjxskjxiWBMIRg4mCaUvf9aIK0hT78g9T2Ib/05U/4U8cU6q4dFuUWrc79CKysh X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8bb4a30-429f-4211-443e-08d8d42dd0cc X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:11.5774 (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: HIcb65EDL4QvU8LmyG7VlUTJY0hRW+isk80zra35o+zq8TabshMsug9JGRhKH2IslXELMcZGrii+mKLbQX9IdQbFe3NKPOT5m3zsGWl9OMU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180143 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Allison Collins These routines to set up and start a new deferred attribute operations. These functions are meant to be called by any routine needing to initiate a deferred attribute operation as opposed to the existing inline operations. New helper function xfs_attr_item_init also added. Finally enable delayed attributes in xfs_attr_set and xfs_attr_remove. Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++-- fs/xfs/libxfs/xfs_attr.h | 2 ++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 666cc69..cec861e 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -25,6 +25,7 @@ #include "xfs_trans_space.h" #include "xfs_trace.h" #include "xfs_attr_item.h" +#include "xfs_attr.h" /* * xfs_attr.c @@ -838,9 +839,10 @@ xfs_attr_set( if (error != -ENOATTR && error != -EEXIST) goto out_trans_cancel; - error = xfs_attr_set_args(args); + error = xfs_attr_set_deferred(args); if (error) goto out_trans_cancel; + /* shortform attribute has already been committed */ if (!args->trans) goto out_unlock; @@ -849,7 +851,7 @@ xfs_attr_set( if (error != -EEXIST) goto out_trans_cancel; - error = xfs_attr_remove_args(args); + error = xfs_attr_remove_deferred(args); if (error) goto out_trans_cancel; } @@ -879,6 +881,58 @@ xfs_attr_set( goto out_unlock; } +STATIC int +xfs_attr_item_init( + struct xfs_da_args *args, + unsigned int op_flags, /* op flag (set or remove) */ + struct xfs_attr_item **attr) /* new xfs_attr_item */ +{ + + struct xfs_attr_item *new; + + new = kmem_zalloc(sizeof(struct xfs_attr_item), KM_NOFS); + new->xattri_op_flags = op_flags; + new->xattri_dac.da_args = args; + + *attr = new; + return 0; +} + +/* Sets an attribute for an inode as a deferred operation */ +int +xfs_attr_set_deferred( + struct xfs_da_args *args) +{ + struct xfs_attr_item *new; + int error = 0; + + error = xfs_attr_item_init(args, XFS_ATTR_OP_FLAGS_SET, &new); + if (error) + return error; + + xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list); + + return 0; +} + +/* Removes an attribute for an inode as a deferred operation */ +int +xfs_attr_remove_deferred( + struct xfs_da_args *args) +{ + + struct xfs_attr_item *new; + int error; + + error = xfs_attr_item_init(args, XFS_ATTR_OP_FLAGS_REMOVE, &new); + if (error) + return error; + + xfs_defer_add(args->trans, XFS_DEFER_OPS_TYPE_ATTR, &new->xattri_list); + + return 0; +} + /*======================================================================== * External routines when attribute list is inside the inode *========================================================================*/ diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index ee79763..4abf02c 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -462,5 +462,7 @@ bool xfs_attr_namecheck(const void *name, size_t length); void xfs_delattr_context_init(struct xfs_delattr_context *dac, struct xfs_da_args *args); int xfs_attr_calc_size(struct xfs_da_args *args, int *local); +int xfs_attr_set_deferred(struct xfs_da_args *args); +int xfs_attr_remove_deferred(struct xfs_da_args *args); #endif /* __XFS_ATTR_H__ */ From patchwork Thu Feb 18 16:53:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093969 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 C824FC433E0 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7985F64EB9 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233121AbhBRSsM (ORCPT ); Thu, 18 Feb 2021 13:48:12 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:45952 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234041AbhBRQzU (ORCPT ); Thu, 18 Feb 2021 11:55:20 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGnmL8069815 for ; Thu, 18 Feb 2021 16:54:16 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=TOwoeObWJ9z2ho1E/rIafwpVLwYdfNvTldIK5IKUT9g=; b=Cmyj59KqbRcpFYV/4b93u2rGPUV1xJlzmRgm9l/L9X/lXsZ6GwsPvam/7+fvkDS2i0o0 AheHwXmtW4YTMxRCMai7XH0XTo5SfNjRjo8ZS2plAFClznBT5Ych96V+coq8EGmcHi6o aVfBoLdH2tBEGBszBxvK99IjV1jyPxED0H2v6/mmRBnF6b8eehbJXo5wG8q3dLocmuq/ kmEwEJa1RZEqEc8VaCf6FMLQLLRwB1PrkE3uypkJt5ZO4KvJ/gXpW4kQoVka6icAY0Id W7On/3HOdAA8twmYrijEoQiKNIdhOX1GFHHX9Zfeir3g76e20wW7e4ULzx7+GtWeUOM0 qQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 36pd9ae4qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:16 +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 11IGoALK119728 for ; Thu, 18 Feb 2021 16:54:15 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by userp3030.oracle.com with ESMTP id 36prq0qeh7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jOlfyB3qria9jqQ9ScaXmSVejFf+T6VCSAuHuVBRWqUcZG+tUL8oWy539fHG2HwnO/bJe2bgWZiBxx78eGX5llqfunceBt6rbfk2hVCs3qsFALTJ1oqwpXqQ5mNv1+fRrdXkcjdCIHyvvOiV7/Z5zvA1D15PnJaGVGGLduD1OAfhFnMeUPH7RevacxpGd4HKEnmSSjB25lFO8ADkGzptUoi14Rgw1SZBPUsmAm3BK+kvZd4M0I2jRJfKuLU/oW30VgBB0GnEjreO3UFVHQBUAF4/lxMzY9aaFOMBV2lhDy1sr8AxKB55IfBC2gFKfiPO0jVnxr/cgo3ZelAGv2zHrQ== 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=TOwoeObWJ9z2ho1E/rIafwpVLwYdfNvTldIK5IKUT9g=; b=PY/xTcdcsdPtxbxzSe2NTNab+QbN8+pk9POfOQmc61JeRSH90xm9vM5Mj+mmYBm7J7znEaULOSUuL5R4cwbJ7+4yhgRw/55D62A4Y2WQuJ6kHX5l3lp0n1U/h+0OscBGaMz4lmvG0xNZYyf0UGVenrOVXflCHIRMiu4yVFsuJPwx1aYu0FzA5pc2ANMy1FaYMBarDrlyLhWDUnmNjOUQWwO+Y37g6+bG6G3YqNtrZM8pvVoQi8yWU4b9MJ235xo/wioogwknH/Y8mk7gY7Zho4H0vwgZGuND/CJrDaKGdP8pja2G5p1YYNhj5dKA7r89/V78dHODmGIw0dhjsY6j5g== 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=TOwoeObWJ9z2ho1E/rIafwpVLwYdfNvTldIK5IKUT9g=; b=qkYHVMUdtgQjtLchsdnFVW7HZmGQklWU5qe5SSs67dp7sCZ9IO72Dc8naxGhgDhSwurx3gwnJO9vWEX/1ZL74+3FugBnmxnOO9g/LoGTPYyIGF1Zac7/FoH9kRVfELvQ/kF5pWD78NPS1spAP9cG9bBv+AdSDVUpmYW92O9EcSU= 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 BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:54:13 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:13 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 19/22] xfs: Remove unused xfs_attr_*_args Date: Thu, 18 Feb 2021 09:53:45 -0700 Message-Id: <20210218165348.4754-20-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80ebc6e6-df20-4854-53ca-08d8d42dd110 X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: 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: 9IdwGqUp6ZDAkPmYaTJId19jup49LTCNOhzW0ABzbmWYepcwiNWp3kiR2fV0tBkyvYncSyodgOwC+VfOHWpHLS7LPy47BbqYHb+3ZRU+xj6jVcznGj0nyG+TnOjtH81CwZ5mI41WCnO25YxhbyNZA3WYaw1TbkadDDQj9r8IYoloBt/b4JIVEmoAwT2kStzipW3qd8XaoqCplYOQv6kh+A4NDaNGoFwWrVHyUtFkzlupuCYKsXCB2yjjge5T9knnjYkFmFVTwBQvbJkt6dbYOrDP8Vcg5/QeKf7fIN0kKpr/b5LxoiNG2AYvwstIsXmPWmgghsZQYbgc3R9xI3lHCr8lL9CQqOxaq2S6SldjKKb0WtOijAbreIYJ1H3cEuZKlMnLFKRn7VQKefTj5f2ejfiMS0ENhCuX/zwAdfm+U96sOe+gXB367VPZ58/5ptOOp+ZVKq133kUSHVJXB8J4g0e3TZeGUMsFnJbLZBfeqO67w+DtXRZ/SjYGY47dC5HAK1m75i8Ds1RbWDMeReXevsBtIXFxNQdJyR/Z1sGx74+yAfW/lAJsqRVZTp4gbsrbHy9XtdQObEqsD3p3qma5lg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(39860400002)(366004)(136003)(376002)(396003)(5660300002)(52116002)(8936002)(6916009)(69590400012)(1076003)(478600001)(956004)(6512007)(26005)(16526019)(6486002)(186003)(2906002)(6506007)(2616005)(36756003)(83380400001)(66946007)(86362001)(44832011)(6666004)(66476007)(66556008)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x/nVBL7DJnvmkzBV6c1v4R4d/G3azZACeLDcGhf+xTwjFvfYLhHMgLByUokbfh4Ji2379lumd/yZNo1lXqFi/+GSK0uR3gq/IO/8cUV94SaV1GYVLF/cbxpyvelRwWUwzioDo47tK3/Lphb0dJ3JIM5Nkng2hnw0LEBUPde+FsmRhBg+C/Kxy3+ZwlNJPa3NUxoBBLILmOuhc8VRIV+rXFAC62ru4zj1ZIMyhAfLJ4n567iK4a+9AzlmGznNXr6/IcNwohCiZZkPsLOSwW7JmukqhYeL2xAJ9V0uQniHOweKOXzuOWKWcdCZzGTd7mQcuo6yiPbVKpvZyfV9vpccFtadgT3fZp+imS+OB+F4mwS0gURqZSapngoxs7anXKCl7HPkt9TIeE/o0d3NUzVqMAFBwx22uz68HSPpLUS3cj0F16sV7QiqnK2drYA6ECZ4eLRCXOjo8gBzkfVNw0cjuNay00c1IfYaHUnJ3bJogffL/nnDJi92j3oYR7BZ1RFaKCQ1PW9QZ6wUmRpfI6svB/3MRYI3NBYWI7sEVhMGPf9I0XetrAV7ZntzB/U9Ufy/w21/poeefVAdgqjTUHkutTP0fC8O8tKvqTD1p6l8/GGmb6qSJNoouUNbWDnlTM5dmnltkLH7TPJrULqf8mHCmo1AQ9bvp+EGBieI2ujAbnO5o0H9zomlmlxoE5TVLsxcv6GkgaD3OgCL1qi01Ier8qw51pYqXwv59wvIHl1Z1ltJikFuRVGx2v7FJtgr+7SYZibxM5pVRok0xZGrJHCqvarm9C9CgTu2drIEG+2qFIhss2aPhkoJlXs1RBIRbavtNIUsd/Z/ANdXGTnzLyUyv/g59Dul04886WSY6RNzGCgH05+0qZLnsgzPmHMEST3OwQNU1qED10smowXzezU4+R45W8vNUD5sOWdDaykU7/QLr8kwjl4ZMt6vFoq8xvxtspaKVljXK6a4f1eEl1EWzNVc1mDxmh20zuzrJ/l/l1OVs/IuyKW8Kolg3vbWbecez/PAi77xJIquSN6y3KssYGPlRDIjQ0nD3eQI4kizVM/ol/H5d75yzic5qM93jAiTi0vqdaSJovaQDqQo4mRa+pEGYRoZDZYpext6rLJ7GIT98Ndy86cBtVU7RgIBpgKnr4hr6LJL7jxskmN5Y3qNkbMgadKIqXE5p9Q1cp4VYLeQrcbrqoMDZEnigr/BrZ37FBqCCr8XX9VNertvQ6ixkXzA3WXupGQgkxylaIXDv5r2bvBvYIwJjr5eGuN+Q49mlIauTbffN/ldzYniTTeWIYgP1meoNSKinIVqDXd7OO9DWNBeZDk8ZzrGt08pDMgC X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80ebc6e6-df20-4854-53ca-08d8d42dd110 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:12.0702 (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: xI8ACv6IGc5E+Xy5YPtuMgqYVi+2nucP9VJbkAObrOgbxgJthcrWHt9K8V5WJ0RBhlKtyVX98V+DBnvOPZWPFr33WxI55yqXVdIu++raUkw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Remove xfs_attr_set_args, xfs_attr_remove_args, and xfs_attr_trans_roll. These high level loops are now driven by the delayed operations code, and can be removed. Additionally collapse in the leaf_bp parameter of xfs_attr_set_iter since we only have one caller that passes dac->leaf_bp Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 97 +++-------------------------------------- fs/xfs/libxfs/xfs_attr.h | 10 ++--- fs/xfs/libxfs/xfs_attr_remote.c | 1 - fs/xfs/xfs_attr_item.c | 8 ++-- 4 files changed, 11 insertions(+), 105 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index cec861e..8b62447 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -63,8 +63,6 @@ STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); STATIC int xfs_attr_refillstate(xfs_da_state_t *state); -int xfs_attr_set_iter(struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp); int xfs_inode_hasattr( @@ -223,67 +221,13 @@ xfs_attr_is_shortform( ip->i_afp->if_nextents == 0); } -/* - * Checks to see if a delayed attribute transaction should be rolled. If so, - * also checks for a defer finish. Transaction is finished and rolled as - * needed, and returns true of false if the delayed operation should continue. - */ -STATIC int -xfs_attr_trans_roll( - struct xfs_delattr_context *dac) -{ - struct xfs_da_args *args = dac->da_args; - int error; - - if (dac->flags & XFS_DAC_DEFER_FINISH) { - /* - * The caller wants us to finish all the deferred ops so that we - * avoid pinning the log tail with a large number of deferred - * ops. - */ - dac->flags &= ~XFS_DAC_DEFER_FINISH; - error = xfs_defer_finish(&args->trans); - if (error) - return error; - } else - error = xfs_trans_roll_inode(&args->trans, args->dp); - - return error; -} - -/* - * Set the attribute specified in @args. - */ -int -xfs_attr_set_args( - struct xfs_da_args *args) -{ - struct xfs_buf *leaf_bp = NULL; - int error = 0; - struct xfs_delattr_context dac = { - .da_args = args, - }; - - do { - error = xfs_attr_set_iter(&dac, &leaf_bp); - if (error != -EAGAIN) - break; - - error = xfs_attr_trans_roll(&dac); - if (error) - return error; - } while (true); - - return error; -} - STATIC int xfs_attr_set_fmt( - struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp) + struct xfs_delattr_context *dac) { struct xfs_da_args *args = dac->da_args; struct xfs_inode *dp = args->dp; + struct xfs_buf **leaf_bp = &dac->leaf_bp; int error = 0; /* @@ -316,7 +260,6 @@ xfs_attr_set_fmt( * add. */ trace_xfs_attr_set_fmt_return(XFS_DAS_UNINIT, args->dp); - dac->flags |= XFS_DAC_DEFER_FINISH; return -EAGAIN; } @@ -329,10 +272,10 @@ xfs_attr_set_fmt( */ int xfs_attr_set_iter( - struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp) + struct xfs_delattr_context *dac) { struct xfs_da_args *args = dac->da_args; + struct xfs_buf **leaf_bp = &dac->leaf_bp; struct xfs_inode *dp = args->dp; struct xfs_buf *bp = NULL; struct xfs_da_state *state = NULL; @@ -344,7 +287,7 @@ xfs_attr_set_iter( switch (dac->dela_state) { case XFS_DAS_UNINIT: if (xfs_attr_is_shortform(dp)) - return xfs_attr_set_fmt(dac, leaf_bp); + return xfs_attr_set_fmt(dac); /* * After a shortform to leaf conversion, we need to hold the @@ -381,7 +324,6 @@ xfs_attr_set_iter( * be a node, so we'll fall down into the node * handling code below */ - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_set_iter_return( dac->dela_state, args->dp); return -EAGAIN; @@ -687,32 +629,6 @@ xfs_has_attr( /* * Remove the attribute specified in @args. - */ -int -xfs_attr_remove_args( - struct xfs_da_args *args) -{ - int error; - struct xfs_delattr_context dac = { - .da_args = args, - }; - - do { - error = xfs_attr_remove_iter(&dac); - if (error != -EAGAIN) - break; - - error = xfs_attr_trans_roll(&dac); - if (error) - return error; - - } while (true); - - return error; -} - -/* - * Remove the attribute specified in @args. * * This function may return -EAGAIN to signal that the transaction needs to be * rolled. Callers should continue calling this function until they receive a @@ -1297,7 +1213,6 @@ xfs_attr_node_addname( * this. dela_state is still unset by this function at * this point. */ - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_node_addname_return( dac->dela_state, args->dp); return -EAGAIN; @@ -1312,7 +1227,6 @@ xfs_attr_node_addname( error = xfs_da3_split(state); if (error) goto out; - dac->flags |= XFS_DAC_DEFER_FINISH; } else { /* * Addition succeeded, update Btree hashvals. @@ -1599,7 +1513,6 @@ xfs_attr_node_removename_iter( if (error) goto out; - dac->flags |= XFS_DAC_DEFER_FINISH; dac->dela_state = XFS_DAS_RM_SHRINK; trace_xfs_attr_node_removename_iter_return( dac->dela_state, args->dp); diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 4abf02c..f82c0b1 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -393,9 +393,8 @@ enum xfs_delattr_state { /* * Defines for xfs_delattr_context.flags */ -#define XFS_DAC_DEFER_FINISH 0x01 /* finish the transaction */ -#define XFS_DAC_LEAF_ADDNAME_INIT 0x02 /* xfs_attr_leaf_addname init*/ -#define XFS_DAC_DELAYED_OP_INIT 0x04 /* delayed operations init*/ +#define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/ +#define XFS_DAC_DELAYED_OP_INIT 0x02 /* delayed operations init*/ /* * Context used for keeping track of delayed attribute operations @@ -452,11 +451,8 @@ int xfs_inode_hasattr(struct xfs_inode *ip); int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_set(struct xfs_da_args *args); -int xfs_attr_set_args(struct xfs_da_args *args); -int xfs_attr_set_iter(struct xfs_delattr_context *dac, - struct xfs_buf **leaf_bp); +int xfs_attr_set_iter(struct xfs_delattr_context *dac); int xfs_has_attr(struct xfs_da_args *args); -int xfs_attr_remove_args(struct xfs_da_args *args); int xfs_attr_remove_iter(struct xfs_delattr_context *dac); bool xfs_attr_namecheck(const void *name, size_t length); void xfs_delattr_context_init(struct xfs_delattr_context *dac, diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index b6554a3..78bb552 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -762,7 +762,6 @@ xfs_attr_rmtval_remove( * by the parent */ if (!done) { - dac->flags |= XFS_DAC_DEFER_FINISH; trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); return -EAGAIN; } diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 8c8f72d..13b289b 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -291,7 +291,6 @@ int xfs_trans_attr( struct xfs_delattr_context *dac, struct xfs_attrd_log_item *attrdp, - struct xfs_buf **leaf_bp, uint32_t op_flags) { struct xfs_da_args *args = dac->da_args; @@ -304,7 +303,7 @@ xfs_trans_attr( switch (op_flags) { case XFS_ATTR_OP_FLAGS_SET: args->op_flags |= XFS_DA_OP_ADDNAME; - error = xfs_attr_set_iter(dac, leaf_bp); + error = xfs_attr_set_iter(dac); break; case XFS_ATTR_OP_FLAGS_REMOVE: ASSERT(XFS_IFORK_Q(args->dp)); @@ -428,8 +427,7 @@ xfs_attr_finish_item( */ dac->da_args->trans = tp; - error = xfs_trans_attr(dac, done_item, &dac->leaf_bp, - attr->xattri_op_flags); + error = xfs_trans_attr(dac, done_item, attr->xattri_op_flags); if (error != -EAGAIN) kmem_free(attr); @@ -625,7 +623,7 @@ xfs_attri_item_recover( xfs_trans_ijoin(args.trans, ip, 0); error = xfs_trans_attr(&attr.xattri_dac, done_item, - &attr.xattri_dac.leaf_bp, attrp->alfi_op_flags); + attrp->alfi_op_flags); if (error == -EAGAIN) { /* * There's more work to do, so make a new xfs_attr_item and add From patchwork Thu Feb 18 16:53:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093967 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 F14B6C43332 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA33664ED4 for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233129AbhBRSsO (ORCPT ); Thu, 18 Feb 2021 13:48:14 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:41312 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbhBRQzV (ORCPT ); Thu, 18 Feb 2021 11:55:21 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGoOaR088799 for ; Thu, 18 Feb 2021 16:54:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=0Hg1KhvkFZFjKijbVBZiY8vPLRXFFmSBVMkN0fi69D4=; b=MPq6KiP91ftqrVEMhpKZZhHB52CpW5yA/UkNQopte6Lbkb+M0e6vOOLMIKRstU0g+SrY nDxPg+eJPNOaF12VVAUdfyt37IeXpnH7BmbWKXxtKlVuSbwWtvXAYTRDxYP4uvgtXwHZ Rgofva7W52aWFoxjiLL6qRnRximgBMLE2VPJF+G977YqwqblLZu6cjRvoeADhrVCKfi0 YTSXHahaQJASTMYS93vHLdAB8JNFF0xQ68YgCYj4e8Jr+rsBYnvtjGVwglvHXwFz5+vL cpeWvBoxUFNu04/f2aQ4i7xKnaoRCmMwt8Gcko6xEAkBtHyNL/Qdbjj5X4ISpl3h0Y8D Vg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 36p49besyc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:17 +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 11IGoALL119728 for ; Thu, 18 Feb 2021 16:54:16 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by userp3030.oracle.com with ESMTP id 36prq0qeh7-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UsXI2QBmSzWHMbqz6VC5/EuvmfFI4/nzT4+NXLtuYKsxcyQJhVmw6hnr2yAzCZR/+5TZItnp7gNZdgF6pVlJwhIeGPABvDXgJavMEGEKXIhnl7kSWiHmbCV1FRYEK9m1p+k5XWcghjRme75PlsRayk1C9wO0Pl1Ym6SNnfdVpxwlB9LWtQg7yLU8LV7ZxBtm6NaYrQFkw86Lmyg4wnR51EPF+grh6m+6zgTaypmOlOWFJrO7YDjfD1666GW2mx2Csz8994Ium6+PP/lzW3phFk5oJ8m1gJM0matJSRnjcqSv3/MW3d4r/NSXWIq2ib8UJJKW81FGnQXPzYtu+8jjmg== 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=0Hg1KhvkFZFjKijbVBZiY8vPLRXFFmSBVMkN0fi69D4=; b=gqLPotTZwP+7NEAT9qzJWn2D1QxX2Z8HbOet+BK8mYJAae7QowFscd4jk5XDjZr/fqV/bVp1X7s+rt767YGdz1TJyBgvYPTJTelzDo8WGEDALCMCfTPoedWdPB3F67kCBty9OYg96lRH2fxus/1JNwKxEoCt5nwUJUQpKaCu6A36EA44UBbIJyK5au+2UkUCgu4wFN8z06fS53/gw6eMbAHGBnRFxkj6ztHE5UTJ3RUlPyimCqWE1/aHaTVUg9wrQrQLpxXokM9mCvMJwzeo9/UPo7uhUFFP0PVNY9JkiBcSpIwQlzACG1QkGPQWxSY4Egq7j6yiM2mnkJUHwPVVLQ== 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=0Hg1KhvkFZFjKijbVBZiY8vPLRXFFmSBVMkN0fi69D4=; b=u8AgVQcSoDbssX2GiBMdIYNXN7JeqzLcnquk3EEY8Fyv9xHp8jMMyUMy7H6Yv/1Q9fxCUrhY860DpXDJjOrA2I8LZyIWhXqXV0crFpyd8Z/tVv453u5nJoay1GqQyxzgp3NzvymP2rJTkKfB+q35P+2KufyThF3nk7oGVt+qwXI= 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 BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:54:13 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:13 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 20/22] xfs: Add delayed attributes error tag Date: Thu, 18 Feb 2021 09:53:46 -0700 Message-Id: <20210218165348.4754-21-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30ed99ba-0faf-4125-f603-08d8d42dd169 X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XqJ9cVJ6lMosH9rTOT6ohtSQ0cWW211AZyNHK/BbELWxSjcBO0rZ5QOZJX0T2MCPWBniqCp55bW5AP7edjtlr0GjWq1hv4VyZ15A7KAP+GnQi4sPZ40WOeSzbvP/k6FXhkKxebKyjFPYvcByuIBflcOoMP2RJxTQDsp7A9G8xGOv62bpDP4uikzHapYfXCrp4/6aS5fzC+4+zqnTXMgAifWSyftPZ6KHhsH/VvcvJdaJAWITbrgpG383gMCIuXiMpNdihgOSLkntbJ5CBtZN4w7ftoUov+4UeTzfTWRYlN0A5IVW2Jqiu8UUwNBqtoNvffvEOm3mEGD+SozubyTd+6uG1x6ZowDrXj/oORnhISHmh8ZsEA4J1lB1jwoeAC+cfPehhhEAZET6DmQHUYq/cbJrJR5AIIXgjseMDMmMX/2Lu6rJWtLNcfjyhOPjWki62XEOCFxhXSDgMNTZq6cz4ueOl7QH2I+NPyr9JhmH0R9+l3mXHL7+Fx0aG70+FN8Ytq3Ep6I0T479C9oqgfgg26hcySnZtBEM/J5XAvc50czZxB95ihaAqkzIl+BddJ6FUMD2n5qUQ165sq4tyPMt/g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(39860400002)(366004)(136003)(376002)(396003)(5660300002)(52116002)(8936002)(6916009)(69590400012)(1076003)(478600001)(956004)(6512007)(26005)(16526019)(6486002)(186003)(2906002)(6506007)(2616005)(36756003)(83380400001)(66946007)(86362001)(44832011)(6666004)(66476007)(66556008)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2qnQFmjJQ7fE26gp7swad+gTsLs4SOVH8aFsZxcCxaxVbgDRncx2Nl4nLItuNe1ZPdrKFYcILE8kEYumiVNIQv47o2B9q7etELiu+Km1pFEnTF5vwa55ToPIYZOW0mMJ/WswJSXZQpM8A/QnXIQVBBbHnKTdSn7S+wpjwulu3HtiHFqJLquC11XhhWs4Lk+4vuM3Asbd+VTpwq5xL6SPgUpQZJ2rJOJeN/i7iDtYIW2236ZqYwaud+V4tqtS6I8mavdlKNT2eIwd1LQEIuix0WTPFit94BFHuMM4qEOSNgy8lULK2lrnD56FWhQ9FJ83Q6eWFe3L70r027myG7aIvkvvAWzEpRfJYMqvtPwPiRF0bnM72RMBrU2UtCu5WMDSsdMdVjf/Gnjk62IG7ZGgagQNyEc6mQfLj2vUBXEDAXKrENdKA1q3vhmK1lNYW6tBZUho7zvDfR9h2bqkhaYCAkVmMa9eVU+FU3lKcNxzDQKr4N12S8QfwUraAKBiaIE1uGIBNzTE3BDMSJS/q2VNoj9IDL9KjKDLC5LcrLYif1dzlXuFK9XIz7/7wqSBORQiKusr471cs20Ra9eWp7H0la9COeCEi3IcsFFYrZWV4yFKtQAoxq097F/nIc3cZSySrsFPLOYSR7In/PzFr3EoCR3kyBtSPxF9EPdIbgYvWR0RQwW5Ght9WaXpJKgRb8z0RtuefrDATD3TwbkBoolSTUb5EYnn1yOIoQKXjadr69vjfGpTzVD5aQVqusHmSPfmPejW4/lG3tFks3lu6PNyCQnPSwTxuoPokaQttyZ4SvnUnA+urjh4LA2sEmsJOiqC0728AUG//I92d47o3B1pDz1yicGV6j7y9lzJ24CZFRkQ1bZRQlR1rwUBlpaHT41o/CdK5FxXL2N5EANZS23QNMqLzUxBJCrbxLrwTOY3D3bAKq77xDPo/ppOpFxxVF41SPFkJ8kHF8jaFGofrRbwesV70DEqQKKO9CNA0VSLu2TmNUiuvzmvyEM5Lcxe7KSDVSj750j2tG82/Mrxddm6wqZo7o7XMcJ3ABlAP4mgTGKDCONucLlq/UxcoxDjznmQ0jnmXOcL/5Si212HyU9EH9JfdyAWDYgxCeI+iMErsp93hc8ywkh1uU6TfgHpTD5qRIGQMLXuUAOGwHO8yQdViH3MIpkK9H1AY8m9ZFRyafJkL7nlLhQEEXIxoXHKTDVtj7cNBuAX2iCdHMA4n/3i4fqDCwGNc2vuGYcEJ6mRv1hpUmRy084Qtj7ins9KHl4dR2G+4wQxyusFbOk3HHGEaWRgO2GyBAX+nURX9NcHbLHIpr0hXevEuqMb/M1DPBEs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30ed99ba-0faf-4125-f603-08d8d42dd169 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:12.6298 (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: s3dhMKxM2DzZn/Zfxh6uxqlMxWKcAIHLq9N9eDfLl7z/F2s5wjNrksPsrxToRStdIbOsfWa0pS1OQ0fM59VWcGoXkPGb9PqF4gymPj84cbI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 clxscore=1015 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds an error tag that we can use to test delayed attribute recovery and replay Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_errortag.h | 4 +++- fs/xfs/xfs_attr_item.c | 8 ++++++++ fs/xfs/xfs_error.c | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_errortag.h b/fs/xfs/libxfs/xfs_errortag.h index 6ca9084..72ad14b 100644 --- a/fs/xfs/libxfs/xfs_errortag.h +++ b/fs/xfs/libxfs/xfs_errortag.h @@ -58,7 +58,8 @@ #define XFS_ERRTAG_BUF_IOERROR 35 #define XFS_ERRTAG_REDUCE_MAX_IEXTENTS 36 #define XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT 37 -#define XFS_ERRTAG_MAX 38 +#define XFS_ERRTAG_DELAYED_ATTR 38 +#define XFS_ERRTAG_MAX 39 /* * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. @@ -101,5 +102,6 @@ #define XFS_RANDOM_BUF_IOERROR XFS_RANDOM_DEFAULT #define XFS_RANDOM_REDUCE_MAX_IEXTENTS 1 #define XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT 1 +#define XFS_RANDOM_DELAYED_ATTR 1 #endif /* __XFS_ERRORTAG_H_ */ diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 13b289b..842f84d 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -40,6 +40,8 @@ #include "xfs_trans_space.h" #include "xfs_log_priv.h" #include "xfs_log_recover.h" +#include "xfs_error.h" +#include "xfs_errortag.h" static const struct xfs_item_ops xfs_attri_item_ops; static const struct xfs_item_ops xfs_attrd_item_ops; @@ -300,6 +302,11 @@ xfs_trans_attr( if (error) return error; + if (XFS_TEST_ERROR(false, args->dp->i_mount, XFS_ERRTAG_DELAYED_ATTR)) { + error = -EIO; + goto out; + } + switch (op_flags) { case XFS_ATTR_OP_FLAGS_SET: args->op_flags |= XFS_DA_OP_ADDNAME; @@ -314,6 +321,7 @@ xfs_trans_attr( break; } +out: /* * Mark the transaction dirty, even on error. This ensures the * transaction is aborted, which: diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c index 185b491..39d1130 100644 --- a/fs/xfs/xfs_error.c +++ b/fs/xfs/xfs_error.c @@ -56,6 +56,7 @@ static unsigned int xfs_errortag_random_default[] = { XFS_RANDOM_BUF_IOERROR, XFS_RANDOM_REDUCE_MAX_IEXTENTS, XFS_RANDOM_BMAP_ALLOC_MINLEN_EXTENT, + XFS_RANDOM_DELAYED_ATTR, }; struct xfs_errortag_attr { @@ -168,6 +169,7 @@ XFS_ERRORTAG_ATTR_RW(iunlink_fallback, XFS_ERRTAG_IUNLINK_FALLBACK); XFS_ERRORTAG_ATTR_RW(buf_ioerror, XFS_ERRTAG_BUF_IOERROR); XFS_ERRORTAG_ATTR_RW(reduce_max_iextents, XFS_ERRTAG_REDUCE_MAX_IEXTENTS); XFS_ERRORTAG_ATTR_RW(bmap_alloc_minlen_extent, XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT); +XFS_ERRORTAG_ATTR_RW(delayed_attr, XFS_ERRTAG_DELAYED_ATTR); static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(noerror), @@ -208,6 +210,7 @@ static struct attribute *xfs_errortag_attrs[] = { XFS_ERRORTAG_ATTR_LIST(buf_ioerror), XFS_ERRORTAG_ATTR_LIST(reduce_max_iextents), XFS_ERRORTAG_ATTR_LIST(bmap_alloc_minlen_extent), + XFS_ERRORTAG_ATTR_LIST(delayed_attr), NULL, }; From patchwork Thu Feb 18 16:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093963 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 563C7C4332D for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23CA564EBB for ; Thu, 18 Feb 2021 18:48:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233108AbhBRSsE (ORCPT ); Thu, 18 Feb 2021 13:48:04 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53596 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234045AbhBRQzU (ORCPT ); Thu, 18 Feb 2021 11:55:20 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGsCM3016439 for ; Thu, 18 Feb 2021 16:54:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=TELCJEd5uF4UJyWKbbgm1G25QdqvA8g0LgxTzE2sca8=; b=aHC5Wlz/uedod3waR8TYJt+b8ejKuKIuKSHHDFRqKzfKukiyG6nvRIGLBzrnUUVak3Qs x+rm/e0ZwXuXVAsX6vL7JTEWBEbPftOIca0L0ztpx0aDB800iloGJkaFbAJU9ZNKo5RU y78E5tWvLHvgYvIYKePGGjqmlakWOIBd0+tTBret4Iul9AZgIWTWoyzCJcpNX5bYla6K /LxZwo95uWsXTRCfhzTvm24SjqcX3bDasm218mOt/vBrj0KoeErv5iAtZ+Zp7h8soKH9 NLIpPPDhcDGeRy/EHXzz2sSkzfanrY87OCMt0wDR0oRYGWlg2puna9fgzFQmSlqpg2bj lA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 36p7dnpj6x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:17 +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 11IGoALM119728 for ; Thu, 18 Feb 2021 16:54:16 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by userp3030.oracle.com with ESMTP id 36prq0qeh7-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dWDuDTKWXHM+bmVN+f7t3nERXKydM4B/FiUsJqNEvui4sxa9Zy/AANpz9IKk2fgVTUWEX56n8qXVI0SJ4M6FcPZmAPFA2MqUm2uWRc917Tb6/XYKPuKI3wC21M/UOpJWrH2li501UBua8fU19MNqwJ2vukM7dr/YRH8ZE8pqw+gPYYbsiEWE2LRam1P5V2VpBA1qVHgHamSbmn2y9KFZVgPVhpPrtnFrFIYXOnyVkvary2ny0o4S6+dxF8s75zRyMxhucTNFa554s487iknIlDA37866sj5ob8IB7ELy8QEdPdgw34UZ+KOCYplntCjSb3ww5hLcDLZmR6Ld4LPByw== 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=TELCJEd5uF4UJyWKbbgm1G25QdqvA8g0LgxTzE2sca8=; b=bknS2//qqs8EYnJ711paYBJULxWsjUfbcsNKgTiVn0fjTLhuioEZOS7VMTLyDMNnP+iWGR++lHXVQ9+tCFMqXSK7QmZrjI42FIffAy3hr2AyMRj8IzHURzrNY9hCaooNcO6yVo226GQWbjOM2YznRsuw+3TosCv42od05nq/xR9Nn0+P8hI0ir5RrIbuYi/WTp7JGRc5M1sSZwQR1ixU6+QiIJ579GywjnN9LTA/KNEE9q8v7bVrdGPoe8dIzawnkGykOp72V7FnBXAYGE1TAt7C2M+9o878s7aCCyi6lX2YnyA16bkL117cO+/pv+GEKnjbOt/yoCQJHhrXyxo3mA== 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=TELCJEd5uF4UJyWKbbgm1G25QdqvA8g0LgxTzE2sca8=; b=PFVjmMBlg2MiwTMgTPgdwrkeKyHog11Z2VpQNxLYlsP9cbWJhitsRP2ziiqiwkKxb0Fj0xIF7WK1KmNAb0wBe5DBvVfyTMNdXFRKw64UIXtB6SkIHXhbyLA8jEg/ISHyZ/CuHIoItBsh4SZn/ErYgcB3z+e2tnE66STfOEFQMDs= 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 BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:54:13 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:13 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 21/22] xfs: Add delattr mount option Date: Thu, 18 Feb 2021 09:53:47 -0700 Message-Id: <20210218165348.4754-22-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc07a81f-a513-4b91-8a7c-08d8d42dd1af X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8D+lQbCRwXecMeMK9RA7cR3aLB/CFtrSMqCcHpSMQiexV5mXs3TsmOSTdp97m7Zf9K/VKoTRuj27MZGmthqHlOCnUdYVAS8xFnWK5YaQcj2oQngfMaEH8ACpQ0x78zSRf3IhLME88O4HcF0ipRVKcaBzJpT8JukQ5hrls0pHdZfostaxDBAcWd8yMjPw4ogFJmcMtU7M3Fc+q1xO+eMqgO+50zbiVTFIfP2Qv/NhS3D8eD5TUpW73ctoRLxH0RLBelD21sH3JvivZqi8uuYiuF7f4IZ5ZT+2ImN8eWyjKnHTueEge5jEbAh2l+6Izr8JPFiWfReevsb9Ln1JPuHIE8hH4s9NDt5EFo8VvunPsvaoJhA9VuhTZGkaHSFxnyXz9urkxIq+wgozJnQ0O11xON6yzlUqlwCURFHoU1BTBShApODaPAQCwI5/qa+qAOrUzfeK48xHYSq8hQEp/xZ/k50jHy0CNrpZEI9B2bQvkiwO+fJ+iGnevkypWgJ3YBqNs7XZ3WzvwW4o0J9wn7jQFbk/O2PeU+OZkDJqSwKR4X7fpyy6NNeIK3XJFHtI9qQw0d91mMctYLv09nVOc7isPg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(39860400002)(366004)(136003)(376002)(396003)(5660300002)(52116002)(8936002)(6916009)(69590400012)(1076003)(478600001)(956004)(6512007)(26005)(16526019)(6486002)(186003)(2906002)(6506007)(2616005)(36756003)(83380400001)(66946007)(86362001)(44832011)(6666004)(66476007)(66556008)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tWQIfYcxrFoI91bb4CidTog3MndqO1PP9E2OcoWAZ/1ymLPayq6r9GD6yE38qlqW4K90AvVFdCGUcR5oaxx4Lmyl9LPaeHBTOBZxtFi8t0M1FHkwsCK95nXz+38RhNRBeI/fcZXzNqYuuGHhWTmWmgcoeyIyEMm0L72LGcCGST14HVuLUThsft9Xbe3RZ8iHYJRX616ou3c6AMNQLxeQ70dJPfO14vOEkeUZ0DVON7op52EFpTIvqacn9faSm8qcg9KjxKSJPD2FxEbVP1DyEC2G2IdcV6ZMZL0Nth+NAcjqCofnHS47UmscSwOHISIPYtukVnlscMe8or0mzyP5eU4W2BatBjc4YwbWnYebH/ChZWXv4Ac5s3RzPVYiL87jAXS37NqvnEJJZ51gS5IoYePtgBshrppHS4kioBF04XE52HB6UwAsAivOM5XOmiZY7q8NmfLOoLO++sHz0bjRC+5eoth0zaSyYwWUOmzHZqgZOtsLcWiBrdCoXKamAs2V3F36/uXZoHOVpVFJ8LLg6Mag9gqur5o2aqLktmBC0Dv+LfJptVOfT6WNIWnOR84VJz1TiTuHlR0tU/Y2lCFZy6x1wAQsIfZPlkcXMxfrt7Wibt+6oEZXA1wnMwzQ4H+KccRBGoPukIejOkcHSFMmZHa53FEolj8/wt5OEFVUjvkTst1i3UpMBWT9CTVpH+82SnpNduvrI07SipDKHInm5wnJM/+3hTuNMK19cfuZcVu1iknWD3jH8N0SrX/fVMI5hVJf6CosMy5/yJ3iFb5Df/9Mp6BKcp9UeQkGhIrY6TNfx7CpFNcKH7IZ4eP4Lr/dVPMR0piv2H+48AOFmat6Pl3HL46F4PRYdkgNlQd9D0SjK/kDzYuFlHtRTdfkg29Zhl/pzFdCTComeWPTtP/eSW7CyuHBIlMDwsADmpd2HSrcc7WZ0AZhmTTC+6LPWEZN2ImdI5FpK2bNeaI3sH7kUp1BEwc+5q/VV9gtKaqKPTdHWAo45cGqFfG0tFnq8XP03Sze/pGZhRSzDaWHMPKNXzpprwszVHNqWC2cvscUZF4L9RZPFZjk8Lm0NLO9Trg2LMEHuULDwZ4vjNwyAWyHICL/cCJpbr1CyB/k6d2pDV3lkdlLlDD5lzLNdktoWOq9mLKSPprt29gzYxapLC/cA12NhFfq0Dbn/g0YpGhDmtTVRQj9WHMISMFrA03k2qh8bb6Iyzi4OsLGE4RD915kqvPagYD/1lt9K8nmK0c5Y1PQG3bkXFdWW/UzJnaBBqvuY49R0uP81yWkJYt0ZX04a2kuSDl42JA1cKudGQV0T2x4svH1jsO/eEhEQPBg0LZa X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc07a81f-a513-4b91-8a7c-08d8d42dd1af X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:13.1296 (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: o5/crIclyxwRlWRvWfuxnGp4gVa3HzLoC9QYmHQDOAqbyg/YJ5NRuw6apwGdVhaSp5PfqDCSQck+8vJO1O0cdg8GEwhSUlf24AMjmnkPeyo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180143 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch adds a mount option to enable delayed attributes. Eventually this can be removed when delayed attrs becomes permanent. Signed-off-by: Allison Henderson --- fs/xfs/libxfs/xfs_attr.h | 2 +- fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_super.c | 6 +++++- fs/xfs/xfs_xattr.c | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index f82c0b1..35f3a53 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -30,7 +30,7 @@ struct xfs_attr_list_context; static inline bool xfs_hasdelattr(struct xfs_mount *mp) { - return false; + return mp->m_flags & XFS_MOUNT_DELATTR; } /* diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 659ad95..57cd914 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -250,6 +250,7 @@ typedef struct xfs_mount { #define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 format */ #define XFS_MOUNT_DAX_ALWAYS (1ULL << 26) #define XFS_MOUNT_DAX_NEVER (1ULL << 27) +#define XFS_MOUNT_DELATTR (1ULL << 28) /* enable delayed attributes */ /* * Max and min values for mount-option defined I/O diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 21b1d03..f6b08f9 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -93,7 +93,7 @@ enum { Opt_filestreams, Opt_quota, Opt_noquota, Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_uquota, Opt_gquota, Opt_pquota, Opt_uqnoenforce, Opt_gqnoenforce, Opt_pqnoenforce, Opt_qnoenforce, - Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum, + Opt_discard, Opt_nodiscard, Opt_dax, Opt_dax_enum, Opt_delattr }; static const struct fs_parameter_spec xfs_fs_parameters[] = { @@ -138,6 +138,7 @@ static const struct fs_parameter_spec xfs_fs_parameters[] = { fsparam_flag("nodiscard", Opt_nodiscard), fsparam_flag("dax", Opt_dax), fsparam_enum("dax", Opt_dax_enum, dax_param_enums), + fsparam_flag("delattr", Opt_delattr), {} }; @@ -1263,6 +1264,9 @@ xfs_fs_parse_param( xfs_mount_set_dax_mode(mp, result.uint_32); return 0; #endif + case Opt_delattr: + mp->m_flags |= XFS_MOUNT_DELATTR; + return 0; /* Following mount options will be removed in September 2025 */ case Opt_ikeep: xfs_warn(mp, "%s mount option is deprecated.", param->key); diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c index 9b0c790..8ec61df 100644 --- a/fs/xfs/xfs_xattr.c +++ b/fs/xfs/xfs_xattr.c @@ -8,6 +8,8 @@ #include "xfs_shared.h" #include "xfs_format.h" #include "xfs_log_format.h" +#include "xfs_trans_resv.h" +#include "xfs_mount.h" #include "xfs_da_format.h" #include "xfs_inode.h" #include "xfs_da_btree.h" From patchwork Thu Feb 18 16:53:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 12093981 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 34C14C433DB for ; Thu, 18 Feb 2021 18:48:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0F8864EC2 for ; Thu, 18 Feb 2021 18:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233169AbhBRSsX (ORCPT ); Thu, 18 Feb 2021 13:48:23 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:53764 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234046AbhBRQzW (ORCPT ); Thu, 18 Feb 2021 11:55:22 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11IGmxiE185321 for ; Thu, 18 Feb 2021 16:54:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2020-01-29; bh=7osTyVSwmEXRzaykOoUMW48UxjSqojrJKBLI/sROYa0=; b=TsbNTmahba/DxCZ6Fv+GtIW1l0BI6n+2v0Dg8H43TBC0fxqFoDjQYReMcWdk4I+UdDY0 75B9t3j6iseOry+sZ/jNepihzOczdiKM9mOTa0A0+QpKmClZsvOWsl7hF9ctCBw9xofz i+3iJpI4ZgHy1R2CTnxY43bTxQomJSS+3m/xCGLnljmvEGWJ4ynJCf19Tsm6tJjDQ7NT K9Ewm014fpPx6qPfY6G55R5zMXeV52OMU8PZX0E0JgdxKNbGM7Kd+/YSawubuRshseg+ 8ht9wZeijjuB1MCpPONcuJBkxKXpyJ5IP033qrfylgk1gKUdk49WPqalGS/B9BWWmQM2 BQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36p66r6n9a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:17 +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 11IGoALN119728 for ; Thu, 18 Feb 2021 16:54:17 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by userp3030.oracle.com with ESMTP id 36prq0qeh7-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 18 Feb 2021 16:54:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jxtc5n4soUs6WLOhphXebVkRac5M3N+cBuLzuQqdLBe6bGzLRKE+8nm2psuG2czwo1jwr0QlkQ2AAJzEkz87twWqZE4cXvm9QbbkBkgDE5lqm1fIQ8aj68Vr4CtlsKnIWPhfhSSUT+NcOntzRHXOmOLijgwkoUgJ4ldA5K2dEUFVH/nwG0CLih5NIDmOU0aI4nALKLYIunOdR6pIhplVYXSGWvSS+Ulj/ej9/XA+OyEM3oWi6trJ93pRYPLSSsXxRTd5nowaK1s4zlzdnUNkiLYjHtWCZ0RkMhsZOAfcGMhoyRoA4KC8c612IA1eBrS5/7bMOlk+9a3jIZYjp0N0TQ== 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=7osTyVSwmEXRzaykOoUMW48UxjSqojrJKBLI/sROYa0=; b=b9vmbniQhadm24+0P08/5qUqhhQrHbc/TNy6TWUP8k8oGl5WDnvRzqWA3oYGIal4dG+6z8IfIZIbC2rbPFQ0j87+3mx9aUrkalA5m4Vmo1FUNazALRU9VliqitGMqWaaZ4lShbuxTF63/1cVcGEw2TaGpK8s9nRxcx6fHvC5VdaxRFdw/t+qpoBDNdmYiLYOXy8EIjdDNNRIvXKuJPD0FqRIk9W7b0mmDA0jl7nTBjFxXf39XRl3k0/EkNySiVEIZrBicP46RsDQqBN8EkTyC9VJPGkehO1Ybr1YCYL3OZJjfDB7zEBpBqBO3R4XBt+eVEEZVf88pt2ShBZQ+afTig== 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=7osTyVSwmEXRzaykOoUMW48UxjSqojrJKBLI/sROYa0=; b=pRLYLgqr97v2/l9ZzfgWSgdEM1ZveVmd2G4Auwv9WpJKzyDjKf9eE2URl0SkcGG9qjB0USKYKhFgz30eN5wWZUpHbH5BioPLR5mP9Em9TA03yNztxJHe2CBy9rudweGxWPsa2PdsUElSw4MiTUM5v3GgHmrd6LlKE8l9pJkPMw4= 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 BYAPR10MB3605.namprd10.prod.outlook.com (2603:10b6:a03:129::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Thu, 18 Feb 2021 16:54:14 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::f4a1:6643:4c93:2a9f%3]) with mapi id 15.20.3846.042; Thu, 18 Feb 2021 16:54:14 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH v15 22/22] xfs: Merge xfs_delattr_context into xfs_attr_item Date: Thu, 18 Feb 2021 09:53:48 -0700 Message-Id: <20210218165348.4754-23-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218165348.4754-1-allison.henderson@oracle.com> References: <20210218165348.4754-1-allison.henderson@oracle.com> X-Originating-IP: [67.1.223.248] X-ClientProxiedBy: SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (67.1.223.248) by SJ0PR03CA0352.namprd03.prod.outlook.com (2603:10b6:a03:39c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 16:54:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f8dcbf5-22f7-4e43-86d8-08d8d42dd1f9 X-MS-TrafficTypeDiagnostic: BYAPR10MB3605: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:230; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iuEChGLwUIqJLumwApsoFzylJYe3f0bvfc+uChUoyr3bGumBmyL7M827Vvd6ujrTLyrz+lXsT13QZZFuISrr4PjbAle1JU8RKio4eJ4gLfSiL6tEBD7dY6s2hwKrlzj+TTlwHcngXg7xzcax4EcLoTrOW/lopz89HAC12TVgdiV7pIWmo+wIs9rXI6O5rDKHICjYdj/q0GnV97f2ps92x0P99haV++WSSIHWl5f8acv7fAQHyHDbjgRrVUSBY1akYigOP4KXIoc87Kpw8nRpZ05caCFFXzg8tYpTlJlzC9smwDvCKUefKVh7QwIQIeRO9BfzYFk6D/nRBbe2ymGxCDFpQQq6QCC9AhktSeXIdtoAgTiRb9JAuyGtyyOL3WxZpz9QI1pto0+LUpKxQVuahDsKEq+67gsJrxu81J4RR4DiSS56ZE6IP0AJGBYyE6leY8bZeRUUqbvORbENWvCDzdl/uVfGRGZamCAo7jeEdcpUlZJRD59w1DuffYLfG3WH3xRecPHLGcl8WLAUfeP6e6LVDzij+CXqVusoURRfoHoUwxfC9rsI0D1C3zqOHds5i3azhsD16EqxcDLilTcuYw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(39860400002)(366004)(136003)(376002)(396003)(5660300002)(52116002)(8936002)(6916009)(69590400012)(1076003)(478600001)(956004)(6512007)(26005)(16526019)(6486002)(186003)(2906002)(6506007)(2616005)(36756003)(83380400001)(66946007)(86362001)(44832011)(6666004)(66476007)(66556008)(8676002)(316002)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jDi8xWnkzQRV8Nf3LUyxjfh2JgbBYWTbSuhNQnJuVUCxo6AwHRnzGQouasM/KI3SLvQ69jkYHZowBLfh0bSTKZ4oetn8Bv4Eg3vSWvF5p1zcWamPT16HrimcIdOZ6en0Dmgx/0q9YGwou+UtB1pijy9v47uMu0REMsB59bNoV6dPhQ4GiuZ9/keETQ8QT5ObMI6ZYEMhWSDKagiMhPRpcr1wBu3TsP508KBys8zFmdxVtiPCfv8hgK90CIr54C4xW4Imp+MVeM1cdfMSmNYlLURVJK4P5UhyofBgUh09LuaahBxWzig5mPs3AKRQ7T6GS2oMciT3z4pNcwFPL60/ai/JLyyIbwXqQpnMiQF1w52qdfMUh835wwOHw2piW7RmzcZOd8X1GkW568H0JyUxdAm9m1N1Pe+Wm8p2mEXmAnv0+t7Docw2CN4jaFWY5E43pYeU3DdLQHhnuUfkqLUJfUCKpR5sIRP6dkwdLuAIoGvIa3cvFKFbiujJsxiKVx2zDN5G1OmYoTWBFPArsb8AK5eQJAQ2UvwXgVxy/Rynw1thhWipOqxRsyz1ap2Kk176Wu6ky8sjOBjQ4ZViZhNYUGbiRgLoYLuEu6GEIFt8sKhgSufIXZCpWfYDULUz8f7EX8ecOMZ1kAHhb16zZK57EIssUFGQeSiGl41gsTkEGH0i8w6klkTjvP0oxSgNGRadkWTj6Csi2hlPrRxC2GEbay00IkSox5bUkWzkvC/Z4+dj+k627FEYUXTZMgrRUSKaP3DxNAIMgxPTE66Nl6m3PFmQ2ieqpQlZSqBrR89+JDwX2zStGEF1E0zrlFrO04kXfkptGfhfpDg6rIWDCrJb5H+sPVdXmDqcBxlSdJJZ0/ooxQpjTSgNqUlHcQN3qdCsmnwdW1tt85NGtXpyGtTAXQ/U6d2DdzjjDDLry5ZHig9Sr26rSFD02WaZ5IAXV6D9TFbUCQzGmQo7U/MQ7kAf+XJWLpqzwFHCcRgqJGIa+1y1hOmctpNhaDxogezkFigAeZ6zhiwtW1fo9IjS2gOSCoF1Tf+iMqwODJG3BAw2gpwNu6Re2sILrbmk1qxhDKQgPasG9FFiXHyWSH+XdeeLsHJ5vBCZlK27fhp5JjXfhrthzFpqXC/5MTJbXjNDrRKe5iG1UuM6GJRFw5utgFUpJdj8v9i9O9hh/7ukNzhZpTrQGNfQp3I3beb1PfKWptRza6zOXsZDB02KfUfpHom9LOEVclsEbiic8xbtL/jZTH+LDY2NFbRhbQnkbZRgnmcsZIKc5/jTJkalltU0emDDfhuZ4snrkOIagFvKufLwidOMMrLTdP+ELnvF3CkRMrkk X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f8dcbf5-22f7-4e43-86d8-08d8d42dd1f9 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 16:54:13.6493 (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: a1TI2/AMos5DOd9rh6QPplrNcwWvQWbob3avihTy0lrtug8kXELUA7+U42EOPH+5RremW8UjZYs3WcV0uj/fabdq5YchrLroxQIfIW+G08Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3605 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9898 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102180142 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This is a clean up patch that merges xfs_delattr_context into xfs_attr_item. Now that the refactoring is complete and the delayed operation infastructure is in place, we can combine these to eliminate the extra struct Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_attr.c | 159 ++++++++++++++++++++-------------------- fs/xfs/libxfs/xfs_attr.h | 40 +++++----- fs/xfs/libxfs/xfs_attr_remote.c | 35 ++++----- fs/xfs/libxfs/xfs_attr_remote.h | 6 +- fs/xfs/xfs_attr_item.c | 46 ++++++------ 5 files changed, 139 insertions(+), 147 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 8b62447..76ad617 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -55,10 +55,10 @@ STATIC int xfs_attr_leaf_try_add(struct xfs_da_args *args, struct xfs_buf *bp); */ STATIC int xfs_attr_node_get(xfs_da_args_t *args); STATIC void xfs_attr_restore_rmt_blk(struct xfs_da_args *args); -STATIC int xfs_attr_node_addname(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_addname_find_attr(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_addname_work(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_removename_iter(struct xfs_delattr_context *dac); +STATIC int xfs_attr_node_addname(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_addname_find_attr(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_addname_work(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_removename_iter(struct xfs_attr_item *attr); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); @@ -223,11 +223,11 @@ xfs_attr_is_shortform( STATIC int xfs_attr_set_fmt( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; - struct xfs_buf **leaf_bp = &dac->leaf_bp; + struct xfs_buf **leaf_bp = &attr->xattri_leaf_bp; int error = 0; /* @@ -272,10 +272,10 @@ xfs_attr_set_fmt( */ int xfs_attr_set_iter( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_buf **leaf_bp = &dac->leaf_bp; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_buf **leaf_bp = &attr->xattri_leaf_bp; struct xfs_inode *dp = args->dp; struct xfs_buf *bp = NULL; struct xfs_da_state *state = NULL; @@ -284,10 +284,10 @@ xfs_attr_set_iter( struct xfs_mount *mp = args->dp->i_mount; /* State machine switch */ - switch (dac->dela_state) { + switch (attr->xattri_dela_state) { case XFS_DAS_UNINIT: if (xfs_attr_is_shortform(dp)) - return xfs_attr_set_fmt(dac); + return xfs_attr_set_fmt(attr); /* * After a shortform to leaf conversion, we need to hold the @@ -325,18 +325,18 @@ xfs_attr_set_iter( * handling code below */ trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } else if (error) return error; } else { - error = xfs_attr_node_addname_find_attr(dac); + error = xfs_attr_node_addname_find_attr(attr); if (error) return error; - error = xfs_attr_node_addname(dac); + error = xfs_attr_node_addname(attr); if (error) return error; @@ -347,14 +347,15 @@ xfs_attr_set_iter( if (!args->rmtblkno && !args->rmtblkno2) return error; - dac->dela_state = XFS_DAS_FOUND_NBLK; - trace_xfs_attr_set_iter_return(dac->dela_state, + attr->xattri_dela_state = XFS_DAS_FOUND_NBLK; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } - dac->dela_state = XFS_DAS_FOUND_LBLK; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + attr->xattri_dela_state = XFS_DAS_FOUND_LBLK; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; case XFS_DAS_FOUND_LBLK: @@ -366,10 +367,10 @@ xfs_attr_set_iter( */ /* Open coded xfs_attr_rmtval_set without trans handling */ - if ((dac->flags & XFS_DAC_LEAF_ADDNAME_INIT) == 0) { - dac->flags |= XFS_DAC_LEAF_ADDNAME_INIT; + if ((attr->xattri_flags & XFS_DAC_LEAF_ADDNAME_INIT) == 0) { + attr->xattri_flags |= XFS_DAC_LEAF_ADDNAME_INIT; if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_find_space(dac); + error = xfs_attr_rmtval_find_space(attr); if (error) return error; } @@ -379,12 +380,12 @@ xfs_attr_set_iter( * Roll through the "value", allocating blocks on disk as * required. */ - if (dac->blkcnt > 0) { - error = xfs_attr_rmtval_set_blk(dac); + if (attr->xattri_blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(attr); if (error) return error; - trace_xfs_attr_set_iter_return(dac->dela_state, + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -422,8 +423,8 @@ xfs_attr_set_iter( * Commit the flag value change and start the next trans * in series. */ - dac->dela_state = XFS_DAS_FLIP_LFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, + attr->xattri_dela_state = XFS_DAS_FLIP_LFLAG; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -441,15 +442,15 @@ xfs_attr_set_iter( return error; /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ - dac->dela_state = XFS_DAS_RM_LBLK; + attr->xattri_dela_state = XFS_DAS_RM_LBLK; /* fallthrough */ case XFS_DAS_RM_LBLK: if (args->rmtblkno) { - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); if (error) return error; } @@ -487,7 +488,7 @@ xfs_attr_set_iter( * Open coded xfs_attr_rmtval_set without trans * handling */ - error = xfs_attr_rmtval_find_space(dac); + error = xfs_attr_rmtval_find_space(attr); if (error) return error; @@ -496,19 +497,19 @@ xfs_attr_set_iter( * as required. Set the state in case of -EAGAIN return * code */ - dac->dela_state = XFS_DAS_ALLOC_NODE; + attr->xattri_dela_state = XFS_DAS_ALLOC_NODE; } /* fallthrough */ case XFS_DAS_ALLOC_NODE: if (args->rmtblkno > 0) { - if (dac->blkcnt > 0) { - error = xfs_attr_rmtval_set_blk(dac); + if (attr->xattri_blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(attr); if (error) return error; trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -545,8 +546,8 @@ xfs_attr_set_iter( * Commit the flag value change and start the next trans * in series */ - dac->dela_state = XFS_DAS_FLIP_NFLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, + attr->xattri_dela_state = XFS_DAS_FLIP_NFLAG; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -564,21 +565,21 @@ xfs_attr_set_iter( return error; /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ - dac->dela_state = XFS_DAS_RM_NBLK; + attr->xattri_dela_state = XFS_DAS_RM_NBLK; /* fallthrough */ case XFS_DAS_RM_NBLK: if (args->rmtblkno) { - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); if (error) return error; } - error = xfs_attr_node_addname_work(dac); + error = xfs_attr_node_addname_work(attr); out: if (state) @@ -588,7 +589,7 @@ xfs_attr_set_iter( return retval; default: - ASSERT(dac->dela_state != XFS_DAS_RM_SHRINK); + ASSERT(attr->xattri_dela_state != XFS_DAS_RM_SHRINK); break; } @@ -636,13 +637,13 @@ xfs_has_attr( */ int xfs_attr_remove_iter( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; /* If we are shrinking a node, resume shrink */ - if (dac->dela_state == XFS_DAS_RM_SHRINK) + if (attr->xattri_dela_state == XFS_DAS_RM_SHRINK) goto node; if (!xfs_inode_hasattr(dp)) @@ -657,7 +658,7 @@ xfs_attr_remove_iter( return xfs_attr_leaf_removename(args); node: /* If we are not short form or leaf, then proceed to remove node */ - return xfs_attr_node_removename_iter(dac); + return xfs_attr_node_removename_iter(attr); } /* @@ -808,7 +809,7 @@ xfs_attr_item_init( new = kmem_zalloc(sizeof(struct xfs_attr_item), KM_NOFS); new->xattri_op_flags = op_flags; - new->xattri_dac.da_args = args; + new->xattri_da_args = args; *attr = new; return 0; @@ -1121,16 +1122,16 @@ xfs_attr_node_hasname( STATIC int xfs_attr_node_addname_find_attr( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; int retval; /* * Search to see if name already exists, and get back a pointer * to where it should go. */ - retval = xfs_attr_node_hasname(args, &dac->da_state); + retval = xfs_attr_node_hasname(args, &attr->xattri_da_state); if (retval != -ENOATTR && retval != -EEXIST) return retval; @@ -1158,8 +1159,8 @@ xfs_attr_node_addname_find_attr( return 0; out: - if (dac->da_state) - xfs_da_state_free(dac->da_state); + if (attr->xattri_da_state) + xfs_da_state_free(attr->xattri_da_state); return retval; } @@ -1180,10 +1181,10 @@ xfs_attr_node_addname_find_attr( */ STATIC int xfs_attr_node_addname( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_da_state *state = dac->da_state; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_da_state *state = attr->xattri_da_state; struct xfs_da_state_blk *blk; int error; @@ -1214,7 +1215,7 @@ xfs_attr_node_addname( * this point. */ trace_xfs_attr_node_addname_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -1243,9 +1244,9 @@ xfs_attr_node_addname( STATIC int xfs_attr_node_addname_work( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_da_state *state = NULL; struct xfs_da_state_blk *blk; int retval = 0; @@ -1353,10 +1354,10 @@ xfs_attr_leaf_mark_incomplete( */ STATIC int xfs_attr_node_removename_setup( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_da_state **state = &dac->da_state; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_da_state **state = &attr->xattri_da_state; int error; error = xfs_attr_node_hasname(args, state); @@ -1384,7 +1385,7 @@ int xfs_attr_node_removename_setup( STATIC int xfs_attr_node_remove_rmt ( - struct xfs_delattr_context *dac, + struct xfs_attr_item *attr, struct xfs_da_state *state) { int error = 0; @@ -1392,10 +1393,10 @@ xfs_attr_node_remove_rmt ( /* * May return -EAGAIN to request that the caller recall this function */ - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) - trace_xfs_attr_node_remove_rmt_return(dac->dela_state, - dac->da_args->dp); + trace_xfs_attr_node_remove_rmt_return(attr->xattri_dela_state, + attr->xattri_da_args->dp); if (error) return error; @@ -1439,10 +1440,10 @@ xfs_attr_node_remove_cleanup( */ STATIC int xfs_attr_node_remove_step( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_da_state *state = dac->da_state; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_da_state *state = attr->xattri_da_state; int error = 0; /* @@ -1454,7 +1455,7 @@ xfs_attr_node_remove_step( /* * May return -EAGAIN. Remove blocks until args->rmtblkno == 0 */ - error = xfs_attr_node_remove_rmt(dac, state); + error = xfs_attr_node_remove_rmt(attr, state); if (error) return error; } @@ -1475,29 +1476,29 @@ xfs_attr_node_remove_step( */ STATIC int xfs_attr_node_removename_iter( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_da_state *state = NULL; int retval, error; struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); - if (!dac->da_state) { - error = xfs_attr_node_removename_setup(dac); + if (!attr->xattri_da_state) { + error = xfs_attr_node_removename_setup(attr); if (error) goto out; } - state = dac->da_state; + state = attr->xattri_da_state; - switch (dac->dela_state) { + switch (attr->xattri_dela_state) { case XFS_DAS_UNINIT: /* * repeatedly remove remote blocks, remove the entry and join. * returns -EAGAIN or 0 for completion of the step. */ - error = xfs_attr_node_remove_step(dac); + error = xfs_attr_node_remove_step(attr); if (error) break; @@ -1513,9 +1514,9 @@ xfs_attr_node_removename_iter( if (error) goto out; - dac->dela_state = XFS_DAS_RM_SHRINK; + attr->xattri_dela_state = XFS_DAS_RM_SHRINK; trace_xfs_attr_node_removename_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -1536,7 +1537,7 @@ xfs_attr_node_removename_iter( if (error == -EAGAIN) { trace_xfs_attr_node_removename_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return error; } out: diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h index 35f3a53..c0015a4 100644 --- a/fs/xfs/libxfs/xfs_attr.h +++ b/fs/xfs/libxfs/xfs_attr.h @@ -370,7 +370,7 @@ struct xfs_attr_list_context { */ /* - * Enum values for xfs_delattr_context.da_state + * Enum values for xfs_attr_item.xattri_da_state * * These values are used by delayed attribute operations to keep track of where * they were before they returned -EAGAIN. A return code of -EAGAIN signals the @@ -391,7 +391,7 @@ enum xfs_delattr_state { }; /* - * Defines for xfs_delattr_context.flags + * Defines for xfs_attr_item.xattri_flags */ #define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/ #define XFS_DAC_DELAYED_OP_INIT 0x02 /* delayed operations init*/ @@ -399,32 +399,25 @@ enum xfs_delattr_state { /* * Context used for keeping track of delayed attribute operations */ -struct xfs_delattr_context { - struct xfs_da_args *da_args; +struct xfs_attr_item { + struct xfs_da_args *xattri_da_args; /* * Used by xfs_attr_set to hold a leaf buffer across a transaction roll */ - struct xfs_buf *leaf_bp; + struct xfs_buf *xattri_leaf_bp; /* Used in xfs_attr_rmtval_set_blk to roll through allocating blocks */ - struct xfs_bmbt_irec map; - xfs_dablk_t lblkno; - int blkcnt; + struct xfs_bmbt_irec xattri_map; + xfs_dablk_t xattri_lblkno; + int xattri_blkcnt; /* Used in xfs_attr_node_removename to roll through removing blocks */ - struct xfs_da_state *da_state; + struct xfs_da_state *xattri_da_state; /* Used to keep track of current state of delayed operation */ - unsigned int flags; - enum xfs_delattr_state dela_state; -}; - -/* - * List of attrs to commit later. - */ -struct xfs_attr_item { - struct xfs_delattr_context xattri_dac; + unsigned int xattri_flags; + enum xfs_delattr_state xattri_dela_state; /* * Indicates if the attr operation is a set or a remove @@ -432,7 +425,10 @@ struct xfs_attr_item { */ uint32_t xattri_op_flags; - /* used to log this item to an intent */ + /* + * used to log this item to an intent containing a list of attrs to + * commit later + */ struct list_head xattri_list; }; @@ -451,12 +447,10 @@ int xfs_inode_hasattr(struct xfs_inode *ip); int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_set(struct xfs_da_args *args); -int xfs_attr_set_iter(struct xfs_delattr_context *dac); +int xfs_attr_set_iter(struct xfs_attr_item *attr); int xfs_has_attr(struct xfs_da_args *args); -int xfs_attr_remove_iter(struct xfs_delattr_context *dac); +int xfs_attr_remove_iter(struct xfs_attr_item *attr); bool xfs_attr_namecheck(const void *name, size_t length); -void xfs_delattr_context_init(struct xfs_delattr_context *dac, - struct xfs_da_args *args); int xfs_attr_calc_size(struct xfs_da_args *args, int *local); int xfs_attr_set_deferred(struct xfs_da_args *args); int xfs_attr_remove_deferred(struct xfs_da_args *args); diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c index 78bb552..ad06018 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.c +++ b/fs/xfs/libxfs/xfs_attr_remote.c @@ -634,14 +634,14 @@ xfs_attr_rmtval_set( */ int xfs_attr_rmtval_find_space( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_bmbt_irec *map = &dac->map; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_bmbt_irec *map = &attr->xattri_map; int error; - dac->lblkno = 0; - dac->blkcnt = 0; + attr->xattri_lblkno = 0; + attr->xattri_blkcnt = 0; args->rmtblkcnt = 0; args->rmtblkno = 0; memset(map, 0, sizeof(struct xfs_bmbt_irec)); @@ -650,8 +650,8 @@ xfs_attr_rmtval_find_space( if (error) return error; - dac->blkcnt = args->rmtblkcnt; - dac->lblkno = args->rmtblkno; + attr->xattri_blkcnt = args->rmtblkcnt; + attr->xattri_lblkno = args->rmtblkno; return 0; } @@ -664,17 +664,17 @@ xfs_attr_rmtval_find_space( */ int xfs_attr_rmtval_set_blk( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; - struct xfs_bmbt_irec *map = &dac->map; + struct xfs_bmbt_irec *map = &attr->xattri_map; int nmap; int error; nmap = 1; - error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)dac->lblkno, - dac->blkcnt, XFS_BMAPI_ATTRFORK, args->total, + error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)attr->xattri_lblkno, + attr->xattri_blkcnt, XFS_BMAPI_ATTRFORK, args->total, map, &nmap); if (error) return error; @@ -684,8 +684,8 @@ xfs_attr_rmtval_set_blk( (map->br_startblock != HOLESTARTBLOCK)); /* roll attribute extent map forwards */ - dac->lblkno += map->br_blockcount; - dac->blkcnt -= map->br_blockcount; + attr->xattri_lblkno += map->br_blockcount; + attr->xattri_blkcnt -= map->br_blockcount; return 0; } @@ -738,9 +738,9 @@ xfs_attr_rmtval_invalidate( */ int xfs_attr_rmtval_remove( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; int error, done; /* @@ -762,7 +762,8 @@ xfs_attr_rmtval_remove( * by the parent */ if (!done) { - trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); + trace_xfs_attr_rmtval_remove_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; } diff --git a/fs/xfs/libxfs/xfs_attr_remote.h b/fs/xfs/libxfs/xfs_attr_remote.h index 6ae91af..d3aa27d 100644 --- a/fs/xfs/libxfs/xfs_attr_remote.h +++ b/fs/xfs/libxfs/xfs_attr_remote.h @@ -13,9 +13,9 @@ int xfs_attr_rmtval_set(struct xfs_da_args *args); int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map, xfs_buf_flags_t incore_flags); int xfs_attr_rmtval_invalidate(struct xfs_da_args *args); -int xfs_attr_rmtval_remove(struct xfs_delattr_context *dac); +int xfs_attr_rmtval_remove(struct xfs_attr_item *attr); int xfs_attr_rmt_find_hole(struct xfs_da_args *args); int xfs_attr_rmtval_set_value(struct xfs_da_args *args); -int xfs_attr_rmtval_set_blk(struct xfs_delattr_context *dac); -int xfs_attr_rmtval_find_space(struct xfs_delattr_context *dac); +int xfs_attr_rmtval_set_blk(struct xfs_attr_item *attr); +int xfs_attr_rmtval_find_space(struct xfs_attr_item *attr); #endif /* __XFS_ATTR_REMOTE_H__ */ diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 842f84d..b943c20 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -291,11 +291,11 @@ xfs_attrd_item_release( */ int xfs_trans_attr( - struct xfs_delattr_context *dac, + struct xfs_attr_item *attr, struct xfs_attrd_log_item *attrdp, uint32_t op_flags) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; int error; error = xfs_qm_dqattach_locked(args->dp, 0); @@ -310,11 +310,11 @@ xfs_trans_attr( switch (op_flags) { case XFS_ATTR_OP_FLAGS_SET: args->op_flags |= XFS_DA_OP_ADDNAME; - error = xfs_attr_set_iter(dac); + error = xfs_attr_set_iter(attr); break; case XFS_ATTR_OP_FLAGS_REMOVE: ASSERT(XFS_IFORK_Q(args->dp)); - error = xfs_attr_remove_iter(dac); + error = xfs_attr_remove_iter(attr); break; default: error = -EFSCORRUPTED; @@ -358,16 +358,16 @@ xfs_attr_log_item( * structure with fields from this xfs_attr_item */ attrp = &attrip->attri_format; - attrp->alfi_ino = attr->xattri_dac.da_args->dp->i_ino; + attrp->alfi_ino = attr->xattri_da_args->dp->i_ino; attrp->alfi_op_flags = attr->xattri_op_flags; - attrp->alfi_value_len = attr->xattri_dac.da_args->valuelen; - attrp->alfi_name_len = attr->xattri_dac.da_args->namelen; - attrp->alfi_attr_flags = attr->xattri_dac.da_args->attr_filter; - - attrip->attri_name = (void *)attr->xattri_dac.da_args->name; - attrip->attri_value = attr->xattri_dac.da_args->value; - attrip->attri_name_len = attr->xattri_dac.da_args->namelen; - attrip->attri_value_len = attr->xattri_dac.da_args->valuelen; + attrp->alfi_value_len = attr->xattri_da_args->valuelen; + attrp->alfi_name_len = attr->xattri_da_args->namelen; + attrp->alfi_attr_flags = attr->xattri_da_args->attr_filter; + + attrip->attri_name = (void *)attr->xattri_da_args->name; + attrip->attri_value = attr->xattri_da_args->value; + attrip->attri_name_len = attr->xattri_da_args->namelen; + attrip->attri_value_len = attr->xattri_da_args->valuelen; } /* Get an ATTRI. */ @@ -408,10 +408,8 @@ xfs_attr_finish_item( struct xfs_attr_item *attr; struct xfs_attrd_log_item *done_item = NULL; int error; - struct xfs_delattr_context *dac; attr = container_of(item, struct xfs_attr_item, xattri_list); - dac = &attr->xattri_dac; if (done) done_item = ATTRD_ITEM(done); @@ -423,19 +421,18 @@ xfs_attr_finish_item( * in a standard delay op, so we need to catch this here and rejoin the * leaf to the new transaction */ - if (attr->xattri_dac.leaf_bp && - attr->xattri_dac.leaf_bp->b_transp != tp) { - xfs_trans_bjoin(tp, attr->xattri_dac.leaf_bp); - xfs_trans_bhold(tp, attr->xattri_dac.leaf_bp); + if (attr->xattri_leaf_bp && attr->xattri_leaf_bp->b_transp != tp) { + xfs_trans_bjoin(tp, attr->xattri_leaf_bp); + xfs_trans_bhold(tp, attr->xattri_leaf_bp); } /* * Always reset trans after EAGAIN cycle * since the transaction is new */ - dac->da_args->trans = tp; + attr->xattri_da_args->trans = tp; - error = xfs_trans_attr(dac, done_item, attr->xattri_op_flags); + error = xfs_trans_attr(attr, done_item, attr->xattri_op_flags); if (error != -EAGAIN) kmem_free(attr); @@ -570,7 +567,7 @@ xfs_attri_item_recover( struct xfs_attrd_log_item *done_item = NULL; struct xfs_attr_item attr = { .xattri_op_flags = attrip->attri_format.alfi_op_flags, - .xattri_dac.da_args = &args, + .xattri_da_args = &args, }; /* @@ -630,8 +627,7 @@ xfs_attri_item_recover( xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(args.trans, ip, 0); - error = xfs_trans_attr(&attr.xattri_dac, done_item, - attrp->alfi_op_flags); + error = xfs_trans_attr(&attr, done_item, attrp->alfi_op_flags); if (error == -EAGAIN) { /* * There's more work to do, so make a new xfs_attr_item and add @@ -648,7 +644,7 @@ xfs_attri_item_recover( memcpy(new_args, &args, sizeof(struct xfs_da_args)); memcpy(new_attr, &attr, sizeof(struct xfs_attr_item)); - new_attr->xattri_dac.da_args = new_args; + new_attr->xattri_da_args = new_args; memset(&new_attr->xattri_list, 0, sizeof(struct list_head)); xfs_defer_add(args.trans, XFS_DEFER_OPS_TYPE_ATTR,