[sheepdog] [PATCH 1/3] sheep: print symbolic command names

Liu Yuan namei.unix at gmail.com
Fri Jul 13 14:00:48 CEST 2012


On 07/13/2012 05:52 PM, Christoph Hellwig wrote:
> ===================================================================
> --- sheepdog.orig/sheep/sdnet.c	2012-07-13 09:24:16.423304255 +0200
> +++ sheepdog/sheep/sdnet.c	2012-07-13 11:31:54.473258506 +0200
> @@ -110,16 +110,16 @@ static void local_op_done(struct work *w
>  static int check_request_epoch(struct request *req)
>  {
>  	if (before(req->rq.epoch, sys->epoch)) {
> -		eprintf("old node version %u, %u, %x\n",
> -			sys->epoch, req->rq.epoch, req->rq.opcode);
> +		eprintf("old node version %u, %u (%s)\n",
> +			sys->epoch, req->rq.epoch, op_name(req->op));

I think better eprintf -> dprintf, not everyone find it useful.

>  		/* ask gateway to retry. */
>  		req->rp.result = SD_RES_OLD_NODE_VER;
>  		req->rp.epoch = sys->epoch;
>  		put_request(req);
>  		return -1;
>  	} else if (after(req->rq.epoch, sys->epoch)) {
> -		eprintf("new node version %u, %u, %x\n",
> -			sys->epoch, req->rq.epoch, req->rq.opcode);
> +		eprintf("new node version %u, %u (%s)\n",
> +			sys->epoch, req->rq.epoch, op_name(req->op));

Ditto

>  
>  		/* put on local wait queue, waiting for local epoch
>  		   to be lifted */
> @@ -320,7 +320,7 @@ static void queue_request(struct request
>  		goto done;
>  	}
>  
> -	dprintf("%x\n", hdr->opcode);
> +	dprintf("%s\n", op_name(req->op));
>  
>  	switch (sys->status) {
>  	case SD_STATUS_SHUTDOWN:
> Index: sheepdog/sheep/sheep_priv.h
> ===================================================================
> --- sheepdog.orig/sheep/sheep_priv.h	2012-07-13 09:24:16.423304255 +0200
> +++ sheepdog/sheep/sheep_priv.h	2012-07-13 11:29:45.119925946 +0200
> @@ -284,6 +284,7 @@ void put_request(struct request *req);
>  /* Operations */
>  
>  struct sd_op_template *get_sd_op(uint8_t opcode);
> +const char *op_name(struct sd_op_template *op);
>  int is_cluster_op(struct sd_op_template *op);
>  int is_local_op(struct sd_op_template *op);
>  int is_peer_op(struct sd_op_template *op);
> Index: sheepdog/sheep/group.c
> ===================================================================
> --- sheepdog.orig/sheep/group.c	2012-07-13 11:33:04.303258089 +0200
> +++ sheepdog/sheep/group.c	2012-07-13 11:34:11.339924363 +0200
> @@ -335,7 +335,7 @@ bool sd_block_handler(struct sd_node *se
>   */
>  void queue_cluster_request(struct request *req)
>  {
> -	eprintf("%p %x\n", req, req->rq.opcode);
> +	eprintf("%s (%p)\n", op_name(req->op), req);
>

Ditto

>  	if (has_process_work(req->op)) {
>  		list_add_tail(&req->pending_list, &sys->pending_list);



More information about the sheepdog mailing list