Re: [PATCH 09/32] mlx4: Convert pv_id_table to XArray

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

 



On Wed, Feb 20, 2019 at 04:20:44PM -0800, Matthew Wilcox wrote:

> @@ -196,13 +193,12 @@ static void id_map_find_del(struct ib_device *ibdev, int pv_cm_id)
>  	struct id_map_entry *ent, *found_ent;
>  
>  	spin_lock(&sriov->id_map_lock);
> -	ent = (struct id_map_entry *)idr_find(&sriov->pv_id_table, pv_cm_id);
> +	ent = xa_erase(&sriov->pv_id_table, pv_cm_id);
>  	if (!ent)
>  		goto out;
>  	found_ent = id_map_find_by_sl_id(ibdev, ent->slave_id, ent->sl_cm_id);
>  	if (found_ent && found_ent == ent)
>  		rb_erase(&found_ent->node, sl_id_map);
> -	idr_remove(&sriov->pv_id_table, pv_cm_id);
>  out:
>  	spin_unlock(&sriov->id_map_lock);
>  }
> @@ -256,25 +252,19 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
>  	ent->dev = to_mdev(ibdev);
>  	INIT_DELAYED_WORK(&ent->timeout, id_map_ent_timeout);
>  
> -	idr_preload(GFP_KERNEL);
> -	spin_lock(&to_mdev(ibdev)->sriov.id_map_lock);
> -
> -	ret = idr_alloc_cyclic(&sriov->pv_id_table, ent, 0, 0, GFP_NOWAIT);
> +	ret = xa_alloc_cyclic(&sriov->pv_id_table, &ent->pv_cm_id, ent,
> +			xa_limit_32b, &sriov->pv_id_next, GFP_KERNEL);

Why drop the NO_WAIT? Explain in the commit message?

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux