Skip to content

Commit 21136f8

Browse files
committed
dm mpath: remove repeat_count support from multipath core
Preparation for making __multipath_map() avoid taking the m->lock spinlock -- in favor of using RCU locking. repeat_count was primarily for bio-based DM multipath's benefit. There is really no need for it anymore now that DM multipath is request-based. As such, repeat_count > 1 is no longer honored and a warning is displayed if the user attempts to use a value > 1. This is a temporary change for the round-robin path-selector (as a later commit will restore its support for repeat_count > 1). Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent 7943bd6 commit 21136f8

4 files changed

Lines changed: 24 additions & 10 deletions

File tree

‎drivers/md/dm-mpath.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ struct multipath {
8383
struct pgpath *current_pgpath;
8484
struct priority_group *current_pg;
8585
struct priority_group *next_pg; /* Switch to this PG if set */
86-
unsigned repeat_count; /* I/Os left before calling PS again */
8786

8887
unsigned queue_io:1; /* Must we queue all I/O? */
8988
unsigned queue_if_no_path:1; /* Queue I/O if last path fails? */
@@ -319,8 +318,9 @@ static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg,
319318
size_t nr_bytes)
320319
{
321320
struct dm_path *path;
321+
unsigned repeat_count;
322322

323-
path = pg->ps.type->select_path(&pg->ps, &m->repeat_count, nr_bytes);
323+
path = pg->ps.type->select_path(&pg->ps, &repeat_count, nr_bytes);
324324
if (!path)
325325
return -ENXIO;
326326

@@ -412,8 +412,7 @@ static int __multipath_map(struct dm_target *ti, struct request *clone,
412412
spin_lock_irq(&m->lock);
413413

414414
/* Do we need to select a new pgpath? */
415-
if (!m->current_pgpath ||
416-
(!m->queue_io && (m->repeat_count && --m->repeat_count == 0)))
415+
if (!m->current_pgpath || !m->queue_io)
417416
__choose_pgpath(m, nr_bytes);
418417

419418
pgpath = m->current_pgpath;

‎drivers/md/dm-queue-length.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <linux/atomic.h>
2424

2525
#define DM_MSG_PREFIX "multipath queue-length"
26-
#define QL_MIN_IO 128
27-
#define QL_VERSION "0.1.0"
26+
#define QL_MIN_IO 1
27+
#define QL_VERSION "0.2.0"
2828

2929
struct selector {
3030
struct list_head valid_paths;
@@ -129,6 +129,11 @@ static int ql_add_path(struct path_selector *ps, struct dm_path *path,
129129
return -EINVAL;
130130
}
131131

132+
if (repeat_count > 1) {
133+
DMWARN_LIMIT("repeat_count > 1 is deprecated, using 1 instead");
134+
repeat_count = 1;
135+
}
136+
132137
/* Allocate the path information structure */
133138
pi = kmalloc(sizeof(*pi), GFP_KERNEL);
134139
if (!pi) {

‎drivers/md/dm-round-robin.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <linux/module.h>
1818

1919
#define DM_MSG_PREFIX "multipath round-robin"
20+
#define RR_MIN_IO 1
21+
#define RR_VERSION "1.1.0"
2022

2123
/*-----------------------------------------------------------------
2224
* Path-handling code, paths are held in lists
@@ -41,8 +43,6 @@ static void free_paths(struct list_head *paths)
4143
* Round-robin selector
4244
*---------------------------------------------------------------*/
4345

44-
#define RR_MIN_IO 1000
45-
4646
struct selector {
4747
struct list_head valid_paths;
4848
struct list_head invalid_paths;
@@ -127,6 +127,11 @@ static int rr_add_path(struct path_selector *ps, struct dm_path *path,
127127
return -EINVAL;
128128
}
129129

130+
if (repeat_count > 1) {
131+
DMWARN_LIMIT("repeat_count > 1 is deprecated, using 1 instead");
132+
repeat_count = 1;
133+
}
134+
130135
/* allocate the path */
131136
pi = kmalloc(sizeof(*pi), GFP_KERNEL);
132137
if (!pi) {
@@ -198,7 +203,7 @@ static int __init dm_rr_init(void)
198203
if (r < 0)
199204
DMERR("register failed %d", r);
200205

201-
DMINFO("version 1.0.0 loaded");
206+
DMINFO("version " RR_VERSION " loaded");
202207

203208
return r;
204209
}

‎drivers/md/dm-service-time.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define ST_MAX_RELATIVE_THROUGHPUT 100
2020
#define ST_MAX_RELATIVE_THROUGHPUT_SHIFT 7
2121
#define ST_MAX_INFLIGHT_SIZE ((size_t)-1 >> ST_MAX_RELATIVE_THROUGHPUT_SHIFT)
22-
#define ST_VERSION "0.2.0"
22+
#define ST_VERSION "0.3.0"
2323

2424
struct selector {
2525
struct list_head valid_paths;
@@ -134,6 +134,11 @@ static int st_add_path(struct path_selector *ps, struct dm_path *path,
134134
return -EINVAL;
135135
}
136136

137+
if (repeat_count > 1) {
138+
DMWARN_LIMIT("repeat_count > 1 is deprecated, using 1 instead");
139+
repeat_count = 1;
140+
}
141+
137142
if ((argc == 2) &&
138143
(sscanf(argv[1], "%u%c", &relative_throughput, &dummy) != 1 ||
139144
relative_throughput > ST_MAX_RELATIVE_THROUGHPUT)) {

0 commit comments

Comments
 (0)