Message ID | 20240120230824.2619716-15-willy@infradead.org |
---|---|
State | Superseded |
Headers | show |
Series | ubifs folio conversion | expand |
在 2024/1/21 7:08, Matthew Wilcox (Oracle) 写道: > When looking in the page cache, retrieve a folio instead of a page. > This would need some work to make it safe for large folios. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> > --- > fs/ubifs/file.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> > > diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c > index 8cad1fe9c50f..dec5258b4f38 100644 > --- a/fs/ubifs/file.c > +++ b/fs/ubifs/file.c > @@ -777,19 +777,19 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu, > > for (page_idx = 1; page_idx < page_cnt; page_idx++) { > pgoff_t page_offset = offset + page_idx; > - struct page *page; > + struct folio *folio; > > if (page_offset > end_index) > break; > - page = pagecache_get_page(mapping, page_offset, > + folio = __filemap_get_folio(mapping, page_offset, > FGP_LOCK|FGP_ACCESSED|FGP_CREAT|FGP_NOWAIT, > ra_gfp_mask); > - if (!page) > + if (IS_ERR(folio)) > break; > - if (!PageUptodate(page)) > - err = populate_page(c, page, bu, &n); > - unlock_page(page); > - put_page(page); > + if (!folio_test_uptodate(folio)) > + err = populate_page(c, &folio->page, bu, &n); > + folio_unlock(folio); > + folio_put(folio); > if (err) > break; > } >
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 8cad1fe9c50f..dec5258b4f38 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -777,19 +777,19 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu, for (page_idx = 1; page_idx < page_cnt; page_idx++) { pgoff_t page_offset = offset + page_idx; - struct page *page; + struct folio *folio; if (page_offset > end_index) break; - page = pagecache_get_page(mapping, page_offset, + folio = __filemap_get_folio(mapping, page_offset, FGP_LOCK|FGP_ACCESSED|FGP_CREAT|FGP_NOWAIT, ra_gfp_mask); - if (!page) + if (IS_ERR(folio)) break; - if (!PageUptodate(page)) - err = populate_page(c, page, bu, &n); - unlock_page(page); - put_page(page); + if (!folio_test_uptodate(folio)) + err = populate_page(c, &folio->page, bu, &n); + folio_unlock(folio); + folio_put(folio); if (err) break; }
When looking in the page cache, retrieve a folio instead of a page. This would need some work to make it safe for large folios. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- fs/ubifs/file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)