Commit db6e1105 authored by Ziye Yang's avatar Ziye Yang Committed by Jim Harris
Browse files

blobfs: add the check for cache_buffer



Though the buffer can be allocated in the normal case,
however we still need to check it.

Change-Id: I483c7bd083c24590295e44473674c7b8ed30e9da
Signed-off-by: default avatarZiye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/420462


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 8749a9a5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2243,6 +2243,12 @@ check_readahead(struct spdk_file *file, uint64_t offset)
	args->file = file;
	args->op.readahead.offset = offset;
	args->op.readahead.cache_buffer = cache_insert_buffer(file, offset);
	if (!args->op.readahead.cache_buffer) {
		BLOBFS_TRACE(file, "Cannot allocate buf for offset=%jx\n", offset);
		free(args);
		return;
	}

	args->op.readahead.cache_buffer->in_progress = true;
	if (file->length < (offset + CACHE_BUFFER_SIZE)) {
		args->op.readahead.length = file->length & (CACHE_BUFFER_SIZE - 1);