diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-03-21 21:03:11 +0000 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-04-19 17:25:19 +0200 |
commit | 32c0a6bcaa1f57e80f67bf3ae2b35d00cea8361a (patch) | |
tree | f2451c3cfcbe388f19a92e1724eba0e428f9638d /fs/btrfs/extent_io.c | |
parent | 183ebab766aff0ab17350c74eed1c0c6965687e1 (diff) |
btrfs: add and use readahead_batch_length
Implement readahead_batch_length() to determine the number of bytes in
the current batch of readahead pages and use it in btrfs. Also use the
readahead_pos to get the offset.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 18e69e1a5f9c..a50adbd8808d 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4650,10 +4650,8 @@ void extent_readahead(struct readahead_control *rac) int nr; while ((nr = readahead_page_batch(rac, pagepool))) { - u64 contig_start = page_offset(pagepool[0]); - u64 contig_end = page_offset(pagepool[nr - 1]) + PAGE_SIZE - 1; - - ASSERT(contig_start + nr * PAGE_SIZE - 1 == contig_end); + u64 contig_start = readahead_pos(rac); + u64 contig_end = contig_start + readahead_batch_length(rac) - 1; contiguous_readpages(pagepool, nr, contig_start, contig_end, &em_cached, &bio, &bio_flags, &prev_em_start); |