From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> This is done so the bdi inode is derived correctly when file->f_mapping is not the same as mapping passed. Set conditionally because some callee pass NULL for file pointer. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- mm/readahead.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/readahead.c b/mm/readahead.c index d589f147f4c2..9f303a31f650 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -443,6 +443,9 @@ static void ondemand_readahead(struct readahead_control *ractl, unsigned long index = readahead_index(ractl); pgoff_t prev_index; + if (ractl->file) + bdi = inode_to_bdi(file_inode(ractl->file)); + /* * If the request exceeds the readahead window, allow the read to * be up to the optimal hardware IO size -- 2.33.1