[sheepdog] [PATCH 4/4] farm: use slice_{read, write} to read/write object

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Jul 18 09:35:20 CEST 2013


At Tue, 16 Jul 2013 17:30:21 +0800,
Liu Yuan wrote:
> 
> For a test with 200M cluster with 2 copies (so roughly 100M data to backup),
> I got the following resualt:
> 
>                    size  time
> w/ slice (64K)  :  51M   2.037s
> w/ slice (128K) :  53M   1.223s
> w/ slice (256K) :  57M   1.216s
> w/ slice (512K) :  61M   1.205s
> w/o slice (4M)  :  97M   1.174s
> 
> This is why I choose 128K as slice size.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  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 385397f..d4aff48 100644
> --- a/collie/farm/farm.c
> +++ b/collie/farm/farm.c
> @@ -243,7 +243,7 @@ static void do_save_object(struct work *work)
>  	if (sd_read_object(sw->entry.oid, buf, size, 0, true) < 0)
>  		goto error;
>  
> -	if (sha1_file_write(buf, size, sw->entry.sha1) < 0)
> +	if (slice_write(buf, size, sw->entry.sha1) < 0)
>  		goto error;
>  
>  	free(buf);
> @@ -337,7 +337,7 @@ static void do_load_object(struct work *work)
>  
>  	sw = container_of(work, struct snapshot_work, work);
>  
> -	buffer = sha1_file_read(sw->entry.sha1, &size);
> +	buffer = slice_read(sw->entry.sha1, &size);
>  
>  	if (!buffer)
>  		goto error;

Sorry, tests/functional/030 cannot be passed after merging this patch.

Thanks,

Kazutaka



More information about the sheepdog mailing list