RE: [PATCH v4 3/9] scsi: ufshpb: Add region's reads counter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Avri,

> +static void ufshpb_normalization_work_handler(struct work_struct *work)
> +{
> +        struct ufshpb_lu *hpb;
> +        int rgn_idx;
> +
> +        hpb = container_of(work, struct ufshpb_lu, ufshpb_normalization_work);
> +
> +        for (rgn_idx = 0; rgn_idx < hpb->rgns_per_lu; rgn_idx++) {
> +                struct ufshpb_region *rgn = hpb->rgn_tbl + rgn_idx;

*HERE*
> +                if (rgn->reads) {
> +                        unsigned long flags;
> +
> +                        spin_lock_irqsave(&rgn->rgn_lock, flags);

I thinks this lock should protect rgn->reads when it is accessed.

> +                        rgn->reads = (rgn->reads >> 1);
> +                        spin_unlock_irqrestore(&rgn->rgn_lock, flags);
> +                }
*HERE*

> +
> +                if (rgn->rgn_state != HPB_RGN_ACTIVE || rgn->reads)
> +                        continue;
> +
> +                /* if region is active but has no reads - inactivate it */
> +                spin_lock(&hpb->rsp_list_lock);
> +                ufshpb_update_inactive_info(hpb, rgn->rgn_idx);
> +                spin_unlock(&hpb->rsp_list_lock);
> +        }
> +
> +        clear_bit(WORK_PENDING, &hpb->work_data_bits);

Why we use work_data_bits? It may be checked by worker API.

Thanks,
Daejun



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux