]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson: use uint32_t when calling ioctl(BLKGETNRZONES)
authorKefu Chai <k.chai@proxmox.com>
Mon, 11 May 2026 05:07:25 +0000 (13:07 +0800)
committerKefu Chai <k.chai@proxmox.com>
Tue, 12 May 2026 03:03:03 +0000 (11:03 +0800)
commitf8cde1e00fbf6d7b7815ec79a7340bd09fa54331
treec4902666b24369d386d011f8ff6862a357a77056
parent458368c1b88d3d028231dc91e2d323323d87623f
crimson: use uint32_t when calling ioctl(BLKGETNRZONES)

before this change, we pass a pointer to a `size_t` to
ioctl(BLKGETNRZONES), but in the Linux kernel,
include/uapi/linux/blkzoned.h:

```c
 #define BLKGETNRZONES _IOR(0x12, 133, __u32)
```
this API reads 32 bits of data into the pointer. on 64-bit
architectures, size_t is 64 bits. fortunately, we initialize
nr_zones with 0, so the upper 32 bits remain zero. this works
on little-endian systems, but not on big-endian systems. it is
also semantically wrong. we should pass a pointer to a 32-bit
value when calling ioctl(BLKGETNRZONES).

in this change, we change the type of nr_zones from size_t to
uint32_t to match what the Linux kernel expects.

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