dm.c (4cc96131afce3eaae7c13dff41c6ba771cf10e96) | dm.c (e83068a5faafb8ca65d3b58bd1e1e3959ce1ddce) |
---|---|
1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 1724 unchanged lines hidden (view full) --- 1733 */ 1734struct queue_limits *dm_get_queue_limits(struct mapped_device *md) 1735{ 1736 BUG_ON(!atomic_read(&md->holders)); 1737 return &md->queue->limits; 1738} 1739EXPORT_SYMBOL_GPL(dm_get_queue_limits); 1740 | 1/* 2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. 3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm-core.h" --- 1724 unchanged lines hidden (view full) --- 1733 */ 1734struct queue_limits *dm_get_queue_limits(struct mapped_device *md) 1735{ 1736 BUG_ON(!atomic_read(&md->holders)); 1737 return &md->queue->limits; 1738} 1739EXPORT_SYMBOL_GPL(dm_get_queue_limits); 1740 |
1741static unsigned filter_md_type(unsigned type, struct mapped_device *md) 1742{ 1743 if (type == DM_TYPE_BIO_BASED) 1744 return type; 1745 1746 return !md->use_blk_mq ? DM_TYPE_REQUEST_BASED : DM_TYPE_MQ_REQUEST_BASED; 1747} 1748 | |
1749/* 1750 * Setup the DM device's queue based on md's type 1751 */ 1752int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) 1753{ 1754 int r; | 1741/* 1742 * Setup the DM device's queue based on md's type 1743 */ 1744int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) 1745{ 1746 int r; |
1755 unsigned md_type = filter_md_type(dm_get_md_type(md), md); | |
1756 | 1747 |
1757 switch (md_type) { | 1748 switch (dm_get_md_type(md)) { |
1758 case DM_TYPE_REQUEST_BASED: 1759 r = dm_old_init_request_queue(md); 1760 if (r) { 1761 DMERR("Cannot initialize queue for request-based mapped device"); 1762 return r; 1763 } 1764 break; 1765 case DM_TYPE_MQ_REQUEST_BASED: | 1749 case DM_TYPE_REQUEST_BASED: 1750 r = dm_old_init_request_queue(md); 1751 if (r) { 1752 DMERR("Cannot initialize queue for request-based mapped device"); 1753 return r; 1754 } 1755 break; 1756 case DM_TYPE_MQ_REQUEST_BASED: |
1766 r = dm_mq_init_request_queue(md, dm_table_get_immutable_target(t)); | 1757 r = dm_mq_init_request_queue(md, t); |
1767 if (r) { 1768 DMERR("Cannot initialize queue for request-based dm-mq mapped device"); 1769 return r; 1770 } 1771 break; 1772 case DM_TYPE_BIO_BASED: 1773 dm_init_normal_md_queue(md); 1774 blk_queue_make_request(md->queue, dm_make_request); --- 692 unchanged lines hidden (view full) --- 2467 struct dm_md_mempools *pools = kzalloc_node(sizeof(*pools), GFP_KERNEL, md->numa_node_id); 2468 struct kmem_cache *cachep = NULL; 2469 unsigned int pool_size = 0; 2470 unsigned int front_pad; 2471 2472 if (!pools) 2473 return NULL; 2474 | 1758 if (r) { 1759 DMERR("Cannot initialize queue for request-based dm-mq mapped device"); 1760 return r; 1761 } 1762 break; 1763 case DM_TYPE_BIO_BASED: 1764 dm_init_normal_md_queue(md); 1765 blk_queue_make_request(md->queue, dm_make_request); --- 692 unchanged lines hidden (view full) --- 2458 struct dm_md_mempools *pools = kzalloc_node(sizeof(*pools), GFP_KERNEL, md->numa_node_id); 2459 struct kmem_cache *cachep = NULL; 2460 unsigned int pool_size = 0; 2461 unsigned int front_pad; 2462 2463 if (!pools) 2464 return NULL; 2465 |
2475 type = filter_md_type(type, md); 2476 | |
2477 switch (type) { 2478 case DM_TYPE_BIO_BASED: 2479 cachep = _io_cache; 2480 pool_size = dm_get_reserved_bio_based_ios(); 2481 front_pad = roundup(per_io_data_size, __alignof__(struct dm_target_io)) + offsetof(struct dm_target_io, clone); 2482 break; 2483 case DM_TYPE_REQUEST_BASED: 2484 cachep = _rq_tio_cache; --- 193 unchanged lines hidden --- | 2466 switch (type) { 2467 case DM_TYPE_BIO_BASED: 2468 cachep = _io_cache; 2469 pool_size = dm_get_reserved_bio_based_ios(); 2470 front_pad = roundup(per_io_data_size, __alignof__(struct dm_target_io)) + offsetof(struct dm_target_io, clone); 2471 break; 2472 case DM_TYPE_REQUEST_BASED: 2473 cachep = _rq_tio_cache; --- 193 unchanged lines hidden --- |