From patchwork Thu Mar 14 21:07:27 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: 10853655 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 5994F1874 for ; Thu, 14 Mar 2019 21:07:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 422B929E7B for ; Thu, 14 Mar 2019 21:07:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3636C29DEC; Thu, 14 Mar 2019 21:07:38 +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 CEBD429DEC for ; Thu, 14 Mar 2019 21:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727832AbfCNVHh (ORCPT ); Thu, 14 Mar 2019 17:07:37 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:54172 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727366AbfCNVHh (ORCPT ); Thu, 14 Mar 2019 17:07:37 -0400 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 x2EKwlPq095329; Thu, 14 Mar 2019 21:07:35 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=qG6fA622RSt/osajklYcB3EuBAt93j18pHNBfl2pYCQ=; b=fHJe5nlPEWeq5vhQVushjcOaaBbQ4i6ee1MIhIqE8h/cMrOcIN/ilNYfdvycDo6cXsb4 z4S8ZSFqUMgZjsqBLjQ5W1lGT9ahkw3i4BOu4T8kNM8QsFHkkTmh/SWm8DyKBrxDsX0t WsGVQVS9vii5dGwReXOX+krpw9bMGoWpATSnJvMIKiSH7MvJFclkqqmFkLlPqEdym1au mfJq9AT+D3BD2786PAp4M2lpf1OfrCMTizzLqUBIVQMAk2oM+j4LRg2Zp0WK3tOksJsc Iw/7rDeyahpHOXRkC0rmZMl/VEbKxRfFHFcRcWf6InHOzHwusqKr7+KfkwHkY9TR8iN0 Dw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2r44wukfvd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Mar 2019 21:07:34 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2EL7ShB009733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Mar 2019 21:07:29 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2EL7SYq004147; Thu, 14 Mar 2019 21:07:28 GMT Received: from localhost (/10.145.178.102) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 14 Mar 2019 21:07:28 +0000 Subject: [PATCH 35/36] libxfs: shorten inode item lifetime From: "Darrick J. Wong" To: sandeen@sandeen.net, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Thu, 14 Mar 2019 14:07:27 -0700 Message-ID: <155259764777.31886.5969876849048391381.stgit@magnolia> In-Reply-To: <155259742281.31886.17157720770696604377.stgit@magnolia> References: <155259742281.31886.17157720770696604377.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9195 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=823 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903140143 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 --- 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 69d5abb2..fd8c6591 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -1429,9 +1429,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 2ceb9838..ce199654 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -820,6 +820,16 @@ _("Transaction block reservation exceeded! %u > %u\n"), tp->t_flags |= (XFS_TRANS_SB_DIRTY | XFS_TRANS_DIRTY); } +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) @@ -844,7 +854,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; } /* @@ -854,7 +864,7 @@ inode_item_done( if (error) { fprintf(stderr, _("%s: warning - imap_to_bp failed (%d)\n"), progname, error); - return; + goto free; } /* @@ -870,7 +880,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); @@ -878,6 +888,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 @@ -955,6 +967,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 */