From patchwork Tue Apr 23 20:51:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10913743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A4246922 for ; Tue, 23 Apr 2019 20:51:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9555D289B1 for ; Tue, 23 Apr 2019 20:51:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A23D289B4; Tue, 23 Apr 2019 20:51:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31F2C289B1 for ; Tue, 23 Apr 2019 20:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbfDWUvl (ORCPT ); Tue, 23 Apr 2019 16:51:41 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:40654 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbfDWUvk (ORCPT ); Tue, 23 Apr 2019 16:51:40 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3NKmw1I057912; Tue, 23 Apr 2019 20:51:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=yC5rAzpiGQnAYpfUDrhmprjtBK7aKRom5gPpNA8qbd8=; b=ScwY0cgi2r2xV6OMFBachJ/h5Up5TavOIH3H2UhRwXD7ws04l6tJZuWMwFYSmCvAr+oi lQAEp6eb0O7iUEPruiTq6xmVzMvO5xI+CxRP0r0AFUWTNNfcPyMor3exlkF7CuGtVVOn e5cE/3xDnEMkHb5JqAehZRliY2SKVyICZ1JdX0DbjV5GxnN0LKZaTwaGBD3ubeFDcM1b d5FCslCFqecy1eQp24FzH1lHLj5mWc57QApAuWCAqhhQbcQuLKCLBL7v7K0sYG1pUs6e o1AiZEM6nPx+rF979R8ffxiKKY7zfgPyi/hj3VJMMjNNW/6a3R3nhSMTCAFJQAfRSn94 ww== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2ryrxcxuyk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2019 20:51:37 +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 x3NKoTat170116; Tue, 23 Apr 2019 20:51:37 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2s0fv36ywg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2019 20:51:36 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3NKpZI3002782; Tue, 23 Apr 2019 20:51:35 GMT Received: from localhost (/10.145.179.89) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 23 Apr 2019 13:51:35 -0700 Date: Tue, 23 Apr 2019 13:51:33 -0700 From: "Darrick J. Wong" To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org Subject: [PATCH v2 07/10] libxfs: refactor buffer item release code Message-ID: <20190423205133.GB178290@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> <155594793429.115924.9115512760848857551.stgit@magnolia> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <155594793429.115924.9115512760848857551.stgit@magnolia> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9236 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 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-1810050000 definitions=main-1904230147 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9236 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1810050000 definitions=main-1904230147 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Refactor the buffer item release code into a helper, which we will use in subsequent patches to make the buffer log item lifetime match the kernel equivalents. Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell --- v2: fix a bug where we put the buf log item after the buf --- libxfs/trans.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libxfs/trans.c b/libxfs/trans.c index 9de77c8b..121636b5 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -505,6 +505,16 @@ libxfs_trans_ordered_buf( return ret; } +static void +xfs_buf_item_put( + struct xfs_buf_log_item *bip) +{ + struct xfs_buf *bp = bip->bli_buf; + + bp->b_log_item = NULL; + kmem_zone_free(xfs_buf_item_zone, bip); +} + void libxfs_trans_brelse( xfs_trans_t *tp, @@ -846,7 +856,6 @@ buf_item_done( bp = bip->bli_buf; ASSERT(bp != NULL); - bp->b_log_item = NULL; /* remove log item */ bp->b_transp = NULL; /* remove xact ptr */ hold = (bip->bli_flags & XFS_BLI_HOLD); @@ -857,12 +866,12 @@ buf_item_done( #endif libxfs_writebuf_int(bp, 0); } + + bip->bli_flags &= ~XFS_BLI_HOLD; + xfs_buf_item_put(bip); if (hold) - bip->bli_flags &= ~XFS_BLI_HOLD; - else - libxfs_putbuf(bp); - /* release the buf item */ - kmem_zone_free(xfs_buf_item_zone, bip); + return; + libxfs_putbuf(bp); } static void