staging: erofs: introduce .migratepage for managed cache
PATCH v2 1/1 staging: erofs: introduce .migratepage for managed cache
It's awkward for managed cache to use the default migration path since the default approach will fall back to try_to_release_page for all PG_private pages.
Let's create a customized method to handle this more effectively.
Signed-off-by Gao Xiang <gaoxiang25 at huawei.com>
---
change log v2:
- rebased on the latest greg's staging tree;
- add more useful comments.
Thanks,
Gao Xiang
drivers/staging/erofs/internal.h | 6 +++ drivers/staging/erofs/super.c | 3 ++ drivers/staging/erofs/unzip_vle.c | 111 ++++++++++++++++++++++++++++++++++++++ drivers/staging/erofs/unzip_vle.h | 4 ++ 4 files changed, 124 insertions(+)
drivers/staging/erofs/internal.h +6 -0
@@ -294,6 +294,12 @@ extern int erofs_try_to_free_all_cached_pages(struct erofs_sb_info *sbi,extern int erofs_try_to_free_cached_page (struct address_space *mapping,struct page *page); +#ifdef CONFIG_MIGRATION +int erofs_migrate_cached_page (struct address_space *mapping, +struct page *newpage,struct page *page, +enum migrate_mode mode); +#endif +#define MNGD_MAPPING (sbi) ((sbi)->managed_cache->i_mapping)#else #define MNGD_MAPPING (sbi) (NULL)
drivers/staging/erofs/super.c +3 -0
@@ -329,6 +329,9 @@ static void managed_cache_invalidatepage(struct page *page,static const struct address_space_operations managed_cache_aops = { .releasepage = managed_cache_releasepage, .invalidatepage = managed_cache_invalidatepage, +#ifdef CONFIG_MIGRATION + .migratepage = erofs_migrate_cached_page, +#endif };static struct inode *erofs_init_managed_cache (struct super_block *sb)
drivers/staging/erofs/unzip_vle.c +111 -0
129 lines not on this page · raw message
drivers/staging/erofs/unzip_vle.h +4 -0
@@ -67,6 +67,10 @@ struct z_erofs_vle_work {#define Z_EROFS_VLE_WORKGRP_FMT_LZ4 1#define Z_EROFS_VLE_WORKGRP_FMT_MASK 1 +/* used to wait decompression for this workgroup */ +#define Z_EROFS_WG_WAIT_COMPLETION_BIT 3 +#define Z_EROFS_WG_WAIT_COMPLETION BIT(Z_EROFS_WG_WAIT_COMPLETION_BIT) +typedef void *z_erofs_vle_owned_workgrp_t ;struct z_erofs_vle_workgroup {
Signature · 1 line
2.14.4