At Tue, 13 Dec 2011 15:27:29 +0800, Liu Yuan wrote: > > From: Liu Yuan <tailai.ly at taobao.com> > > Current recovery logic needs to query underlying object store of object list > in the specified epoch, in order to calculate object relocation. We need to abstract > it out to adopt sheepdog to more stores. > > Signed-off-by: Liu Yuan <tailai.ly at taobao.com> > --- > sheep/sheep_priv.h | 1 + > sheep/simple_store.c | 40 +++++++++++++++++++++++++++++++++++++++- > sheep/store.c | 46 ++++++++++------------------------------------ > 3 files changed, 50 insertions(+), 37 deletions(-) > > diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h > index 618267e..7c61032 100644 > --- a/sheep/sheep_priv.h > +++ b/sheep/sheep_priv.h > @@ -172,6 +172,7 @@ struct store_driver { > int (*write)(uint64_t oid, struct siocb *); > int (*read)(uint64_t oid, struct siocb *); > int (*close)(uint64_t oid, struct siocb *); > + int (*get_objlist)(struct siocb *); > }; > > extern void register_store_driver(struct store_driver *); > diff --git a/sheep/simple_store.c b/sheep/simple_store.c > index 424589f..441bc3f 100644 > --- a/sheep/simple_store.c > +++ b/sheep/simple_store.c > @@ -19,6 +19,7 @@ > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> > +#include <dirent.h> > > #include "sheep_priv.h" > #include "strbuf.h" > @@ -141,13 +142,50 @@ static int simple_store_close(uint64_t oid, struct siocb *iocb) > return SD_RES_SUCCESS; > } > > +static int simple_store_get_objlist(struct siocb *siocb) > +{ > + struct strbuf buf = STRBUF_INIT; > + int epoch = siocb->epoch; > + uint64_t *objlist = (uint64_t *)siocb->buf; > + DIR *dir; > + struct dirent *d; > + int ret = SD_RES_SUCCESS; > + > + strbuf_addf(&buf,"%s%08u/", obj_path, epoch); Space before "%s%08u/". Other than this looks good. I've applied after fixing it. Thanks, Kazutaka |