Skip to content

Commit 7bcb68e

Browse files
authored
Merge pull request ceph#55374 from aclamk/wip-aclamk-bs-multi-label
os/bluestore: Multiple bdev labels on main block device
2 parents c77bd7e + 64f6b5d commit 7bcb68e

File tree

11 files changed

+1129
-188
lines changed

11 files changed

+1129
-188
lines changed

src/common/options/global.yaml.in

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4411,6 +4411,40 @@ options:
44114411
flags:
44124412
- create
44134413
with_legacy: true
4414+
- name: bluestore_bdev_label_multi
4415+
type: bool
4416+
level: advanced
4417+
desc: Keep multiple copies of block device label.
4418+
long_desc: Having multiple labels is only useful in error conditions.
4419+
The label located at offset 0 has been known to be sometimes overwritten by unknown causes,
4420+
but without it OSD cannot run.
4421+
default: true
4422+
flags:
4423+
- create
4424+
with_legacy: false
4425+
- name: bluestore_bdev_label_require_all
4426+
type: bool
4427+
level: advanced
4428+
desc: Require all copies to match.
4429+
long_desc: Under normal conditions, all copies should be the same.
4430+
Clearing this flag allows to run OSD if at least one of labels
4431+
could be properly read.
4432+
default: true
4433+
see_also:
4434+
- bluestore_bdev_label_multi
4435+
flags:
4436+
- runtime
4437+
with_legacy: false
4438+
- name: bluestore_bdev_label_multi_upgrade
4439+
type: bool
4440+
level: advanced
4441+
desc: Let repair upgrade to multi label.
4442+
long_desc: By default single label is preserved.
4443+
Setting this variable before running fsck-repair upgrades single label into multi label.
4444+
default: false
4445+
flags:
4446+
- startup
4447+
with_legacy: false
44144448
# whether preallocate space if block/db_path/wal_path is file rather that block device.
44154449
- name: bluestore_block_preallocate_file
44164450
type: bool
@@ -5333,12 +5367,6 @@ options:
53335367
level: dev
53345368
default: false
53355369
with_legacy: true
5336-
- name: bluestore_debug_prefill
5337-
type: float
5338-
level: dev
5339-
desc: simulate fragmentation
5340-
default: 0
5341-
with_legacy: true
53425370
- name: bluestore_debug_prefragment_max
53435371
type: size
53445372
level: dev

src/os/bluestore/BlueFS.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ int BlueFS::add_block_device(unsigned id, const string& path, bool trim,
490490
break;
491491
case BDEV_DB:
492492
case BDEV_NEWDB:
493-
reserved = DB_SUPER_RESERVED;
493+
reserved = SUPER_RESERVED;
494494
break;
495495
case BDEV_SLOW:
496496
reserved = 0;
@@ -546,6 +546,13 @@ uint64_t BlueFS::get_block_device_size(unsigned id) const
546546
return 0;
547547
}
548548

549+
BlockDevice* BlueFS::get_block_device(unsigned id) const
550+
{
551+
if (id < bdev.size() && bdev[id])
552+
return bdev[id];
553+
return nullptr;
554+
}
555+
549556
void BlueFS::handle_discard(unsigned id, interval_set<uint64_t>& to_release)
550557
{
551558
dout(10) << __func__ << " bdev " << id << dendl;

src/os/bluestore/BlueFS.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ class BlueFS {
743743
bluefs_shared_alloc_context_t* _shared_alloc = nullptr);
744744
bool bdev_support_label(unsigned id);
745745
uint64_t get_block_device_size(unsigned bdev) const;
746+
BlockDevice* get_block_device(unsigned bdev) const;
746747

747748
// handler for discard event
748749
void handle_discard(unsigned dev, interval_set<uint64_t>& to_release);

0 commit comments

Comments
 (0)