Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm raid1: dont use map_context

Don't use map_info any more in dm-raid1.

map_info was used for writes to hold the region number. For this purpose
we add a new field dm_bio_details to dm_raid1_bio_record.

map_info was used for reads to hold a pointer to dm_raid1_bio_record (if
the pointer was non-NULL, bio details were saved; if the pointer was
NULL, bio details were not saved). We use
dm_raid1_bio_record.details->bi_bdev for this purpose. If bi_bdev is
NULL, details were not saved, if bi_bdev is non-NULL, details were
saved.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

authored by

Mikulas Patocka and committed by
Alasdair G Kergon
0045d61b c7cfdf59

+13 -9
+13 -9
drivers/md/dm-raid1.c
··· 140 140 141 141 struct dm_raid1_bio_record { 142 142 struct mirror *m; 143 + /* if details->bi_bdev == NULL, details were not saved */ 143 144 struct dm_bio_details details; 145 + region_t write_region; 144 146 }; 145 147 146 148 /* ··· 1148 1146 int r, rw = bio_rw(bio); 1149 1147 struct mirror *m; 1150 1148 struct mirror_set *ms = ti->private; 1151 - struct dm_raid1_bio_record *bio_record; 1152 1149 struct dm_dirty_log *log = dm_rh_dirty_log(ms->rh); 1150 + struct dm_raid1_bio_record *bio_record = 1151 + dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record)); 1152 + 1153 + bio_record->details.bi_bdev = NULL; 1153 1154 1154 1155 if (rw == WRITE) { 1155 1156 /* Save region for mirror_end_io() handler */ 1156 - map_context->ll = dm_rh_bio_to_region(ms->rh, bio); 1157 + bio_record->write_region = dm_rh_bio_to_region(ms->rh, bio); 1157 1158 queue_bio(ms, bio, rw); 1158 1159 return DM_MAPIO_SUBMITTED; 1159 1160 } ··· 1184 1179 if (unlikely(!m)) 1185 1180 return -EIO; 1186 1181 1187 - bio_record = dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record)); 1188 1182 dm_bio_record(&bio_record->details, bio); 1189 - map_context->ptr = bio_record; 1190 1183 bio_record->m = m; 1191 1184 1192 1185 map_bio(m, bio); ··· 1199 1196 struct mirror_set *ms = (struct mirror_set *) ti->private; 1200 1197 struct mirror *m = NULL; 1201 1198 struct dm_bio_details *bd = NULL; 1202 - struct dm_raid1_bio_record *bio_record = map_context->ptr; 1199 + struct dm_raid1_bio_record *bio_record = 1200 + dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record)); 1203 1201 1204 1202 /* 1205 1203 * We need to dec pending if this was a write. 1206 1204 */ 1207 1205 if (rw == WRITE) { 1208 1206 if (!(bio->bi_rw & (REQ_FLUSH | REQ_DISCARD))) 1209 - dm_rh_dec(ms->rh, map_context->ll); 1207 + dm_rh_dec(ms->rh, bio_record->write_region); 1210 1208 return error; 1211 1209 } 1212 1210 ··· 1218 1214 goto out; 1219 1215 1220 1216 if (unlikely(error)) { 1221 - if (!bio_record) { 1217 + if (!bio_record->details.bi_bdev) { 1222 1218 /* 1223 1219 * There wasn't enough memory to record necessary 1224 1220 * information for a retry or there was no other ··· 1243 1239 bd = &bio_record->details; 1244 1240 1245 1241 dm_bio_restore(bd, bio); 1246 - map_context->ptr = NULL; 1242 + bio_record->details.bi_bdev = NULL; 1247 1243 queue_bio(ms, bio, rw); 1248 1244 return DM_ENDIO_INCOMPLETE; 1249 1245 } ··· 1251 1247 } 1252 1248 1253 1249 out: 1254 - map_context->ptr = NULL; 1250 + bio_record->details.bi_bdev = NULL; 1255 1251 1256 1252 return error; 1257 1253 }