From patchwork Sun Feb 23 02:06:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 11398573 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 79DC217F0 for ; Sun, 23 Feb 2020 02:06:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 59F4E20707 for ; Sun, 23 Feb 2020 02:06:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="P8ZZnvyv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727209AbgBWCG0 (ORCPT ); Sat, 22 Feb 2020 21:06:26 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:56542 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727201AbgBWCGZ (ORCPT ); Sat, 22 Feb 2020 21:06:25 -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 01N21e2G008635 for ; Sun, 23 Feb 2020 02:06:24 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-2020-01-29; bh=/sLC+zw136D5ryml0Mrd81smZVe/IQvsGu7ENMC7LVo=; b=P8ZZnvyvy36l55nuavxfwDobmKI7t+ScMSVInk9PovlqdKSUJO39vJQ2DB8VX5NkvFv5 6wT1vELj1GLqdjKZMIne9pWUaoEowxCT7WoJqqV6vsl9954qAkWaAGO5tcSp5COpc4xX f1w/Bw553DNQz5fZf6vtuh8WNEItDF8921FLXGU7EQSWFRG0/QMmlOIh9KD9q7Gi5jzF q5xwktFfWdinhqY2iBCVbakPgIzIEeyFe8GAouuqLPEml4bSHXYeKOHoVg6zB0t9lk1C 9/LVzugVgfy9xtPt8YEECRWJ/ZQhMbgivucHXSJGyPdmFwchVVQHKeoJi9YMDKBq/dmN Dg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2yav8qa0ta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 23 Feb 2020 02:06:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 01N26OWG184273 for ; Sun, 23 Feb 2020 02:06:24 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2ybdure4g4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 23 Feb 2020 02:06:24 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01N26NMt013238 for ; Sun, 23 Feb 2020 02:06:23 GMT Received: from localhost.localdomain (/67.1.3.112) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 23 Feb 2020 02:06:23 +0000 From: Allison Collins To: linux-xfs@vger.kernel.org Subject: [PATCH v7 17/19] xfs: Add helper function xfs_attr_leaf_mark_incomplete Date: Sat, 22 Feb 2020 19:06:09 -0700 Message-Id: <20200223020611.1802-18-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200223020611.1802-1-allison.henderson@oracle.com> References: <20200223020611.1802-1-allison.henderson@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9539 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=1 mlxlogscore=999 malwarescore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002230015 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9539 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 impostorscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002230014 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org This patch helps to 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 Reviewed-by: Amir Goldstein Reviewed-by: Chandan Rajendra --- fs/xfs/libxfs/xfs_attr.c | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index dd935ff..b9728d1 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1416,6 +1416,36 @@ xfs_attr_node_shrink( } /* + * Mark an attribute entry INCOMPLETE and save pointers to the relevant buffers + * for later deletion of the entry. + */ +STATIC int +xfs_attr_leaf_mark_incomplete( + 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 @@ -1473,20 +1503,7 @@ xfs_attr_node_removename( args->dac.da_state = state; 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_leaf_mark_incomplete(args, state); if (error) goto out;