Commit 1285f823 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

blobfs: relax locking for __rw_send_from_file calls



The file's lock does not need to be held across
calls to this function as the file is not dereferenced
at all.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Idf0a52f2528521f12e45963bb0ab1f414b37380f
Reviewed-on: https://review.gerrithub.io/363138


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 2b2ab244
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1860,9 +1860,9 @@ spdk_file_write(struct spdk_file *file, struct spdk_io_channel *_channel,
			int rc;

			file->append_pos += length;
			pthread_spin_unlock(&file->lock);
			rc = __send_rw_from_file(file, &channel->sem, payload,
						 offset, length, false);
			pthread_spin_unlock(&file->lock);
			sem_wait(&channel->sem);
			return rc;
		}
@@ -2007,10 +2007,14 @@ static int
__file_read(struct spdk_file *file, void *payload, uint64_t offset, uint64_t length, sem_t *sem)
{
	struct cache_buffer *buf;
	int rc;

	buf = spdk_tree_find_filled_buffer(file->tree, offset);
	if (buf == NULL) {
		return __send_rw_from_file(file, sem, payload, offset, length, true);
		pthread_spin_unlock(&file->lock);
		rc = __send_rw_from_file(file, sem, payload, offset, length, true);
		pthread_spin_lock(&file->lock);
		return rc;
	}

	if ((offset + length) > (buf->offset + buf->bytes_filled)) {