@@ -39,6 +39,10 @@ enum feature_flag_bits {
39
39
DROP_WRITES
40
40
};
41
41
42
+ struct per_bio_data {
43
+ bool bio_submitted ;
44
+ };
45
+
42
46
static int parse_features (struct dm_arg_set * as , struct flakey_c * fc ,
43
47
struct dm_target * ti )
44
48
{
@@ -214,6 +218,7 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
214
218
215
219
ti -> num_flush_requests = 1 ;
216
220
ti -> num_discard_requests = 1 ;
221
+ ti -> per_bio_data_size = sizeof (struct per_bio_data );
217
222
ti -> private = fc ;
218
223
return 0 ;
219
224
@@ -270,14 +275,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio,
270
275
{
271
276
struct flakey_c * fc = ti -> private ;
272
277
unsigned elapsed ;
278
+ struct per_bio_data * pb = dm_per_bio_data (bio , sizeof (struct per_bio_data ));
279
+ pb -> bio_submitted = false;
273
280
274
281
/* Are we alive ? */
275
282
elapsed = (jiffies - fc -> start_time ) / HZ ;
276
283
if (elapsed % (fc -> up_interval + fc -> down_interval ) >= fc -> up_interval ) {
277
284
/*
278
285
* Flag this bio as submitted while down.
279
286
*/
280
- map_context -> ll = 1 ;
287
+ pb -> bio_submitted = true ;
281
288
282
289
/*
283
290
* Map reads as normal.
@@ -318,13 +325,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio,
318
325
int error , union map_info * map_context )
319
326
{
320
327
struct flakey_c * fc = ti -> private ;
321
- unsigned bio_submitted_while_down = map_context -> ll ;
328
+ struct per_bio_data * pb = dm_per_bio_data ( bio , sizeof ( struct per_bio_data )) ;
322
329
323
330
/*
324
331
* Corrupt successful READs while in down state.
325
332
* If flags were specified, only corrupt those that match.
326
333
*/
327
- if (fc -> corrupt_bio_byte && !error && bio_submitted_while_down &&
334
+ if (fc -> corrupt_bio_byte && !error && pb -> bio_submitted &&
328
335
(bio_data_dir (bio ) == READ ) && (fc -> corrupt_bio_rw == READ ) &&
329
336
all_corrupt_bio_flags_match (bio , fc ))
330
337
corrupt_bio_data (bio , fc );
@@ -406,7 +413,7 @@ static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_
406
413
407
414
static struct target_type flakey_target = {
408
415
.name = "flakey" ,
409
- .version = {1 , 2 , 0 },
416
+ .version = {1 , 3 , 0 },
410
417
.module = THIS_MODULE ,
411
418
.ctr = flakey_ctr ,
412
419
.dtr = flakey_dtr ,
0 commit comments