File tree Expand file tree Collapse file tree 1 file changed +8
-24
lines changed Expand file tree Collapse file tree 1 file changed +8
-24
lines changed Original file line number Diff line number Diff line change @@ -305,36 +305,20 @@ void __shmem_writeback(size_t size, struct address_space *mapping)
305
305
.range_end = LLONG_MAX ,
306
306
.for_reclaim = 1 ,
307
307
};
308
- unsigned long i ;
308
+ struct folio * folio = NULL ;
309
+ int error = 0 ;
309
310
310
311
/*
311
312
* Leave mmapings intact (GTT will have been revoked on unbinding,
312
- * leaving only CPU mmapings around) and add those pages to the LRU
313
+ * leaving only CPU mmapings around) and add those folios to the LRU
313
314
* instead of invoking writeback so they are aged and paged out
314
315
* as normal.
315
316
*/
316
-
317
- /* Begin writeback on each dirty page */
318
- for (i = 0 ; i < size >> PAGE_SHIFT ; i ++ ) {
319
- struct page * page ;
320
-
321
- page = find_lock_page (mapping , i );
322
- if (!page )
323
- continue ;
324
-
325
- if (!page_mapped (page ) && clear_page_dirty_for_io (page )) {
326
- int ret ;
327
-
328
- SetPageReclaim (page );
329
- ret = mapping -> a_ops -> writepage (page , & wbc );
330
- if (!PageWriteback (page ))
331
- ClearPageReclaim (page );
332
- if (!ret )
333
- goto put ;
334
- }
335
- unlock_page (page );
336
- put :
337
- put_page (page );
317
+ while ((folio = writeback_iter (mapping , & wbc , folio , & error ))) {
318
+ if (folio_mapped (folio ))
319
+ folio_redirty_for_writepage (& wbc , folio );
320
+ else
321
+ error = shmem_writeout (folio , & wbc );
338
322
}
339
323
}
340
324
You can’t perform that action at this time.
0 commit comments