diff options
| author | 2021-03-21 21:03:11 +0000 | |
|---|---|---|
| committer | 2021-04-19 17:25:19 +0200 | |
| commit | 32c0a6bcaa1f57e80f67bf3ae2b35d00cea8361a (patch) | |
| tree | f2451c3cfcbe388f19a92e1724eba0e428f9638d /include/linux | |
| parent | btrfs: move forward declarations to the beginning of extent_io.h (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 'include/linux')
| -rw-r--r-- | include/linux/pagemap.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 8c9947fd62f3..4c1ffe1d5dac 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -981,6 +981,15 @@ static inline unsigned int readahead_count(struct readahead_control *rac) return rac->_nr_pages; } +/** + * readahead_batch_length - The number of bytes in the current batch. + * @rac: The readahead request. + */ +static inline loff_t readahead_batch_length(struct readahead_control *rac) +{ + return rac->_batch_count * PAGE_SIZE; +} + static inline unsigned long dir_pages(struct inode *inode) { return (unsigned long)(inode->i_size + PAGE_SIZE - 1) >> |
