RE: [RFC PATCH v2 4/5] scsi: ufs: L2P map management for HPB read

Avri Altman
2020-06-18T10:23:02Z

> +static void ufshpb_run_active_subregion_list(struct ufshpb_lu *hpb)
> +{
> + struct ufshpb_region *rgn;
> + struct ufshpb_subregion *srgn;
> + struct ufshpb_map_ctx *mctx;
mctx doesn't really do anything here

> + unsigned long flags;
> + int ret = 0;
> +
> + spin_lock_irqsave(&hpb->rsp_list_lock, flags);
> + while ((srgn = list_first_entry_or_null(&hpb->lh_act_srgn,
> + struct ufshpb_subregion,
> + list_act_srgn))) {
> + list_del_init(&srgn->list_act_srgn);
> + spin_unlock_irqrestore(&hpb->rsp_list_lock, flags);
> +
> + rgn = hpb->rgn_tbl + srgn->rgn_idx;
> + mctx = NULL;
> + ret = ufshpb_add_region(hpb, rgn);
> + if (ret)
> + break;
> +
> + ret = ufshpb_issue_map_req(hpb, rgn, srgn);
> + if (ret) {
> + dev_notice(&hpb->hpb_lu_dev,
> + "issue map_req failed. ret %d, region %d - %d\n",
> + ret, rgn->rgn_idx, srgn->srgn_idx);
> + break;
> + }
> + spin_lock_irqsave(&hpb->rsp_list_lock, flags);
> + }
> +
> + if (ret) {
> + dev_notice(&hpb->hpb_lu_dev, "region %d - %d, will retry\n",
> + rgn->rgn_idx, srgn->srgn_idx);
> + spin_lock_irqsave(&hpb->rsp_list_lock, flags);
> + ufshpb_add_active_list(hpb, rgn, srgn);
> + }
> + spin_unlock_irqrestore(&hpb->rsp_list_lock, flags);
> +}