mirror of
https://github.com/versity/scoutfs.git
synced 2025-12-23 05:25:18 +00:00
Fix tail ring entry zeroing
The space calculation didn't include the terminating zero entry. That ensured that the space for the netry would never be consumed. But the remaining space was used to zero the end of the block so the final entry wasn't being zeroed. So have the space remaining include the terminating entry and factor that into the space consumption of each entry being appended. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -68,7 +68,7 @@ void scoutfs_ring_append(struct super_block *sb,
|
||||
struct scoutfs_ring_block *ring = rinf->ring;
|
||||
unsigned int len = le16_to_cpu(eh->len);
|
||||
|
||||
if (rinf->space < len) {
|
||||
if (rinf->space < (len + sizeof(struct scoutfs_ring_entry_header))) {
|
||||
if (rinf->space)
|
||||
finish_block(ring, rinf->space);
|
||||
ring = scoutfs_page_block_address(rinf->pages, rinf->nr_blocks);
|
||||
@@ -79,8 +79,7 @@ void scoutfs_ring_append(struct super_block *sb,
|
||||
rinf->nr_blocks++;
|
||||
rinf->next_eh = ring->entries;
|
||||
rinf->space = SCOUTFS_BLOCK_SIZE -
|
||||
offsetof(struct scoutfs_ring_block, entries) -
|
||||
sizeof(struct scoutfs_ring_entry_header);
|
||||
offsetof(struct scoutfs_ring_block, entries);
|
||||
}
|
||||
|
||||
memcpy(rinf->next_eh, eh, len);
|
||||
|
||||
Reference in New Issue
Block a user