Slide 87
Slide 87 text
void create_file( void *file_, void* ) {
auto file = reinterpret_cast< file_t* >( file_ );
if( spdk_fs_create_file( file->context->fs, file->context-
>channel.get(), file->name.c_str() ) < 0 )
ABORT( "ϑΝΠϧΛ࡞͢Δࣄ͕Ͱ͖ͳ͍" );
if( spdk_fs_open_file( file->context->fs, file->context-
>channel.get(), file->name.c_str(), 0, &file->fd ) < 0 )
ABORT( "ϑΝΠϧΛ։͘ࣄ͕Ͱ͖ͳ͍" );
auto head = std::next( file->context->buffer.get(), file-
>header->offset );
auto begin = std::chrono::high_resolution_clock::now();
if( spdk_file_write( file->fd, file->context->channel.get(),
head, 0, file->header->size ) < 0 )
ABORT( "ϑΝΠϧΛॻ͖ࠐΉࣄ͕Ͱ͖ͳ͍" );
if( file->context->flush ) {
if( spdk_file_sync( file->fd, file->context->channel.get() ) <
0 )
spdk_fs_create_fileͰϑΝΠϧΛ࡞Γ
spdk_fs_open_fileͰϑΝΠϧΛ։͖