]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Fix write_bdev_label
authorAdam Kupczyk <akupczyk@ibm.com>
Fri, 2 Feb 2024 12:19:05 +0000 (12:19 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Mon, 22 Jul 2024 12:28:50 +0000 (12:28 +0000)
Fix default value of parameter 'location'.
It should consist of one element BDEV_LABEL_POSITION (0),
not just create with size 0.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 2ae3dc5502728e1739c33e5a316ab688e86cefd9..e97a86ab1ff48c55446ef87994e177cff6161ed9 100644 (file)
@@ -6526,10 +6526,7 @@ int BlueStore::_write_bdev_label(
   }
   bl.rebuild_aligned_size_and_memory(BDEV_LABEL_BLOCK_SIZE, BDEV_LABEL_BLOCK_SIZE, IOV_MAX);
   int r = 0;
-  if (std::find(locations.begin(), locations.end(), BDEV_LABEL_POSITION) ==
-      locations.end()) {
-    locations.push_back(BDEV_LABEL_POSITION);
-  }
+  ceph_assert(locations.size() > 0);
   struct stat st;
   r = ::fstat(fd, &st);
   if (r < 0) {
index 599bd42f317adae2b72cbcbe66c9224fc73be080..9b9b3f8bbbc2aed573cc48aae2093b9466f39a28 100644 (file)
@@ -2757,7 +2757,7 @@ public:
     CephContext* cct,
     const std::string &path,
     bluestore_bdev_label_t label,
-    std::vector<uint64_t> locations = std::vector<uint64_t>(BDEV_LABEL_POSITION));
+    std::vector<uint64_t> locations = std::vector<uint64_t>({BDEV_LABEL_POSITION}));
   static int _read_bdev_label(
     CephContext* cct, const std::string &path,
     bluestore_bdev_label_t *label, uint64_t disk_position = BDEV_LABEL_POSITION);