forked from luck/tmp_suning_uos_patched
nbd: nbd_reset() call in nbd_dev_add() is redundant
There is nothing to clear -- nbd_device has just been allocated. Fold nbd_reset() into its other caller, nbd_config_put(). Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
8aa6382907
commit
af622b8666
|
@ -937,14 +937,6 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset all properties of an NBD device */
|
|
||||||
static void nbd_reset(struct nbd_device *nbd)
|
|
||||||
{
|
|
||||||
nbd->config = NULL;
|
|
||||||
nbd->tag_set.timeout = 0;
|
|
||||||
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void nbd_bdev_reset(struct block_device *bdev)
|
static void nbd_bdev_reset(struct block_device *bdev)
|
||||||
{
|
{
|
||||||
if (bdev->bd_openers > 1)
|
if (bdev->bd_openers > 1)
|
||||||
|
@ -1029,7 +1021,10 @@ static void nbd_config_put(struct nbd_device *nbd)
|
||||||
}
|
}
|
||||||
kfree(config->socks);
|
kfree(config->socks);
|
||||||
}
|
}
|
||||||
nbd_reset(nbd);
|
nbd->config = NULL;
|
||||||
|
|
||||||
|
nbd->tag_set.timeout = 0;
|
||||||
|
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
|
||||||
|
|
||||||
mutex_unlock(&nbd->config_lock);
|
mutex_unlock(&nbd->config_lock);
|
||||||
nbd_put(nbd);
|
nbd_put(nbd);
|
||||||
|
@ -1483,7 +1478,6 @@ static int nbd_dev_add(int index)
|
||||||
disk->fops = &nbd_fops;
|
disk->fops = &nbd_fops;
|
||||||
disk->private_data = nbd;
|
disk->private_data = nbd;
|
||||||
sprintf(disk->disk_name, "nbd%d", index);
|
sprintf(disk->disk_name, "nbd%d", index);
|
||||||
nbd_reset(nbd);
|
|
||||||
add_disk(disk);
|
add_disk(disk);
|
||||||
nbd_total_devices++;
|
nbd_total_devices++;
|
||||||
return index;
|
return index;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user