From 6bbbd4e7652786fca91c6703527be8f25ff99a1c Mon Sep 17 00:00:00 2001 From: Xitee <59659167+Xitee1@users.noreply.github.com> Date: Wed, 13 May 2026 10:46:55 +0200 Subject: [PATCH] perf(burn): disable BD-R defect management for ~2x speed + 256 MiB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit growisofs unconditionally formats blank BD-R before burning, which enables drive-firmware defect management: read-after-write verify on every block + Outer Spare Area reservation. The verify-after-write halves effective burn speed (a 4x BD-R writes at ~2x), and the OSA reserves ~256 MiB on a 25 GB single-layer disc. We already have application-layer integrity coverage: par2 FEC, sha512 sidecars, and a post-burn verify pass. Drive-firmware DM is redundant for this workflow. Pass `-use-the-force-luke=spare=none` to skip the format step. On unformatted blanks the drive then accepts writes up to the full `Free Blocks` figure (12219392 blocks × 2048 ≈ 25.03 GB on SL BD-R), so `detect_disc_capacity` is simplified to return `Free Blocks` directly — the MMC-6 32h format-type descriptor walk is no longer needed and would now under-report by ~256 MiB. The two changes are coupled and documented as such in both files. README gains a note that BD-R discs must be blank and unformatted for the fit check to be accurate. Co-Authored-By: Claude Opus 4.7 (1M context) --- AGENTS.md | 6 ++-- README.md | 2 ++ src/bd_archive/tools/growisofs.py | 26 +++++++++++++++- src/bd_archive/tools/mediainfo.py | 52 ++++++++++--------------------- 4 files changed, 47 insertions(+), 39 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index b0c0ce2..a93a9cb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -58,7 +58,7 @@ src/bd_archive/ │ ├── mount.py # plain mount/umount (no sudo) │ ├── udisks.py # is_available, mount/unmount, loop_setup/loop_delete │ ├── eject.py # eject + close_tray + drive_status (CDROM ioctl, CDS_* constants) -│ ├── mediainfo.py # detect_disc_capacity (parses all non-00h format-type descriptors, falls back to Track Size for rewritable media) +│ ├── mediainfo.py # detect_disc_capacity (Free Blocks for write-once, Track Size for rewritables; assumes growisofs spare=none — no format → no OSA) │ ├── optical.py # list_drives + resolve_device (sysfs sr* enum, interactive picker) │ └── lsof.py # find_device_holders (optional — no-op if lsof absent) ├── archive/ # domain logic over tools/ @@ -83,7 +83,7 @@ Layering: `commands/` → `archive/` → `tools/` → `shell/`. Lower layers nev Four subcommands form a pipeline. `create` previews disc count + last-disc fill before prompting for confirmation, so users can dry-run sizing without committing. 1. **`create`** (`commands/create.py`) reads disc capacity via `tools.mediainfo.detect_disc_capacity` (or `args.bytes`), scans the source, and computes slice sizing plus a disc-count estimate (optionally measuring the compression ratio via `--sample`). The user confirms via `prompt_yn` before any heavy work begins (skip with `-y`). Then runs `tools.dar.create_sliced` with `--hash sha512 --min-digits 4 -Q` (plus `-z[:level] -am` when compression is enabled) to slice the source into per-disc-sized `.dar` files in `/tmp/`. par2 is generated **inline** via dar's `-E` hook (`bd_archive._par2_helper`) — the hook fires after each slice is fully written, so par2 reads the slice while it is still hot in the OS page cache, eliminating most SSD read traffic of the create phase. After dar completes, the catalog is isolated. For each slice in order: regenerate `README.txt` with the right disc number and call `tools.mkisofs.build` (mkisofs `-iso-level 3 -udf -V