[sheepdog] [PATCH v1 1/5] sheep: add new option for configure

Liu Yuan namei.unix at gmail.com
Mon May 5 04:53:26 CEST 2014


On Mon, May 05, 2014 at 09:59:42AM +0800, Robin Dong wrote:
> 2014-05-04 15:41 GMT+08:00 Liu Yuan <namei.unix at gmail.com>:
> 
> > On Tue, Apr 29, 2014 at 10:53:41AM +0800, Robin Dong wrote:
> > > From: Robin Dong <sanbai at taobao.com>
> > >
> > > Add new configure option '--enable-diskvnodes' so we can
> > > start sheep cluster by using disk as vnodes.
> > >
> > > Signed-off-by: Robin Dong <sanbai at taobao.com>
> > > ---
> > >  configure.ac             | 10 ++++++++++
> > >  include/internal_proto.h |  1 +
> > >  sheep/config.c           |  9 ++++++++-
> > >  sheep/sheep.c            |  6 ++++++
> > >  4 files changed, 25 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/configure.ac b/configure.ac
> > > index a3abb7b..7e6691f 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -255,6 +255,12 @@ AC_ARG_ENABLE([nfs],
> > >       [ enable_nfs="no" ],)
> > >  AM_CONDITIONAL(BUILD_NFS, test x$enable_nfs = xyes)
> > >
> > > +AC_ARG_ENABLE([diskvnodes],
> > > +     [ --enable-diskvnodes : enable disk as vnodes (default no) ],,
> > > +     [ enable_diskvnodes="no" ],)
> > > +AM_CONDITIONAL(BUILD_DISKVNODES, test x$enable_diskvnodes = xyes)
> > > +
> > > +
> > >  CP=cp
> > >  OS_LDL="-ldl"
> > >  case "$host_os" in
> > > @@ -367,6 +373,10 @@ if test "x${enable_nfs}" = xyes; then
> > >       PACKAGE_FEATURES="$PACKAGE_FEATURES nfs"
> > >  fi
> > >
> > > +if test "x${enable_diskvnodes}" = xyes; then
> > > +     AC_DEFINE_UNQUOTED(HAVE_DISKVNODES, 1, [have diskvnodes])
> > > +fi
> > > +
> > >  # extra warnings
> > >  EXTRA_WARNINGS=""
> > >
> > > diff --git a/include/internal_proto.h b/include/internal_proto.h
> > > index 0eb7227..7db3769 100644
> > > --- a/include/internal_proto.h
> > > +++ b/include/internal_proto.h
> > > @@ -172,6 +172,7 @@ struct cluster_info {
> > >       uint8_t nr_copies;
> > >       uint8_t copy_policy;
> > >       enum sd_status status : 8;
> > > +     uint8_t disk_as_vnode;
> > >       uint32_t __pad;
> >
> > why not use 8 bytes in __pad?
> >
> 
> Because there is a hole after "enum sd_status status : 8", so add "uint8
> disk_as_vnode" here will not change the size of struct cluster_info.
> 

We use 'pad' to explicitly mark the length of structure to make it compiler
independent.

If there was hole, it meant something wrong in the padding. how many bytes does
enum occupy?

Thanks
Yuan



More information about the sheepdog mailing list