dm-mpath.c (f45f11868e0efeccfc1c695e56864f9032f18bdc) | dm-mpath.c (17213ec1806199ab528655946af144abc37d89fb) |
---|---|
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> --- 560 unchanged lines hidden (view full) --- 569 570 blk_put_request(clone); 571} 572 573/* 574 * Map cloned bios (bio-based multipath) 575 */ 576 | 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> --- 560 unchanged lines hidden (view full) --- 569 570 blk_put_request(clone); 571} 572 573/* 574 * Map cloned bios (bio-based multipath) 575 */ 576 |
577static void multipath_queue_bio(struct multipath *m, struct bio *bio) | 577static void __multipath_queue_bio(struct multipath *m, struct bio *bio) |
578{ | 578{ |
579 unsigned long flags; 580 | |
581 /* Queue for the daemon to resubmit */ | 579 /* Queue for the daemon to resubmit */ |
582 spin_lock_irqsave(&m->lock, flags); | |
583 bio_list_add(&m->queued_bios, bio); 584 if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) 585 queue_work(kmultipathd, &m->process_queued_bios); | 580 bio_list_add(&m->queued_bios, bio); 581 if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) 582 queue_work(kmultipathd, &m->process_queued_bios); |
583} 584 585static void multipath_queue_bio(struct multipath *m, struct bio *bio) 586{ 587 unsigned long flags; 588 589 spin_lock_irqsave(&m->lock, flags); 590 __multipath_queue_bio(m, bio); |
|
586 spin_unlock_irqrestore(&m->lock, flags); 587} 588 589static struct pgpath *__map_bio(struct multipath *m, struct bio *bio) 590{ 591 struct pgpath *pgpath; 592 unsigned long flags; | 591 spin_unlock_irqrestore(&m->lock, flags); 592} 593 594static struct pgpath *__map_bio(struct multipath *m, struct bio *bio) 595{ 596 struct pgpath *pgpath; 597 unsigned long flags; |
593 bool queue_io; | |
594 595 /* Do we need to select a new pgpath? */ 596 pgpath = READ_ONCE(m->current_pgpath); 597 if (!pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) 598 pgpath = choose_pgpath(m, bio->bi_iter.bi_size); 599 | 598 599 /* Do we need to select a new pgpath? */ 600 pgpath = READ_ONCE(m->current_pgpath); 601 if (!pgpath || !test_bit(MPATHF_QUEUE_IO, &m->flags)) 602 pgpath = choose_pgpath(m, bio->bi_iter.bi_size); 603 |
600 /* MPATHF_QUEUE_IO might have been cleared by choose_pgpath. */ 601 queue_io = test_bit(MPATHF_QUEUE_IO, &m->flags); | 604 if (!pgpath) { 605 spin_lock_irqsave(&m->lock, flags); 606 if (test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { 607 __multipath_queue_bio(m, bio); 608 pgpath = ERR_PTR(-EAGAIN); 609 } 610 spin_unlock_irqrestore(&m->lock, flags); |
602 | 611 |
603 if ((pgpath && queue_io) || 604 (!pgpath && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))) { | 612 } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || 613 test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { |
605 multipath_queue_bio(m, bio); | 614 multipath_queue_bio(m, bio); |
606 607 /* PG_INIT_REQUIRED cannot be set without QUEUE_IO */ 608 if (queue_io || test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) 609 pg_init_all_paths(m); 610 | 615 pg_init_all_paths(m); |
611 return ERR_PTR(-EAGAIN); 612 } 613 614 return pgpath; 615} 616 617static int __multipath_map_bio(struct multipath *m, struct bio *bio, 618 struct dm_mpath_io *mpio) --- 1574 unchanged lines hidden --- | 616 return ERR_PTR(-EAGAIN); 617 } 618 619 return pgpath; 620} 621 622static int __multipath_map_bio(struct multipath *m, struct bio *bio, 623 struct dm_mpath_io *mpio) --- 1574 unchanged lines hidden --- |