Skip to content

Commit 473e87c

Browse files
jbrassowneilbrown
authored andcommitted
MD: Move macros from raid1*.h to raid1*.c
MD RAID1/RAID10: Move some macros from .h file to .c file There are three macros (IO_BLOCKED,IO_MADE_GOOD,BIO_SPECIAL) which are defined in both raid1.h and raid10.h. They are only used in there respective .c files. However, if we wish to make RAID10 accessible to the device-mapper RAID target (dm-raid.c), then we need to move these macros into the .c files where they are used so that they do not conflict with each other. The macros from the two files are identical and could be moved into md.h, but I chose to leave the duplication and have them remain in the personality files. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
1 parent 0eaf822 commit 473e87c

4 files changed

Lines changed: 29 additions & 29 deletions

File tree

‎drivers/md/raid1.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@
4646
*/
4747
#define NR_RAID1_BIOS 256
4848

49+
/* when we get a read error on a read-only array, we redirect to another
50+
* device without failing the first device, or trying to over-write to
51+
* correct the read error. To keep track of bad blocks on a per-bio
52+
* level, we store IO_BLOCKED in the appropriate 'bios' pointer
53+
*/
54+
#define IO_BLOCKED ((struct bio *)1)
55+
/* When we successfully write to a known bad-block, we need to remove the
56+
* bad-block marking which must be done from process context. So we record
57+
* the success by setting devs[n].bio to IO_MADE_GOOD
58+
*/
59+
#define IO_MADE_GOOD ((struct bio *)2)
60+
61+
#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2)
62+
4963
/* When there are this many requests queue to be written by
5064
* the raid1 thread, we become 'congested' to provide back-pressure
5165
* for writeback.

‎drivers/md/raid1.h‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,6 @@ struct r1bio {
135135
/* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
136136
};
137137

138-
/* when we get a read error on a read-only array, we redirect to another
139-
* device without failing the first device, or trying to over-write to
140-
* correct the read error. To keep track of bad blocks on a per-bio
141-
* level, we store IO_BLOCKED in the appropriate 'bios' pointer
142-
*/
143-
#define IO_BLOCKED ((struct bio *)1)
144-
/* When we successfully write to a known bad-block, we need to remove the
145-
* bad-block marking which must be done from process context. So we record
146-
* the success by setting bios[n] to IO_MADE_GOOD
147-
*/
148-
#define IO_MADE_GOOD ((struct bio *)2)
149-
150-
#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2)
151-
152138
/* bits for r1bio.state */
153139
#define R1BIO_Uptodate 0
154140
#define R1BIO_IsSync 1

‎drivers/md/raid10.c‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,21 @@
6060
*/
6161
#define NR_RAID10_BIOS 256
6262

63-
/* When there are this many requests queue to be written by
63+
/* when we get a read error on a read-only array, we redirect to another
64+
* device without failing the first device, or trying to over-write to
65+
* correct the read error. To keep track of bad blocks on a per-bio
66+
* level, we store IO_BLOCKED in the appropriate 'bios' pointer
67+
*/
68+
#define IO_BLOCKED ((struct bio *)1)
69+
/* When we successfully write to a known bad-block, we need to remove the
70+
* bad-block marking which must be done from process context. So we record
71+
* the success by setting devs[n].bio to IO_MADE_GOOD
72+
*/
73+
#define IO_MADE_GOOD ((struct bio *)2)
74+
75+
#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2)
76+
77+
/* When there are this many requests queued to be written by
6478
* the raid10 thread, we become 'congested' to provide back-pressure
6579
* for writeback.
6680
*/

‎drivers/md/raid10.h‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,6 @@ struct r10bio {
123123
} devs[0];
124124
};
125125

126-
/* when we get a read error on a read-only array, we redirect to another
127-
* device without failing the first device, or trying to over-write to
128-
* correct the read error. To keep track of bad blocks on a per-bio
129-
* level, we store IO_BLOCKED in the appropriate 'bios' pointer
130-
*/
131-
#define IO_BLOCKED ((struct bio*)1)
132-
/* When we successfully write to a known bad-block, we need to remove the
133-
* bad-block marking which must be done from process context. So we record
134-
* the success by setting devs[n].bio to IO_MADE_GOOD
135-
*/
136-
#define IO_MADE_GOOD ((struct bio *)2)
137-
138-
#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2)
139-
140126
/* bits for r10bio.state */
141127
enum r10bio_state {
142128
R10BIO_Uptodate,

0 commit comments

Comments
 (0)