From patchwork Fri Dec 30 06:22:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guo Xuenan X-Patchwork-Id: 13084102 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4ABEC4332F for ; Fri, 30 Dec 2022 06:23:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234412AbiL3GXS (ORCPT ); Fri, 30 Dec 2022 01:23:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbiL3GXS (ORCPT ); Fri, 30 Dec 2022 01:23:18 -0500 Received: from frasgout11.his.huawei.com (frasgout11.his.huawei.com [14.137.139.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 942E11F7 for ; Thu, 29 Dec 2022 22:23:15 -0800 (PST) Received: from mail02.huawei.com (unknown [172.18.147.227]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4Njw3w3Qjhz9v7HJ for ; Fri, 30 Dec 2022 14:15:40 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.170]) by APP2 (Coremail) with SMTP id BqC_BwDXBH_Ag65j7ezMAA--.12751S2; Fri, 30 Dec 2022 06:23:01 +0000 (GMT) From: Guo Xuenan To: djwong@kernel.org, dchinner@redhat.com, linux-xfs@vger.kernel.org Cc: guoxuenan@huawei.com, guoxuenan@huaweicloud.com, houtao1@huawei.com, jack.qiu@huawei.com, yi.zhang@huawei.com, zhengbin13@huawei.com Subject: [PATCH] xfs: set minleft correctly for randomly sparse inode allocations Date: Fri, 30 Dec 2022 14:22:29 +0800 Message-Id: <20221230062229.211186-1-guoxuenan@huawei.com> X-Mailer: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8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa 73UjIFyTuYvjxUFjg4DUUUU Sender: guoxuenan@huaweicloud.com X-CM-SenderInfo: xjxr53hhqd0q5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org In DEBUG mode may do sparse inode allocations randomly, but forget to set the remaining space correctly for the inode btree to split. It's OK for most cases, only under DEBUG mode and AG space is running out may bring something bad. Fixes: 1cdadee11f8d ("xfs: randomly do sparse inode allocations in DEBUG mode") Signed-off-by: Guo Xuenan --- fs/xfs/libxfs/xfs_ialloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 94db50eb706a..29bc160312ec 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -763,6 +763,8 @@ xfs_ialloc_ag_alloc( args.alignment = args.mp->m_sb.sb_spino_align; args.prod = 1; + /* Allow space for the inode btree to split */ + args.minleft = igeo->inobt_maxlevels; args.minlen = igeo->ialloc_min_blks; args.maxlen = args.minlen;