diff options
| author | Zi Yan <ziy@nvidia.com> | 2026-09-20 22:28:05 -0400 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-09-30 16:56:48 -0700 |
| commit | b7bc8864a4b784ec5effb24718a5ca78efed7cff (patch) | |
| tree | d980f53094ebc4505884ca6960db2157cba80564 /include/trace | |
| parent | 79b2b2eb0d345a6e3dd031332fbe63778d965f0e (diff) | |
| download | linux-next-b7bc8864a4b784ec5effb24718a5ca78efed7cff.tar.gz linux-next-b7bc8864a4b784ec5effb24718a5ca78efed7cff.zip | |
erofs: use folio_attach/detach_private() instead of direct assignment
erofs_onlinefolio_init/split/end() use folio->private without setting
PG_private or increasing folio refcount and it works. But after
PG_private is replaced by checking folio->private in a future commit, it
can break folio_expected_ref_count(), since the folio has private data
without elevated refcount. Change them to use
folio_attach/detach_private(). Folios during this process are locked as
they are in the process of readahead, so no parallel migration/folio split
can happen.
Furthermore, because folio->private is used to store in-flight I/O counter
and the counter reaches 0 when all I/O completes successfully without
error or being dirty, ->private=0 causes folio_detach_private() to not
drop the elevated folio refcount. Solve this issue by using bias=1 for
the counter, so that ->private stays non NULL throughout every
attach-to-detach process. Add a macro EROFS_ONLINEFOLIO_BIAS=1. While at
it, fix the comment about ->private bit layout and add
EROFS_ONLINEFOLIO_COUNT_MASK.
It prepares for a future commit that removes PG_private.
Link: https://lore.kernel.org/20260920-remove-pg_private-v5-9-bb68b6a21869@nvidia.com
Signed-off-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Gao Xiang <xiang@kernel.org>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Assisted-by: LLM
Cc: Chao Yu <chao@kernel.org>
Cc: Yue Hu <zbestahu@gmail.com>
Cc: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: Sandeep Dhavale <dhavale@google.com>
Cc: Hongbo Li <hongbohbli@tencent.com>
Cc: Chunhai Guo <guochunhai@vivo.com>
Diffstat (limited to 'include/trace')
0 files changed, 0 insertions, 0 deletions
