diff mbox series

[RFC,1/5] mm: Use file parameter to determine bdi

Message ID 11dbd8d715fab9c7fe8536552c18fcb44a36b849.1634933121.git.rgoldwyn@suse.com (mailing list archive)
State New, archived
Headers show
Series Shared memory for shared extents | expand

Commit Message

Goldwyn Rodrigues Oct. 22, 2021, 8:15 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

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@suse.com>
---
 mm/readahead.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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