summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorlbmkplaceholder <placeholder@lbmkplaceholder.com>2022-12-23 10:28:25 +0000
committerlbmkplaceholder <placeholder@lbmkplaceholder.com>2022-12-23 10:28:25 +0000
commiteffcb942ceef282536d1da7de584357bdda5f9f3 (patch)
treeaad18f5abea3d3c2ea60d8aeeecff61319757bba /util
parent6e5828e4a8d11ce7f6d8a4868a6e0afa54e6ebf0 (diff)
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
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index b80616a..9a70634 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;
}
}