scsi: ufs: Prepare HPB read for cached sub-region
Quoted 25 lines
Quoted 25 lines
Quoted 11 lines
(quoted diff) +11
-0+ /* + * If the region state is active, mctx must be allocated. + * In this case, check whether the region is evicted or + * mctx allcation fail. + */ + if (unlikely(!srgn->mctx)) { + dev_err(&hpb->sdev_ufs_lu->sdev_dev, + "no mctx in region %d subregion %d.\n", + srgn->rgn_idx, srgn->srgn_idx); + return true; + }Review
Quoted 10 lines
(quoted diff) +10
-0+ + if ((srgn_offset + cnt) > bitmap_len) + bit_len = bitmap_len - srgn_offset; + else + bit_len = cnt; + + if (find_next_bit(srgn->mctx->ppn_dirty, bitmap_len, + srgn_offset) < bit_len + srgn_offset) + return true; +It seems unnecessary to search through
bitmap_len
How about searching by transfer size?
Quoted 3 lines
Quoted 2 lines
if (find_next_bit(srgn->mctx->ppn_dirty,
bit_len+srgn_offset,srgn_offset) <bit_len+srgn_offset)Isn't
bit_lenshould be used for size, and notbit_len+srgn_offset?
then find_next_bit checks from start to bit_len. find_next_bit stops checking if start is greater than bit_len. it does not check for dirty as transfer_size.
Thanks
Yohan
Quoted 7 lines
Thanks,
AvriQuoted 3 lines
Thanks
Yohan
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 11 lines
(quoted diff) +11
-0+ /* + * If the region state is active, mctx must be allocated. + * In this case, check whether the region is evicted or + * mctx allcation fail. + */ + if (unlikely(!srgn->mctx)) { + dev_err(&hpb->sdev_ufs_lu->sdev_dev, + "no mctx in region %d subregion %d.\n", + srgn->rgn_idx, srgn->srgn_idx); + return true; + }Review
Quoted 10 lines
(quoted diff) +10
-0+ + if ((srgn_offset + cnt) > bitmap_len) + bit_len = bitmap_len - srgn_offset; + else + bit_len = cnt; + + if (find_next_bit(srgn->mctx->ppn_dirty, bitmap_len, + srgn_offset) < bit_len + srgn_offset) + return true; +It seems unnecessary to search through
bitmap_len
How about searching by transfer size?
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
if (find_next_bit(srgn->mctx->ppn_dirty,
bit_len+srgn_offset,srgn_offset) <bit_len+srgn_offset)Isn't
bit_lenshould be used for size, and notbit_len+srgn_offset?then
find_next_bitchecks from start tobit_len.find_next_bitstops checking if start is greater thanbit_len. it does not check for dirty astransfer_size.
Right. Size (nbits in _find_next_bit) practically means @end - Confusing... Either way, Is this tad optimization worth another spin in your opinion?
Thanks,
Avri
Quoted 11 lines
Thanks
YohanQuoted 7 lines
Thanks,
AvriQuoted 3 lines
Thanks
Yohan