• Home
  • Raw
  • Download

Lines Matching +full:round +full:- +full:robin

3  * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
9 * Round-robin path selector.
12 #include <linux/device-mapper.h>
14 #include "dm-path-selector.h"
19 #define DM_MSG_PREFIX "multipath round-robin"
23 /*-----------------------------------------------------------------
24 * Path-handling code, paths are held in lists
25 *---------------------------------------------------------------*/
37 list_del(&pi->list); in free_paths()
42 /*-----------------------------------------------------------------
43 * Round-robin selector
44 *---------------------------------------------------------------*/
57 INIT_LIST_HEAD(&s->valid_paths); in alloc_selector()
58 INIT_LIST_HEAD(&s->invalid_paths); in alloc_selector()
59 spin_lock_init(&s->lock); in alloc_selector()
71 return -ENOMEM; in rr_create()
73 ps->context = s; in rr_create()
79 struct selector *s = ps->context; in rr_destroy()
81 free_paths(&s->valid_paths); in rr_destroy()
82 free_paths(&s->invalid_paths); in rr_destroy()
84 ps->context = NULL; in rr_destroy()
100 pi = path->pscontext; in rr_status()
101 DMEMIT("%u ", pi->repeat_count); in rr_status()
116 struct selector *s = ps->context; in rr_add_path()
123 *error = "round-robin ps: incorrect number of arguments"; in rr_add_path()
124 return -EINVAL; in rr_add_path()
129 *error = "round-robin ps: invalid repeat count"; in rr_add_path()
130 return -EINVAL; in rr_add_path()
141 *error = "round-robin ps: Error allocating path context"; in rr_add_path()
142 return -ENOMEM; in rr_add_path()
145 pi->path = path; in rr_add_path()
146 pi->repeat_count = repeat_count; in rr_add_path()
148 path->pscontext = pi; in rr_add_path()
150 spin_lock_irqsave(&s->lock, flags); in rr_add_path()
151 list_add_tail(&pi->list, &s->valid_paths); in rr_add_path()
152 spin_unlock_irqrestore(&s->lock, flags); in rr_add_path()
160 struct selector *s = ps->context; in rr_fail_path()
161 struct path_info *pi = p->pscontext; in rr_fail_path()
163 spin_lock_irqsave(&s->lock, flags); in rr_fail_path()
164 list_move(&pi->list, &s->invalid_paths); in rr_fail_path()
165 spin_unlock_irqrestore(&s->lock, flags); in rr_fail_path()
171 struct selector *s = ps->context; in rr_reinstate_path()
172 struct path_info *pi = p->pscontext; in rr_reinstate_path()
174 spin_lock_irqsave(&s->lock, flags); in rr_reinstate_path()
175 list_move(&pi->list, &s->valid_paths); in rr_reinstate_path()
176 spin_unlock_irqrestore(&s->lock, flags); in rr_reinstate_path()
184 struct selector *s = ps->context; in rr_select_path()
187 spin_lock_irqsave(&s->lock, flags); in rr_select_path()
188 if (!list_empty(&s->valid_paths)) { in rr_select_path()
189 pi = list_entry(s->valid_paths.next, struct path_info, list); in rr_select_path()
190 list_move_tail(&pi->list, &s->valid_paths); in rr_select_path()
192 spin_unlock_irqrestore(&s->lock, flags); in rr_select_path()
194 return pi ? pi->path : NULL; in rr_select_path()
198 .name = "round-robin",
234 MODULE_DESCRIPTION(DM_NAME " round-robin multipath path selector");
235 MODULE_AUTHOR("Sistina Software <dm-devel@redhat.com>");