There is little value to a function that has two callers, where one of them only needs half of it. Signed-off-by: Christoph Hellwig --- sheep/group.c | 13 ------------- sheep/sdnet.c | 14 ++++++++++++-- sheep/sheep_priv.h | 1 - 3 files changed, 12 insertions(+), 16 deletions(-) Index: sheepdog/sheep/group.c =================================================================== --- sheepdog.orig/sheep/group.c 2012-04-26 15:54:24.348356650 +0200 +++ sheepdog/sheep/group.c 2012-04-26 15:54:39.704357043 +0200 @@ -187,19 +187,6 @@ void free_ordered_sd_vnode_list(struct s } } -void setup_ordered_sd_vnode_list(struct request *req) -{ - int res; - - if (req->entry) - free_ordered_sd_vnode_list(req->entry); - - res = get_ordered_sd_vnode_list(&req->entry, &req->nr_vnodes, - &req->nr_zones); - if (res != SD_RES_SUCCESS) - panic("unrecoverable error\n"); -} - static void do_cluster_op(void *arg) { struct vdi_op_message *msg = arg; Index: sheepdog/sheep/sdnet.c =================================================================== --- sheepdog.orig/sheep/sdnet.c 2012-04-26 15:54:37.912356998 +0200 +++ sheepdog/sheep/sdnet.c 2012-04-26 15:54:39.704357043 +0200 @@ -8,6 +8,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#include #include #include #include @@ -153,7 +154,13 @@ static void io_op_done(struct work *work retry: req->rq.epoch = sys->epoch; - setup_ordered_sd_vnode_list(req); + + if (req->entry) + free_ordered_sd_vnode_list(req->entry); + if (get_ordered_sd_vnode_list(&req->entry, &req->nr_vnodes, + &req->nr_zones) != SD_RES_SUCCESS) + panic("failed to setup vnode list\n"); + setup_access_to_local_objects(req); list_add_tail(&req->cev.event_list, &sys->request_queue); @@ -320,7 +327,10 @@ static void queue_request(struct request list_del(&req->r_wlist); - setup_ordered_sd_vnode_list(req); + assert(req->entry == NULL); + if (get_ordered_sd_vnode_list(&req->entry, &req->nr_vnodes, + &req->nr_zones) != SD_RES_SUCCESS) + panic("failed to setup vnode list\n"); cevent->ctype = EVENT_REQUEST; list_add_tail(&cevent->event_list, &sys->request_queue); Index: sheepdog/sheep/sheep_priv.h =================================================================== --- sheepdog.orig/sheep/sheep_priv.h 2012-04-26 15:54:24.348356650 +0200 +++ sheepdog/sheep/sheep_priv.h 2012-04-26 15:54:39.704357043 +0200 @@ -236,7 +236,6 @@ int get_vdi_attr(uint32_t epoch, struct int write, int excl, int delete); int get_zones_nr_from(struct sd_node *nodes, int nr_nodes); -void setup_ordered_sd_vnode_list(struct request *req); int get_ordered_sd_vnode_list(struct sd_vnode **entries, int *nr_vnodes, int *nr_zones); void free_ordered_sd_vnode_list(struct sd_vnode *entries);