diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-04-13 08:39:02 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-04-21 18:46:30 -0400 |
commit | 3304c90beca961b1bc8ae291015d4064bc3ce203 (patch) | |
tree | 86a996e4e9f71469af3e1a3c7d3186ec172a42d3 /c_src | |
parent | fee67d807bc36ff2cacb77286156798fd70e3f0c (diff) |
format_opts.no_sb_at_end
Add an option for controlling whether we create a third redundant
superblock at the end of the device.
For image files that are going to immediately be resized, we want to
skip this.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src')
-rw-r--r-- | c_src/libbcachefs.c | 2 | ||||
-rw-r--r-- | c_src/libbcachefs.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/c_src/libbcachefs.c b/c_src/libbcachefs.c index 2abf488d..eb99535f 100644 --- a/c_src/libbcachefs.c +++ b/c_src/libbcachefs.c @@ -315,7 +315,7 @@ struct bch_sb *bch2_format(struct bch_opt_strs fs_opt_strs, * means we're being run from the migrate tool and we could be * overwriting existing data if we write to the end of the disk: */ - if (i->sb_offset == BCH_SB_SECTOR) { + if (i->sb_offset == BCH_SB_SECTOR && !opts.no_sb_at_end) { struct bch_sb_layout *l = &sb.sb->layout; u64 backup_sb = size_sectors - (1 << l->sb_max_size_bits); diff --git a/c_src/libbcachefs.h b/c_src/libbcachefs.h index defdbe2b..6e9de138 100644 --- a/c_src/libbcachefs.h +++ b/c_src/libbcachefs.h @@ -43,6 +43,7 @@ struct format_opts { bool encrypted; char *passphrase; char *source; + bool no_sb_at_end; }; static inline unsigned bcachefs_kernel_version(void) |