From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mLfag-000596-7L for mharc-grub-devel@gnu.org; Thu, 02 Sep 2021 01:48:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLfae-00057g-RZ for grub-devel@gnu.org; Thu, 02 Sep 2021 01:48:44 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.111.102]:36930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLfac-0005Hd-DM for grub-devel@gnu.org; Thu, 02 Sep 2021 01:48:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1630561719; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RUkkonuvV597ufbiLhPPGk9TIHbnbaAIgy34CMngpvs=; b=TkEKhZXaU4loDgsaBOaXQvkV13+8dAqSUVEFJ06z3YbKRtgA5OPWMz6LDTUG4GIsOp7CN8 GmqYbLwaQQgtcYYizGYTHzHbChtWv95UF2w3D3m7wCSsJlmootJUW0HFS61FrtOhBsgTJy X/7VBmJbVAa6qICffloDZTBSKVTAjLs= Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01lp2058.outbound.protection.outlook.com [104.47.2.58]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-16-RQMMYCL7POOL0giE5SBg_w-1; Thu, 02 Sep 2021 07:48:37 +0200 X-MC-Unique: RQMMYCL7POOL0giE5SBg_w-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G0lVA0se1+OyzgYqMBHpaj183EWbD2l1bmVzityhAxI1/yxLWxe20d/DCLhxOJOFzuQr3mbsGi/AX9m/eaObgpJ+NpnqnYLoS5K/koCJFuzxxETnLW57hisCEQ0u3BhEkc/40AfbJegOC/57Zw/iUUyWL1rMJLa1AqKLF41LBV/SdGafLbkKHcgySUd8x3i+PZnTORYiNj2xPPas7QdfGt+o8bohcdxu/URDwdTA8F1WlApnRtmeb0nlJ+Y1kQyXcKff0qgzWnkicVbJXXvP/JVUz+QlfuIKHZGOxUfsBx+PCkksfSKZtRI13WN1PIODb1W2rT1a8oAM5Aqi4iz29A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RUkkonuvV597ufbiLhPPGk9TIHbnbaAIgy34CMngpvs=; b=CJXjZrvTXiubPAwims30ZECfNMcsz+CjPjXx/IqgY5ZS1pS/AzYF4zkPQmoIuZjwsYxyvE/PiI7GazBQQW9+TsZXysyFKSPo8W7hGwAYC1nASB7EJf647mrf1DdlsU6H8w1GAzMHaqAruYg5tpen9SIENJc1Ni7/7QrmUkIvzX7jBqj44PQXbAmnyBjVa11CS0gVA2F7i7FlYqlE6pUxjzBJbbrA1GciNvO7CE3y9PQVjMq/dpJp33NOTtPYJxgM3oeAP0QpbjBHtJ9lXuVy3tlSGK2bmdeFYOBgaxCFcPnQLhkxEV1Z7ZZk1/tOAI9me+9A+kKu7nDzoYABg+KbwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=suse.com; Received: from DU2PR04MB8648.eurprd04.prod.outlook.com (2603:10a6:10:2df::21) by DU2PR04MB8808.eurprd04.prod.outlook.com (2603:10a6:10:2e3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.23; Thu, 2 Sep 2021 05:48:36 +0000 Received: from DU2PR04MB8648.eurprd04.prod.outlook.com ([fe80::5586:d75d:b656:b85]) by DU2PR04MB8648.eurprd04.prod.outlook.com ([fe80::5586:d75d:b656:b85%7]) with mapi id 15.20.4478.021; Thu, 2 Sep 2021 05:48:36 +0000 Date: Thu, 2 Sep 2021 13:48:30 +0800 From: Michael Chang To: The development of GNU GRUB Subject: Re: [PATCH] i386-pc: build btrfs zstd support into separate module Message-ID: <20210902054830.GA9354@mazu> References: <20210831071228.8282-1-mchang@suse.com> <20210901163822.5vq766pc2wdjveef@tomti.i.net-space.pl> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210901163822.5vq766pc2wdjveef@tomti.i.net-space.pl> User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: HK2PR06CA0001.apcprd06.prod.outlook.com (2603:1096:202:2e::13) To DU2PR04MB8648.eurprd04.prod.outlook.com (2603:10a6:10:2df::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost (2001:b011:30d0:1e12:6600:6aff:fe77:a7be) by HK2PR06CA0001.apcprd06.prod.outlook.com (2603:1096:202:2e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Thu, 2 Sep 2021 05:48:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3327ad2e-e21e-4e2d-cda0-08d96dd54e66 X-MS-TrafficTypeDiagnostic: DU2PR04MB8808: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IvHSGPH/kd2/Z2zDk1gEPHanOm/ZvURHTe/WZVCHTBZgRerPUWPYdJbI9VyWngimwlnLnstuGQBto0TTeEGcteL/wFtBfdAnee7Vi/JigPxWLJ+1pv72bBDObj4wMZAE2Jrs/Wt8OyAV28Ve2a6CNZ9oTiMK/VjeSM304fBByVlxWnCze0Ybhi16/pg1sIbyFiMF+kFEeYc0WKYN3iHPpauBoUR0mYid/D/SYAsS3yjdsM6mUlbaePMx0Y0dhQ+n4QQr7XNgEq0bAf08BOenLpHqtP7+r/rNibbBtLhRQfNJK4pCciLE1UZEnl2ntK/MBEMsnsHjcuC/8kmUhH06WzMRhaPowpdbEeCpnmMQ86VxdrVzK54eku6vrZYgAVd3+VjlAchxjTcRoeEBGCJepRqFXtRtWg7q+87NjrWjF1SuPc16Iw7vbsi6aB4Vmobnrsl6abZQHyNUYlzyM209/C/9qRye7uRfxpLjrjec+lI0oloXrVmkQkexPN285FzAx448YLGkVYMGtFEvurHhGDZ0kcWNtiYTUW8QAMoxRIjwjbRltSFyVKa2rLWZC3Wld2Uv7P45HYI9Hw7yrFLAntlq/hm7nQ1oXlhpqwL8EFbh4Trya17bZdssZ+ULvRjQ1NpaKw5PuHhhTXsdD+Qsu02qR5lvQotTvi1JdxWMOZzko8DrXHoQO3c9A+sUDvJJLWd105RP5xw6BD1h2/IX0uqdX0eqcCiudUZfOwI66tZGS0Q9VLuirHCrudsROjdifsqg7OSyteVqDOHl5Qh9maph+7uRovjpbKsAz4pO3wVZQQRe4VkP3CouQjibbD/O X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8648.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(7916004)(346002)(396003)(136003)(39860400002)(376002)(366004)(9686003)(478600001)(316002)(83380400001)(66476007)(86362001)(5660300002)(33716001)(6916009)(6666004)(8936002)(1076003)(66946007)(186003)(33656002)(38100700002)(6496006)(8676002)(966005)(2906002)(66556008)(6486002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yZXBVXQDveBhFVmTpNzB2cDPpR4qhr89xRv//OUU0xoAy2AA4R5d/AnKGN7v?= =?us-ascii?Q?8b5Id48RtM54u26itjLddLQ09SQR924hoWKDgiVyxN292u8pMewwT/4Wn966?= =?us-ascii?Q?mAdiJFodGIoF+8ff9B+GVqnnZrYXhCStABHVhDmv01iM9+IJ0yDVnAufFlnp?= =?us-ascii?Q?RWKM/AKIpa82SXkXkLNbgehQMYVBAet6kBzygObvj4nZIhdptpO0xWjujpCr?= =?us-ascii?Q?p/aXtsPw3CxAOhpFFVAqrElmvUzuRR76giDiEemKvDL7lp36Vc4UFzrg+C0E?= =?us-ascii?Q?XJsxS2SgWZlQwoPcupzj9GUY+9Zdp9TaloPEAyf64x6+i08hMBScLxkV4Ocm?= =?us-ascii?Q?0IauYd+VL9MGOapKVsrPqiR/cR+PE4rn162LtgFAt/Vjf5DqTd1tnTTrNBSa?= =?us-ascii?Q?Cm/EA2dEP1vylBzq+oYpZYzFopHsayMrZVpd2Z+0bzLU5JA79J5lc7Z4qXwg?= =?us-ascii?Q?XitP3lORUnZmgMrTL6v7ktkpIDJZwLXP4bbMonT9Wm5+FlrNSsB4eAifCloW?= =?us-ascii?Q?GJVAumJiuEXCpHUMhl1LZwkWPazVENQEmQ6IbeUGKloZlG5x4UNDdyOaxlGG?= =?us-ascii?Q?gCPe8x2o98ybRPYhMrkQ+lub8T4BYTwiSl2P48pln84GrqZ8OPNsPm2YiENp?= =?us-ascii?Q?raFXg6rRaC/66ed5fTwu2gyJpGdIYXendQ70e8Is3VE98pU3/ipiAz8a/5pU?= =?us-ascii?Q?aDyn9WUmBAShGLAtRbxfuPLugMA08gDptr4zANp7Fhma8qUJNYyCCsHTUZwW?= =?us-ascii?Q?DO+O2OJlonOTe0IuvvS53nf5eiVo4cfaNlNshKEwU2eqe4/YxgFJcCaVKshs?= =?us-ascii?Q?PVDX8GwPwW6W0onwIXdKLT0GZ15wo6T+2RgncLpuAHcIZi6CzOXFOC/3lQH8?= =?us-ascii?Q?nLHg/PagO/DONRcOCPIvEo0qy7LGvbsYxTzGJuiIU9xDfdrATGupCJyHy8aR?= =?us-ascii?Q?LwHAdJ9YZgXC9K0BkZeHYUPELUgb+agdbHTrgL2Vu7xMGdxNTRLrAc3/7CRG?= =?us-ascii?Q?taYpnx//srWiBcCeyd5iVnmMqWkOS+P6GlegsbvPbHnc2NqDN74NJVbBleki?= =?us-ascii?Q?ITErKcXFr2IwBy8Fhzd7lBIKo7c7MdLaGMdbZblK8Q5gw3bOc+pzomV4fEkN?= =?us-ascii?Q?XwL42CW2qlf3p+X0GJOh7rrDbtV5NEGtGn1cuh8/2rT2zSINOhjiQgY3HN0z?= =?us-ascii?Q?1w5WG1xZV+bAv9KxrQ365hbKSWwBmX2rGKS1QCxnf4sMHTr7tIu/QeG74C+9?= =?us-ascii?Q?/evP5ZOHs5jGmEu8dG5xxPWJoKb+Ab4gprC78PA6Qljxb2sHFOjFwR+2NerU?= =?us-ascii?Q?MKmAUZ+edz5/gEIHzkqrHnVAr8zuDDz5EsdHeASy+/Jn/SfSxYIUlH20NeGh?= =?us-ascii?Q?xF4uhZ0ABga78pKST3wX84znQt8V?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3327ad2e-e21e-4e2d-cda0-08d96dd54e66 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8648.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2021 05:48:36.2259 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pTcpaBr9VIa02S82PLGvyQ8j9fx9dthi/7qph4LX987tv9uMrz+ooSMB3S2DCU50 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8808 Received-SPF: pass client-ip=194.104.111.102; envelope-from=mchang@suse.com; helo=de-smtp-delivery-102.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2021 05:48:45 -0000 On Wed, Sep 01, 2021 at 06:38:22PM +0200, Daniel Kiper wrote: > On Tue, Aug 31, 2021 at 03:12:28PM +0800, Michael Chang via Grub-devel wrote: > > The zstd support in btrfs brings significant size increment to the > > on-disk image that it can no longer fit into btrfs bootloader area and > > short mbr gap. > > > > In order to support grub update on outstanding i386-pc setup with these > > size constraints remain in place, here we build the zstd suppprt of > > btrfs into a separate module, named btrfs_zstd, to alleviate the size > > change. Please note this only makes it's way to i386-pc, other > > architecture is not affected. > > I am OK with extracting zstd code from btrfs code. However, I want that be > done for all architectures and platforms. No exceptions. May I ask for more background about this decision ? Given that btrfs compression is per file property and can be recompressed on the fly, there is no way to detect it beforehand thus the safest bet is to assume that it is always needed. In other words if the platform has no known limitation on the size of image, the zstd code should be indivisible to btrfs.mo. > > [...] > > > diff --git a/grub-core/fs/btrfs_zstd.c b/grub-core/fs/btrfs_zstd.c > > new file mode 100644 > > index 000000000..d5d1e013c > > --- /dev/null > > +++ b/grub-core/fs/btrfs_zstd.c > > @@ -0,0 +1,36 @@ > > +/* > > + * GRUB -- GRand Unified Bootloader > > + * Copyright (C) 2008 Free Software Foundation, Inc. > > + * > > + * GRUB is free software: you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the Free Software Foundation, either version 3 of the License, or > > + * (at your option) any later version. > > + * > > + * GRUB is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + * > > + * You should have received a copy of the GNU General Public License > > + * along with GRUB. If not, see . > > + */ > > + > > +#include > > +#include > > +/* For NULL. */ > > +#include > > +#include > > +#include > > + > > +GRUB_MOD_LICENSE ("GPLv3+"); > > + > > +GRUB_MOD_INIT (btrfs_zstd) > > +{ > > + grub_btrfs_zstd_decompress_func = grub_zstd_decompress; > > Please create a function in btrfs module which will do this for you. Sure. np. > > > +} > > + > > +GRUB_MOD_FINI (btrfs_zstd) > > +{ > > + grub_btrfs_zstd_decompress_func = NULL; > > Ditto. OK. > > Last but not least, please CC original author of zstd support next time. OK. I will CC Nick Terrell next time. Thank you very much for the review. Regards, Michael > > Daniel > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel