From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75464C4727E for ; Wed, 23 Sep 2020 22:18:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 274AF2311A for ; Wed, 23 Sep 2020 22:18:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XsstD3bU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbgIWWS6 (ORCPT ); Wed, 23 Sep 2020 18:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbgIWWS5 (ORCPT ); Wed, 23 Sep 2020 18:18:57 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF887C0613CE for ; Wed, 23 Sep 2020 15:18:57 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id q5so1193650ilj.1 for ; Wed, 23 Sep 2020 15:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=TITV6wjSakumv03bQwJ/jmvc8gen2aBv8Dq1oW8jiCU=; b=XsstD3bUKwUAkoQ50QxG+0DjnHD+gWlg7vF6mQOmCe4mDHL064VgI/mu4VauvgrujB 3QUoc/1TA63KGotAa549Me/8VmYzV3d6Z1ymeFTqy12BObZlMKITGwOyKFMW/E5gEjPQ a2Pc/RxicKv6KJfvjcpdJoMaTp2HG1bQhVMCtJQfFmen+764kcWWkUpPsvr+hoksQHwA rG48co5mWagivX2iR9zbtFAoOZhUM1QKjpJtjhaakF3YdytMYNnP+04rkCB0RGOA6bix MVJ3PrAXK4k0sCCw7Yv3zGv9aZ39+Z00z+EK0IbNXIHEx7UTIbhQwCFCeLPiOoYQhfIg AiDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=TITV6wjSakumv03bQwJ/jmvc8gen2aBv8Dq1oW8jiCU=; b=mvqfa7vJArY2KdAfdRRPo/ZyLOjrAQgoDf2oBqkKVa5h2vZdNLjD5v9KAbfLrfD01p ozYdN/7qhyetB1WRezxXsQkT0iQNSK/bT1M8E27ZyB73NlVX6a+QoNbupLGkKpTX3MZ7 CFxsS5a1K2BgJP1qTfaIhrwYvflmdo6EimCXWBgav+eYUF/IE2W7yXi8qk5C2cYGLIth EOmdUyObE1R8xqlXsjc4Fa3CY6naMfE1frfP+6BOqNIC5/deJeYHC4et3SlQNYhOU4F7 fkc5pjwhoCAogIEOxNF8Na0faOB+NoteJyNUPR8mllCDkUsdCj+wGF18yMAbId6r+LOW fm+g== X-Gm-Message-State: AOAM532iTuR+w6cO14PvL4yI0JaZU+i2jxsWdrMVqcLJ1GhgUVFxHhN+ co7R0SpyVRPmGwWYUBsk/45V6ohC9gjG0ya3drM= X-Google-Smtp-Source: ABdhPJxXTa9VvU9cnetSgW1oZGLMEAC90Iun9VLFVEqgxKAV89IvhgQoM411eNCQz5WPNJDlXJQLhlLNUbordCTGyYE= X-Received: by 2002:a92:2901:: with SMTP id l1mr1606298ilg.10.1600899537013; Wed, 23 Sep 2020 15:18:57 -0700 (PDT) MIME-Version: 1.0 References: <20200923171405.17456-1-marcos@mpdesouza.com> In-Reply-To: <20200923171405.17456-1-marcos@mpdesouza.com> From: Neal Gompa Date: Wed, 23 Sep 2020 18:18:21 -0400 Message-ID: Subject: Re: [PATCH] btrfs-progs: convert: Mention which reserve_space call failed To: Marcos Paulo de Souza Cc: David Sterba , Btrfs BTRFS , Qu Wenruo , Marcos Paulo de Souza Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Wed, Sep 23, 2020 at 1:44 PM Marcos Paulo de Souza wrote: > > From: Marcos Paulo de Souza > > btrfs-convert currently can't handle more fragmented block groups when > converting ext4 because the minimum size of a data chunk is 32Mb. > > When converting an ext4 fs with more fragmented block group and the disk > almost full, we can end up hitting a ENOSPC problem [1] since smaller > block groups (10Mb for example) end up being extended to 32Mb, leaving > the free space tree smaller when converting it to btrfs. > > This patch adds error messages telling which needed bytes couldn't be > allocated from the free space tree: > > create btrfs filesystem: > blocksize: 4096 > nodesize: 16384 > features: extref, skinny-metadata (default) > checksum: crc32c > free space report: > total: 1073741824 > free: 39124992 (3.64%) > ERROR: failed to reserve 33554432 bytes from free space for metadata chun= k > ERROR: unable to create initial ctree: No space left on device > > Link: https://github.com/kdave/btrfs-progs/issues/251 > > Signed-off-by: Marcos Paulo de Souza > --- > convert/common.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/convert/common.c b/convert/common.c > index 048629df..6392e7f4 100644 > --- a/convert/common.c > +++ b/convert/common.c > @@ -812,8 +812,10 @@ int make_convert_btrfs(int fd, struct btrfs_mkfs_con= fig *cfg, > */ > ret =3D reserve_free_space(free_space, BTRFS_STRIPE_LEN, > &cfg->super_bytenr); > - if (ret < 0) > + if (ret < 0) { > + error("failed to reserve %d bytes from free space for tem= porary superblock", BTRFS_STRIPE_LEN); > goto out; > + } > > /* > * Then reserve system chunk space > @@ -823,12 +825,16 @@ int make_convert_btrfs(int fd, struct btrfs_mkfs_co= nfig *cfg, > */ > ret =3D reserve_free_space(free_space, BTRFS_MKFS_SYSTEM_GROUP_SI= ZE, > &sys_chunk_start); > - if (ret < 0) > + if (ret < 0) { > + error("failed to reserve %d bytes from free space for sys= tem chunk", BTRFS_MKFS_SYSTEM_GROUP_SIZE); > goto out; > + } > ret =3D reserve_free_space(free_space, BTRFS_CONVERT_META_GROUP_S= IZE, > &meta_chunk_start); > - if (ret < 0) > + if (ret < 0) { > + error("failed to reserve %d bytes from free space for met= adata chunk", BTRFS_CONVERT_META_GROUP_SIZE); > goto out; > + } > > /* > * Allocated meta/sys chunks will be mapped 1:1 with device offse= t. > -- > 2.28.0 > Reviewed-by: Neal Gompa -- =E7=9C=9F=E5=AE=9F=E3=81=AF=E3=81=84=E3=81=A4=E3=82=82=E4=B8=80=E3=81=A4=EF= =BC=81/ Always, there's only one truth!