]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson/seastore: clamp block_size to laddr_t::UNIT_SIZE on small-LBA devices 69006/head
authorKefu Chai <k.chai@proxmox.com>
Wed, 20 May 2026 00:55:55 +0000 (08:55 +0800)
committerKefu Chai <k.chai@proxmox.com>
Wed, 20 May 2026 00:57:38 +0000 (08:57 +0800)
commita47da78c0dcd18dbe3ae67f8030d43f46aa5b7cd
treea54fa9b14298aa32002ad5c8a308543d30b123d8
parent4d15f1ce0650d41c7291d2e843751b4fe3854869
crimson/seastore: clamp block_size to laddr_t::UNIT_SIZE on small-LBA devices

Seastar's file::disk_write_dma_alignment() faithfully reports what the
kernel exposes for the underlying device. On block devices in 512-byte
LBA mode (the factory default for many NVMe SSDs), it correctly returns
512.

SeaStore's internal addressing, however, operates at a 4 KiB page
granularity defined by laddr_t::UNIT_SIZE, and SeaStore::_mount() asserts
that block_size >= UNIT_SIZE. As a result, ceph-osd-crimson --mkfs
--osd-objectstore seastore aborts on any device shipped in 512-LBA
mode:

  seastore.cc:344  ceph_assert(block_size >= laddr_t::UNIT_SIZE)
  seastore requires a device block size of at least 4096 bytes,
  but the primary device at '/var/lib/ceph/osd/ceph-N/block'
  reports block_size=512

The reported alignment is not wrong; it is the minimum Linux enforces
for O_DIRECT on that device, so users with optimization in mind can
override it through io_properties.yaml. But SeaStore can run correctly
on 512-LBA devices as long as it issues only 4 KiB-aligned I/O (which
is also 512-aligned, so the device is happy). Clamp the captured
block_size to laddr_t::UNIT_SIZE so SeaStore can host an OSD on
512-LBA storage without operator intervention, while still honoring
larger device-reported alignments when present.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/crimson/os/seastore/segment_manager/block.cc