# Re: \[PATCH 086/117\] Staging: hv: storvsc: Leverage the spinlock to manage ref\_cnt

- From: Greg KH \<hidden\>
- Date: 2011-08-23 23:30:46 
- List: virtualization
- Page: https://ratatoskr.run/virtualization/2011/08/3756147
- Thread: https://ratatoskr.run/lkml/2011/07/3741749/t/2.md

```text
On Fri, Jul 15, 2011 at 10:47:14AM -0700, K. Y. Srinivasan wrote:
> Now that we have a spin lock protecting access to the stor device pointer,
> use it manage the reference count as well.
> 
> Signed-off-by: K. Y. Srinivasan <redacted>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> ---
>  drivers/staging/hv/hyperv_storage.h |    8 ++++----
>  drivers/staging/hv/storvsc.c        |   10 +++++-----
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/hv/hyperv_storage.h b/drivers/staging/hv/hyperv_storage.h
> index 53b65be..d946211 100644
> --- a/drivers/staging/hv/hyperv_storage.h
> +++ b/drivers/staging/hv/hyperv_storage.h
> @@ -265,7 +265,7 @@ struct storvsc_device {
>  	struct hv_device *device;
>  
>  	/* 0 indicates the device is being destroyed */
> -	atomic_t ref_count;
> +	int	 ref_count;

Is this really needed?  Can't you rely on the reference count of the
hv_device itself?

greg k-h
```
