util/nvmutil: greatly optimise cmd_copy()

similar to the last change by concept. we now write
individual 4KB blocks per part 0 and 1, at the end
of nvmutil, based on pointer values gbe and gbe2

instead of running memcpy, simply overwrite the pointer

this results in less I/O, thus more speed
fsdg20230625
lbmkplaceholder 2022-12-23 10:28:25 +00:00
parent 6e5828e4a8
commit effcb942ce
1 changed files with 5 additions and 7 deletions

View File

@ -379,16 +379,14 @@ cmd_swap(void)
void void
cmd_copy(void) cmd_copy(void)
{ {
int src = (part << 12);
int destPart = (part ^ 1);
int dest = (destPart << 12);
if (validChecksum(part)) { if (validChecksum(part)) {
memcpy((gbe + dest), (gbe + src), SIZE_4KB); if (part)
gbe = gbe2;
else
gbe2 = gbe;
gbeFileModified = 1; gbeFileModified = 1;
nvmPartModified[destPart] = 1; nvmPartModified[part ^ 1] = 1;
} }
} }