[PATCH 12/21] Use memmove instead of memset to move btree items

Valerie Aurora val at versity.com
Tue Feb 11 13:19:09 PST 2025


From: Zach Brown <zab at versity.com>

The new and old location of a btree item can overlap, so use
memmove().

Co-authored-by: Valerie Aurora <val at versity.com>
Signed-off-by: Zach Brown <zab at versity.com>
Signed-off-by: Valerie Aurora <val at versity.com>
---
 shared/btree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/btree.c b/shared/btree.c
index b96a912..39d0805 100644
--- a/shared/btree.c
+++ b/shared/btree.c
@@ -357,7 +357,7 @@ static int compact_items(struct ngnfs_txn_block *tblk, struct ngnfs_btree_block
 		if (le16_to_cpu(bt->ihdrs[ind].off) != off) {
 			dst = item_from_off(bt, off);
 			ngnfs_tblk_assign(tblk, bt->ihdrs[ind].off, cpu_to_le16(off));
-			ngnfs_tblk_memcpy(tblk, dst, item, bytes);
+			ngnfs_tblk_memmove(tblk, dst, item, bytes);
 		}
 
 		off += bytes;
-- 
2.48.1




More information about the ngnfs-devel mailing list