[sheepdog] [PATCH 3/3] collie: don't use uint64_t for atomic operations

Liu Yuan namei.unix at gmail.com
Fri Aug 2 10:34:00 CEST 2013


On Fri, Aug 02, 2013 at 04:14:41PM +0900, MORITA Kazutaka wrote:
> From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> 
> Atomic operations against 64 bit integers are not allowed on 32 bit
> architectures.  Using unsigned long instead of uint64_t fixes the
> problem and doesn't hurt x86_64.
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> ---
>  collie/farm/farm.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/collie/farm/farm.c b/collie/farm/farm.c
> index 2a4e307..4b43f3d 100644
> --- a/collie/farm/farm.c
> +++ b/collie/farm/farm.c
> @@ -255,7 +255,7 @@ static void save_object_done(struct work *work)
>  {
>  	struct snapshot_work *sw = container_of(work, struct snapshot_work,
>  						work);
> -	static uint64_t saved;
> +	static unsigned long saved;
>  
>  	if (uatomic_is_true(&work_error))
>  		goto out;
> @@ -329,7 +329,7 @@ static void do_load_object(struct work *work)
>  	void *buffer = NULL;
>  	size_t size;
>  	struct snapshot_work *sw;
> -	static uint64_t loaded;
> +	static unsigned long loaded;
>  
>  	if (uatomic_is_true(&work_error))
>  		return;

So this means for 32 bit machine, we can only support up to 4G objects, that is
16P storage in total? Do you know why uatomic can't operate on u64?

Thanks
Yuan



More information about the sheepdog mailing list