dm-mpath.c (9a8ac3ae682e8760afebab71556a9a8d1b18f906) | dm-mpath.c (86331f39a5935b092d3ea59446d416563ed05d16) |
---|---|
1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 428 unchanged lines hidden (view full) --- 437 m->current_pgpath = NULL; 438 m->current_pg = NULL; 439 spin_unlock_irqrestore(&m->lock, flags); 440 441 return NULL; 442} 443 444/* | 1/* 2 * Copyright (C) 2003 Sistina Software Limited. 3 * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include <linux/device-mapper.h> --- 428 unchanged lines hidden (view full) --- 437 m->current_pgpath = NULL; 438 m->current_pg = NULL; 439 spin_unlock_irqrestore(&m->lock, flags); 440 441 return NULL; 442} 443 444/* |
445 * dm_report_EIO() is a macro instead of a function to make pr_debug() 446 * report the function name and line number of the function from which 447 * it has been invoked. 448 */ 449#define dm_report_EIO(m) \ 450({ \ 451 struct mapped_device *md = dm_table_get_md((m)->ti->table); \ 452 \ 453 pr_debug("%s: returning EIO; QIFNP = %d; SQIFNP = %d; DNFS = %d\n", \ 454 dm_device_name(md), \ 455 test_bit(MPATHF_QUEUE_IF_NO_PATH, &(m)->flags), \ 456 test_bit(MPATHF_SAVED_QUEUE_IF_NO_PATH, &(m)->flags), \ 457 dm_noflush_suspending((m)->ti)); \ 458 -EIO; \ 459}) 460 461/* |
|
445 * Map cloned requests (request-based multipath) 446 */ 447static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, 448 union map_info *map_context, 449 struct request **__clone) 450{ 451 struct multipath *m = ti->private; 452 size_t nr_bytes = blk_rq_bytes(rq); --- 6 unchanged lines hidden (view full) --- 459 /* Do we need to select a new pgpath? */ 460 pgpath = lockless_dereference(m->current_pgpath); 461 if (!pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) 462 pgpath = choose_pgpath(m, nr_bytes); 463 464 if (!pgpath) { 465 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 466 return DM_MAPIO_DELAY_REQUEUE; | 462 * Map cloned requests (request-based multipath) 463 */ 464static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, 465 union map_info *map_context, 466 struct request **__clone) 467{ 468 struct multipath *m = ti->private; 469 size_t nr_bytes = blk_rq_bytes(rq); --- 6 unchanged lines hidden (view full) --- 476 /* Do we need to select a new pgpath? */ 477 pgpath = lockless_dereference(m->current_pgpath); 478 if (!pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) 479 pgpath = choose_pgpath(m, nr_bytes); 480 481 if (!pgpath) { 482 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 483 return DM_MAPIO_DELAY_REQUEUE; |
467 return -EIO; /* Failed */ | 484 return dm_report_EIO(m); /* Failed */ |
468 } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || 469 test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { 470 if (pg_init_all_paths(m)) 471 return DM_MAPIO_DELAY_REQUEUE; 472 return DM_MAPIO_REQUEUE; 473 } 474 475 memset(mpio, 0, sizeof(*mpio)); --- 60 unchanged lines hidden (view full) --- 536 else if (!queue_io) 537 queue_work(kmultipathd, &m->process_queued_bios); 538 return DM_MAPIO_SUBMITTED; 539 } 540 541 if (!pgpath) { 542 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 543 return DM_MAPIO_REQUEUE; | 485 } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || 486 test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { 487 if (pg_init_all_paths(m)) 488 return DM_MAPIO_DELAY_REQUEUE; 489 return DM_MAPIO_REQUEUE; 490 } 491 492 memset(mpio, 0, sizeof(*mpio)); --- 60 unchanged lines hidden (view full) --- 553 else if (!queue_io) 554 queue_work(kmultipathd, &m->process_queued_bios); 555 return DM_MAPIO_SUBMITTED; 556 } 557 558 if (!pgpath) { 559 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) 560 return DM_MAPIO_REQUEUE; |
544 return -EIO; | 561 return dm_report_EIO(m); |
545 } 546 547 mpio->pgpath = pgpath; 548 mpio->nr_bytes = nr_bytes; 549 550 bio->bi_error = 0; 551 bio->bi_bdev = pgpath->path.dev->bdev; 552 bio->bi_opf |= REQ_FAILFAST_TRANSPORT; --- 918 unchanged lines hidden (view full) --- 1471 if (noretry_error(error)) 1472 return error; 1473 1474 if (mpio->pgpath) 1475 fail_path(mpio->pgpath); 1476 1477 if (atomic_read(&m->nr_valid_paths) == 0 && 1478 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) | 562 } 563 564 mpio->pgpath = pgpath; 565 mpio->nr_bytes = nr_bytes; 566 567 bio->bi_error = 0; 568 bio->bi_bdev = pgpath->path.dev->bdev; 569 bio->bi_opf |= REQ_FAILFAST_TRANSPORT; --- 918 unchanged lines hidden (view full) --- 1488 if (noretry_error(error)) 1489 return error; 1490 1491 if (mpio->pgpath) 1492 fail_path(mpio->pgpath); 1493 1494 if (atomic_read(&m->nr_valid_paths) == 0 && 1495 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) |
1479 r = -EIO; | 1496 r = dm_report_EIO(m); |
1480 1481 return r; 1482} 1483 1484static int multipath_end_io(struct dm_target *ti, struct request *clone, 1485 int error, union map_info *map_context) 1486{ 1487 struct multipath *m = ti->private; --- 26 unchanged lines hidden (view full) --- 1514 if (noretry_error(error)) 1515 return error; 1516 1517 if (mpio->pgpath) 1518 fail_path(mpio->pgpath); 1519 1520 if (atomic_read(&m->nr_valid_paths) == 0 && 1521 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) | 1497 1498 return r; 1499} 1500 1501static int multipath_end_io(struct dm_target *ti, struct request *clone, 1502 int error, union map_info *map_context) 1503{ 1504 struct multipath *m = ti->private; --- 26 unchanged lines hidden (view full) --- 1531 if (noretry_error(error)) 1532 return error; 1533 1534 if (mpio->pgpath) 1535 fail_path(mpio->pgpath); 1536 1537 if (atomic_read(&m->nr_valid_paths) == 0 && 1538 !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) |
1522 return -EIO; | 1539 return dm_report_EIO(m); |
1523 1524 /* Queue for the daemon to resubmit */ 1525 dm_bio_restore(get_bio_details_from_bio(clone), clone); 1526 1527 spin_lock_irqsave(&m->lock, flags); 1528 bio_list_add(&m->queued_bios, clone); 1529 spin_unlock_irqrestore(&m->lock, flags); 1530 if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) --- 488 unchanged lines hidden --- | 1540 1541 /* Queue for the daemon to resubmit */ 1542 dm_bio_restore(get_bio_details_from_bio(clone), clone); 1543 1544 spin_lock_irqsave(&m->lock, flags); 1545 bio_list_add(&m->queued_bios, clone); 1546 spin_unlock_irqrestore(&m->lock, flags); 1547 if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) --- 488 unchanged lines hidden --- |