mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
block: t10-pi: Return correct ref tag when queue has no integrity profile
Commitc6e56cf6b2
("block: move integrity information into queue_limits") changed the ref tag calculation logic. It would break if there is no integrity profile. This in turn causes read/write failures for such cases. Fixes:c6e56cf6b2
("block: move integrity information into queue_limits") Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Link: https://lore.kernel.org/r/20240704061515.282343-1-joshi.k@samsung.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
98d34c0872
commit
162e06871e
@ -39,8 +39,11 @@ struct t10_pi_tuple {
|
||||
|
||||
static inline u32 t10_pi_ref_tag(struct request *rq)
|
||||
{
|
||||
unsigned int shift = rq->q->limits.integrity.interval_exp;
|
||||
unsigned int shift = ilog2(queue_logical_block_size(rq->q));
|
||||
|
||||
if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) &&
|
||||
rq->q->limits.integrity.interval_exp)
|
||||
shift = rq->q->limits.integrity.interval_exp;
|
||||
return blk_rq_pos(rq) >> (shift - SECTOR_SHIFT) & 0xffffffff;
|
||||
}
|
||||
|
||||
@ -61,8 +64,11 @@ static inline u64 lower_48_bits(u64 n)
|
||||
|
||||
static inline u64 ext_pi_ref_tag(struct request *rq)
|
||||
{
|
||||
unsigned int shift = rq->q->limits.integrity.interval_exp;
|
||||
unsigned int shift = ilog2(queue_logical_block_size(rq->q));
|
||||
|
||||
if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) &&
|
||||
rq->q->limits.integrity.interval_exp)
|
||||
shift = rq->q->limits.integrity.interval_exp;
|
||||
return lower_48_bits(blk_rq_pos(rq) >> (shift - SECTOR_SHIFT));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user