Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
423 | giacomo | 1 | #ifndef _RAID1_H |
2 | #define _RAID1_H |
||
3 | |||
4 | #include <linux/raid/md.h> |
||
5 | |||
6 | typedef struct mirror_info mirror_info_t; |
||
7 | |||
8 | struct mirror_info { |
||
9 | mdk_rdev_t *rdev; |
||
10 | sector_t head_position; |
||
11 | }; |
||
12 | |||
13 | typedef struct r1bio_s r1bio_t; |
||
14 | |||
15 | struct r1_private_data_s { |
||
16 | mddev_t *mddev; |
||
17 | mirror_info_t *mirrors; |
||
18 | int raid_disks; |
||
19 | int working_disks; |
||
20 | int last_used; |
||
21 | sector_t next_seq_sect; |
||
22 | spinlock_t device_lock; |
||
23 | |||
24 | /* for use when syncing mirrors: */ |
||
25 | |||
26 | spinlock_t resync_lock; |
||
27 | int nr_pending; |
||
28 | int barrier; |
||
29 | sector_t next_resync; |
||
30 | |||
31 | wait_queue_head_t wait_idle; |
||
32 | wait_queue_head_t wait_resume; |
||
33 | |||
34 | mempool_t *r1bio_pool; |
||
35 | mempool_t *r1buf_pool; |
||
36 | }; |
||
37 | |||
38 | typedef struct r1_private_data_s conf_t; |
||
39 | |||
40 | /* |
||
41 | * this is the only point in the RAID code where we violate |
||
42 | * C type safety. mddev->private is an 'opaque' pointer. |
||
43 | */ |
||
44 | #define mddev_to_conf(mddev) ((conf_t *) mddev->private) |
||
45 | |||
46 | /* |
||
47 | * this is our 'private' RAID1 bio. |
||
48 | * |
||
49 | * it contains information about what kind of IO operations were started |
||
50 | * for this RAID1 operation, and about their status: |
||
51 | */ |
||
52 | |||
53 | struct r1bio_s { |
||
54 | atomic_t remaining; /* 'have we finished' count, |
||
55 | * used from IRQ handlers |
||
56 | */ |
||
57 | int cmd; |
||
58 | sector_t sector; |
||
59 | unsigned long state; |
||
60 | mddev_t *mddev; |
||
61 | /* |
||
62 | * original bio going to /dev/mdx |
||
63 | */ |
||
64 | struct bio *master_bio; |
||
65 | /* |
||
66 | * if the IO is in READ direction, then this bio is used: |
||
67 | */ |
||
68 | struct bio *read_bio; |
||
69 | int read_disk; |
||
70 | |||
71 | r1bio_t *next_r1; /* next for retry or in free list */ |
||
72 | struct list_head retry_list; |
||
73 | /* |
||
74 | * if the IO is in WRITE direction, then multiple bios are used. |
||
75 | * We choose the number when they are allocated. |
||
76 | */ |
||
77 | struct bio *write_bios[0]; |
||
78 | }; |
||
79 | |||
80 | /* bits for r1bio.state */ |
||
81 | #define R1BIO_Uptodate 1 |
||
82 | |||
83 | #endif |