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: Jim Harris <james.r.harris@intel.com> Change-Id: Idf0a52f2528521f12e45963bb0ab1f414b37380f Reviewed-on: https://review.gerrithub.io/363138 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
2b2ab24477
commit
1285f823e4
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user