mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-08-21 16:31:14 +02:00
nvme: allow integrity when PI is not in first bytes
NVM command set 1.0 (or later) mandates PI to be in the last bytes of metadata. But this was not supported in the block-layer, and driver registered a nop profile. Since block-integrity can now handle flexible PI offset, change the driver to support this configuration. Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240201130126.211402-4-joshi.k@samsung.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
60d21aac52
commit
921e81db52
|
@ -1771,6 +1771,7 @@ static void nvme_init_integrity(struct gendisk *disk,
|
|||
}
|
||||
|
||||
integrity.tuple_size = head->ms;
|
||||
integrity.pi_offset = head->pi_offset;
|
||||
blk_integrity_register(disk, &integrity);
|
||||
blk_queue_max_integrity_segments(disk->queue, max_integrity_segments);
|
||||
}
|
||||
|
@ -1880,11 +1881,16 @@ static int nvme_init_ms(struct nvme_ctrl *ctrl, struct nvme_ns_head *head,
|
|||
free_data:
|
||||
kfree(nvm);
|
||||
set_pi:
|
||||
if (head->pi_size && (first || head->ms == head->pi_size))
|
||||
if (head->pi_size && head->ms >= head->pi_size)
|
||||
head->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
|
||||
else
|
||||
head->pi_type = 0;
|
||||
|
||||
if (first)
|
||||
head->pi_offset = 0;
|
||||
else
|
||||
head->pi_offset = head->ms - head->pi_size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -463,6 +463,7 @@ struct nvme_ns_head {
|
|||
u16 ms;
|
||||
u16 pi_size;
|
||||
u8 pi_type;
|
||||
u8 pi_offset;
|
||||
u8 guard_type;
|
||||
u16 sgs;
|
||||
u32 sws;
|
||||
|
|
Loading…
Reference in New Issue
Block a user