1.1 --- a/files/block_file_accessor.cc Thu Mar 18 00:59:55 2021 +0100
1.2 +++ b/files/block_file_accessor.cc Fri Mar 19 00:28:31 2021 +0100
1.3 @@ -62,27 +62,15 @@
1.4 }
1.5 }
1.6
1.7 -/* Data transfer methods. */
1.8 +/* Data transfer helper methods. */
1.9
1.10 -void BlockFileAccessor::fill(Flexpage *flexpage)
1.11 +/* Fill the populated portion of a flexpage. */
1.12 +
1.13 +void BlockFileAccessor::fill_populated(Flexpage *flexpage)
1.14 {
1.15 offset_t filepos = flexpage->base_offset;
1.16 offset_t addr = flexpage->base_addr;
1.17 - offset_t populated_size;
1.18 -
1.19 - /* Filling completely beyond the end of file should produce an empty
1.20 - flexpage. This could potentially be a shared read-only flexpage that
1.21 - would be replaced by an independent writable flexpage if ever written. */
1.22 -
1.23 - if (filepos > _size)
1.24 - {
1.25 - memset((void *) addr, 0, flexpage->size);
1.26 - return;
1.27 - }
1.28 -
1.29 - /* Otherwise, fill the populated portion of a flexpage. */
1.30 -
1.31 - populated_size = std::min(flexpage->size, _size - filepos);
1.32 + offset_t populated_size = std::min(flexpage->size, _size - filepos);
1.33
1.34 /* Tag the region with file state. */
1.35
1.36 @@ -98,21 +86,13 @@
1.37 memset((void *) (addr + populated_size), 0, flexpage->size - populated_size);
1.38 }
1.39
1.40 -void BlockFileAccessor::flush(Flexpage *flexpage)
1.41 -{
1.42 - offset_t addr = flexpage->base_addr;
1.43 - offset_t filepos = flexpage->base_offset;
1.44 - offset_t populated_size;
1.45 +/* Flush the populated portion of a flexpage. */
1.46
1.47 - /* Flushing completely beyond the end of file should discard the
1.48 - flexpage. */
1.49 -
1.50 - if (filepos > _size)
1.51 - return;
1.52 -
1.53 - /* Otherwise, only the populated portion of a flexpage should be flushed. */
1.54 -
1.55 - populated_size = std::min(flexpage->size, _size - filepos);
1.56 +void BlockFileAccessor::flush_populated(Flexpage *flexpage)
1.57 +{
1.58 + offset_t filepos = flexpage->base_offset;
1.59 + offset_t addr = flexpage->base_addr;
1.60 + offset_t populated_size = std::min(flexpage->size, _size - filepos);
1.61
1.62 /* Remove the file state tag from the region. */
1.63