Commit 0dc6aac1 authored by Mike Gerdts's avatar Mike Gerdts Committed by Jim Harris
Browse files

bdev: use SPDK spinlocks



Transition from pthread spinlocks to SPDK spinlocks for improved error
checking.

Signed-off-by: default avatarMike Gerdts <mgerdts@nvidia.com>
Change-Id: I7877c3a4601d7d5cf03e632df493974f97782272
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15439


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent 7722996d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ device.
A new API `spdk_bdev_channel_get_histogram` was added to get the histogram of a specified
channel for a bdev.

Converted internal use of `pthread_mutex_t` to `struct spdk_spinlock`. Consumers of bdev
API functions must be on an SPDK thread or the program will abort. It is now enforced
that no internal bdev locks can be held when a poller or message goes off CPU.

### event

Added core lock file mechanism to prevent the same CPU cores from being used by multiple
+1 −1
Original line number Diff line number Diff line
@@ -490,7 +490,7 @@ struct spdk_bdev {
		bool qos_mod_in_progress;

		/** Spin lock protecting claimed */
		pthread_spinlock_t spinlock;
		struct spdk_spinlock spinlock;

		/** The bdev status */
		enum spdk_bdev_status status;
+121 −121

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -921,7 +921,7 @@ io_valid_test(void)
	memset(&bdev, 0, sizeof(bdev));

	bdev.blocklen = 512;
	CU_ASSERT(pthread_spin_init(&bdev.internal.spinlock, PTHREAD_PROCESS_PRIVATE) == 0);
	spdk_spin_init(&bdev.internal.spinlock);

	spdk_bdev_notify_blockcnt_change(&bdev, 100);

@@ -940,7 +940,7 @@ io_valid_test(void)
	/* Offset near end of uint64_t range (2^64 - 1) */
	CU_ASSERT(bdev_io_valid_blocks(&bdev, 18446744073709551615ULL, 1) == false);

	CU_ASSERT(pthread_spin_destroy(&bdev.internal.spinlock) == 0);
	spdk_spin_destroy(&bdev.internal.spinlock);
}

static void