dm-flakey.c (0898782247ae533d1f4e47a06bc5d4870931b284) | dm-flakey.c (2e2d6f7e44a2b9f96ca8af445ae0150a6cefde41) |
---|---|
1/* 2 * Copyright (C) 2003 Sistina Software (UK) Limited. 3 * Copyright (C) 2004, 2010-2011 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 266 unchanged lines hidden (view full) --- 275 return fc->start + dm_target_offset(ti, bi_sector); 276} 277 278static void flakey_map_bio(struct dm_target *ti, struct bio *bio) 279{ 280 struct flakey_c *fc = ti->private; 281 282 bio_set_dev(bio, fc->dev->bdev); | 1/* 2 * Copyright (C) 2003 Sistina Software (UK) Limited. 3 * Copyright (C) 2004, 2010-2011 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 266 unchanged lines hidden (view full) --- 275 return fc->start + dm_target_offset(ti, bi_sector); 276} 277 278static void flakey_map_bio(struct dm_target *ti, struct bio *bio) 279{ 280 struct flakey_c *fc = ti->private; 281 282 bio_set_dev(bio, fc->dev->bdev); |
283 if (bio_sectors(bio) || bio_op(bio) == REQ_OP_ZONE_RESET) | 283 if (bio_sectors(bio) || op_is_zone_mgmt(bio_op(bio))) |
284 bio->bi_iter.bi_sector = 285 flakey_map_sector(ti, bio->bi_iter.bi_sector); 286} 287 288static void corrupt_bio_data(struct bio *bio, struct flakey_c *fc) 289{ 290 unsigned int corrupt_bio_byte = fc->corrupt_bio_byte - 1; 291 --- 25 unchanged lines hidden (view full) --- 317 318static int flakey_map(struct dm_target *ti, struct bio *bio) 319{ 320 struct flakey_c *fc = ti->private; 321 unsigned elapsed; 322 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 323 pb->bio_submitted = false; 324 | 284 bio->bi_iter.bi_sector = 285 flakey_map_sector(ti, bio->bi_iter.bi_sector); 286} 287 288static void corrupt_bio_data(struct bio *bio, struct flakey_c *fc) 289{ 290 unsigned int corrupt_bio_byte = fc->corrupt_bio_byte - 1; 291 --- 25 unchanged lines hidden (view full) --- 317 318static int flakey_map(struct dm_target *ti, struct bio *bio) 319{ 320 struct flakey_c *fc = ti->private; 321 unsigned elapsed; 322 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 323 pb->bio_submitted = false; 324 |
325 /* Do not fail reset zone */ 326 if (bio_op(bio) == REQ_OP_ZONE_RESET) | 325 if (op_is_zone_mgmt(bio_op(bio))) |
327 goto map_bio; 328 329 /* Are we alive ? */ 330 elapsed = (jiffies - fc->start_time) / HZ; 331 if (elapsed % (fc->up_interval + fc->down_interval) >= fc->up_interval) { 332 /* 333 * Flag this bio as submitted while down. 334 */ --- 44 unchanged lines hidden (view full) --- 379} 380 381static int flakey_end_io(struct dm_target *ti, struct bio *bio, 382 blk_status_t *error) 383{ 384 struct flakey_c *fc = ti->private; 385 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 386 | 326 goto map_bio; 327 328 /* Are we alive ? */ 329 elapsed = (jiffies - fc->start_time) / HZ; 330 if (elapsed % (fc->up_interval + fc->down_interval) >= fc->up_interval) { 331 /* 332 * Flag this bio as submitted while down. 333 */ --- 44 unchanged lines hidden (view full) --- 378} 379 380static int flakey_end_io(struct dm_target *ti, struct bio *bio, 381 blk_status_t *error) 382{ 383 struct flakey_c *fc = ti->private; 384 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); 385 |
387 if (bio_op(bio) == REQ_OP_ZONE_RESET) | 386 if (op_is_zone_mgmt(bio_op(bio))) |
388 return DM_ENDIO_DONE; 389 390 if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { 391 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && 392 all_corrupt_bio_flags_match(bio, fc)) { 393 /* 394 * Corrupt successful matching READs while in down state. 395 */ --- 131 unchanged lines hidden --- | 387 return DM_ENDIO_DONE; 388 389 if (!*error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { 390 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && 391 all_corrupt_bio_flags_match(bio, fc)) { 392 /* 393 * Corrupt successful matching READs while in down state. 394 */ --- 131 unchanged lines hidden --- |