Skip to content

Commit 21cf866

Browse files
Christoph Hellwigaxboe
authored andcommitted
writeback: remove bdi->congested_fn
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. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Song Liu <song@kernel.org> Acked-by: David Sterba <dsterba@suse.com> [axboe: fixup unused variables in bcache/request.c] Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8c911f3 commit 21cf866

23 files changed

Lines changed: 1 addition & 468 deletions

‎drivers/block/drbd/drbd_main.c‎

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,62 +2415,6 @@ static void drbd_cleanup(void)
24152415
pr_info("module cleanup done.\n");
24162416
}
24172417

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-
24742418
static void drbd_init_workqueue(struct drbd_work_queue* wq)
24752419
{
24762420
spin_lock_init(&wq->q_lock);
@@ -2825,9 +2769,6 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
28252769
/* we have no partitions. we contain only ourselves. */
28262770
device->this_bdev->bd_contains = device->this_bdev;
28272771

2828-
q->backing_dev_info->congested_fn = drbd_congested;
2829-
q->backing_dev_info->congested_data = device;
2830-
28312772
blk_queue_write_cache(q, true, true);
28322773
/* Setting the max_hw_sectors to an odd value of 8kibyte here
28332774
This triggers a max_bio_size message upon first attach or connect */

‎drivers/md/bcache/request.c‎

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,36 +1228,8 @@ static int cached_dev_ioctl(struct bcache_device *d, fmode_t mode,
12281228
return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg);
12291229
}
12301230

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-
12561231
void bch_cached_dev_request_init(struct cached_dev *dc)
12571232
{
1258-
struct gendisk *g = dc->disk.disk;
1259-
1260-
g->queue->backing_dev_info->congested_fn = cached_dev_congested;
12611233
dc->disk.cache_miss = cached_dev_cache_miss;
12621234
dc->disk.ioctl = cached_dev_ioctl;
12631235
}
@@ -1341,27 +1313,8 @@ static int flash_dev_ioctl(struct bcache_device *d, fmode_t mode,
13411313
return -ENOTTY;
13421314
}
13431315

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-
13601316
void bch_flash_dev_request_init(struct bcache_device *d)
13611317
{
1362-
struct gendisk *g = d->disk;
1363-
1364-
g->queue->backing_dev_info->congested_fn = flash_dev_congested;
13651318
d->cache_miss = flash_dev_cache_miss;
13661319
d->ioctl = flash_dev_ioctl;
13671320
}

‎drivers/md/bcache/super.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
885885
return -ENOMEM;
886886

887887
d->disk->queue = q;
888-
q->backing_dev_info->congested_data = d;
889888
q->limits.max_hw_sectors = UINT_MAX;
890889
q->limits.max_sectors = UINT_MAX;
891890
q->limits.max_segment_size = UINT_MAX;

‎drivers/md/dm-cache-target.c‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,6 @@ struct cache {
421421

422422
struct rw_semaphore quiesce_lock;
423423

424-
struct dm_target_callbacks callbacks;
425-
426424
/*
427425
* origin_blocks entries, discarded if set.
428426
*/
@@ -2423,20 +2421,6 @@ static void set_cache_size(struct cache *cache, dm_cblock_t size)
24232421
cache->cache_size = size;
24242422
}
24252423

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-
24402424
#define DEFAULT_MIGRATION_THRESHOLD 2048
24412425

24422426
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)
24712455
goto bad;
24722456
}
24732457

2474-
cache->callbacks.congested_fn = cache_is_congested;
2475-
dm_table_add_target_callbacks(ti->table, &cache->callbacks);
2476-
24772458
cache->metadata_dev = ca->metadata_dev;
24782459
cache->origin_dev = ca->origin_dev;
24792460
cache->cache_dev = ca->cache_dev;

‎drivers/md/dm-clone-target.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ struct hash_table_bucket;
6868

6969
struct clone {
7070
struct dm_target *ti;
71-
struct dm_target_callbacks callbacks;
7271

7372
struct dm_dev *metadata_dev;
7473
struct dm_dev *dest_dev;
@@ -1518,18 +1517,6 @@ static void clone_status(struct dm_target *ti, status_type_t type,
15181517
DMEMIT("Error");
15191518
}
15201519

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-
15331520
static sector_t get_dev_size(struct dm_dev *dev)
15341521
{
15351522
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)
19301917
goto out_with_mempool;
19311918

19321919
mutex_init(&clone->commit_lock);
1933-
clone->callbacks.congested_fn = clone_is_congested;
1934-
dm_table_add_target_callbacks(ti->table, &clone->callbacks);
19351920

19361921
/* Enable flushes */
19371922
ti->num_flush_bios = 1;

‎drivers/md/dm-era-target.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,6 @@ static int metadata_get_stats(struct era_metadata *md, void *ptr)
11371137

11381138
struct era {
11391139
struct dm_target *ti;
1140-
struct dm_target_callbacks callbacks;
11411140

11421141
struct dm_dev *metadata_dev;
11431142
struct dm_dev *origin_dev;
@@ -1375,18 +1374,6 @@ static void stop_worker(struct era *era)
13751374
/*----------------------------------------------------------------
13761375
* Target methods
13771376
*--------------------------------------------------------------*/
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-
13901377
static void era_destroy(struct era *era)
13911378
{
13921379
if (era->md)
@@ -1514,8 +1501,6 @@ static int era_ctr(struct dm_target *ti, unsigned argc, char **argv)
15141501
ti->flush_supported = true;
15151502

15161503
ti->num_discard_bios = 1;
1517-
era->callbacks.congested_fn = era_is_congested;
1518-
dm_table_add_target_callbacks(ti->table, &era->callbacks);
15191504

15201505
return 0;
15211506
}

‎drivers/md/dm-raid.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ struct raid_set {
242242

243243
struct mddev md;
244244
struct raid_type *raid_type;
245-
struct dm_target_callbacks callbacks;
246245

247246
sector_t array_sectors;
248247
sector_t dev_sectors;
@@ -1705,13 +1704,6 @@ static void do_table_event(struct work_struct *ws)
17051704
dm_table_event(rs->ti->table);
17061705
}
17071706

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-
17151707
/*
17161708
* Make sure a valid takover (level switch) is being requested on @rs
17171709
*
@@ -3248,9 +3240,6 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
32483240
goto bad_md_start;
32493241
}
32503242

3251-
rs->callbacks.congested_fn = raid_is_congested;
3252-
dm_table_add_target_callbacks(ti->table, &rs->callbacks);
3253-
32543243
/* If raid4/5/6 journal mode explicitly requested (only possible with journal dev) -> set it */
32553244
if (test_bit(__CTR_FLAG_JOURNAL_MODE, &rs->ctr_flags)) {
32563245
r = r5c_journal_mode_set(&rs->md, rs->journal_dev.mode);
@@ -3310,7 +3299,6 @@ static void raid_dtr(struct dm_target *ti)
33103299
{
33113300
struct raid_set *rs = ti->private;
33123301

3313-
list_del_init(&rs->callbacks.list);
33143302
md_stop(&rs->md);
33153303
raid_set_free(rs);
33163304
}

‎drivers/md/dm-table.c‎

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ struct dm_table {
6464
void *event_context;
6565

6666
struct dm_md_mempools *mempools;
67-
68-
struct list_head target_callbacks;
6967
};
7068

7169
/*
@@ -190,7 +188,6 @@ int dm_table_create(struct dm_table **result, fmode_t mode,
190188
return -ENOMEM;
191189

192190
INIT_LIST_HEAD(&t->devices);
193-
INIT_LIST_HEAD(&t->target_callbacks);
194191

195192
if (!num_targets)
196193
num_targets = KEYS_PER_NODE;
@@ -361,7 +358,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
361358
* This upgrades the mode on an already open dm_dev, being
362359
* careful to leave things as they were if we fail to reopen the
363360
* 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.
365362
*/
366363
static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
367364
struct mapped_device *md)
@@ -2052,38 +2049,6 @@ int dm_table_resume_targets(struct dm_table *t)
20522049
return 0;
20532050
}
20542051

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-
20872052
struct mapped_device *dm_table_get_md(struct dm_table *t)
20882053
{
20892054
return t->md;

‎drivers/md/dm-thin.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ struct pool_c {
326326
struct pool *pool;
327327
struct dm_dev *data_dev;
328328
struct dm_dev *metadata_dev;
329-
struct dm_target_callbacks callbacks;
330329

331330
dm_block_t low_water_blocks;
332331
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)
27962795
}
27972796
}
27982797

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-
28112798
static void requeue_bios(struct pool *pool)
28122799
{
28132800
struct thin_c *tc;
@@ -3420,9 +3407,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
34203407
dm_pool_register_pre_commit_callback(pool->pmd,
34213408
metadata_pre_commit_callback, pool);
34223409

3423-
pt->callbacks.congested_fn = pool_is_congested;
3424-
dm_table_add_target_callbacks(ti->table, &pt->callbacks);
3425-
34263410
mutex_unlock(&dm_thin_pool_table.mutex);
34273411

34283412
return 0;

0 commit comments

Comments
 (0)