[sheepdog] [PATCH] sheep: initialize only used write_info
Liu Yuan
namei.unix at gmail.com
Mon Oct 22 08:52:24 CEST 2012
On 10/22/2012 11:58 AM, MORITA Kazutaka wrote:
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> ---
> sheep/gateway.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/sheep/gateway.c b/sheep/gateway.c
> index 2c0cb89..2bd6e78 100644
> --- a/sheep/gateway.c
> +++ b/sheep/gateway.c
> @@ -208,10 +208,10 @@ finish_write:
> return err_ret;
> }
>
> -static inline void write_info_init(struct write_info *wi)
> +static inline void write_info_init(struct write_info *wi, size_t nr_to_send)
> {
> int i;
> - for (i = 0; i < SD_MAX_NODES; i++)
> + for (i = 0; i < nr_to_send; i++)
> wi->ent[i].pfd.fd = -1;
> wi->nr_sent = 0;
> }
> @@ -264,9 +264,9 @@ static int gateway_forward_request(struct request *req, bool all_node)
> gateway_init_fwd_hdr(&hdr, &req->rq);
> op = get_sd_op(hdr.opcode);
>
> - write_info_init(&wi);
> wlen = hdr.data_length;
> nr_to_send = init_target_nodes(req, all_node, oid, target_nodes);
> + write_info_init(&wi, nr_to_send);
>
> for (i = 0; i < nr_to_send; i++) {
> struct sockfd *sfd;
>
Applied these tow.
Thanks,
Yuan
More information about the sheepdog
mailing list