Commit 4838a081 authored by Tsuyoshi Uchida's avatar Tsuyoshi Uchida Committed by Daniel Verkamp
Browse files

scsi: use spdk_lun_db_get_lun in spdk_scsi_lun_delete (#93)

It's a little refactoring.
parent ee5b26a2
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -366,19 +366,10 @@ spdk_scsi_lun_delete(const char *lun_name)
{
	struct spdk_scsi_lun *lun;
	struct spdk_scsi_dev *dev;
	struct spdk_lun_db_entry *current;

	pthread_mutex_lock(&g_spdk_scsi.mutex);
	current = spdk_scsi_lun_list_head;
	while (current != NULL) {
		lun = current->lun;
		if (strncmp(lun->name, lun_name, sizeof(lun->name)) == 0) {
			break;
		}
		current = current->next;
	}

	if (current == NULL) {
	lun = spdk_lun_db_get_lun(lun_name, 0);
	if (lun == NULL) {
		pthread_mutex_unlock(&g_spdk_scsi.mutex);
		return;
	}