From patchwork Sat Jan 18 22:50:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 11340309 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 545BF109A for ; Sat, 18 Jan 2020 22:50:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 339A5246AE for ; Sat, 18 Jan 2020 22:50:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="hUiozJqj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727056AbgARWuu (ORCPT ); Sat, 18 Jan 2020 17:50:50 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40274 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726997AbgARWut (ORCPT ); Sat, 18 Jan 2020 17:50:49 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00IMcrC0093474 for ; Sat, 18 Jan 2020 22:50:48 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=QSQ9TxgzrtuCJfA9EtivhM7QCnEr/Aa4yvg9IfZfQvU=; b=hUiozJqjKV3CKdpBEzvw2nxUwvwMu6cBfgbZtDu3mpfHZaJH0I7wsPiHeWN4pc0OphR7 RJwHXuxAKTQzMsF0SOknd7WHB+zbEwHPh4ysINrqaIlRcoLjlwXRY2J8mCNXq0eSn2cy 7v5WomUNFXccU3cgdLLIBRY5BbrIiKJWCyk2ID3P+x1/P/mhAsKPJfYuC0MkFycuFAnm tJN9GTWMZYCpoqIjqVm2ea6JQWBI9lPCEoOja+6JHbpZcE8FBMLdakrZOwZN8lKyzxGP P9nMI478JNTzR5NtEU86gwB+d8v47TB6ibvvHOwoVYCO3xNUUKCzd3u6ZZNUdkju2c4T Lw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2xkseu24es-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Jan 2020 22:50:48 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00IMct9t045985 for ; Sat, 18 Jan 2020 22:50:47 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2xksuw8rxj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sat, 18 Jan 2020 22:50:47 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00IMolAk026160 for ; Sat, 18 Jan 2020 22:50:47 GMT Received: from localhost.localdomain (/67.1.3.112) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 18 Jan 2020 14:50:47 -0800 From: Allison Collins To: linux-xfs@vger.kernel.org Subject: [PATCH v6 12/16] xfs: Add helper function xfs_attr_init_unmapstate Date: Sat, 18 Jan 2020 15:50:31 -0700 Message-Id: <20200118225035.19503-13-allison.henderson@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200118225035.19503-1-allison.henderson@oracle.com> References: <20200118225035.19503-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 --- 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 e9d22c1..453ea59 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1202,6 +1202,36 @@ xfs_attr_node_addname( } /* + * 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 @@ -1233,20 +1263,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;