From nobody Fri Oct 24 20:28:42 2025 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 3631DC00140 for ; Mon, 15 Aug 2022 23:32:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353468AbiHOXbp (ORCPT ); Mon, 15 Aug 2022 19:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343985AbiHOX0K (ORCPT ); Mon, 15 Aug 2022 19:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 685947FE5C; Mon, 15 Aug 2022 13:06:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 04AA86069E; Mon, 15 Aug 2022 20:06:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB8C9C433D6; Mon, 15 Aug 2022 20:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593990; bh=OoFLweGMGU3hs6aXiOhf2CsOVzv7McoV0UwXcZHxGHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q+sDy9HvSIhcil2q8gyBgRI7qul0gwlFoJ7Y5vS/yd3dFHSeaMcJLGuYybdKzCXhK 6DYuTGFxhk+MsVVAela91Wr0CA8JTvUMI7yeTKS40gXpCN4bW1t/K1mlXsOEBNaIB0 wso/UoUNt5gNeF8q315N+XHWKz98ZpKiCp1SSLT4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Thumshirn , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.18 1021/1095] btrfs: let can_allocate_chunk return error Date: Mon, 15 Aug 2022 20:07:00 +0200 Message-Id: <20220815180511.327770468@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit bb9950d3df7169a673c594d38fb74e241ed4fb2a ] For the later patch, convert the return type from bool to int and return errors. No functional changes. Reviewed-by: Johannes Thumshirn Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/extent-tree.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f45ecd939a2c..8bdcbc0c6d60 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3985,12 +3985,12 @@ static void found_extent(struct find_free_extent_ct= l *ffe_ctl, } } =20 -static bool can_allocate_chunk(struct btrfs_fs_info *fs_info, - struct find_free_extent_ctl *ffe_ctl) +static int can_allocate_chunk(struct btrfs_fs_info *fs_info, + struct find_free_extent_ctl *ffe_ctl) { switch (ffe_ctl->policy) { case BTRFS_EXTENT_ALLOC_CLUSTERED: - return true; + return 0; case BTRFS_EXTENT_ALLOC_ZONED: /* * If we have enough free space left in an already @@ -4000,8 +4000,8 @@ static bool can_allocate_chunk(struct btrfs_fs_info *= fs_info, */ if (ffe_ctl->max_extent_size >=3D ffe_ctl->min_alloc_size && !btrfs_can_activate_zone(fs_info->fs_devices, ffe_ctl->flags)) - return false; - return true; + return -ENOSPC; + return 0; default: BUG(); } @@ -4083,8 +4083,9 @@ static int find_free_extent_update_loop(struct btrfs_= fs_info *fs_info, int exist =3D 0; =20 /*Check if allocation policy allows to create a new chunk */ - if (!can_allocate_chunk(fs_info, ffe_ctl)) - return -ENOSPC; + ret =3D can_allocate_chunk(fs_info, ffe_ctl); + if (ret) + return ret; =20 trans =3D current->journal_info; if (trans) --=20 2.35.1