From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D307BC433F5 for ; Wed, 18 May 2022 00:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231205AbiERAM6 (ORCPT ); Tue, 17 May 2022 20:12:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232384AbiERAMr (ORCPT ); Tue, 17 May 2022 20:12:47 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCCF149CA1 for ; Tue, 17 May 2022 17:12:45 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKSZdk023116 for ; Wed, 18 May 2022 00:12:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=ZHYNydA9GKnYAliU4YKLpJs8IwQVzWjktOOc18zaPm0=; b=ooWnEnCqWjKbl0iG7fpyNsEGQse2/6sKQLf8igWxRI+k6reaOFARLQQK3IGy9w/YCVEI HdJzuLZvo+diYvkLQoSK6O3IdlmAjooEaBkjdGaXsFyXvQKCs8ZVewf+c/LmulJm7Xlv 0Lx2ZaALooRSJO9hCm9cIxyFvNI2o8Zs5r+JI5vXNM4W9cKr9/QyjqMqbHBXSCyx6II1 E+0g2FZTRZP79bZMTBU+QrSzp0iGyOMg2JL+jIeettodbuj/tw23QhfpsNPlY8jYsaLg hxWd4LBFgNclteG7ApoZT6KFyNGraVU+qL00IvwGd3a/0jVx+6TLW26YfKFp8Z2FZNIr jA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241s7ss3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 18 May 2022 00:12:44 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24I0BXph017045 for ; Wed, 18 May 2022 00:12:44 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3ebar-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 18 May 2022 00:12:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mnLG/ogTnpM/j527SEPXdM2T8K4/aijF2uqEyrdcRpzwXGzkmx2P7sRw2JUXGs4A4H1p7W3BhK5fqjQsnE8xVX0AVUYtO6cUio68R6tVXGw7PgK+xnEvkNyNfG4UOVpR4NLQT2cFoywXZC/ebppXRDTCXCSylonK5YatcwlRtev9YTFppcFOPJECTjMmOy/UITHDLwkr2VvKcAplMOfh7fhuBuLuhG9fpkP9/Y2ICj3YKGwlKt6mzViDyk6jeRhfir6r6A6h9/4TbDcnELV+pRod5SvZ5acsrh5VwORags6fiAfWlfxzysHmIUJKlyKLYBXA0e+C2EuxtvdoXK4uxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZHYNydA9GKnYAliU4YKLpJs8IwQVzWjktOOc18zaPm0=; b=PYjp+LMsWBkplTRLI3FBfEehKnh8lK1QvON+QCAPUUhClTms41QSSq9dIs+fHbhDMRjunSID79C4i5JePcMQDqQ2jyUSt+xKduHm6oVGwZaAlw3L/XcrNMkrMdh1mtAgdd2EMsBTSwRp7JpVLnO8qoLfm3NdlDK8KltHojgfeOQSYCKMFETTmJPpNUfF/b7aCFSsj4S2rEFlvVq8XahfBQ0XzNZDf+uzp3CrnDA8lznJ1yOP9hq0ZaxFSlJGfWZ4+yO+QnKWhZCN6cjlLGECl3l1SDaxd/oK+PqjfCKhSyELQ6CHQtcvf9RsWKgSIrJJXZN1LN57Gr91q6vo8XLyeQ== 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=ZHYNydA9GKnYAliU4YKLpJs8IwQVzWjktOOc18zaPm0=; b=sJ/d8n4PViyWLfC+HGCgu3DqRRR6qscrhHnL+qgVlp3kh5/hhsYlwVq9xmcdf/oOg9Mn3992aBDz9wCDhaJn5yPbR6bW+wN/Rl4vCemHKVL3hh1ePkM3U4lcOQZqBxCKdYLoULgg9w9ttMPqbP37ynR2pYB97om6PAqwMr3/fmQ= Received: from BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) by CY4PR10MB1528.namprd10.prod.outlook.com (2603:10b6:903:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Wed, 18 May 2022 00:12:41 +0000 Received: from BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::918:be3d:3964:a311]) by BY5PR10MB4306.namprd10.prod.outlook.com ([fe80::918:be3d:3964:a311%4]) with mapi id 15.20.5273.014; Wed, 18 May 2022 00:12:41 +0000 From: Allison Henderson To: linux-xfs@vger.kernel.org Subject: [PATCH 13/18] xfsprogs: Merge xfs_delattr_context into xfs_attr_item Date: Tue, 17 May 2022 17:12:22 -0700 Message-Id: <20220518001227.1779324-14-allison.henderson@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220518001227.1779324-1-allison.henderson@oracle.com> References: <20220518001227.1779324-1-allison.henderson@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH0P220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::17) To BY5PR10MB4306.namprd10.prod.outlook.com (2603:10b6:a03:211::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4fd5b5d-4814-4f28-c4ea-08da38631ef4 X-MS-TrafficTypeDiagnostic: CY4PR10MB1528:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FABHqy32p8uikHHegzBgeWrVbI3F2fx580qFKEGmTCGiSotWa+duz8mBs6tei9NASqZ2cHh/3c3k6Dis1vghQ8Jo4EEBt5sErdBEWnaZbwww1qQRaLewkqH5qFieYXIvkUVJ+ljdPj8JX5frOZdd7dMU1Jhc81LMtnbvpwRObGfY+BHMvUQI0ac5L4g0v+gJGtnggCMFtKgaK0hku1nawYveeIyGp99av++mPHY1rpoSEY1pujtI9kK0mgb2hcV+8gJm3FpgycP1o1FdRVVo8UxmQTPQkVSP7MTMzj5fWuySnxQ1kPn3CR+vzaALp+4Ub8ABj1q7rxvFoVBXO4dMfza9TufvskAg6IOekJj/i5Z2VHZjNBI7Bn0yRicbuIMazwZy8JJZtqnqlN9Wkod67Vn+27OiThwxEZxMd7IXDu8gvWavRjHtGCvemZyqQh34d6g2YPokovHHre6sBXd7afz5haDtvTiCMf975q0AI2TTXSeT3dheCb4gRNZIQ0wTOSbQ9dGw3Trf7mL98FJNUh5VX8pKb+WorGVyAnjLufqLu391KshEiyNLRzv8/AFTrNZ1cW5rcuKyiIahmpbiA1VBIXbECpAL9sPB5VPL23W1iIG3oLMRA6e0Kr6kt8fvgtMlUh7Ul5hqW/7SmoLs3i8DSbQU1mYZPbl8/QH5/tS8Ln/jXqrvx1Cwh/93hm62fWdPh3uQRb5tbhtLqGB7+A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4306.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(36756003)(508600001)(38350700002)(38100700002)(6506007)(26005)(6666004)(6916009)(66946007)(44832011)(30864003)(2616005)(2906002)(5660300002)(52116002)(316002)(66556008)(8676002)(66476007)(6512007)(6486002)(186003)(86362001)(1076003)(8936002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2t079sHGQTJ7xXNYkUISiXqRS9ICMnDYPjtT8M12EQzCRj9J0egZa7Rvq77y?= =?us-ascii?Q?fDQlzIlf1di9V1z2cfYFZI5CSQCQpClaUMxZT6m/vO0vLeHxu4H3oyBYlnRL?= =?us-ascii?Q?4hjFH55SSCE50OMEHfNntd7yrT6Qb/53Y7WVs83UAC/7pmPR+ahiWy1/SLdV?= =?us-ascii?Q?LeAO+yFI0eSxkVz1WFqPQD8VhjDKY1M4rX4KgYFvxd3Qt345gthS/0sUf9Wf?= =?us-ascii?Q?q9FuS1PIqw2mWA/BlqwF3wW0Twr2FFSb+8FqFK7mcrB98VXOlDGnWiHUQgwh?= =?us-ascii?Q?Xv6IeILhxULSQ/ES4BAuudjuPxUT5AyBhgl3ubeY0kxG6ktdvr8ESxrUDxVB?= =?us-ascii?Q?debrq5wcM9Clh5FRC27DQwEYa1geuJ0TYp7HJ0V0hyiVMQHJLjZjtXp8zrGv?= =?us-ascii?Q?oz1ql5Q0HXNA+riFA7LTukV1sqdqoHhncvTtr7janVtpuIwj7SYEayabLOJU?= =?us-ascii?Q?RIrFaVNknQ7PJ92jf0+WR7PRqAHPBJz8239FBnlnZsXMVhg1A3aAGyYZzOJu?= =?us-ascii?Q?A141A3NvrONppjWn7zb+GWL4WItsNZBiy4o5iCwtuulC3HHcn4iaWkMlbpyd?= =?us-ascii?Q?xdXS5a1hilBP9fBt9nHCg1JHFK1Agja8wCh4vU8ypwOHaC40pAZa59iFGQNw?= =?us-ascii?Q?jVtdz07TXaAuyJXAPvWlviWjrLgzYd7ohaYbjXZ70CoLl48cHs2530gAvqoD?= =?us-ascii?Q?Pj0SC6NTYZHT8F6IrjbDomZxJIeQ6rkoKAZXTFjCmGXCYU72l5NJEFakh5Qc?= =?us-ascii?Q?JtZHt4dv0j9hHTRGUgrPAhtVv9n1gcy4qzna7QtenZodhpnyUfZUOgConWCy?= =?us-ascii?Q?DYJoQLKPhXkjFceQPrQQU4X3LCvURMGRl5D9B/hmZZPBaLh7ZZe2m7clfia+?= =?us-ascii?Q?+iTvlyOlpB1OWxAL/RCBTRadVrEDmS0BV1H7zakzIZ1Q9qENqr0XE3/uPeEL?= =?us-ascii?Q?kjnIuMKMyjdFbh614JPfxvmTEdg35XVK7392s5DvS6pyZbb2PJko5lVDkEeE?= =?us-ascii?Q?XF9n1pSGLW+v2nZlNBThuBELAETmC3TK1mlbehcql5TrlaIMlHFPKCyCHqi7?= =?us-ascii?Q?pKSsqNo1v+rvhxfsgQ1nxtnTSA8VBCDUCnHkLdGvoApo3jCsHhMBmjMXRAO4?= =?us-ascii?Q?84EzdIcXpP5jEjQ+YEkusBgMePTNlbBptJfq7YWw/k3l9y23SREh3pCni46P?= =?us-ascii?Q?ZhXw0tBWSoSzPjq4cG1S8g0U6xALt4iKVXFg1UpMcv/BC6+l0ZeWTKIkaP6T?= =?us-ascii?Q?Epl+AzNIGf52VvUR45tRqDpvjhghpeLAKltm9RG0D7O2Eksukay6rOKogHq0?= =?us-ascii?Q?Hkv/MLGvQIbjTYryRgOR4ms60g1X5QZXWacPEiZ9fMomnXDhPo1PSSQJ8JdB?= =?us-ascii?Q?P0fOuk3GpQqXv3c8Z4YV+V9Tv8A3HSB7jew3O0qco4iXl0lunWJaigTaxGeJ?= =?us-ascii?Q?cYNPvBUIISSeyuvBMhiUhpVSnPbOMSSS4yZprt8868U/wnOE8GuFOMxRdK3a?= =?us-ascii?Q?a2CA7hIVFjWRQ3C6WTnMkctdUVWSPVD4y9s7a2FdHpgbHGMlr79mEF2h7K2/?= =?us-ascii?Q?c9dcf2L4xCm1g9OEi4LKZPXFsvpqbmKllbjTaD9BC7F1yqVcwrSNiBUwh72d?= =?us-ascii?Q?Ayk+gAhmTMfIqCV0dHfQMLyKtX13X7rulms2bTSYYR2RUj+ZWedLahEqhhJC?= =?us-ascii?Q?8/++A3oYMiu0qlrai5CTqqu22c5+xhR+hcv3sSdjp82uL3gP0KAcmZcokNVY?= =?us-ascii?Q?NLyAf6sBkQb5OxBVfGlB7Zx9ZDbnHtY=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4fd5b5d-4814-4f28-c4ea-08da38631ef4 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4306.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 00:12:40.0652 (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: YF7XdvuJTewTPvjI8C4/4n9f+WfKzGaWO9Sy/1YQKM1B57sIArthfpr4NrX4mlKso1kxaR3RZU9IApwHLlftk0OYM9tmtZk9M5L++L3sqh8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1528 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170143 X-Proofpoint-GUID: l2NQZCEu7gz6wy0CHZt7qwpER6AP1jf3 X-Proofpoint-ORIG-GUID: l2NQZCEu7gz6wy0CHZt7qwpER6AP1jf3 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: d68c51e9a4095b57f06bf5dd15ab8fae6dab5d8b This is a clean up patch that merges xfs_delattr_context into xfs_attr_item. Now that the refactoring is complete and the delayed operation infrastructure is in place, we can combine these to eliminate the extra struct Signed-off-by: Allison Henderson Reviewed-by: Darrick J. Wong Reviewed-by: Chandan Babu R Signed-off-by: Dave Chinner Signed-off-by: Allison Henderson --- libxfs/defer_item.c | 14 ++-- libxfs/xfs_attr.c | 162 ++++++++++++++++++++------------------- libxfs/xfs_attr.h | 40 ++++------ libxfs/xfs_attr_remote.c | 36 +++++---- libxfs/xfs_attr_remote.h | 6 +- 5 files changed, 129 insertions(+), 129 deletions(-) diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c index a6ba75fbfd8b..b910ffc693d7 100644 --- a/libxfs/defer_item.c +++ b/libxfs/defer_item.c @@ -128,10 +128,10 @@ const struct xfs_defer_op_type xfs_extent_free_defer_type = { */ STATIC int xfs_trans_attr_finish_update( - struct xfs_delattr_context *dac, + struct xfs_attr_item *attr, uint32_t op_flags) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; unsigned int op = op_flags & XFS_ATTR_OP_FLAGS_TYPE_MASK; int error; @@ -143,11 +143,11 @@ xfs_trans_attr_finish_update( switch (op) { case XFS_ATTR_OP_FLAGS_SET: - error = xfs_attr_set_iter(dac); + error = xfs_attr_set_iter(attr); break; case XFS_ATTR_OP_FLAGS_REMOVE: ASSERT(XFS_IFORK_Q(args->dp)); - error = xfs_attr_remove_iter(dac); + error = xfs_attr_remove_iter(attr); break; default: error = -EFSCORRUPTED; @@ -205,18 +205,16 @@ xfs_attr_finish_item( { struct xfs_attr_item *attr; int error; - struct xfs_delattr_context *dac; attr = container_of(item, struct xfs_attr_item, xattri_list); - dac = &attr->xattri_dac; /* * Always reset trans after EAGAIN cycle * since the transaction is new */ - dac->da_args->trans = tp; + attr->xattri_da_args->trans = tp; - error = xfs_trans_attr_finish_update(dac, attr->xattri_op_flags); + error = xfs_trans_attr_finish_update(attr, attr->xattri_op_flags); if (error != -EAGAIN) kmem_free(attr); diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 3d9164fa9a2b..0cfcae5e2993 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -53,10 +53,9 @@ STATIC int xfs_attr_leaf_try_add(struct xfs_da_args *args, struct xfs_buf *bp); */ STATIC int xfs_attr_node_get(xfs_da_args_t *args); STATIC void xfs_attr_restore_rmt_blk(struct xfs_da_args *args); -STATIC int xfs_attr_node_addname(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_addname_find_attr(struct xfs_delattr_context *dac); -STATIC int xfs_attr_node_addname_clear_incomplete( - struct xfs_delattr_context *dac); +STATIC int xfs_attr_node_addname(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_addname_find_attr(struct xfs_attr_item *attr); +STATIC int xfs_attr_node_addname_clear_incomplete(struct xfs_attr_item *attr); STATIC int xfs_attr_node_hasname(xfs_da_args_t *args, struct xfs_da_state **state); STATIC int xfs_attr_fillstate(xfs_da_state_t *state); @@ -243,9 +242,9 @@ xfs_attr_is_shortform( STATIC int xfs_attr_sf_addname( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; int error = 0; @@ -262,7 +261,7 @@ xfs_attr_sf_addname( * It won't fit in the shortform, transform to a leaf block. GROT: * another possible req'mt for a double-split btree op. */ - error = xfs_attr_shortform_to_leaf(args, &dac->leaf_bp); + error = xfs_attr_shortform_to_leaf(args, &attr->xattri_leaf_bp); if (error) return error; @@ -271,7 +270,7 @@ xfs_attr_sf_addname( * push cannot grab the half-baked leaf buffer and run into problems * with the write verifier. */ - xfs_trans_bhold(args->trans, dac->leaf_bp); + xfs_trans_bhold(args->trans, attr->xattri_leaf_bp); /* * We're still in XFS_DAS_UNINIT state here. We've converted @@ -291,16 +290,16 @@ xfs_attr_sf_addname( */ int xfs_attr_set_iter( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; struct xfs_buf *bp = NULL; int forkoff, error = 0; struct xfs_mount *mp = args->dp->i_mount; /* State machine switch */ - switch (dac->dela_state) { + switch (attr->xattri_dela_state) { case XFS_DAS_UNINIT: /* * If the fork is shortform, attempt to add the attr. If there @@ -310,14 +309,16 @@ xfs_attr_set_iter( * release the hold once we return with a clean transaction. */ if (xfs_attr_is_shortform(dp)) - return xfs_attr_sf_addname(dac); - if (dac->leaf_bp != NULL) { - xfs_trans_bhold_release(args->trans, dac->leaf_bp); - dac->leaf_bp = NULL; + return xfs_attr_sf_addname(attr); + if (attr->xattri_leaf_bp != NULL) { + xfs_trans_bhold_release(args->trans, + attr->xattri_leaf_bp); + attr->xattri_leaf_bp = NULL; } if (xfs_attr_is_leaf(dp)) { - error = xfs_attr_leaf_try_add(args, dac->leaf_bp); + error = xfs_attr_leaf_try_add(args, + attr->xattri_leaf_bp); if (error == -ENOSPC) { error = xfs_attr3_leaf_to_node(args); if (error) @@ -337,19 +338,19 @@ xfs_attr_set_iter( * handling code below */ trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } else if (error) { return error; } - dac->dela_state = XFS_DAS_FOUND_LBLK; + attr->xattri_dela_state = XFS_DAS_FOUND_LBLK; } else { - error = xfs_attr_node_addname_find_attr(dac); + error = xfs_attr_node_addname_find_attr(attr); if (error) return error; - error = xfs_attr_node_addname(dac); + error = xfs_attr_node_addname(attr); if (error) return error; @@ -361,9 +362,10 @@ xfs_attr_set_iter( !(args->op_flags & XFS_DA_OP_RENAME)) return 0; - dac->dela_state = XFS_DAS_FOUND_NBLK; + attr->xattri_dela_state = XFS_DAS_FOUND_NBLK; } - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; case XFS_DAS_FOUND_LBLK: /* @@ -374,10 +376,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; } @@ -387,11 +389,11 @@ xfs_attr_set_iter( * Repeat allocating remote blocks for the attr value until * blkcnt drops to zero. */ - if (dac->blkcnt > 0) { - error = xfs_attr_rmtval_set_blk(dac); + if (attr->xattri_blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(attr); if (error) return error; - trace_xfs_attr_set_iter_return(dac->dela_state, + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -427,8 +429,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; } @@ -447,17 +449,18 @@ xfs_attr_set_iter( fallthrough; case XFS_DAS_RM_LBLK: /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ - dac->dela_state = XFS_DAS_RM_LBLK; + attr->xattri_dela_state = XFS_DAS_RM_LBLK; if (args->rmtblkno) { - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); if (error) return error; - dac->dela_state = XFS_DAS_RD_LEAF; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + attr->xattri_dela_state = XFS_DAS_RD_LEAF; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; } @@ -488,7 +491,7 @@ xfs_attr_set_iter( * state. */ if (args->rmtblkno > 0) { - error = xfs_attr_rmtval_find_space(dac); + error = xfs_attr_rmtval_find_space(attr); if (error) return error; } @@ -501,14 +504,14 @@ xfs_attr_set_iter( * after we create the attribute so that we don't overflow the * maximum size of a transaction and/or hit a deadlock. */ - dac->dela_state = XFS_DAS_ALLOC_NODE; + attr->xattri_dela_state = XFS_DAS_ALLOC_NODE; if (args->rmtblkno > 0) { - if (dac->blkcnt > 0) { - error = xfs_attr_rmtval_set_blk(dac); + if (attr->xattri_blkcnt > 0) { + error = xfs_attr_rmtval_set_blk(attr); if (error) return error; trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -544,8 +547,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; } @@ -565,18 +568,19 @@ xfs_attr_set_iter( fallthrough; case XFS_DAS_RM_NBLK: /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */ - dac->dela_state = XFS_DAS_RM_NBLK; + attr->xattri_dela_state = XFS_DAS_RM_NBLK; if (args->rmtblkno) { - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) trace_xfs_attr_set_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); if (error) return error; - dac->dela_state = XFS_DAS_CLR_FLAG; - trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); + attr->xattri_dela_state = XFS_DAS_CLR_FLAG; + trace_xfs_attr_set_iter_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; } @@ -586,7 +590,7 @@ xfs_attr_set_iter( * The last state for node format. Look up the old attr and * remove it. */ - error = xfs_attr_node_addname_clear_incomplete(dac); + error = xfs_attr_node_addname_clear_incomplete(attr); break; default: ASSERT(0); @@ -783,7 +787,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; @@ -1093,16 +1097,16 @@ xfs_attr_node_hasname( STATIC int xfs_attr_node_addname_find_attr( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; int retval; /* * Search to see if name already exists, and get back a pointer * to where it should go. */ - retval = xfs_attr_node_hasname(args, &dac->da_state); + retval = xfs_attr_node_hasname(args, &attr->xattri_da_state); if (retval != -ENOATTR && retval != -EEXIST) goto error; @@ -1130,8 +1134,8 @@ xfs_attr_node_addname_find_attr( return 0; error: - if (dac->da_state) - xfs_da_state_free(dac->da_state); + if (attr->xattri_da_state) + xfs_da_state_free(attr->xattri_da_state); return retval; } @@ -1152,10 +1156,10 @@ error: */ 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; @@ -1186,7 +1190,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; } @@ -1215,9 +1219,9 @@ out: STATIC int xfs_attr_node_addname_clear_incomplete( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_da_state *state = NULL; struct xfs_mount *mp = args->dp->i_mount; int retval = 0; @@ -1321,10 +1325,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); @@ -1383,16 +1387,16 @@ xfs_attr_node_removename( */ int xfs_attr_remove_iter( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_da_state *state = dac->da_state; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_da_state *state = attr->xattri_da_state; int retval, error = 0; struct xfs_inode *dp = args->dp; trace_xfs_attr_node_removename(args); - switch (dac->dela_state) { + switch (attr->xattri_dela_state) { case XFS_DAS_UNINIT: if (!xfs_inode_hasattr(dp)) return -ENOATTR; @@ -1411,16 +1415,16 @@ xfs_attr_remove_iter( * Node format may require transaction rolls. Set up the * state context and fall into the state machine. */ - if (!dac->da_state) { - error = xfs_attr_node_removename_setup(dac); + if (!attr->xattri_da_state) { + error = xfs_attr_node_removename_setup(attr); if (error) return error; - state = dac->da_state; + state = attr->xattri_da_state; } fallthrough; case XFS_DAS_RMTBLK: - dac->dela_state = XFS_DAS_RMTBLK; + attr->xattri_dela_state = XFS_DAS_RMTBLK; /* * If there is an out-of-line value, de-allocate the blocks. @@ -1433,10 +1437,10 @@ xfs_attr_remove_iter( * May return -EAGAIN. Roll and repeat until all remote * blocks are removed. */ - error = xfs_attr_rmtval_remove(dac); + error = xfs_attr_rmtval_remove(attr); if (error == -EAGAIN) { trace_xfs_attr_remove_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return error; } else if (error) { goto out; @@ -1451,8 +1455,10 @@ xfs_attr_remove_iter( error = xfs_attr_refillstate(state); if (error) goto out; - dac->dela_state = XFS_DAS_RM_NAME; - trace_xfs_attr_remove_iter_return(dac->dela_state, args->dp); + + attr->xattri_dela_state = XFS_DAS_RM_NAME; + trace_xfs_attr_remove_iter_return( + attr->xattri_dela_state, args->dp); return -EAGAIN; } @@ -1462,7 +1468,7 @@ xfs_attr_remove_iter( * If we came here fresh from a transaction roll, reattach all * the buffers to the current transaction. */ - if (dac->dela_state == XFS_DAS_RM_NAME) { + if (attr->xattri_dela_state == XFS_DAS_RM_NAME) { error = xfs_attr_refillstate(state); if (error) goto out; @@ -1479,9 +1485,9 @@ xfs_attr_remove_iter( if (error) goto out; - dac->dela_state = XFS_DAS_RM_SHRINK; + attr->xattri_dela_state = XFS_DAS_RM_SHRINK; trace_xfs_attr_remove_iter_return( - dac->dela_state, args->dp); + attr->xattri_dela_state, args->dp); return -EAGAIN; } diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index 977434f343a1..71271d203d01 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -430,7 +430,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 @@ -455,39 +455,32 @@ enum xfs_delattr_state { }; /* - * Defines for xfs_delattr_context.flags + * Defines for xfs_attr_item.xattri_flags */ #define XFS_DAC_LEAF_ADDNAME_INIT 0x01 /* xfs_attr_leaf_addname init*/ /* * Context used for keeping track of delayed attribute operations */ -struct xfs_delattr_context { - struct xfs_da_args *da_args; +struct xfs_attr_item { + struct xfs_da_args *xattri_da_args; /* * Used by xfs_attr_set to hold a leaf buffer across a transaction roll */ - struct xfs_buf *leaf_bp; + struct xfs_buf *xattri_leaf_bp; /* Used in xfs_attr_rmtval_set_blk to roll through allocating blocks */ - struct xfs_bmbt_irec map; - xfs_dablk_t lblkno; - int blkcnt; + struct xfs_bmbt_irec xattri_map; + xfs_dablk_t xattri_lblkno; + int xattri_blkcnt; /* Used in xfs_attr_node_removename to roll through removing blocks */ - struct xfs_da_state *da_state; + struct xfs_da_state *xattri_da_state; /* Used to keep track of current state of delayed operation */ - unsigned int flags; - enum xfs_delattr_state dela_state; -}; - -/* - * List of attrs to commit later. - */ -struct xfs_attr_item { - struct xfs_delattr_context xattri_dac; + unsigned int xattri_flags; + enum xfs_delattr_state xattri_dela_state; /* * Indicates if the attr operation is a set or a remove @@ -495,7 +488,10 @@ struct xfs_attr_item { */ unsigned int xattri_op_flags; - /* used to log this item to an intent */ + /* + * used to log this item to an intent containing a list of attrs to + * commit later + */ struct list_head xattri_list; }; @@ -515,11 +511,9 @@ bool xfs_attr_is_leaf(struct xfs_inode *ip); int xfs_attr_get_ilocked(struct xfs_da_args *args); int xfs_attr_get(struct xfs_da_args *args); int xfs_attr_set(struct xfs_da_args *args); -int xfs_attr_set_iter(struct xfs_delattr_context *dac); -int xfs_attr_remove_iter(struct xfs_delattr_context *dac); +int xfs_attr_set_iter(struct xfs_attr_item *attr); +int xfs_attr_remove_iter(struct xfs_attr_item *attr); bool xfs_attr_namecheck(const void *name, size_t length); -void xfs_delattr_context_init(struct xfs_delattr_context *dac, - struct xfs_da_args *args); int xfs_attr_calc_size(struct xfs_da_args *args, int *local); int xfs_attr_set_deferred(struct xfs_da_args *args); int xfs_attr_remove_deferred(struct xfs_da_args *args); diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index 5dc93c3b26d4..40215a4dba5d 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -567,14 +567,14 @@ xfs_attr_rmtval_stale( */ int xfs_attr_rmtval_find_space( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; - struct xfs_bmbt_irec *map = &dac->map; + struct xfs_da_args *args = attr->xattri_da_args; + struct xfs_bmbt_irec *map = &attr->xattri_map; int error; - dac->lblkno = 0; - dac->blkcnt = 0; + attr->xattri_lblkno = 0; + attr->xattri_blkcnt = 0; args->rmtblkcnt = 0; args->rmtblkno = 0; memset(map, 0, sizeof(struct xfs_bmbt_irec)); @@ -583,8 +583,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; } @@ -597,17 +597,18 @@ xfs_attr_rmtval_find_space( */ int xfs_attr_rmtval_set_blk( - struct xfs_delattr_context *dac) + struct xfs_attr_item *attr) { - struct xfs_da_args *args = dac->da_args; + struct xfs_da_args *args = attr->xattri_da_args; struct xfs_inode *dp = args->dp; - struct xfs_bmbt_irec *map = &dac->map; + struct xfs_bmbt_irec *map = &attr->xattri_map; int nmap; int error; nmap = 1; - error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)dac->lblkno, - dac->blkcnt, XFS_BMAPI_ATTRFORK, args->total, + error = xfs_bmapi_write(args->trans, dp, + (xfs_fileoff_t)attr->xattri_lblkno, + attr->xattri_blkcnt, XFS_BMAPI_ATTRFORK, args->total, map, &nmap); if (error) return error; @@ -617,8 +618,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; } @@ -672,9 +673,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; /* @@ -694,7 +695,8 @@ xfs_attr_rmtval_remove( * the parent */ if (!done) { - trace_xfs_attr_rmtval_remove_return(dac->dela_state, args->dp); + trace_xfs_attr_rmtval_remove_return(attr->xattri_dela_state, + args->dp); return -EAGAIN; } diff --git a/libxfs/xfs_attr_remote.h b/libxfs/xfs_attr_remote.h index d72eff30ca18..62b398edec3f 100644 --- a/libxfs/xfs_attr_remote.h +++ b/libxfs/xfs_attr_remote.h @@ -12,9 +12,9 @@ int xfs_attr_rmtval_get(struct xfs_da_args *args); int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map, xfs_buf_flags_t incore_flags); int xfs_attr_rmtval_invalidate(struct xfs_da_args *args); -int xfs_attr_rmtval_remove(struct xfs_delattr_context *dac); +int xfs_attr_rmtval_remove(struct xfs_attr_item *attr); int xfs_attr_rmt_find_hole(struct xfs_da_args *args); int xfs_attr_rmtval_set_value(struct xfs_da_args *args); -int xfs_attr_rmtval_set_blk(struct xfs_delattr_context *dac); -int xfs_attr_rmtval_find_space(struct xfs_delattr_context *dac); +int xfs_attr_rmtval_set_blk(struct xfs_attr_item *attr); +int xfs_attr_rmtval_find_space(struct xfs_attr_item *attr); #endif /* __XFS_ATTR_REMOTE_H__ */ -- 2.25.1