]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: restore previous offline expansion logic 66344/head
authorJoshua Blanch <joshua.blanch@clyso.com>
Mon, 13 Apr 2026 17:20:30 +0000 (17:20 +0000)
committerJoshua Blanch <joshua.blanch@clyso.com>
Thu, 23 Apr 2026 15:05:55 +0000 (15:05 +0000)
expanding allocator before opening for offline path
fixes to comments and null check

Signed-off-by: Joshua Blanch <joshua.blanch@clyso.com>
src/os/bluestore/BlueStore.cc

index 49e78cebc10987e5c439efd0212e64a54d0bf97a..3d49feff4e74a8f8442138f378456604bd48e859 100644 (file)
@@ -9223,7 +9223,7 @@ int BlueStore::expand_devices(ostream& out)
       continue;
     }
     my_bdev->refresh_size();
-    uint64_t size = my_bdev ? my_bdev->get_size() : 0;
+    uint64_t size = my_bdev->get_size();
 
     if (size == 0) {
       // no bdev
@@ -9266,7 +9266,7 @@ int BlueStore::expand_devices(ostream& out)
                 << " : size updated to 0x" << std::hex << size
                 << std::dec << "(" << byte_u_t(size) << ")"
                 << std::endl;
-            // online expand needs to update allocator now
+            // online expand needs to update BlueFS allocator(s) now
             // offline does not need this as update will happen
             // on next open
             if (!need_to_close)
@@ -9332,15 +9332,23 @@ int BlueStore::expand_devices(ostream& out)
 
       if (need_to_close) {
         _close_db_and_around();
+        //
+        // Mount in read/write to sync expansion changes
+        // and make sure everything is all right.
+        //
+        before_expansion_bdev_size = size0; // preserve orignal size to permit
+                                            // following _db_open_and_around()
+                                            // do some post-init stuff on opened
+                                            // allocator.
         r = _open_db_and_around(false);
         ceph_assert(r == 0);
+      } else {
+        fm->expand(aligned_size, db);
+        alloc->expand(aligned_size);
+        uint64_t aligned_size0 = p2roundup(size0, min_alloc_size);
+        alloc->init_add_free(aligned_size0, aligned_size - aligned_size0);
       }
 
-      fm->expand(aligned_size, db);
-      alloc->expand(aligned_size);
-      uint64_t aligned_size0 = p2roundup(size0, min_alloc_size);
-      alloc->init_add_free(aligned_size0, aligned_size - aligned_size0);
-
       dout(1) << __func__
               << " : size updated to 0x" << std::hex << size
               << std::dec << "(" << byte_u_t(size) << ")"