From patchwork Mon Apr 22 15:45:53 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: 10911219 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 4F51E161F for ; Mon, 22 Apr 2019 15:45:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41249286F6 for ; Mon, 22 Apr 2019 15:45:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35FB528707; Mon, 22 Apr 2019 15:45:57 +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 D3E92286F6 for ; Mon, 22 Apr 2019 15:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727277AbfDVPp4 (ORCPT ); Mon, 22 Apr 2019 11:45:56 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:39116 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVPp4 (ORCPT ); Mon, 22 Apr 2019 11:45:56 -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 x3MFi3rX049231; Mon, 22 Apr 2019 15:45:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=W4bvcF6F18HRq3kwN1i8zn4ASXQ0HDZma9+L9at4e7E=; b=JV55EsmFAZtX8CHLwizz4a/fVy1eizpVEX1uWzOzCETKmO0gHwmpRTSID7T1RQxjj37W b3O86QiHRzVvi2lM37UfiktQA6ig1Nu7FAYSja1DT1MnI6XSrOh71U4pQqaMvVTFVUvW l5FHDkMNQHiyo4o6HkfSfkRpArM3PSDSawkRb4Ax0uTuMOPJGYo2GI2lNvpkM1KEQDDH ipaoYdonX50TzA80kib5UBomwD4dhuKQTC0Lgp32ATI4nfRolciFroO7tMePHgnrJtOg /UKiT4dc1ts4WHZOZG4mk/ws+xOvOuWB0zTXqABe59Zu7s4B3O1ejtO25PrGlXbo8EfB Sw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2ryrxcq5vs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:53 +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 x3MFiNZH017456; Mon, 22 Apr 2019 15:45:53 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2s0fv2g7b5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Apr 2019 15:45:53 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3MFjqCs014182; Mon, 22 Apr 2019 15:45:52 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Apr 2019 08:45:51 -0700 Subject: [PATCH 10/10] libxfs: shorten inode item lifetime From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 22 Apr 2019 08:45:53 -0700 Message-ID: <155594795339.115924.2841573798611518042.stgit@magnolia> In-Reply-To: <155594788997.115924.16224143537288136652.stgit@magnolia> References: <155594788997.115924.16224143537288136652.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=834 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904220118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9235 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=856 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904220119 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 Shorten the inode item lifetime so that we only keep them around while the inode is joined with a transaction. Signed-off-by: Darrick J. Wong Reviewed-by: Bill O'Donnell --- libxfs/rdwr.c | 4 +--- libxfs/trans.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index bc2ed38c..a5efc805 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1428,9 +1428,7 @@ void libxfs_irele( struct xfs_inode *ip) { - if (ip->i_itemp) - kmem_zone_free(xfs_ili_zone, ip->i_itemp); - ip->i_itemp = NULL; + ASSERT(ip->i_itemp == NULL); libxfs_idestroy(ip); kmem_zone_free(xfs_inode_zone, ip); } diff --git a/libxfs/trans.c b/libxfs/trans.c index 22926236..1dcdebf3 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -785,6 +785,16 @@ _("Transaction block reservation exceeded! %u > %u\n"), tp->t_flags |= (XFS_TRANS_SB_DIRTY | XFS_TRANS_DIRTY); } +static void +xfs_inode_item_put( + struct xfs_inode_log_item *iip) +{ + struct xfs_inode *ip = iip->ili_inode; + + ip->i_itemp = NULL; + kmem_zone_free(xfs_ili_zone, iip); +} + /* * Transaction commital code follows (i.e. write to disk in libxfs) @@ -809,7 +819,7 @@ inode_item_done( if (!(iip->ili_fields & XFS_ILOG_ALL)) { ip->i_transp = NULL; /* disassociate from transaction */ iip->ili_flags = 0; /* reset all flags */ - return; + goto free; } /* @@ -819,7 +829,7 @@ inode_item_done( if (error) { fprintf(stderr, _("%s: warning - imap_to_bp failed (%d)\n"), progname, error); - return; + goto free; } /* @@ -835,7 +845,7 @@ inode_item_done( fprintf(stderr, _("%s: warning - iflush_int failed (%d)\n"), progname, error); libxfs_putbuf(bp); - return; + goto free; } libxfs_writebuf(bp, 0); @@ -843,6 +853,8 @@ inode_item_done( fprintf(stderr, "flushing dirty inode %llu, buffer %p\n", ip->i_ino, bp); #endif +free: + xfs_inode_item_put(iip); } static void @@ -920,6 +932,7 @@ inode_item_unlock( ip->i_transp = NULL; iip->ili_flags = 0; + xfs_inode_item_put(iip); } /* Detach and unlock all of the items in a transaction */