]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> |
2 | Subject: dm-mpath: add a path selector interface | |
3 | References: FATE#303862,FATE#302108 | |
4 | ||
5 | This patch adds a new hook for dm path selector: start_io. | |
6 | Target drivers should call this hook before submitting I/O to | |
7 | the selected path. | |
8 | Path selectors can use it to start accounting of the I/O. | |
9 | (e.g. counting the number of in-flight I/Os.) | |
10 | ||
11 | The code is based on the patch posted by Stefan Bader: | |
12 | https://www.redhat.com/archives/dm-devel/2005-October/msg00050.html | |
13 | ||
14 | ||
15 | Signed-off-by: Stefan Bader <stefan.bader@canonical.com> | |
16 | Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> | |
17 | Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> | |
18 | Signed-off-by: Hannes Reinecke <hare@suse.de> | |
19 | ||
20 | Index: linux-2.6.27/drivers/md/dm-mpath.c | |
21 | =================================================================== | |
22 | --- linux-2.6.27.orig/drivers/md/dm-mpath.c | |
23 | +++ linux-2.6.27/drivers/md/dm-mpath.c | |
24 | @@ -359,6 +359,9 @@ static int map_io(struct multipath *m, s | |
25 | ||
26 | mpio->pgpath = pgpath; | |
27 | ||
28 | + if (r == DM_MAPIO_REMAPPED && pgpath->pg->ps.type->start_io) | |
29 | + pgpath->pg->ps.type->start_io(&pgpath->pg->ps, &pgpath->path); | |
30 | + | |
31 | spin_unlock_irqrestore(&m->lock, flags); | |
32 | ||
33 | return r; | |
34 | Index: linux-2.6.27/drivers/md/dm-path-selector.h | |
35 | =================================================================== | |
36 | --- linux-2.6.27.orig/drivers/md/dm-path-selector.h | |
37 | +++ linux-2.6.27/drivers/md/dm-path-selector.h | |
38 | @@ -75,6 +75,7 @@ struct path_selector_type { | |
39 | int (*status) (struct path_selector *ps, struct dm_path *path, | |
40 | status_type_t type, char *result, unsigned int maxlen); | |
41 | ||
42 | + int (*start_io) (struct path_selector *ps, struct dm_path *path); | |
43 | int (*end_io) (struct path_selector *ps, struct dm_path *path); | |
44 | }; | |
45 |