Skip to content

Commit af622b8

Browse files
idryomovaxboe
authored andcommitted
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>
1 parent 8aa6382 commit af622b8

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/block/nbd.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -937,14 +937,6 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
937937
return -ENOSPC;
938938
}
939939

940-
/* Reset all properties of an NBD device */
941-
static void nbd_reset(struct nbd_device *nbd)
942-
{
943-
nbd->config = NULL;
944-
nbd->tag_set.timeout = 0;
945-
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
946-
}
947-
948940
static void nbd_bdev_reset(struct block_device *bdev)
949941
{
950942
if (bdev->bd_openers > 1)
@@ -1029,7 +1021,10 @@ static void nbd_config_put(struct nbd_device *nbd)
10291021
}
10301022
kfree(config->socks);
10311023
}
1032-
nbd_reset(nbd);
1024+
nbd->config = NULL;
1025+
1026+
nbd->tag_set.timeout = 0;
1027+
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue);
10331028

10341029
mutex_unlock(&nbd->config_lock);
10351030
nbd_put(nbd);
@@ -1483,7 +1478,6 @@ static int nbd_dev_add(int index)
14831478
disk->fops = &nbd_fops;
14841479
disk->private_data = nbd;
14851480
sprintf(disk->disk_name, "nbd%d", index);
1486-
nbd_reset(nbd);
14871481
add_disk(disk);
14881482
nbd_total_devices++;
14891483
return index;

0 commit comments

Comments
 (0)