mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-08 15:14:30 -04:00
mm/filemap: fix readahead return types
A readahead request will not allocate more memory than can be represented
by a size_t, even on systems that have HIGHMEM available. Change the
length functions from returning an loff_t to a size_t.
Link: https://lkml.kernel.org/r/20210510201201.1558972-1-willy@infradead.org
Fixes: 32c0a6bcaa ("btrfs: add and use readahead_batch_length")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
f649dc0e0d
commit
076171a677
@@ -997,9 +997,9 @@ static inline loff_t readahead_pos(struct readahead_control *rac)
|
||||
* readahead_length - The number of bytes in this readahead request.
|
||||
* @rac: The readahead request.
|
||||
*/
|
||||
static inline loff_t readahead_length(struct readahead_control *rac)
|
||||
static inline size_t readahead_length(struct readahead_control *rac)
|
||||
{
|
||||
return (loff_t)rac->_nr_pages * PAGE_SIZE;
|
||||
return rac->_nr_pages * PAGE_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1024,7 +1024,7 @@ static inline unsigned int readahead_count(struct readahead_control *rac)
|
||||
* 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)
|
||||
static inline size_t readahead_batch_length(struct readahead_control *rac)
|
||||
{
|
||||
return rac->_batch_count * PAGE_SIZE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user