dm-mpath.c (6a23e05c2fe3c64ec012fd81e51e3ab51e4f2f9f) dm-mpath.c (953923c09fe83255ae11845db1c9eb576ba73df8)
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>

--- 189 unchanged lines hidden (view full) ---

198 }
199
200 return m;
201}
202
203static int alloc_multipath_stage2(struct dm_target *ti, struct multipath *m)
204{
205 if (m->queue_mode == DM_TYPE_NONE) {
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>

--- 189 unchanged lines hidden (view full) ---

198 }
199
200 return m;
201}
202
203static int alloc_multipath_stage2(struct dm_target *ti, struct multipath *m)
204{
205 if (m->queue_mode == DM_TYPE_NONE) {
206 m->queue_mode = DM_TYPE_MQ_REQUEST_BASED;
206 m->queue_mode = DM_TYPE_REQUEST_BASED;
207 } else if (m->queue_mode == DM_TYPE_BIO_BASED) {
208 INIT_WORK(&m->process_queued_bios, process_queued_bios);
209 /*
210 * bio-based doesn't support any direct scsi_dh management;
211 * it just discovers if a scsi_dh is attached.
212 */
213 set_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags);
214 }

--- 438 unchanged lines hidden (view full) ---

653 struct dm_mpath_io *mpio = NULL;
654
655 multipath_init_per_bio_data(bio, &mpio);
656 return __multipath_map_bio(m, bio, mpio);
657}
658
659static void process_queued_io_list(struct multipath *m)
660{
207 } else if (m->queue_mode == DM_TYPE_BIO_BASED) {
208 INIT_WORK(&m->process_queued_bios, process_queued_bios);
209 /*
210 * bio-based doesn't support any direct scsi_dh management;
211 * it just discovers if a scsi_dh is attached.
212 */
213 set_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags);
214 }

--- 438 unchanged lines hidden (view full) ---

653 struct dm_mpath_io *mpio = NULL;
654
655 multipath_init_per_bio_data(bio, &mpio);
656 return __multipath_map_bio(m, bio, mpio);
657}
658
659static void process_queued_io_list(struct multipath *m)
660{
661 if (m->queue_mode == DM_TYPE_MQ_REQUEST_BASED)
661 if (m->queue_mode == DM_TYPE_REQUEST_BASED)
662 dm_mq_kick_requeue_list(dm_table_get_md(m->ti->table));
663 else if (m->queue_mode == DM_TYPE_BIO_BASED)
664 queue_work(kmultipathd, &m->process_queued_bios);
665}
666
667static void process_queued_bios(struct work_struct *work)
668{
669 int r;

--- 404 unchanged lines hidden (view full) ---

1074 }
1075
1076 if (!strcasecmp(arg_name, "queue_mode") &&
1077 (argc >= 1)) {
1078 const char *queue_mode_name = dm_shift_arg(as);
1079
1080 if (!strcasecmp(queue_mode_name, "bio"))
1081 m->queue_mode = DM_TYPE_BIO_BASED;
662 dm_mq_kick_requeue_list(dm_table_get_md(m->ti->table));
663 else if (m->queue_mode == DM_TYPE_BIO_BASED)
664 queue_work(kmultipathd, &m->process_queued_bios);
665}
666
667static void process_queued_bios(struct work_struct *work)
668{
669 int r;

--- 404 unchanged lines hidden (view full) ---

1074 }
1075
1076 if (!strcasecmp(arg_name, "queue_mode") &&
1077 (argc >= 1)) {
1078 const char *queue_mode_name = dm_shift_arg(as);
1079
1080 if (!strcasecmp(queue_mode_name, "bio"))
1081 m->queue_mode = DM_TYPE_BIO_BASED;
1082 else if (!strcasecmp(queue_mode_name, "rq"))
1082 else if (!strcasecmp(queue_mode_name, "rq") ||
1083 !strcasecmp(queue_mode_name, "mq"))
1083 m->queue_mode = DM_TYPE_REQUEST_BASED;
1084 m->queue_mode = DM_TYPE_REQUEST_BASED;
1084 else if (!strcasecmp(queue_mode_name, "mq"))
1085 m->queue_mode = DM_TYPE_MQ_REQUEST_BASED;
1086 else {
1087 ti->error = "Unknown 'queue_mode' requested";
1088 r = -EINVAL;
1089 }
1090 argc--;
1091 continue;
1092 }
1093

--- 617 unchanged lines hidden (view full) ---

1711 DMEMIT("pg_init_delay_msecs %u ", m->pg_init_delay_msecs);
1712 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags))
1713 DMEMIT("retain_attached_hw_handler ");
1714 if (m->queue_mode != DM_TYPE_REQUEST_BASED) {
1715 switch(m->queue_mode) {
1716 case DM_TYPE_BIO_BASED:
1717 DMEMIT("queue_mode bio ");
1718 break;
1085 else {
1086 ti->error = "Unknown 'queue_mode' requested";
1087 r = -EINVAL;
1088 }
1089 argc--;
1090 continue;
1091 }
1092

--- 617 unchanged lines hidden (view full) ---

1710 DMEMIT("pg_init_delay_msecs %u ", m->pg_init_delay_msecs);
1711 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags))
1712 DMEMIT("retain_attached_hw_handler ");
1713 if (m->queue_mode != DM_TYPE_REQUEST_BASED) {
1714 switch(m->queue_mode) {
1715 case DM_TYPE_BIO_BASED:
1716 DMEMIT("queue_mode bio ");
1717 break;
1719 case DM_TYPE_MQ_REQUEST_BASED:
1720 DMEMIT("queue_mode mq ");
1721 break;
1722 default:
1723 WARN_ON_ONCE(true);
1724 break;
1725 }
1726 }
1727 }
1728
1729 if (!m->hw_handler_name || type == STATUSTYPE_INFO)

--- 227 unchanged lines hidden (view full) ---

1957 struct pgpath *pgpath;
1958
1959 /* pg_init in progress */
1960 if (atomic_read(&m->pg_init_in_progress))
1961 return true;
1962
1963 /* no paths available, for blk-mq: rely on IO mapping to delay requeue */
1964 if (!atomic_read(&m->nr_valid_paths) && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
1718 default:
1719 WARN_ON_ONCE(true);
1720 break;
1721 }
1722 }
1723 }
1724
1725 if (!m->hw_handler_name || type == STATUSTYPE_INFO)

--- 227 unchanged lines hidden (view full) ---

1953 struct pgpath *pgpath;
1954
1955 /* pg_init in progress */
1956 if (atomic_read(&m->pg_init_in_progress))
1957 return true;
1958
1959 /* no paths available, for blk-mq: rely on IO mapping to delay requeue */
1960 if (!atomic_read(&m->nr_valid_paths) && test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
1965 return (m->queue_mode != DM_TYPE_MQ_REQUEST_BASED);
1961 return (m->queue_mode != DM_TYPE_REQUEST_BASED);
1966
1967 /* Guess which priority_group will be used at next mapping time */
1968 pg = READ_ONCE(m->current_pg);
1969 next_pg = READ_ONCE(m->next_pg);
1970 if (unlikely(!READ_ONCE(m->current_pgpath) && next_pg))
1971 pg = next_pg;
1972
1973 if (!pg) {

--- 119 unchanged lines hidden ---
1962
1963 /* Guess which priority_group will be used at next mapping time */
1964 pg = READ_ONCE(m->current_pg);
1965 next_pg = READ_ONCE(m->next_pg);
1966 if (unlikely(!READ_ONCE(m->current_pgpath) && next_pg))
1967 pg = next_pg;
1968
1969 if (!pg) {

--- 119 unchanged lines hidden ---