From patchwork Wed Sep 2 02:56:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 11749669 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 46A7F618 for ; Wed, 2 Sep 2020 02:56:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30AC520866 for ; Wed, 2 Sep 2020 02:56:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="e+8R3wF5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726380AbgIBC4L (ORCPT ); Tue, 1 Sep 2020 22:56:11 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:50516 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgIBC4K (ORCPT ); Tue, 1 Sep 2020 22:56:10 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0822tAU9003447; Wed, 2 Sep 2020 02:56:08 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-2020-01-29; bh=lEBa5xeQs3ZHjM3sX4PJPGc+lYH86cJ/EZ68lKKNihk=; b=e+8R3wF5ttD+/llaPYUTr22Jzoq48zPQ7v5+BTWUVuvPvavLjmIE3AV8qie53RBmmCgq dM9pySWkKnqyxcSjUCp9RnD9oLiJ3W064sXQw1UKl1yXxzZzwzNsWftsPnpn5J7KjhbZ nQZ8z0jTEONYXDdqMvMM1rMYtqzdGS8Sp2KWzDf3NJcn/SzpwBJktrsvOVH/RykLKLrr OZnqQgEENApBpjvkLdErKXBCTBez5Z8tM8J4k8nb8XqQ7a43XbFyDQnJsLUPFguugk73 1GU1ZUZQUXx4UIdmudZNeWX+M+WkSKg5rR7wo8q6cwZZ/Jh96yVYNYgArpAwGRnpwqOz NA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 337eeqyvhm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 02 Sep 2020 02:56:07 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0822t2Nc186128; Wed, 2 Sep 2020 02:56:07 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 3380st0w3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Sep 2020 02:56:07 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0822u69e031570; Wed, 2 Sep 2020 02:56:07 GMT Received: from localhost (/10.159.133.7) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Sep 2020 19:56:06 -0700 Subject: [PATCH 2/5] xfs: use the finobt block counts to speed up mount times From: "Darrick J. Wong" To: darrick.wong@oracle.com, bfoster@redhat.com Cc: linux-xfs@vger.kernel.org Date: Tue, 01 Sep 2020 19:56:05 -0700 Message-ID: <159901536498.547164.1936784142034292353.stgit@magnolia> In-Reply-To: <159901535219.547164.1381621861988558776.stgit@magnolia> References: <159901535219.547164.1381621861988558776.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9731 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009020026 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9731 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009020026 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Now that we have reliable finobt block counts, use them to speed up the per-AG block reservation calculations at mount time. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster --- fs/xfs/libxfs/xfs_ialloc_btree.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c index cf51b342b6ef..1df04e48bd87 100644 --- a/fs/xfs/libxfs/xfs_ialloc_btree.c +++ b/fs/xfs/libxfs/xfs_ialloc_btree.c @@ -697,6 +697,28 @@ xfs_inobt_count_blocks( return error; } +/* Read finobt block count from AGI header. */ +static int +xfs_finobt_read_blocks( + struct xfs_mount *mp, + struct xfs_trans *tp, + xfs_agnumber_t agno, + xfs_extlen_t *tree_blocks) +{ + struct xfs_buf *agbp; + struct xfs_agi *agi; + int error; + + error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); + if (error) + return error; + + agi = agbp->b_addr; + *tree_blocks = be32_to_cpu(agi->agi_fblocks); + xfs_trans_brelse(tp, agbp); + return 0; +} + /* * Figure out how many blocks to reserve and how many are used by this btree. */ @@ -714,7 +736,11 @@ xfs_finobt_calc_reserves( if (!xfs_sb_version_hasfinobt(&mp->m_sb)) return 0; - error = xfs_inobt_count_blocks(mp, tp, agno, XFS_BTNUM_FINO, &tree_len); + if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) + error = xfs_finobt_read_blocks(mp, tp, agno, &tree_len); + else + error = xfs_inobt_count_blocks(mp, tp, agno, XFS_BTNUM_FINO, + &tree_len); if (error) return error;