Skip to content

Direct filesystem updates ignore the changed-track list and attempt a full-disk write #872

Description

@rjburrows

Summary

FluxSectorInterface::flushChanges() gathers only modified tracks and passes them to writeDiskCommand(), but writeDiskCommand() discards that list and recreates a list of every logical track in the layout.

This makes a direct filesystem update attempt to rewrite the entire disk, even though only the modified tracks have been loaded.

Reproduction

A direct Roland D-20 filesystem update:

fluxengine putfile -c rolandd20 -f drive:1 \  -l TESTSND.333 -p TESTSND2.333

After reading the directory, FluxEngine attempted a full-disk write and failed before writing because the untouched tracks were absent from the in-memory image:

Error: sector 0.0.0 is missing from the image

This appears generic to direct filesystem modifications, not Roland-specific.

Cause

The overload with a location argument currently reconstructs all logical locations:

auto sectorLocations =
    std::ranges::views::keys(diskLayout.layoutByLogicalLocation);
auto chs = std::vector(sectorLocations.begin(), sectorLocations.end());

It then writes chs, ignoring the supplied list.

Proposed fix

Use the supplied logical-location list:

void writeDiskCommand(
    const DiskLayout& diskLayout,
    const Image& image,
    Encoder& encoder,
    FluxSinkFactory& fluxSinkFactory,
    Decoder* decoder,
    FluxSource* fluxSource,
    const std::vector<CylinderHead>& logicalLocations)
{
    if (fluxSource && decoder)
        writeTracksAndVerify(
            diskLayout, fluxSinkFactory, encoder,
            *fluxSource, *decoder, image, logicalLocations);
    else
        writeTracks(
            diskLayout, fluxSinkFactory, encoder,
            image, logicalLocations);
}

The existing overload with no list can continue to construct and pass all logical tracks for full-disk write operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions