From effcb942ceef282536d1da7de584357bdda5f9f3 Mon Sep 17 00:00:00 2001 From: lbmkplaceholder Date: Fri, 23 Dec 2022 10:28:25 +0000 Subject: 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 --- util/nvmutil/nvmutil.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'util') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index b80616ae..9a70634e 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -379,16 +379,14 @@ cmd_swap(void) void cmd_copy(void) { - int src = (part << 12); - - int destPart = (part ^ 1); - int dest = (destPart << 12); - if (validChecksum(part)) { - memcpy((gbe + dest), (gbe + src), SIZE_4KB); + if (part) + gbe = gbe2; + else + gbe2 = gbe; gbeFileModified = 1; - nvmPartModified[destPart] = 1; + nvmPartModified[part ^ 1] = 1; } } -- cgit v1.2.1