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: Ziye Yang <optimistyzy@gmail.com> Reviewed-on: https://review.gerrithub.io/420462 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
8749a9a591
commit
db6e1105aa
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user