summaryrefslogtreecommitdiff
path: root/rust/helpers/build_bug.c
diff options
context:
space:
mode:
authorSergey Bashirov <sergeybashirov@gmail.com>2025-07-01 15:21:48 +0300
committerTrond Myklebust <trond.myklebust@hammerspace.com>2025-07-14 15:20:28 -0700
commit81438498a285759f31e843ac4800f82a5ce6521f (patch)
tree00f00faf07363db5649816d9c4ad9a1046d14dfd /rust/helpers/build_bug.c
parentd897d81671bc4615c80f4f3bd5e6b218f59df50c (diff)
pNFS: Fix stripe mapping in block/scsi layout
Because of integer division, we need to carefully calculate the disk offset. Consider the example below for a stripe of 6 volumes, a chunk size of 4096, and an offset of 70000. chunk = div_u64(offset, dev->chunk_size) = 70000 / 4096 = 17 offset = chunk * dev->chunk_size = 17 * 4096 = 69632 disk_offset_wrong = div_u64(offset, dev->nr_children) = 69632 / 6 = 11605 disk_chunk = div_u64(chunk, dev->nr_children) = 17 / 6 = 2 disk_offset = disk_chunk * dev->chunk_size = 2 * 4096 = 8192 Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20250701122341.199112-1-sergeybashirov@gmail.com Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'rust/helpers/build_bug.c')
0 files changed, 0 insertions, 0 deletions