FROMGIT: scsi: ufshpb: rewind the read timeout on every read

The "cold"-timer purpose is not to hang-on to active regions with no
reads.  Therefore the read-timeout should be re-wind on every read, and
not just when the region is activated.

Link: https://lore.kernel.org/r/20210808090024.21721-2-avri.altman@wdc.com
Fixes: 13c044e91678 (scsi: ufs: ufshpb: Add "cold" regions timer)
(cherry picked from commit 283e61c5a9bed2c2acde3f50a3f76f09816c0aab
git: //git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next)
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Change-Id: If174a161028cf2382538d69e30181cda979a12de
This commit is contained in:
Avri Altman
2021-07-29 15:18:23 +03:00
committed by Alistair Delva
parent 8c2c4d12bb
commit d054108519

View File

@@ -184,9 +184,19 @@ next_srgn:
set_bit_len = cnt; set_bit_len = cnt;
spin_lock_irqsave(&hpb->rgn_state_lock, flags); spin_lock_irqsave(&hpb->rgn_state_lock, flags);
if (set_dirty && rgn->rgn_state != HPB_RGN_INACTIVE && if (rgn->rgn_state != HPB_RGN_INACTIVE) {
srgn->srgn_state == HPB_SRGN_VALID) if (set_dirty) {
bitmap_set(srgn->mctx->ppn_dirty, srgn_offset, set_bit_len); if (srgn->srgn_state == HPB_SRGN_VALID)
bitmap_set(srgn->mctx->ppn_dirty, srgn_offset,
set_bit_len);
} else if (hpb->is_hcm) {
/* rewind the read timer for lru regions */
rgn->read_timeout = ktime_add_ms(ktime_get(),
rgn->hpb->params.read_timeout_ms);
rgn->read_timeout_expiries =
rgn->hpb->params.read_timeout_expiries;
}
}
spin_unlock_irqrestore(&hpb->rgn_state_lock, flags); spin_unlock_irqrestore(&hpb->rgn_state_lock, flags);
if (hpb->is_hcm && prev_srgn != srgn) { if (hpb->is_hcm && prev_srgn != srgn) {