[Sheepdog] [PATCH 1/2] object cache: make sync flush as default
Liu Yuan
namei.unix at gmail.com
Mon Apr 16 09:37:44 CEST 2012
On 04/12/2012 10:53 PM, Liu Yuan wrote:
> From: Liu Yuan <tailai.ly at taobao.com>
>
>
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> ---
> sheep/ops.c | 2 +-
> sheep/sheep.c | 10 +++++-----
> sheep/sheep_priv.h | 2 +-
> 3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/sheep/ops.c b/sheep/ops.c
> index ee6dee1..809ef51 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -504,7 +504,7 @@ static int local_flush_vdi(const struct sd_req *req, struct sd_rsp *rsp, void *d
> struct object_cache *cache = find_object_cache(vid, 0);
>
> if (cache) {
> - if (sys->sync_flush)
> + if (!sys->async_flush)
> return object_cache_push(cache);
> else {
> struct flush_work *fw = xmalloc(sizeof(*fw));
> diff --git a/sheep/sheep.c b/sheep/sheep.c
> index 6d500ae..a0a44a9 100644
> --- a/sheep/sheep.c
> +++ b/sheep/sheep.c
> @@ -36,6 +36,7 @@ static struct option const long_options[] = {
> {"loglevel", required_argument, NULL, 'l'},
> {"debug", no_argument, NULL, 'd'},
> {"directio", no_argument, NULL, 'D'},
> + {"asyncflush", no_argument, NULL, 'a'},
> {"zone", required_argument, NULL, 'z'},
> {"vnodes", required_argument, NULL, 'v'},
> {"cluster", required_argument, NULL, 'c'},
> @@ -43,7 +44,7 @@ static struct option const long_options[] = {
> {NULL, 0, NULL, 0},
> };
>
> -static const char *short_options = "p:fl:dDz:v:c:h";
> +static const char *short_options = "p:fl:dDaz:v:c:h";
>
> static void usage(int status)
> {
> @@ -60,7 +61,7 @@ Options:\n\
> -l, --loglevel specify the level of logging detail\n\
> -d, --debug include debug messages in the log\n\
> -D, --directio use direct IO when accessing the object from object cache\n\
> - -S, --sync flush the object cache synchronously\n\
> + -a, --asyncflush flush the object cache asynchronously\n\
> -z, --zone specify the zone id\n\
> -v, --vnodes specify the number of virtual nodes\n\
> -c, --cluster specify the cluster driver\n\
> @@ -134,9 +135,8 @@ int main(int argc, char **argv)
> dprintf("direct IO mode\n");
> sys->use_directio = 1;
> break;
> - case 'S':
> - dprintf("sync flush\n");
> - sys->sync_flush = 1;
> + case 'a':
> + sys->async_flush = 1;
> break;
> case 'z':
> zone = strtol(optarg, &p, 10);
> diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
> index c8d9bb4..78cc8aa 100644
> --- a/sheep/sheep_priv.h
> +++ b/sheep/sheep_priv.h
> @@ -150,7 +150,7 @@ struct cluster_info {
> uint32_t recovered_epoch;
>
> int use_directio;
> - uint8_t sync_flush;
> + uint8_t async_flush;
>
> struct work_queue *event_wqueue;
> struct work_queue *gateway_wqueue;
Applied these two patches.
And for 2/2, make the default as 4 and maximum to UINT32_MAX, I don't
have time profiling which is the best default number, so I think might
as well keep the original one and handle an option to users.
Thanks,
Yuan
More information about the sheepdog
mailing list