if: deactivate mars_congested earlier

This commit is contained in:
Thomas Schoebel-Theuer 2021-01-24 11:27:24 +01:00
parent 1ac5b70da6
commit c3e98aec5d

View File

@ -1192,6 +1192,15 @@ static int if_switch(struct if_brick *brick)
/* There might be subtle races */ /* There might be subtle races */
check_io_done(brick, true); check_io_done(brick, true);
if (input->bdev) { if (input->bdev) {
#if defined(USE_CONGESTED_FN) && defined(MARS_HAS_BDI_GET)
struct backing_dev_info *bdi;
/* ensure that callbacks will stop */
MARS_DBG("unregister congested_fn\n");
bdi = input->bdev->bd_bdi;
if (bdi)
bdi->congested_fn = NULL;
#endif
MARS_DBG("calling bdput()\n"); MARS_DBG("calling bdput()\n");
bdput(input->bdev); bdput(input->bdev);
input->bdev = NULL; input->bdev = NULL;
@ -1201,6 +1210,11 @@ static int if_switch(struct if_brick *brick)
input->disk = NULL; input->disk = NULL;
q = input->q; q = input->q;
if (q) { if (q) {
#if defined(USE_CONGESTED_FN) && !defined(MARS_HAS_BDI_GET)
/* ensure that callbacks will stop */
MARS_DBG("unregister congested_fn\n");
q->backing_dev_info.congested_fn = NULL;
#endif
blk_cleanup_queue(q); blk_cleanup_queue(q);
input->q = NULL; input->q = NULL;
} }
@ -1428,6 +1442,7 @@ static int if_input_construct(struct if_input *input)
static int if_input_destruct(struct if_input *input) static int if_input_destruct(struct if_input *input)
{ {
int i; int i;
for (i = 0; i < IF_HASH_MAX; i++) { for (i = 0; i < IF_HASH_MAX; i++) {
CHECK_HEAD_EMPTY(&input->hash_table[i].hash_anchor); CHECK_HEAD_EMPTY(&input->hash_table[i].hash_anchor);
} }