Skip to content

Commit e3915ad

Browse files
Vladimir ZapolskiyGao Xiang
authored andcommitted
erofs: remove void tagging/untagging of workgroup pointers
Because workgroup pointers inserted to a radix tree are always tagged with a single value of 0, it is possible to remove tagging and untagging of the pointers completely. Signed-off-by: Vladimir Zapolskiy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Gao Xiang <[email protected]>
1 parent e5e9a43 commit e3915ad

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

fs/erofs/utils.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
6868
rcu_read_lock();
6969
grp = radix_tree_lookup(&sbi->workstn_tree, index);
7070
if (grp) {
71-
grp = xa_untag_pointer(grp);
72-
7371
if (erofs_workgroup_get(grp)) {
7472
/* prefer to relax rcu read side */
7573
rcu_read_unlock();
@@ -101,8 +99,6 @@ int erofs_register_workgroup(struct super_block *sb,
10199
sbi = EROFS_SB(sb);
102100
xa_lock(&sbi->workstn_tree);
103101

104-
grp = xa_tag_pointer(grp, 0);
105-
106102
/*
107103
* Bump up reference count before making this workgroup
108104
* visible to other users in order to avoid potential UAF
@@ -173,8 +169,7 @@ static bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
173169
* however in order to avoid some race conditions, add a
174170
* DBG_BUGON to observe this in advance.
175171
*/
176-
DBG_BUGON(xa_untag_pointer(radix_tree_delete(&sbi->workstn_tree,
177-
grp->index)) != grp);
172+
DBG_BUGON(radix_tree_delete(&sbi->workstn_tree, grp->index) != grp);
178173

179174
/*
180175
* If managed cache is on, last refcount should indicate
@@ -199,7 +194,7 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
199194
batch, first_index, PAGEVEC_SIZE);
200195

201196
for (i = 0; i < found; ++i) {
202-
struct erofs_workgroup *grp = xa_untag_pointer(batch[i]);
197+
struct erofs_workgroup *grp = batch[i];
203198

204199
first_index = grp->index + 1;
205200

0 commit comments

Comments
 (0)