Skip to content

Commit

Permalink
Don't use optimized read for non-cache-aligned destination buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
TravMurav committed Mar 26, 2024
1 parent 4bcb8e1 commit f853332
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/fs/ext2/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,14 @@ ssize_t ext2_read_inode(ext2_t *ext2, struct ext2_inode *inode, void *_buf, off_
if (phys_block == 0) {
memset(buf, 0, EXT2_BLOCK_SIZE(ext2->sb));
} else {
while (count_cont_blks < max_blocks && file_block_to_fs_block(ext2, inode, file_block + count_cont_blks) == phys_block + count_cont_blks) {
count_cont_blks++;
}
bio_read(ext2->dev, buf, EXT2_BLOCK_SIZE(ext2->sb) * phys_block, EXT2_BLOCK_SIZE(ext2->sb) * count_cont_blks);
if ((addr_t)buf % CACHE_LINE) {
ext2_read_block(ext2, buf, phys_block);
} else {
while (count_cont_blks < max_blocks && file_block_to_fs_block(ext2, inode, file_block + count_cont_blks) == phys_block + count_cont_blks) {
count_cont_blks++;
}
bio_read(ext2->dev, buf, EXT2_BLOCK_SIZE(ext2->sb) * phys_block, EXT2_BLOCK_SIZE(ext2->sb) * count_cont_blks);
}
}

/* increment our stuff */
Expand Down

0 comments on commit f853332

Please sign in to comment.