From 9a7c25e46ff1bb592fafb313401f0fe610840c54 Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Tue, 13 Feb 2024 12:54:27 +0000 Subject: [PATCH] os/bluestore: Small fix to mkfs Signed-off-by: Adam Kupczyk (cherry picked from commit eac365cd1a7554f31d0018a3b45f060e22ad7add) --- src/os/bluestore/BlueStore.cc | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 24570965d79..38d459c77eb 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -8287,22 +8287,6 @@ int BlueStore::mkfs() return r; // idempotent } } - - { - string type; - r = read_meta("type", &type); - if (r == 0) { - if (type != "bluestore") { - derr << __func__ << " expected bluestore, but type is " << type << dendl; - return -EIO; - } - } else { - r = write_meta("type", "bluestore"); - if (r < 0) - return r; - } - } - r = _open_path(); if (r < 0) return r; @@ -8355,6 +8339,20 @@ int BlueStore::mkfs() r = _open_bdev(true); if (r < 0) goto out_close_fsid; + { + string type; + r = read_meta("type", &type); + if (r == 0) { + if (type != "bluestore") { + derr << __func__ << " expected bluestore, but type is " << type << dendl; + return -EIO; + } + } else { + r = write_meta("type", "bluestore"); + if (r < 0) + return r; + } + } freelist_type = "bitmap"; dout(10) << " freelist_type " << freelist_type << dendl; -- 2.39.5