Except for pktdvd, the only places setting congested bits are file systems that allocate their own backing_dev_info structures. And pktdvd is a deprecated driver that isn't useful in stack setup either. So remove the dead congested_fn stacking infrastructure.
Unified · Split
| @@ -2415,62 +2415,6 @@ static void drbd_cleanup(void) · 2414 unmodified lines | |||
| 2415 | pr_info("module cleanup done.\n"); | 2415 | pr_info("module cleanup done.\n"); |
| 2416 | } | 2416 | } |
| 2417 | 2417 | ||
| 2418 | /** | ||
| 2419 | * drbd_congested() - Callback for the flusher thread | ||
| 2420 | * @congested_data: User data | ||
| 2421 | * @bdi_bits: Bits the BDI flusher thread is currently interested in | ||
| 2422 | * | ||
| 2423 | * Returns 1<<WB_async_congested and/or 1<<WB_sync_congested if we are congested. | ||
| 2424 | */ | ||
| 2425 | static int drbd_congested(void *congested_data, int bdi_bits) | ||
| 2426 | { | ||
| 2427 | struct drbd_device *device = congested_data; | ||
| 2428 | struct request_queue *q; | ||
| 2429 | char reason = '-'; | ||
| 2430 | int r = 0; | ||
| 2431 | |||
| 2432 | if (!may_inc_ap_bio(device)) { | ||
| 2433 | /* DRBD has frozen IO */ | ||
| 2434 | r = bdi_bits; | ||
| 2435 | reason = 'd'; | ||
| 2436 | goto out; | ||
| 2437 | } | ||
| 2438 | |||
| 2439 | if (test_bit(CALLBACK_PENDING, &first_peer_device(device)->connection->flags)) { | ||
| 2440 | r |= (1 << WB_async_congested); | ||
| 2441 | /* Without good local data, we would need to read from remote, | ||
| 2442 | * and that would need the worker thread as well, which is | ||
| 2443 | * currently blocked waiting for that usermode helper to | ||
| 2444 | * finish. | ||
| 2445 | */ | ||
| 2446 | if (!get_ldev_if_state(device, D_UP_TO_DATE)) | ||
| 2447 | r |= (1 << WB_sync_congested); | ||
| 2448 | else | ||
| 2449 | put_ldev(device); | ||
| 2450 | r &= bdi_bits; | ||
| 2451 | reason = 'c'; | ||
| 2452 | goto out; | ||
| 2453 | } | ||
| 2454 | |||
| 2455 | if (get_ldev(device)) { | ||
| 2456 | q = bdev_get_queue(device->ldev->backing_bdev); | ||
| 2457 | r = bdi_congested(q->backing_dev_info, bdi_bits); | ||
| 2458 | put_ldev(device); | ||
| 2459 | if (r) | ||
| 2460 | reason = 'b'; | ||
| 2461 | } | ||
| 2462 | |||
| 2463 | if (bdi_bits & (1 << WB_async_congested) && | ||
| 2464 | test_bit(NET_CONGESTED, &first_peer_device(device)->connection->flags)) { | ||
| 2465 | r |= (1 << WB_async_congested); | ||
| 2466 | reason = reason == 'b' ? 'a' : 'n'; | ||
| 2467 | } | ||
| 2468 | |||
| 2469 | out: | ||
| 2470 | device->congestion_reason = reason; | ||
| 2471 | return r; | ||
| 2472 | } | ||
| 2473 | |||
| 2474 | static void drbd_init_workqueue(struct drbd_work_queue* wq) | 2418 | static void drbd_init_workqueue(struct drbd_work_queue* wq) |
| 2475 | { | 2419 | { |
| 2476 | spin_lock_init(&wq->q_lock); | 2420 | spin_lock_init(&wq->q_lock); |
| @@ -2825,9 +2769,6 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig · 348 unmodified lines | |||
| 2825 | /* we have no partitions. we contain only ourselves. */ | 2769 | /* we have no partitions. we contain only ourselves. */ |
| 2826 | device->this_bdev->bd_contains = device->this_bdev; | 2770 | device->this_bdev->bd_contains = device->this_bdev; |
| 2827 | 2771 | ||
| 2828 | q->backing_dev_info->congested_fn = drbd_congested; | ||
| 2829 | q->backing_dev_info->congested_data = device; | ||
| 2830 | |||
| 2831 | blk_queue_write_cache(q, true, true); | 2772 | blk_queue_write_cache(q, true, true); |
| 2832 | /* Setting the max_hw_sectors to an odd value of 8kibyte here | 2773 | /* Setting the max_hw_sectors to an odd value of 8kibyte here |
| 2833 | This triggers a max_bio_size message upon first attach or connect */ | 2774 | This triggers a max_bio_size message upon first attach or connect */ |
| @@ -1228,36 +1228,8 @@ static int cached_dev_ioctl(struct bcache_device *d, fmode_t mode, · 1227 unmodified lines | |||
| 1228 | return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg); | 1228 | return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg); |
| 1229 | } | 1229 | } |
| 1230 | 1230 | ||
| 1231 | static int cached_dev_congested(void *data, int bits) | ||
| 1232 | { | ||
| 1233 | struct bcache_device *d = data; | ||
| 1234 | struct cached_dev *dc = container_of(d, struct cached_dev, disk); | ||
| 1235 | struct request_queue *q = bdev_get_queue(dc->bdev); | ||
| 1236 | int ret = 0; | ||
| 1237 | |||
| 1238 | if (bdi_congested(q->backing_dev_info, bits)) | ||
| 1239 | return 1; | ||
| 1240 | |||
| 1241 | if (cached_dev_get(dc)) { | ||
| 1242 | unsigned int i; | ||
| 1243 | struct cache *ca; | ||
| 1244 | |||
| 1245 | for_each_cache(ca, d->c, i) { | ||
| 1246 | q = bdev_get_queue(ca->bdev); | ||
| 1247 | ret |= bdi_congested(q->backing_dev_info, bits); | ||
| 1248 | } | ||
| 1249 | |||
| 1250 | cached_dev_put(dc); | ||
| 1251 | } | ||
| 1252 | |||
| 1253 | return ret; | ||
| 1254 | } | ||
| 1255 | |||
| 1256 | void bch_cached_dev_request_init(struct cached_dev *dc) | 1231 | void bch_cached_dev_request_init(struct cached_dev *dc) |
| 1257 | { | 1232 | { |
| 1258 | struct gendisk *g = dc->disk.disk; | ||
| 1259 | |||
| 1260 | g->queue->backing_dev_info->congested_fn = cached_dev_congested; | ||
| 1261 | dc->disk.cache_miss = cached_dev_cache_miss; | 1233 | dc->disk.cache_miss = cached_dev_cache_miss; |
| 1262 | dc->disk.ioctl = cached_dev_ioctl; | 1234 | dc->disk.ioctl = cached_dev_ioctl; |
| 1263 | } | 1235 | } |
| @@ -1341,27 +1313,8 @@ static int flash_dev_ioctl(struct bcache_device *d, fmode_t mode, · 77 unmodified lines | |||
| 1341 | return -ENOTTY; | 1313 | return -ENOTTY; |
| 1342 | } | 1314 | } |
| 1343 | 1315 | ||
| 1344 | static int flash_dev_congested(void *data, int bits) | ||
| 1345 | { | ||
| 1346 | struct bcache_device *d = data; | ||
| 1347 | struct request_queue *q; | ||
| 1348 | struct cache *ca; | ||
| 1349 | unsigned int i; | ||
| 1350 | int ret = 0; | ||
| 1351 | |||
| 1352 | for_each_cache(ca, d->c, i) { | ||
| 1353 | q = bdev_get_queue(ca->bdev); | ||
| 1354 | ret |= bdi_congested(q->backing_dev_info, bits); | ||
| 1355 | } | ||
| 1356 | |||
| 1357 | return ret; | ||
| 1358 | } | ||
| 1359 | |||
| 1360 | void bch_flash_dev_request_init(struct bcache_device *d) | 1316 | void bch_flash_dev_request_init(struct bcache_device *d) |
| 1361 | { | 1317 | { |
| 1362 | struct gendisk *g = d->disk; | ||
| 1363 | |||
| 1364 | g->queue->backing_dev_info->congested_fn = flash_dev_congested; | ||
| 1365 | d->cache_miss = flash_dev_cache_miss; | 1318 | d->cache_miss = flash_dev_cache_miss; |
| 1366 | d->ioctl = flash_dev_ioctl; | 1319 | d->ioctl = flash_dev_ioctl; |
| 1367 | } | 1320 | } |
| @@ -885,7 +885,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, · 884 unmodified lines | |||
| 885 | return -ENOMEM; | 885 | return -ENOMEM; |
| 886 | 886 | ||
| 887 | d->disk->queue = q; | 887 | d->disk->queue = q; |
| 888 | q->backing_dev_info->congested_data = d; | ||
| 889 | q->limits.max_hw_sectors = UINT_MAX; | 888 | q->limits.max_hw_sectors = UINT_MAX; |
| 890 | q->limits.max_sectors = UINT_MAX; | 889 | q->limits.max_sectors = UINT_MAX; |
| 891 | q->limits.max_segment_size = UINT_MAX; | 890 | q->limits.max_segment_size = UINT_MAX; |
| @@ -421,8 +421,6 @@ struct cache { · 420 unmodified lines | |||
| 421 | 421 | ||
| 422 | struct rw_semaphore quiesce_lock; | 422 | struct rw_semaphore quiesce_lock; |
| 423 | 423 | ||
| 424 | struct dm_target_callbacks callbacks; | ||
| 425 | |||
| 426 | /* | 424 | /* |
| 427 | * origin_blocks entries, discarded if set. | 425 | * origin_blocks entries, discarded if set. |
| 428 | */ | 426 | */ |
| @@ -2423,20 +2421,6 @@ static void set_cache_size(struct cache *cache, dm_cblock_t size) · 1994 unmodified lines | |||
| 2423 | cache->cache_size = size; | 2421 | cache->cache_size = size; |
| 2424 | } | 2422 | } |
| 2425 | 2423 | ||
| 2426 | static int is_congested(struct dm_dev *dev, int bdi_bits) | ||
| 2427 | { | ||
| 2428 | struct request_queue *q = bdev_get_queue(dev->bdev); | ||
| 2429 | return bdi_congested(q->backing_dev_info, bdi_bits); | ||
| 2430 | } | ||
| 2431 | |||
| 2432 | static int cache_is_congested(struct dm_target_callbacks *cb, int bdi_bits) | ||
| 2433 | { | ||
| 2434 | struct cache *cache = container_of(cb, struct cache, callbacks); | ||
| 2435 | |||
| 2436 | return is_congested(cache->origin_dev, bdi_bits) || | ||
| 2437 | is_congested(cache->cache_dev, bdi_bits); | ||
| 2438 | } | ||
| 2439 | |||
| 2440 | #define DEFAULT_MIGRATION_THRESHOLD 2048 | 2424 | #define DEFAULT_MIGRATION_THRESHOLD 2048 |
| 2441 | 2425 | ||
| 2442 | static int cache_create(struct cache_args *ca, struct cache **result) | 2426 | static int cache_create(struct cache_args *ca, struct cache **result) |
| @@ -2471,9 +2455,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) · 28 unmodified lines | |||
| 2471 | goto bad; | 2455 | goto bad; |
| 2472 | } | 2456 | } |
| 2473 | 2457 | ||
| 2474 | cache->callbacks.congested_fn = cache_is_congested; | ||
| 2475 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); | ||
| 2476 | |||
| 2477 | cache->metadata_dev = ca->metadata_dev; | 2458 | cache->metadata_dev = ca->metadata_dev; |
| 2478 | cache->origin_dev = ca->origin_dev; | 2459 | cache->origin_dev = ca->origin_dev; |
| 2479 | cache->cache_dev = ca->cache_dev; | 2460 | cache->cache_dev = ca->cache_dev; |
| @@ -68,7 +68,6 @@ struct hash_table_bucket; · 67 unmodified lines | |||
| 68 | 68 | ||
| 69 | struct clone { | 69 | struct clone { |
| 70 | struct dm_target *ti; | 70 | struct dm_target *ti; |
| 71 | struct dm_target_callbacks callbacks; | ||
| 72 | 71 | ||
| 73 | struct dm_dev *metadata_dev; | 72 | struct dm_dev *metadata_dev; |
| 74 | struct dm_dev *dest_dev; | 73 | struct dm_dev *dest_dev; |
| @@ -1518,18 +1517,6 @@ error: · 1443 unmodified lines | |||
| 1518 | DMEMIT("Error"); | 1517 | DMEMIT("Error"); |
| 1519 | } | 1518 | } |
| 1520 | 1519 | ||
| 1521 | static int clone_is_congested(struct dm_target_callbacks *cb, int bdi_bits) | ||
| 1522 | { | ||
| 1523 | struct request_queue *dest_q, *source_q; | ||
| 1524 | struct clone *clone = container_of(cb, struct clone, callbacks); | ||
| 1525 | |||
| 1526 | source_q = bdev_get_queue(clone->source_dev->bdev); | ||
| 1527 | dest_q = bdev_get_queue(clone->dest_dev->bdev); | ||
| 1528 | |||
| 1529 | return (bdi_congested(dest_q->backing_dev_info, bdi_bits) | | ||
| 1530 | bdi_congested(source_q->backing_dev_info, bdi_bits)); | ||
| 1531 | } | ||
| 1532 | |||
| 1533 | static sector_t get_dev_size(struct dm_dev *dev) | 1520 | static sector_t get_dev_size(struct dm_dev *dev) |
| 1534 | { | 1521 | { |
| 1535 | return i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT; | 1522 | return i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT; |
| @@ -1930,8 +1917,6 @@ static int clone_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 394 unmodified lines | |||
| 1930 | goto out_with_mempool; | 1917 | goto out_with_mempool; |
| 1931 | 1918 | ||
| 1932 | mutex_init(&clone->commit_lock); | 1919 | mutex_init(&clone->commit_lock); |
| 1933 | clone->callbacks.congested_fn = clone_is_congested; | ||
| 1934 | dm_table_add_target_callbacks(ti->table, &clone->callbacks); | ||
| 1935 | 1920 | ||
| 1936 | /* Enable flushes */ | 1921 | /* Enable flushes */ |
| 1937 | ti->num_flush_bios = 1; | 1922 | ti->num_flush_bios = 1; |
| @@ -1137,7 +1137,6 @@ static int metadata_get_stats(struct era_metadata *md, void *ptr) · 1136 unmodified lines | |||
| 1137 | 1137 | ||
| 1138 | struct era { | 1138 | struct era { |
| 1139 | struct dm_target *ti; | 1139 | struct dm_target *ti; |
| 1140 | struct dm_target_callbacks callbacks; | ||
| 1141 | 1140 | ||
| 1142 | struct dm_dev *metadata_dev; | 1141 | struct dm_dev *metadata_dev; |
| 1143 | struct dm_dev *origin_dev; | 1142 | struct dm_dev *origin_dev; |
| @@ -1375,18 +1374,6 @@ static void stop_worker(struct era *era) · 231 unmodified lines | |||
| 1375 | /*---------------------------------------------------------------- | 1374 | /*---------------------------------------------------------------- |
| 1376 | * Target methods | 1375 | * Target methods |
| 1377 | *--------------------------------------------------------------*/ | 1376 | *--------------------------------------------------------------*/ |
| 1378 | static int dev_is_congested(struct dm_dev *dev, int bdi_bits) | ||
| 1379 | { | ||
| 1380 | struct request_queue *q = bdev_get_queue(dev->bdev); | ||
| 1381 | return bdi_congested(q->backing_dev_info, bdi_bits); | ||
| 1382 | } | ||
| 1383 | |||
| 1384 | static int era_is_congested(struct dm_target_callbacks *cb, int bdi_bits) | ||
| 1385 | { | ||
| 1386 | struct era *era = container_of(cb, struct era, callbacks); | ||
| 1387 | return dev_is_congested(era->origin_dev, bdi_bits); | ||
| 1388 | } | ||
| 1389 | |||
| 1390 | static void era_destroy(struct era *era) | 1377 | static void era_destroy(struct era *era) |
| 1391 | { | 1378 | { |
| 1392 | if (era->md) | 1379 | if (era->md) |
| @@ -1514,8 +1501,6 @@ static int era_ctr(struct dm_target *ti, unsigned argc, char **argv) · 121 unmodified lines | |||
| 1514 | ti->flush_supported = true; | 1501 | ti->flush_supported = true; |
| 1515 | 1502 | ||
| 1516 | ti->num_discard_bios = 1; | 1503 | ti->num_discard_bios = 1; |
| 1517 | era->callbacks.congested_fn = era_is_congested; | ||
| 1518 | dm_table_add_target_callbacks(ti->table, &era->callbacks); | ||
| 1519 | 1504 | ||
| 1520 | return 0; | 1505 | return 0; |
| 1521 | } | 1506 | } |
| @@ -242,7 +242,6 @@ struct raid_set { · 241 unmodified lines | |||
| 242 | 242 | ||
| 243 | struct mddev md; | 243 | struct mddev md; |
| 244 | struct raid_type *raid_type; | 244 | struct raid_type *raid_type; |
| 245 | struct dm_target_callbacks callbacks; | ||
| 246 | 245 | ||
| 247 | sector_t array_sectors; | 246 | sector_t array_sectors; |
| 248 | sector_t dev_sectors; | 247 | sector_t dev_sectors; |
| @@ -1705,13 +1704,6 @@ static void do_table_event(struct work_struct *ws) · 1456 unmodified lines | |||
| 1705 | dm_table_event(rs->ti->table); | 1704 | dm_table_event(rs->ti->table); |
| 1706 | } | 1705 | } |
| 1707 | 1706 | ||
| 1708 | static int raid_is_congested(struct dm_target_callbacks *cb, int bits) | ||
| 1709 | { | ||
| 1710 | struct raid_set *rs = container_of(cb, struct raid_set, callbacks); | ||
| 1711 | |||
| 1712 | return mddev_congested(&rs->md, bits); | ||
| 1713 | } | ||
| 1714 | |||
| 1715 | /* | 1707 | /* |
| 1716 | * Make sure a valid takover (level switch) is being requested on @rs | 1708 | * Make sure a valid takover (level switch) is being requested on @rs |
| 1717 | * | 1709 | * |
| @@ -3248,9 +3240,6 @@ size_check: · 1530 unmodified lines | |||
| 3248 | goto bad_md_start; | 3240 | goto bad_md_start; |
| 3249 | } | 3241 | } |
| 3250 | 3242 | ||
| 3251 | rs->callbacks.congested_fn = raid_is_congested; | ||
| 3252 | dm_table_add_target_callbacks(ti->table, &rs->callbacks); | ||
| 3253 | |||
| 3254 | /* If raid4/5/6 journal mode explicitly requested (only possible with journal dev) -> set it */ | 3243 | /* If raid4/5/6 journal mode explicitly requested (only possible with journal dev) -> set it */ |
| 3255 | if (test_bit(__CTR_FLAG_JOURNAL_MODE, &rs->ctr_flags)) { | 3244 | if (test_bit(__CTR_FLAG_JOURNAL_MODE, &rs->ctr_flags)) { |
| 3256 | r = r5c_journal_mode_set(&rs->md, rs->journal_dev.mode); | 3245 | r = r5c_journal_mode_set(&rs->md, rs->journal_dev.mode); |
| @@ -3310,7 +3299,6 @@ static void raid_dtr(struct dm_target *ti) · 53 unmodified lines | |||
| 3310 | { | 3299 | { |
| 3311 | struct raid_set *rs = ti->private; | 3300 | struct raid_set *rs = ti->private; |
| 3312 | 3301 | ||
| 3313 | list_del_init(&rs->callbacks.list); | ||
| 3314 | md_stop(&rs->md); | 3302 | md_stop(&rs->md); |
| 3315 | raid_set_free(rs); | 3303 | raid_set_free(rs); |
| 3316 | } | 3304 | } |
| @@ -64,8 +64,6 @@ struct dm_table { · 63 unmodified lines | |||
| 64 | void *event_context; | 64 | void *event_context; |
| 65 | 65 | ||
| 66 | struct dm_md_mempools *mempools; | 66 | struct dm_md_mempools *mempools; |
| 67 | |||
| 68 | struct list_head target_callbacks; | ||
| 69 | }; | 67 | }; |
| 70 | 68 | ||
| 71 | /* | 69 | /* |
| @@ -190,7 +188,6 @@ int dm_table_create(struct dm_table **result, fmode_t mode, · 118 unmodified lines | |||
| 190 | return -ENOMEM; | 188 | return -ENOMEM; |
| 191 | 189 | ||
| 192 | INIT_LIST_HEAD(&t->devices); | 190 | INIT_LIST_HEAD(&t->devices); |
| 193 | INIT_LIST_HEAD(&t->target_callbacks); | ||
| 194 | 191 | ||
| 195 | if (!num_targets) | 192 | if (!num_targets) |
| 196 | num_targets = KEYS_PER_NODE; | 193 | num_targets = KEYS_PER_NODE; |
| @@ -361,7 +358,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev, · 164 unmodified lines | |||
| 361 | * This upgrades the mode on an already open dm_dev, being | 358 | * This upgrades the mode on an already open dm_dev, being |
| 362 | * careful to leave things as they were if we fail to reopen the | 359 | * careful to leave things as they were if we fail to reopen the |
| 363 | * device and not to touch the existing bdev field in case | 360 | * device and not to touch the existing bdev field in case |
| 364 | * it is accessed concurrently inside dm_table_any_congested(). | 361 | * it is accessed concurrently. |
| 365 | */ | 362 | */ |
| 366 | static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, | 363 | static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, |
| 367 | struct mapped_device *md) | 364 | struct mapped_device *md) |
| @@ -2052,38 +2049,6 @@ int dm_table_resume_targets(struct dm_table *t) · 1684 unmodified lines | |||
| 2052 | return 0; | 2049 | return 0; |
| 2053 | } | 2050 | } |
| 2054 | 2051 | ||
| 2055 | void dm_table_add_target_callbacks(struct dm_table *t, struct dm_target_callbacks *cb) | ||
| 2056 | { | ||
| 2057 | list_add(&cb->list, &t->target_callbacks); | ||
| 2058 | } | ||
| 2059 | EXPORT_SYMBOL_GPL(dm_table_add_target_callbacks); | ||
| 2060 | |||
| 2061 | int dm_table_any_congested(struct dm_table *t, int bdi_bits) | ||
| 2062 | { | ||
| 2063 | struct dm_dev_internal *dd; | ||
| 2064 | struct list_head *devices = dm_table_get_devices(t); | ||
| 2065 | struct dm_target_callbacks *cb; | ||
| 2066 | int r = 0; | ||
| 2067 | |||
| 2068 | list_for_each_entry(dd, devices, list) { | ||
| 2069 | struct request_queue *q = bdev_get_queue(dd->dm_dev->bdev); | ||
| 2070 | char b[BDEVNAME_SIZE]; | ||
| 2071 | |||
| 2072 | if (likely(q)) | ||
| 2073 | r |= bdi_congested(q->backing_dev_info, bdi_bits); | ||
| 2074 | else | ||
| 2075 | DMWARN_LIMIT("%s: any_congested: nonexistent device %s", | ||
| 2076 | dm_device_name(t->md), | ||
| 2077 | bdevname(dd->dm_dev->bdev, b)); | ||
| 2078 | } | ||
| 2079 | |||
| 2080 | list_for_each_entry(cb, &t->target_callbacks, list) | ||
| 2081 | if (cb->congested_fn) | ||
| 2082 | r |= cb->congested_fn(cb, bdi_bits); | ||
| 2083 | |||
| 2084 | return r; | ||
| 2085 | } | ||
| 2086 | |||
| 2087 | struct mapped_device *dm_table_get_md(struct dm_table *t) | 2052 | struct mapped_device *dm_table_get_md(struct dm_table *t) |
| 2088 | { | 2053 | { |
| 2089 | return t->md; | 2054 | return t->md; |
| @@ -326,7 +326,6 @@ struct pool_c { · 325 unmodified lines | |||
| 326 | struct pool *pool; | 326 | struct pool *pool; |
| 327 | struct dm_dev *data_dev; | 327 | struct dm_dev *data_dev; |
| 328 | struct dm_dev *metadata_dev; | 328 | struct dm_dev *metadata_dev; |
| 329 | struct dm_target_callbacks callbacks; | ||
| 330 | 329 | ||
| 331 | dm_block_t low_water_blocks; | 330 | dm_block_t low_water_blocks; |
| 332 | struct pool_features requested_pf; /* Features requested during table load */ | 331 | struct pool_features requested_pf; /* Features requested during table load */ |
| @@ -2796,18 +2795,6 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) · 2463 unmodified lines | |||
| 2796 | } | 2795 | } |
| 2797 | } | 2796 | } |
| 2798 | 2797 | ||
| 2799 | static int pool_is_congested(struct dm_target_callbacks *cb, int bdi_bits) | ||
| 2800 | { | ||
| 2801 | struct pool_c *pt = container_of(cb, struct pool_c, callbacks); | ||
| 2802 | struct request_queue *q; | ||
| 2803 | |||
| 2804 | if (get_pool_mode(pt->pool) == PM_OUT_OF_DATA_SPACE) | ||
| 2805 | return 1; | ||
| 2806 | |||
| 2807 | q = bdev_get_queue(pt->data_dev->bdev); | ||
| 2808 | return bdi_congested(q->backing_dev_info, bdi_bits); | ||
| 2809 | } | ||
| 2810 | |||
| 2811 | static void requeue_bios(struct pool *pool) | 2798 | static void requeue_bios(struct pool *pool) |
| 2812 | { | 2799 | { |
| 2813 | struct thin_c *tc; | 2800 | struct thin_c *tc; |
| @@ -3420,9 +3407,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) · 606 unmodified lines | |||
| 3420 | dm_pool_register_pre_commit_callback(pool->pmd, | 3407 | dm_pool_register_pre_commit_callback(pool->pmd, |
| 3421 | metadata_pre_commit_callback, pool); | 3408 | metadata_pre_commit_callback, pool); |
| 3422 | 3409 | ||
| 3423 | pt->callbacks.congested_fn = pool_is_congested; | ||
| 3424 | dm_table_add_target_callbacks(ti->table, &pt->callbacks); | ||
| 3425 | |||
| 3426 | mutex_unlock(&dm_thin_pool_table.mutex); | 3410 | mutex_unlock(&dm_thin_pool_table.mutex); |
| 3427 | 3411 | ||
| 3428 | return 0; | 3412 | return 0; |
| @@ -1821,31 +1821,6 @@ static blk_qc_t dm_submit_bio(struct bio *bio) · 1820 unmodified lines | |||
| 1821 | return ret; | 1821 | return ret; |
| 1822 | } | 1822 | } |
| 1823 | 1823 | ||
| 1824 | static int dm_any_congested(void *congested_data, int bdi_bits) | ||
| 1825 | { | ||
| 1826 | int r = bdi_bits; | ||
| 1827 | struct mapped_device *md = congested_data; | ||
| 1828 | struct dm_table *map; | ||
| 1829 | |||
| 1830 | if (!test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) { | ||
| 1831 | if (dm_request_based(md)) { | ||
| 1832 | /* | ||
| 1833 | * With request-based DM we only need to check the | ||
| 1834 | * top-level queue for congestion. | ||
| 1835 | */ | ||
| 1836 | struct backing_dev_info *bdi = md->queue->backing_dev_info; | ||
| 1837 | r = bdi->wb.congested & bdi_bits; | ||
| 1838 | } else { | ||
| 1839 | map = dm_get_live_table_fast(md); | ||
| 1840 | if (map) | ||
| 1841 | r = dm_table_any_congested(map, bdi_bits); | ||
| 1842 | dm_put_live_table_fast(md); | ||
| 1843 | } | ||
| 1844 | } | ||
| 1845 | |||
| 1846 | return r; | ||
| 1847 | } | ||
| 1848 | |||
| 1849 | /*----------------------------------------------------------------- | 1824 | /*----------------------------------------------------------------- |
| 1850 | * An IDR is used to keep track of allocated minor numbers. | 1825 | * An IDR is used to keep track of allocated minor numbers. |
| 1851 | *---------------------------------------------------------------*/ | 1826 | *---------------------------------------------------------------*/ |
| @@ -2284,12 +2259,6 @@ struct queue_limits *dm_get_queue_limits(struct mapped_device *md) · 432 unmodified lines | |||
| 2284 | } | 2259 | } |
| 2285 | EXPORT_SYMBOL_GPL(dm_get_queue_limits); | 2260 | EXPORT_SYMBOL_GPL(dm_get_queue_limits); |
| 2286 | 2261 | ||
| 2287 | static void dm_init_congested_fn(struct mapped_device *md) | ||
| 2288 | { | ||
| 2289 | md->queue->backing_dev_info->congested_data = md; | ||
| 2290 | md->queue->backing_dev_info->congested_fn = dm_any_congested; | ||
| 2291 | } | ||
| 2292 | |||
| 2293 | /* | 2262 | /* |
| 2294 | * Setup the DM device's queue based on md's type | 2263 | * Setup the DM device's queue based on md's type |
| 2295 | */ | 2264 | */ |
| @@ -2306,12 +2275,10 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) · 10 unmodified lines | |||
| 2306 | DMERR("Cannot initialize queue for request-based dm-mq mapped device"); | 2275 | DMERR("Cannot initialize queue for request-based dm-mq mapped device"); |
| 2307 | return r; | 2276 | return r; |
| 2308 | } | 2277 | } |
| 2309 | dm_init_congested_fn(md); | ||
| 2310 | break; | 2278 | break; |
| 2311 | case DM_TYPE_BIO_BASED: | 2279 | case DM_TYPE_BIO_BASED: |
| 2312 | case DM_TYPE_DAX_BIO_BASED: | 2280 | case DM_TYPE_DAX_BIO_BASED: |
| 2313 | case DM_TYPE_NVME_BIO_BASED: | 2281 | case DM_TYPE_NVME_BIO_BASED: |
| 2314 | dm_init_congested_fn(md); | ||
| 2315 | break; | 2282 | break; |
| 2316 | case DM_TYPE_NONE: | 2283 | case DM_TYPE_NONE: |
| 2317 | WARN_ON_ONCE(true); | 2284 | WARN_ON_ONCE(true); |
| @@ -63,7 +63,6 @@ void dm_table_presuspend_targets(struct dm_table *t); · 62 unmodified lines | |||
| 63 | void dm_table_presuspend_undo_targets(struct dm_table *t); | 63 | void dm_table_presuspend_undo_targets(struct dm_table *t); |
| 64 | void dm_table_postsuspend_targets(struct dm_table *t); | 64 | void dm_table_postsuspend_targets(struct dm_table *t); |
| 65 | int dm_table_resume_targets(struct dm_table *t); | 65 | int dm_table_resume_targets(struct dm_table *t); |
| 66 | int dm_table_any_congested(struct dm_table *t, int bdi_bits); | ||
| 67 | enum dm_queue_mode dm_table_get_type(struct dm_table *t); | 66 | enum dm_queue_mode dm_table_get_type(struct dm_table *t); |
| 68 | struct target_type *dm_table_get_immutable_target_type(struct dm_table *t); | 67 | struct target_type *dm_table_get_immutable_target_type(struct dm_table *t); |
| 69 | struct dm_target *dm_table_get_immutable_target(struct dm_table *t); | 68 | struct dm_target *dm_table_get_immutable_target(struct dm_table *t); |
| @@ -46,29 +46,6 @@ static inline struct dev_info *which_dev(struct mddev *mddev, sector_t sector) · 45 unmodified lines | |||
| 46 | return conf->disks + lo; | 46 | return conf->disks + lo; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | /* | ||
| 50 | * In linear_congested() conf->raid_disks is used as a copy of | ||
| 51 | * mddev->raid_disks to iterate conf->disks[], because conf->raid_disks | ||
| 52 | * and conf->disks[] are created in linear_conf(), they are always | ||
| 53 | * consitent with each other, but mddev->raid_disks does not. | ||
| 54 | */ | ||
| 55 | static int linear_congested(struct mddev *mddev, int bits) | ||
| 56 | { | ||
| 57 | struct linear_conf *conf; | ||
| 58 | int i, ret = 0; | ||
| 59 | |||
| 60 | rcu_read_lock(); | ||
| 61 | conf = rcu_dereference(mddev->private); | ||
| 62 | |||
| 63 | for (i = 0; i < conf->raid_disks && !ret ; i++) { | ||
| 64 | struct request_queue *q = bdev_get_queue(conf->disks[i].rdev->bdev); | ||
| 65 | ret |= bdi_congested(q->backing_dev_info, bits); | ||
| 66 | } | ||
| 67 | |||
| 68 | rcu_read_unlock(); | ||
| 69 | return ret; | ||
| 70 | } | ||
| 71 | |||
| 72 | static sector_t linear_size(struct mddev *mddev, sector_t sectors, int raid_disks) | 49 | static sector_t linear_size(struct mddev *mddev, sector_t sectors, int raid_disks) |
| 73 | { | 50 | { |
| 74 | struct linear_conf *conf; | 51 | struct linear_conf *conf; |
| @@ -322,7 +299,6 @@ static struct md_personality linear_personality = · 247 unmodified lines | |||
| 322 | .hot_add_disk = linear_add, | 299 | .hot_add_disk = linear_add, |
| 323 | .size = linear_size, | 300 | .size = linear_size, |
| 324 | .quiesce = linear_quiesce, | 301 | .quiesce = linear_quiesce, |
| 325 | .congested = linear_congested, | ||
| 326 | }; | 302 | }; |
| 327 | 303 | ||
| 328 | static int __init linear_init (void) | 304 | static int __init linear_init (void) |
| @@ -151,28 +151,6 @@ static void multipath_status(struct seq_file *seq, struct mddev *mddev) · 150 unmodified lines | |||
| 151 | seq_putc(seq, ']'); | 151 | seq_putc(seq, ']'); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static int multipath_congested(struct mddev *mddev, int bits) | ||
| 155 | { | ||
| 156 | struct mpconf *conf = mddev->private; | ||
| 157 | int i, ret = 0; | ||
| 158 | |||
| 159 | rcu_read_lock(); | ||
| 160 | for (i = 0; i < mddev->raid_disks ; i++) { | ||
| 161 | struct md_rdev *rdev = rcu_dereference(conf->multipaths[i].rdev); | ||
| 162 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
| 163 | struct request_queue *q = bdev_get_queue(rdev->bdev); | ||
| 164 | |||
| 165 | ret |= bdi_congested(q->backing_dev_info, bits); | ||
| 166 | /* Just like multipath_map, we just check the | ||
| 167 | * first available device | ||
| 168 | */ | ||
| 169 | break; | ||
| 170 | } | ||
| 171 | } | ||
| 172 | rcu_read_unlock(); | ||
| 173 | return ret; | ||
| 174 | } | ||
| 175 | |||
| 176 | /* | 154 | /* |
| 177 | * Careful, this can execute in IRQ contexts as well! | 155 | * Careful, this can execute in IRQ contexts as well! |
| 178 | */ | 156 | */ |
| @@ -478,7 +456,6 @@ static struct md_personality multipath_personality = · 299 unmodified lines | |||
| 478 | .hot_add_disk = multipath_add_disk, | 456 | .hot_add_disk = multipath_add_disk, |
| 479 | .hot_remove_disk= multipath_remove_disk, | 457 | .hot_remove_disk= multipath_remove_disk, |
| 480 | .size = multipath_size, | 458 | .size = multipath_size, |
| 481 | .congested = multipath_congested, | ||
| 482 | }; | 459 | }; |
| 483 | 460 | ||
| 484 | static int __init multipath_init (void) | 461 | static int __init multipath_init (void) |
| @@ -549,26 +549,6 @@ void mddev_resume(struct mddev *mddev) · 548 unmodified lines | |||
| 549 | } | 549 | } |
| 550 | EXPORT_SYMBOL_GPL(mddev_resume); | 550 | EXPORT_SYMBOL_GPL(mddev_resume); |
| 551 | 551 | ||
| 552 | int mddev_congested(struct mddev *mddev, int bits) | ||
| 553 | { | ||
| 554 | struct md_personality *pers = mddev->pers; | ||
| 555 | int ret = 0; | ||
| 556 | |||
| 557 | rcu_read_lock(); | ||
| 558 | if (mddev->suspended) | ||
| 559 | ret = 1; | ||
| 560 | else if (pers && pers->congested) | ||
| 561 | ret = pers->congested(mddev, bits); | ||
| 562 | rcu_read_unlock(); | ||
| 563 | return ret; | ||
| 564 | } | ||
| 565 | EXPORT_SYMBOL_GPL(mddev_congested); | ||
| 566 | static int md_congested(void *data, int bits) | ||
| 567 | { | ||
| 568 | struct mddev *mddev = data; | ||
| 569 | return mddev_congested(mddev, bits); | ||
| 570 | } | ||
| 571 | |||
| 572 | /* | 552 | /* |
| 573 | * Generic flush handling for md | 553 | * Generic flush handling for md |
| 574 | */ | 554 | */ |
| @@ -5965,8 +5945,6 @@ int md_run(struct mddev *mddev) · 5390 unmodified lines | |||
| 5965 | blk_queue_flag_set(QUEUE_FLAG_NONROT, mddev->queue); | 5945 | blk_queue_flag_set(QUEUE_FLAG_NONROT, mddev->queue); |
| 5966 | else | 5946 | else |
| 5967 | blk_queue_flag_clear(QUEUE_FLAG_NONROT, mddev->queue); | 5947 | blk_queue_flag_clear(QUEUE_FLAG_NONROT, mddev->queue); |
| 5968 | mddev->queue->backing_dev_info->congested_data = mddev; | ||
| 5969 | mddev->queue->backing_dev_info->congested_fn = md_congested; | ||
| 5970 | } | 5948 | } |
| 5971 | if (pers->sync_request) { | 5949 | if (pers->sync_request) { |
| 5972 | if (mddev->kobj.sd && | 5950 | if (mddev->kobj.sd && |
| @@ -6351,7 +6329,6 @@ static int do_md_stop(struct mddev *mddev, int mode, · 378 unmodified lines | |||
| 6351 | 6329 | ||
| 6352 | __md_stop_writes(mddev); | 6330 | __md_stop_writes(mddev); |
| 6353 | __md_stop(mddev); | 6331 | __md_stop(mddev); |
| 6354 | mddev->queue->backing_dev_info->congested_fn = NULL; | ||
| 6355 | 6332 | ||
| 6356 | /* tell userspace to handle 'inactive' */ | 6333 | /* tell userspace to handle 'inactive' */ |
| 6357 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 6334 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
| @@ -597,9 +597,6 @@ struct md_personality · 596 unmodified lines | |||
| 597 | * array. | 597 | * array. |
| 598 | */ | 598 | */ |
| 599 | void *(*takeover) (struct mddev *mddev); | 599 | void *(*takeover) (struct mddev *mddev); |
| 600 | /* congested implements bdi.congested_fn(). | ||
| 601 | * Will not be called while array is 'suspended' */ | ||
| 602 | int (*congested)(struct mddev *mddev, int bits); | ||
| 603 | /* Changes the consistency policy of an active array. */ | 600 | /* Changes the consistency policy of an active array. */ |
| 604 | int (*change_consistency_policy)(struct mddev *mddev, const char *buf); | 601 | int (*change_consistency_policy)(struct mddev *mddev, const char *buf); |
| 605 | }; | 602 | }; |
| @@ -710,7 +707,6 @@ extern void md_done_sync(struct mddev *mddev, int blocks, int ok); · 104 unmodified lines | |||
| 710 | extern void md_error(struct mddev *mddev, struct md_rdev *rdev); | 707 | extern void md_error(struct mddev *mddev, struct md_rdev *rdev); |
| 711 | extern void md_finish_reshape(struct mddev *mddev); | 708 | extern void md_finish_reshape(struct mddev *mddev); |
| 712 | 709 | ||
| 713 | extern int mddev_congested(struct mddev *mddev, int bits); | ||
| 714 | extern bool __must_check md_flush_request(struct mddev *mddev, struct bio *bio); | 710 | extern bool __must_check md_flush_request(struct mddev *mddev, struct bio *bio); |
| 715 | extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev, | 711 | extern void md_super_write(struct mddev *mddev, struct md_rdev *rdev, |
| 716 | sector_t sector, int size, struct page *page); | 712 | sector_t sector, int size, struct page *page); |
| @@ -29,21 +29,6 @@ module_param(default_layout, int, 0644); · 28 unmodified lines | |||
| 29 | (1L << MD_HAS_PPL) | \ | 29 | (1L << MD_HAS_PPL) | \ |
| 30 | (1L << MD_HAS_MULTIPLE_PPLS)) | 30 | (1L << MD_HAS_MULTIPLE_PPLS)) |
| 31 | 31 | ||
| 32 | static int raid0_congested(struct mddev *mddev, int bits) | ||
| 33 | { | ||
| 34 | struct r0conf *conf = mddev->private; | ||
| 35 | struct md_rdev **devlist = conf->devlist; | ||
| 36 | int raid_disks = conf->strip_zone[0].nb_dev; | ||
| 37 | int i, ret = 0; | ||
| 38 | |||
| 39 | for (i = 0; i < raid_disks && !ret ; i++) { | ||
| 40 | struct request_queue *q = bdev_get_queue(devlist[i]->bdev); | ||
| 41 | |||
| 42 | ret |= bdi_congested(q->backing_dev_info, bits); | ||
| 43 | } | ||
| 44 | return ret; | ||
| 45 | } | ||
| 46 | |||
| 47 | /* | 32 | /* |
| 48 | * inform the user of the raid configuration | 33 | * inform the user of the raid configuration |
| 49 | */ | 34 | */ |
| @@ -818,7 +803,6 @@ static struct md_personality raid0_personality= · 768 unmodified lines | |||
| 818 | .size = raid0_size, | 803 | .size = raid0_size, |
| 819 | .takeover = raid0_takeover, | 804 | .takeover = raid0_takeover, |
| 820 | .quiesce = raid0_quiesce, | 805 | .quiesce = raid0_quiesce, |
| 821 | .congested = raid0_congested, | ||
| 822 | }; | 806 | }; |
| 823 | 807 | ||
| 824 | static int __init raid0_init (void) | 808 | static int __init raid0_init (void) |
| @@ -786,36 +786,6 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect · 785 unmodified lines | |||
| 786 | return best_disk; | 786 | return best_disk; |
| 787 | } | 787 | } |
| 788 | 788 | ||
| 789 | static int raid1_congested(struct mddev *mddev, int bits) | ||
| 790 | { | ||
| 791 | struct r1conf *conf = mddev->private; | ||
| 792 | int i, ret = 0; | ||
| 793 | |||
| 794 | if ((bits & (1 << WB_async_congested)) && | ||
| 795 | conf->pending_count >= max_queued_requests) | ||
| 796 | return 1; | ||
| 797 | |||
| 798 | rcu_read_lock(); | ||
| 799 | for (i = 0; i < conf->raid_disks * 2; i++) { | ||
| 800 | struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); | ||
| 801 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
| 802 | struct request_queue *q = bdev_get_queue(rdev->bdev); | ||
| 803 | |||
| 804 | BUG_ON(!q); | ||
| 805 | |||
| 806 | /* Note the '|| 1' - when read_balance prefers | ||
| 807 | * non-congested targets, it can be removed | ||
| 808 | */ | ||
| 809 | if ((bits & (1 << WB_async_congested)) || 1) | ||
| 810 | ret |= bdi_congested(q->backing_dev_info, bits); | ||
| 811 | else | ||
| 812 | ret &= bdi_congested(q->backing_dev_info, bits); | ||
| 813 | } | ||
| 814 | } | ||
| 815 | rcu_read_unlock(); | ||
| 816 | return ret; | ||
| 817 | } | ||
| 818 | |||
| 819 | static void flush_bio_list(struct r1conf *conf, struct bio *bio) | 789 | static void flush_bio_list(struct r1conf *conf, struct bio *bio) |
| 820 | { | 790 | { |
| 821 | /* flush any pending bitmap writes to disk before proceeding w/ I/O */ | 791 | /* flush any pending bitmap writes to disk before proceeding w/ I/O */ |
| @@ -3396,7 +3366,6 @@ static struct md_personality raid1_personality = · 2574 unmodified lines | |||
| 3396 | .check_reshape = raid1_reshape, | 3366 | .check_reshape = raid1_reshape, |
| 3397 | .quiesce = raid1_quiesce, | 3367 | .quiesce = raid1_quiesce, |
| 3398 | .takeover = raid1_takeover, | 3368 | .takeover = raid1_takeover, |
| 3399 | .congested = raid1_congested, | ||
| 3400 | }; | 3369 | }; |
| 3401 | 3370 | ||
| 3402 | static int __init raid_init(void) | 3371 | static int __init raid_init(void) |
| @@ -848,31 +848,6 @@ static struct md_rdev *read_balance(struct r10conf *conf, · 847 unmodified lines | |||
| 848 | return rdev; | 848 | return rdev; |
| 849 | } | 849 | } |
| 850 | 850 | ||
| 851 | static int raid10_congested(struct mddev *mddev, int bits) | ||
| 852 | { | ||
| 853 | struct r10conf *conf = mddev->private; | ||
| 854 | int i, ret = 0; | ||
| 855 | |||
| 856 | if ((bits & (1 << WB_async_congested)) && | ||
| 857 | conf->pending_count >= max_queued_requests) | ||
| 858 | return 1; | ||
| 859 | |||
| 860 | rcu_read_lock(); | ||
| 861 | for (i = 0; | ||
| 862 | (i < conf->geo.raid_disks || i < conf->prev.raid_disks) | ||
| 863 | && ret == 0; | ||
| 864 | i++) { | ||
| 865 | struct md_rdev *rdev = rcu_dereference(conf->mirrors[i].rdev); | ||
| 866 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
| 867 | struct request_queue *q = bdev_get_queue(rdev->bdev); | ||
| 868 | |||
| 869 | ret |= bdi_congested(q->backing_dev_info, bits); | ||
| 870 | } | ||
| 871 | } | ||
| 872 | rcu_read_unlock(); | ||
| 873 | return ret; | ||
| 874 | } | ||
| 875 | |||
| 876 | static void flush_pending_writes(struct r10conf *conf) | 851 | static void flush_pending_writes(struct r10conf *conf) |
| 877 | { | 852 | { |
| 878 | /* Any writes that have been queued but are awaiting | 853 | /* Any writes that have been queued but are awaiting |
| @@ -4929,7 +4904,6 @@ static struct md_personality raid10_personality = · 4050 unmodified lines | |||
| 4929 | .start_reshape = raid10_start_reshape, | 4904 | .start_reshape = raid10_start_reshape, |
| 4930 | .finish_reshape = raid10_finish_reshape, | 4905 | .finish_reshape = raid10_finish_reshape, |
| 4931 | .update_reshape_pos = raid10_update_reshape_pos, | 4906 | .update_reshape_pos = raid10_update_reshape_pos, |
| 4932 | .congested = raid10_congested, | ||
| 4933 | }; | 4907 | }; |
| 4934 | 4908 | ||
| 4935 | static int __init raid_init(void) | 4909 | static int __init raid_init(void) |
| @@ -5099,28 +5099,6 @@ static void activate_bit_delay(struct r5conf *conf, · 5098 unmodified lines | |||
| 5099 | } | 5099 | } |
| 5100 | } | 5100 | } |
| 5101 | 5101 | ||
| 5102 | static int raid5_congested(struct mddev *mddev, int bits) | ||
| 5103 | { | ||
| 5104 | struct r5conf *conf = mddev->private; | ||
| 5105 | |||
| 5106 | /* No difference between reads and writes. Just check | ||
| 5107 | * how busy the stripe_cache is | ||
| 5108 | */ | ||
| 5109 | |||
| 5110 | if (test_bit(R5_INACTIVE_BLOCKED, &conf->cache_state)) | ||
| 5111 | return 1; | ||
| 5112 | |||
| 5113 | /* Also checks whether there is pressure on r5cache log space */ | ||
| 5114 | if (test_bit(R5C_LOG_TIGHT, &conf->cache_state)) | ||
| 5115 | return 1; | ||
| 5116 | if (conf->quiesce) | ||
| 5117 | return 1; | ||
| 5118 | if (atomic_read(&conf->empty_inactive_list_nr)) | ||
| 5119 | return 1; | ||
| 5120 | |||
| 5121 | return 0; | ||
| 5122 | } | ||
| 5123 | |||
| 5124 | static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) | 5102 | static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) |
| 5125 | { | 5103 | { |
| 5126 | struct r5conf *conf = mddev->private; | 5104 | struct r5conf *conf = mddev->private; |
| @@ -8427,7 +8405,6 @@ static struct md_personality raid6_personality = · 3300 unmodified lines | |||
| 8427 | .finish_reshape = raid5_finish_reshape, | 8405 | .finish_reshape = raid5_finish_reshape, |
| 8428 | .quiesce = raid5_quiesce, | 8406 | .quiesce = raid5_quiesce, |
| 8429 | .takeover = raid6_takeover, | 8407 | .takeover = raid6_takeover, |
| 8430 | .congested = raid5_congested, | ||
| 8431 | .change_consistency_policy = raid5_change_consistency_policy, | 8408 | .change_consistency_policy = raid5_change_consistency_policy, |
| 8432 | }; | 8409 | }; |
| 8433 | static struct md_personality raid5_personality = | 8410 | static struct md_personality raid5_personality = |
| @@ -8452,7 +8429,6 @@ static struct md_personality raid5_personality = · 18 unmodified lines | |||
| 8452 | .finish_reshape = raid5_finish_reshape, | 8429 | .finish_reshape = raid5_finish_reshape, |
| 8453 | .quiesce = raid5_quiesce, | 8430 | .quiesce = raid5_quiesce, |
| 8454 | .takeover = raid5_takeover, | 8431 | .takeover = raid5_takeover, |
| 8455 | .congested = raid5_congested, | ||
| 8456 | .change_consistency_policy = raid5_change_consistency_policy, | 8432 | .change_consistency_policy = raid5_change_consistency_policy, |
| 8457 | }; | 8433 | }; |
| 8458 | 8434 | ||
| @@ -8478,7 +8454,6 @@ static struct md_personality raid4_personality = · 19 unmodified lines | |||
| 8478 | .finish_reshape = raid5_finish_reshape, | 8454 | .finish_reshape = raid5_finish_reshape, |
| 8479 | .quiesce = raid5_quiesce, | 8455 | .quiesce = raid5_quiesce, |
| 8480 | .takeover = raid4_takeover, | 8456 | .takeover = raid4_takeover, |
| 8481 | .congested = raid5_congested, | ||
| 8482 | .change_consistency_policy = raid5_change_consistency_policy, | 8457 | .change_consistency_policy = raid5_change_consistency_policy, |
| 8483 | }; | 8458 | }; |
| 8484 | 8459 | ||
| @@ -1616,27 +1616,6 @@ fail: · 1615 unmodified lines | |||
| 1616 | return ERR_PTR(ret); | 1616 | return ERR_PTR(ret); |
| 1617 | } | 1617 | } |
| 1618 | 1618 | ||
| 1619 | static int btrfs_congested_fn(void *congested_data, int bdi_bits) | ||
| 1620 | { | ||
| 1621 | struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data; | ||
| 1622 | int ret = 0; | ||
| 1623 | struct btrfs_device *device; | ||
| 1624 | struct backing_dev_info *bdi; | ||
| 1625 | |||
| 1626 | rcu_read_lock(); | ||
| 1627 | list_for_each_entry_rcu(device, &info->fs_devices->devices, dev_list) { | ||
| 1628 | if (!device->bdev) | ||
| 1629 | continue; | ||
| 1630 | bdi = device->bdev->bd_bdi; | ||
| 1631 | if (bdi_congested(bdi, bdi_bits)) { | ||
| 1632 | ret = 1; | ||
| 1633 | break; | ||
| 1634 | } | ||
| 1635 | } | ||
| 1636 | rcu_read_unlock(); | ||
| 1637 | return ret; | ||
| 1638 | } | ||
| 1639 | |||
| 1640 | /* | 1619 | /* |
| 1641 | * called by the kthread helper functions to finally call the bio end_io | 1620 | * called by the kthread helper functions to finally call the bio end_io |
| 1642 | * functions. This is where read checksum verification actually happens | 1621 | * functions. This is where read checksum verification actually happens |
| @@ -3051,8 +3030,6 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device · 1408 unmodified lines | |||
| 3051 | goto fail_sb_buffer; | 3030 | goto fail_sb_buffer; |
| 3052 | } | 3031 | } |
| 3053 | 3032 | ||
| 3054 | sb->s_bdi->congested_fn = btrfs_congested_fn; | ||
| 3055 | sb->s_bdi->congested_data = fs_info; | ||
| 3056 | sb->s_bdi->capabilities |= BDI_CAP_CGROUP_WRITEBACK; | 3033 | sb->s_bdi->capabilities |= BDI_CAP_CGROUP_WRITEBACK; |
| 3057 | sb->s_bdi->ra_pages = VM_READAHEAD_PAGES; | 3034 | sb->s_bdi->ra_pages = VM_READAHEAD_PAGES; |
| 3058 | sb->s_bdi->ra_pages *= btrfs_super_num_devices(disk_super); | 3035 | sb->s_bdi->ra_pages *= btrfs_super_num_devices(disk_super); |
| @@ -33,8 +33,6 @@ enum wb_congested_state { · 32 unmodified lines | |||
| 33 | WB_sync_congested, /* The sync queue is getting full */ | 33 | WB_sync_congested, /* The sync queue is getting full */ |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | typedef int (congested_fn)(void *, int); | ||
| 37 | |||
| 38 | enum wb_stat_item { | 36 | enum wb_stat_item { |
| 39 | WB_RECLAIMABLE, | 37 | WB_RECLAIMABLE, |
| 40 | WB_WRITEBACK, | 38 | WB_WRITEBACK, |
| @@ -170,8 +168,6 @@ struct backing_dev_info { · 129 unmodified lines | |||
| 170 | struct list_head bdi_list; | 168 | struct list_head bdi_list; |
| 171 | unsigned long ra_pages; /* max readahead in PAGE_SIZE units */ | 169 | unsigned long ra_pages; /* max readahead in PAGE_SIZE units */ |
| 172 | unsigned long io_pages; /* max allowed IO size */ | 170 | unsigned long io_pages; /* max allowed IO size */ |
| 173 | congested_fn *congested_fn; /* Function pointer if device is md/dm */ | ||
| 174 | void *congested_data; /* Pointer to aux data for congested func */ | ||
| 175 | 171 | ||
| 176 | struct kref refcnt; /* Reference counter for the structure */ | 172 | struct kref refcnt; /* Reference counter for the structure */ |
| 177 | unsigned int capabilities; /* Device capabilities */ | 173 | unsigned int capabilities; /* Device capabilities */ |
| @@ -169,10 +169,6 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) · 168 unmodified lines | |||
| 169 | 169 | ||
| 170 | static inline int wb_congested(struct bdi_writeback *wb, int cong_bits) | 170 | static inline int wb_congested(struct bdi_writeback *wb, int cong_bits) |
| 171 | { | 171 | { |
| 172 | struct backing_dev_info *bdi = wb->bdi; | ||
| 173 | |||
| 174 | if (bdi->congested_fn) | ||
| 175 | return bdi->congested_fn(bdi->congested_data, cong_bits); | ||
| 176 | return wb->congested & cong_bits; | 172 | return wb->congested & cong_bits; |
| 177 | } | 173 | } |
| 178 | 174 | ||
| @@ -322,12 +322,6 @@ struct dm_target { · 321 unmodified lines | |||
| 322 | bool discards_supported:1; | 322 | bool discards_supported:1; |
| 323 | }; | 323 | }; |
| 324 | 324 | ||
| 325 | /* Each target can link one of these into the table */ | ||
| 326 | struct dm_target_callbacks { | ||
| 327 | struct list_head list; | ||
| 328 | int (*congested_fn) (struct dm_target_callbacks *, int); | ||
| 329 | }; | ||
| 330 | |||
| 331 | void *dm_per_bio_data(struct bio *bio, size_t data_size); | 325 | void *dm_per_bio_data(struct bio *bio, size_t data_size); |
| 332 | struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size); | 326 | struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size); |
| 333 | unsigned dm_bio_get_target_bio_nr(const struct bio *bio); | 327 | unsigned dm_bio_get_target_bio_nr(const struct bio *bio); |
| @@ -477,11 +471,6 @@ int dm_table_create(struct dm_table **result, fmode_t mode, · 143 unmodified lines | |||
| 477 | int dm_table_add_target(struct dm_table *t, const char *type, | 471 | int dm_table_add_target(struct dm_table *t, const char *type, |
| 478 | sector_t start, sector_t len, char *params); | 472 | sector_t start, sector_t len, char *params); |
| 479 | 473 | ||
| 480 | /* | ||
| 481 | * Target_ctr should call this if it needs to add any callbacks. | ||
| 482 | */ | ||
| 483 | void dm_table_add_target_callbacks(struct dm_table *t, struct dm_target_callbacks *cb); | ||
| 484 | |||
| 485 | /* | 474 | /* |
| 486 | * Target can use this to set the table's type. | 475 | * Target can use this to set the table's type. |
| 487 | * Can only ever be called from a target's ctr. | 476 | * Can only ever be called from a target's ctr. |