[sheepdog] [PATCH 4/4] farm: use slice_{read, write} to read/write object
Liu Yuan
namei.unix at gmail.com
Thu Jul 18 10:59:15 CEST 2013
On Thu, Jul 18, 2013 at 04:35:20PM +0900, MORITA Kazutaka wrote:
> 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.
Well, I think it is something wrong with trim before sha1. I add my 1/4 patch
back and I passed the test. I noticed that load failure because it got a wrong
sha1. I guess it is some potential bug in trim-before-sha1.
I didn't find out the root cause yet, but I think would be an argument to merge
my 1/4 patch.
Thanks
Yuan
More information about the sheepdog
mailing list