mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 11:33:28 +02:00
f2fs: Use bio_for_each_folio_all() in __has_merged_page()
Iterate over each folio rather than each page. Convert f2fs_compress_control_page() to f2fs_compress_control_folio() since this is the only caller. Removes a reference to page->mapping which is going away soon as well as calls to fscrypt_is_bounce_page() and fscrypt_pagecache_page(). Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
98251710ca
commit
acede6a573
|
|
@ -137,9 +137,11 @@ static void f2fs_put_rpages_wbc(struct compress_ctx *cc,
|
|||
}
|
||||
}
|
||||
|
||||
struct page *f2fs_compress_control_page(struct page *page)
|
||||
struct folio *f2fs_compress_control_folio(struct folio *folio)
|
||||
{
|
||||
return ((struct compress_io_ctx *)page_private(page))->rpages[0];
|
||||
struct compress_io_ctx *ctx = folio->private;
|
||||
|
||||
return page_folio(ctx->rpages[0]);
|
||||
}
|
||||
|
||||
int f2fs_init_compress_ctx(struct compress_ctx *cc)
|
||||
|
|
|
|||
|
|
@ -548,8 +548,7 @@ static void __submit_merged_bio(struct f2fs_bio_info *io)
|
|||
static bool __has_merged_page(struct bio *bio, struct inode *inode,
|
||||
struct page *page, nid_t ino)
|
||||
{
|
||||
struct bio_vec *bvec;
|
||||
struct bvec_iter_all iter_all;
|
||||
struct folio_iter fi;
|
||||
|
||||
if (!bio)
|
||||
return false;
|
||||
|
|
@ -557,25 +556,25 @@ static bool __has_merged_page(struct bio *bio, struct inode *inode,
|
|||
if (!inode && !page && !ino)
|
||||
return true;
|
||||
|
||||
bio_for_each_segment_all(bvec, bio, iter_all) {
|
||||
struct page *target = bvec->bv_page;
|
||||
bio_for_each_folio_all(fi, bio) {
|
||||
struct folio *target = fi.folio;
|
||||
|
||||
if (fscrypt_is_bounce_page(target)) {
|
||||
target = fscrypt_pagecache_page(target);
|
||||
if (fscrypt_is_bounce_folio(target)) {
|
||||
target = fscrypt_pagecache_folio(target);
|
||||
if (IS_ERR(target))
|
||||
continue;
|
||||
}
|
||||
if (f2fs_is_compressed_page(target)) {
|
||||
target = f2fs_compress_control_page(target);
|
||||
if (f2fs_is_compressed_page(&target->page)) {
|
||||
target = f2fs_compress_control_folio(target);
|
||||
if (IS_ERR(target))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inode && inode == target->mapping->host)
|
||||
return true;
|
||||
if (page && page == target)
|
||||
if (page && page == &target->page)
|
||||
return true;
|
||||
if (ino && ino == ino_of_node(target))
|
||||
if (ino && ino == ino_of_node(&target->page))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4442,7 +4442,7 @@ enum cluster_check_type {
|
|||
CLUSTER_RAW_BLKS /* return # of raw blocks in a cluster */
|
||||
};
|
||||
bool f2fs_is_compressed_page(struct page *page);
|
||||
struct page *f2fs_compress_control_page(struct page *page);
|
||||
struct folio *f2fs_compress_control_folio(struct folio *folio);
|
||||
int f2fs_prepare_compress_overwrite(struct inode *inode,
|
||||
struct page **pagep, pgoff_t index, void **fsdata);
|
||||
bool f2fs_compress_write_end(struct inode *inode, void *fsdata,
|
||||
|
|
@ -4519,7 +4519,7 @@ static inline bool f2fs_is_compress_backend_ready(struct inode *inode)
|
|||
return false;
|
||||
}
|
||||
static inline bool f2fs_is_compress_level_valid(int alg, int lvl) { return false; }
|
||||
static inline struct page *f2fs_compress_control_page(struct page *page)
|
||||
static inline struct folio *f2fs_compress_control_folio(struct folio *folio)
|
||||
{
|
||||
WARN_ON_ONCE(1);
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user