]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: reload head if modified
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 3 Mar 2026 15:42:51 +0000 (00:42 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 17 Mar 2026 08:38:18 +0000 (17:38 +0900)
This commit also fixes the test case to verify that
the head is correctly allocated and updated
during omap_set_keys operations involving multiple keys.

Signed-off-by: Myoungwon Oh <ohmyoungwon@gmail.com>
src/crimson/os/seastore/omap_manager/log/log_manager.cc
src/test/crimson/seastore/test_seastore.cc

index 430fc250d1847ffebef3c897d8d803231428570b..59e182c070948b37578da817eb7ac2b5d86fea97 100644 (file)
@@ -204,7 +204,13 @@ LogManager::omap_set_keys(
       // remove duplicate keys first
       co_await remove_kv(t, log_root.addr, p.first, nullptr);
     }
+    laddr_t last_addr = log_root.addr;
     co_await f(p.first, p.second, has_ow_key);
+    if (last_addr != log_root.addr) {
+      ext = co_await log_load_extent<LogNode>(
+       t, log_root.addr, BEGIN_KEY, END_KEY);
+      last_addr = log_root.addr;
+    }
   }
 
   if (!ow_kv.first.empty()) {
@@ -216,13 +222,17 @@ LogManager::omap_set_keys(
 
 
   if (!dup_kvs.empty()) {
-    ext = co_await log_load_extent<LogNode>(
-        t,
-        co_await get_dup_addr_from_root(t, log_root.addr),
-        BEGIN_KEY,
-        END_KEY);
+    laddr_t last_addr = co_await get_dup_addr_from_root(t, log_root.addr);
+    ext = co_await log_load_extent<LogNode>(t, last_addr, BEGIN_KEY, END_KEY);
     for (auto &p: dup_kvs) {
       co_await f(p.first, p.second, false);
+      if (&p != &*dup_kvs.rbegin()) {
+       laddr_t current_addr = co_await get_dup_addr_from_root(t, log_root.addr);
+       if (last_addr != current_addr) {
+         ext = co_await log_load_extent<LogNode>(t, current_addr, BEGIN_KEY, END_KEY);
+         last_addr = current_addr;
+       }
+      }
     }
   }
   co_return;
index d7fedc0b814e57507f892a345e67a46f903c1919..b251b603e7985e0b1bb31af0dbd05828c82718b4 100644 (file)
@@ -1646,7 +1646,7 @@ TEST_P(seastore_test_t, pgmeta_io)
       encode(ss, l2);
 
       CTransaction t;
-      if (i % 2 == 0) {
+      if ((i / 2) % 2 == 0) {
        test_obj2.set_omap(t, key, l);
        test_obj2.set_omap(t, key2, l2); // x2
       } else {