diff options
author | Amar Tumballi <amar@del.gluster.com> | 2009-03-17 18:15:19 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-03-18 08:23:20 +0530 |
commit | b947dc7161427b8c84f47b0a97861a36557f5748 (patch) | |
tree | 00dbfc53dd01b62ecee878883f1831aa0f6b4c14 /transport/ib-verbs | |
parent | 0a7f4cfc1c516da573949a9521248744ce97c4e9 (diff) |
ib-verbs recv-size and send-size argument takes SIZET arguments now.
With this patch, to specify recv-size and send-size of ib-verbs to <n>KB, we need not give
the option as integer value of 'n * 1024' value. This is neater to do deployments.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'transport/ib-verbs')
-rw-r--r-- | transport/ib-verbs/src/ib-verbs.c | 37 | ||||
-rw-r--r-- | transport/ib-verbs/src/ib-verbs.h | 5 |
2 files changed, 31 insertions, 11 deletions
diff --git a/transport/ib-verbs/src/ib-verbs.c b/transport/ib-verbs/src/ib-verbs.c index b0ac22563c3..9a21b8a8f6d 100644 --- a/transport/ib-verbs/src/ib-verbs.c +++ b/transport/ib-verbs/src/ib-verbs.c @@ -268,8 +268,8 @@ __ib_verbs_ioq_churn_entry (ib_verbs_peer_t *peer, ib_verbs_ioq_t *entry) if (len >= (options->send_size + 2048)) { gf_log ("transport/ib-verbs", GF_LOG_CRITICAL, "increase value of option 'transport.ib-verbs." - "work-request-send-size' (given=> %d) to send " - "bigger (%d) messages", + "work-request-send-size' (given=> %"PRId64") " + "to send bigger (%d) messages", (options->send_size + 2048), len); return -1; } @@ -1251,11 +1251,12 @@ ib_verbs_options_init (transport_t *this) ib_verbs_options_t *options = &priv->options; int32_t mtu; data_t *temp; + int ret = 0; /* TODO: validate arguments from options below */ - options->send_size = 1048576; - options->recv_size = 1048576; + options->send_size = 1048576; /* 1 MB */ + options->recv_size = 1048576; /* 1 MB */ options->send_count = 16; options->recv_count = 16; @@ -1271,13 +1272,29 @@ ib_verbs_options_init (transport_t *this) temp = dict_get (this->xl->options, "transport.ib-verbs.work-request-send-size"); - if (temp) - options->send_size = data_to_int32 (temp); + if (temp) { + ret = gf_string2bytesize (temp->data, &options->send_size); + if (ret != 0) { + gf_log ("ib-verbs", GF_LOG_ERROR, + "invalid number format \"%s\" of " + "\"option request-send-size\"", + temp->data); + options->send_size = 1 * GF_UNIT_MB; + } + } temp = dict_get (this->xl->options, "transport.ib-verbs.work-request-recv-size"); - if (temp) - options->recv_size = data_to_int32 (temp); + if (temp) { + ret = gf_string2bytesize (temp->data, &options->recv_size); + if (ret != 0) { + gf_log ("ib-verbs", GF_LOG_ERROR, + "invalid number format \"%s\" of " + "\"option request-recv-size\"", + temp->data); + options->recv_size = 1 * GF_UNIT_MB; + } + } options->port = 1; temp = dict_get (this->xl->options, @@ -2351,11 +2368,11 @@ struct volume_options options[] = { }, { .key = {"transport.ib-verbs.work-request-send-size", "ib-verbs-work-request-send-size"}, - .type = GF_OPTION_TYPE_INT, + .type = GF_OPTION_TYPE_SIZET, }, { .key = {"transport.ib-verbs.work-request-recv-size", "ib-verbs-work-request-recv-size"}, - .type = GF_OPTION_TYPE_INT, + .type = GF_OPTION_TYPE_SIZET, }, { .key = {"transport.ib-verbs.work-request-send-count", "ib-verbs-work-request-send-count"}, diff --git a/transport/ib-verbs/src/ib-verbs.h b/transport/ib-verbs/src/ib-verbs.h index 26d7799d30b..2aa39c0a491 100644 --- a/transport/ib-verbs/src/ib-verbs.h +++ b/transport/ib-verbs/src/ib-verbs.h @@ -45,7 +45,10 @@ struct _ib_verbs_options { int32_t port; char *device_name; enum ibv_mtu mtu; - int32_t send_count, send_size, recv_count, recv_size; + int32_t send_count; + int32_t recv_count; + uint64_t recv_size; + uint64_t send_size; }; typedef struct _ib_verbs_options ib_verbs_options_t; |