grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Neal Gompa <ngompa13@gmail.com>
To: Michael Chang <mchang@suse.com>
Cc: The development of GNU GRUB <grub-devel@gnu.org>,
	Marta Lewandowska <mlewando@redhat.com>
Subject: Re: [PATCH v2 0/9] Add support for external environment block on Btrfs
Date: Tue, 16 Sep 2025 08:05:51 -0400	[thread overview]
Message-ID: <CAEg-Je8Xreyx9XyvQVki7Lcd=3eSAOmKRFpHcgYLDHZ7JS7=4A@mail.gmail.com> (raw)
In-Reply-To: <20250915090848.131937-1-mchang@suse.com>

On Mon, Sep 15, 2025 at 5:08 AM Michael Chang <mchang@suse.com> wrote:
>
> This patch series adds support for storing the GRUB environment block in
> a reserved area of the Btrfs header. On copy on write filesystems such
> as Btrfs, the normal file based envblk cannot be updated safely at
> runtime because block addresses are not stable. The reserved area
> provides a fixed location that GRUB can write directly, allowing
> commands such as grub-reboot and savedefault to work on Btrfs volumes.
>
> The series proceeds in small chunks to keep each change buildable and
> easier to review. The first patches add new data structures and helpers
> for creating, opening, and writing an environment block in the reserved
> area. Later patches update set_variables, unset_variables, and
> list_variables so they can use the external block when it is present. An
> entry is added to the Btrfs header to reserve space at 256 KiB for the
> environment block. Finally, grub.cfg is modified so that load_env and
> save_env use the external block automatically when env_block is defined.
>
> v2:
> - Define ENV_BTRFS_OFFSET as 256*1024
> - Do not conflate type and variable definitions
> - Align typedef with struct declaration to follow coding style
> - Use bool as the return type of is_abstraction()
> - Add "if (dev->disk != NULL)" check in is_abstraction()
> - Refine the loop logic in is_abstraction() tests
> - Remove extra indentation and redundant lines in read_envblk_fs
> - Use off_t and size_t for offset and size variables, fix similar cases
>   throughout
> - Use explicit check "(fp == NULL)" instead of "(! fp)", fix similar
>   cases throughout
> - Use bool for the "found" field in var_lookup_ctx
> - Add documentation describing the Btrfs environment block and special
>   environment block variables
>
> Michael Chang (9):
>   util/grub-editenv: add basic structures and probe call for external
>     envblk
>   util/grub-editenv: add fs_envblk open helper
>   util/grub-editenv: add fs_envblk write helper
>   util/grub-editenv: wire set_variables to optional fs_envblk
>   util/grub-editenv: wire unset_variables to optional fs_envblk
>   util/grub-editenv: wire list_variables to optional fs_envblk
>   btrfs: add environment block to reserved header area
>   00_header.in: wire grub.cfg to use env_block when present
>   docs: add Btrfs env block and special env vars
>
>  docs/grub.texi           |  60 ++++++
>  grub-core/fs/btrfs.c     |   3 +-
>  include/grub/fs.h        |   2 +
>  util/grub-editenv.c      | 393 ++++++++++++++++++++++++++++++++++++++-
>  util/grub.d/00_header.in |  26 ++-
>  5 files changed, 477 insertions(+), 7 deletions(-)
>
> --
> 2.51.0
>

The patches look reasonable to me and things still seem to work. It is
much easier to understand all the pieces with this series breakout. :)

Reviewed-by: Neal Gompa <ngompa13@gmail.com>


-- 
真実はいつも一つ!/ Always, there's only one truth!

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

      parent reply	other threads:[~2025-09-16 12:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15  9:08 [PATCH v2 0/9] Add support for external environment block on Btrfs Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 1/9] util/grub-editenv: add basic structures and probe call for external envblk Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 2/9] util/grub-editenv: add fs_envblk open helper Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 3/9] util/grub-editenv: add fs_envblk write helper Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 4/9] util/grub-editenv: wire set_variables to optional fs_envblk Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 5/9] util/grub-editenv: wire unset_variables " Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 6/9] util/grub-editenv: wire list_variables " Michael Chang via Grub-devel
2025-09-17 15:16   ` Sudhakar Kuppusamy
2025-09-15  9:08 ` [PATCH v2 7/9] btrfs: add environment block to reserved header area Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 8/9] 00_header.in: wire grub.cfg to use env_block when present Michael Chang via Grub-devel
2025-09-15  9:08 ` [PATCH v2 9/9] docs: add Btrfs env block and special env vars Michael Chang via Grub-devel
2025-09-16 12:05 ` Neal Gompa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEg-Je8Xreyx9XyvQVki7Lcd=3eSAOmKRFpHcgYLDHZ7JS7=4A@mail.gmail.com' \
    --to=ngompa13@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=mchang@suse.com \
    --cc=mlewando@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).