@@ -180,34 +180,46 @@ static bool ext2_check_folio(struct folio *folio, int quiet, char *kaddr)
180
180
}
181
181
182
182
/*
183
- * Calls to ext2_get_page ()/ext2_put_page () must be nested according to the
184
- * rules documented in kmap_local_page ()/kunmap_local().
183
+ * Calls to ext2_get_folio ()/folio_release_kmap () must be nested according
184
+ * to the rules documented in kmap_local_folio ()/kunmap_local().
185
185
*
186
- * NOTE: ext2_find_entry() and ext2_dotdot() act as a call to ext2_get_page()
187
- * and should be treated as a call to ext2_get_page() for nesting purposes.
186
+ * NOTE: ext2_find_entry() and ext2_dotdot() act as a call
187
+ * to folio_release_kmap() and should be treated as a call to
188
+ * folio_release_kmap() for nesting purposes.
188
189
*/
189
- static void * ext2_get_page (struct inode * dir , unsigned long n ,
190
- int quiet , struct page * * page )
190
+ static void * ext2_get_folio (struct inode * dir , unsigned long n ,
191
+ int quiet , struct folio * * foliop )
191
192
{
192
193
struct address_space * mapping = dir -> i_mapping ;
193
194
struct folio * folio = read_mapping_folio (mapping , n , NULL );
194
- void * page_addr ;
195
+ void * kaddr ;
195
196
196
197
if (IS_ERR (folio ))
197
198
return ERR_CAST (folio );
198
- page_addr = kmap_local_folio (folio , 0 );
199
+ kaddr = kmap_local_folio (folio , 0 );
199
200
if (unlikely (!folio_test_checked (folio ))) {
200
- if (!ext2_check_folio (folio , quiet , page_addr ))
201
+ if (!ext2_check_folio (folio , quiet , kaddr ))
201
202
goto fail ;
202
203
}
203
- * page = & folio -> page ;
204
- return page_addr ;
204
+ * foliop = folio ;
205
+ return kaddr ;
205
206
206
207
fail :
207
- ext2_put_page ( & folio -> page , page_addr );
208
+ folio_release_kmap ( folio , kaddr );
208
209
return ERR_PTR (- EIO );
209
210
}
210
211
212
+ static void * ext2_get_page (struct inode * dir , unsigned long n ,
213
+ int quiet , struct page * * pagep )
214
+ {
215
+ struct folio * folio ;
216
+ void * kaddr = ext2_get_folio (dir , n , quiet , & folio );
217
+
218
+ if (!IS_ERR (kaddr ))
219
+ * pagep = & folio -> page ;
220
+ return kaddr ;
221
+ }
222
+
211
223
/*
212
224
* NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
213
225
*
0 commit comments