diff options
author | Gao Xiang <gaoxiang25@huawei.com> | 2018-07-26 20:22:07 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-27 17:24:10 +0200 |
commit | 105d4ad857dcbf3dc1288f339c5b09dafbc8f923 (patch) | |
tree | 1024b2a9b33a67d7a2a483cfe6e48c478c23e7e3 /drivers/staging/erofs/utils.c | |
parent | 3883a79abd02272222a214a5f84395d41eecdc84 (diff) |
staging: erofs: introduce cached decompression
This patch adds an optional choice which can be
enabled by users in order to cache both incomplete
ends of compressed clusters as a complement to
the in-place decompression in order to boost random
read, but it costs more memory than the in-place
decompression only.
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/erofs/utils.c')
-rw-r--r-- | drivers/staging/erofs/utils.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/staging/erofs/utils.c b/drivers/staging/erofs/utils.c index 6530035f8a61..ee70bb9e1636 100644 --- a/drivers/staging/erofs/utils.c +++ b/drivers/staging/erofs/utils.c @@ -143,13 +143,28 @@ repeat: if (cleanup) BUG_ON(cnt != 1); +#ifndef EROFS_FS_HAS_MANAGED_CACHE else if (cnt > 1) +#else + if (!erofs_workgroup_try_to_freeze(grp, 1)) +#endif continue; if (radix_tree_delete(&sbi->workstn_tree, - grp->index) != grp) + grp->index) != grp) { +#ifdef EROFS_FS_HAS_MANAGED_CACHE +skip: + erofs_workgroup_unfreeze(grp, 1); +#endif continue; + } +#ifdef EROFS_FS_HAS_MANAGED_CACHE + if (try_to_free_all_cached_pages(sbi, grp)) + goto skip; + + erofs_workgroup_unfreeze(grp, 1); +#endif /* (rarely) grabbed again when freeing */ erofs_workgroup_put(grp); |