From patchwork Sat Jan 18 22:45:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 11340277 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 07B6614B4 for ; Sat, 18 Jan 2020 22:46:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DAEB0246A8 for ; Sat, 18 Jan 2020 22:46:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="kQHf6vBE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727070AbgARWqT (ORCPT ); Sat, 18 Jan 2020 17:46:19 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:50304 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726997AbgARWqT (ORCPT ); Sat, 18 Jan 2020 17:46:19 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00IMcuBG072129 for ; Sat, 18 Jan 2020 22:46:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=gZSgDoYuJKZsLcwZR9yzb7UEG+II0BdHAG7xFiy98lo=; b=kQHf6vBERDdQVrYn/I2pePXkZ+7hA0muBidz/yIa++nXXVcC/AgL6Ba4vTKROiyDHH0j bo9UKGGFs50q4Lh9hL1XA2r1PjkHNuxADxxjKDPzjJqZ7DivsYgtOgRet+8NdmIRChlU 0kBrV/qr2tucjqLQFoeQbUs55PLY1iQqWL8xWxHXNB8VHnJfqTnMyeFdwBxyFqBgs4CP jPAp448QATS2upu80m4D5UnPs+3ZPOZA8CjhJhd0ojL/F1yveD4cQdDa6Ve7Ju1JSJZF WMYBp6IYbvTafuIJ5AYy0sYtXdSUEmr/TEGIcnH34fWweGpuBqDRNEScgBjcadDD6iJl AA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2xktnqsvtw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Jan 2020 22:46:17 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00IMcqrr125836 for ; Sat, 18 Jan 2020 22:46:16 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2xkr2danqb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Jan 2020 22:46:16 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 00IMkGYW029005 for ; Sat, 18 Jan 2020 22:46:16 GMT Received: from localhost.localdomain (/67.1.3.112) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 18 Jan 2020 14:46:16 -0800 From: Allison Collins To: linux-xfs@vger.kernel.org Subject: [PATCH v6 13/17] xfsprogs: Add helper function xfs_attr_init_unmapstate Date: Sat, 18 Jan 2020 15:45:54 -0700 Message-Id: <20200118224558.19382-14-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200118224558.19382-1-allison.henderson@oracle.com> References: <20200118224558.19382-1-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9504 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001180185 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9504 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001180185 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch helps to pre-simplify xfs_attr_node_removename by modularizing the code around the transactions into helper functions. This will make the function easier to follow when we introduce delayed attributes. Signed-off-by: Allison Collins --- libxfs/xfs_attr.c | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 042eee2..440af79 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -1201,6 +1201,36 @@ out: } /* + * Set up the state for unmap and set the incomplete flag + */ +STATIC int +xfs_attr_init_unmapstate( + struct xfs_da_args *args, + struct xfs_da_state *state) +{ + int error; + + /* + * Fill in disk block numbers in the state structure + * so that we can get the buffers back after we commit + * several transactions in the following calls. + */ + error = xfs_attr_fillstate(state); + if (error) + return error; + + /* + * Mark the attribute as INCOMPLETE + */ + error = xfs_attr3_leaf_setflag(args); + if (error) + return error; + + return 0; +} + + +/* * Remove a name from a B-tree attribute list. * * This will involve walking down the Btree, and may involve joining @@ -1232,20 +1262,7 @@ xfs_attr_node_removename( ASSERT(blk->bp != NULL); ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC); if (args->rmtblkno > 0) { - /* - * Fill in disk block numbers in the state structure - * so that we can get the buffers back after we commit - * several transactions in the following calls. - */ - error = xfs_attr_fillstate(state); - if (error) - goto out; - - /* - * Mark the attribute as INCOMPLETE, then bunmapi() the - * remote value. - */ - error = xfs_attr3_leaf_setflag(args); + error = xfs_attr_init_unmapstate(args, state); if (error) goto out;