History

mm: move readahead nr_pages check into read_pages

Simplify the callers by moving the check for nr_pages and the BUG_ON into read_pages().

Matthew Wilcox (Oracle) committed 6 years ago

Commit ad4ae1c1 parent a1ef8561 file · +7 −5Browse files

Unified · Split

mm/readahead.c+7−5
@@ -119,6 +119,9 @@ static void read_pages(struct address_space *mapping, struct file *filp, · 118 unmodified lines
119 struct blk_plug plug;119 struct blk_plug plug;
120 unsigned page_idx;120 unsigned page_idx;
121 121
122 if (!nr_pages)
123 return;
124
122 blk_start_plug(&plug);125 blk_start_plug(&plug);
123 126
124 if (mapping->a_ops->readpages) {127 if (mapping->a_ops->readpages) {
@@ -138,6 +141,8 @@ static void read_pages(struct address_space *mapping, struct file *filp, · 13 unmodified lines
138 141
139out:142out:
140 blk_finish_plug(&plug);143 blk_finish_plug(&plug);
144
145 BUG_ON(!list_empty(pages));
141}146}
142 147
143/*148/*
@@ -180,8 +185,7 @@ void __do_page_cache_readahead(struct address_space *mapping, · 36 unmodified lines
180 * contiguous pages before continuing with the next185 * contiguous pages before continuing with the next
181 * batch.186 * batch.
182 */187 */
183 if (nr_pages)188 read_pages(mapping, filp, &page_pool, nr_pages,
184 read_pages(mapping, filp, &page_pool, nr_pages,
185 gfp_mask);189 gfp_mask);
186 nr_pages = 0;190 nr_pages = 0;
187 continue;191 continue;
@@ -202,9 +206,7 @@ void __do_page_cache_readahead(struct address_space *mapping, · 14 unmodified lines
202 * uptodate then the caller will launch readpage again, and206 * uptodate then the caller will launch readpage again, and
203 * will then handle the error.207 * will then handle the error.
204 */208 */
205 if (nr_pages)209 read_pages(mapping, filp, &page_pool, nr_pages, gfp_mask);
206 read_pages(mapping, filp, &page_pool, nr_pages, gfp_mask);
207 BUG_ON(!list_empty(&page_pool));
208}210}
209 211
210/*212/*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t