[FOR INTERNAL REVIEW] [PATCH 3/4] staging: erofs: remove RADIX_TREE_EXCEPTIONAL_{ENTRY, SHIFT}

Gao Xiang gaoxiang25 at huawei.com
Mon Jul 30 19:18:30 AEST 2018


After commit 49520d317715 ("xarray: Replace exceptional entries"),
there are no RADIX_TREE_EXCEPTIONAL_{ENTRY,SHIFT} at all, remove them
as a workaround but erofs actually needs an extra bit for each entry.

In the future, it should be converted to XArray of course.

Cc: Matthew Wilcox <willy at infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25 at huawei.com>
---

- Tested with images generated by mkfs.erofs:
   1) mount and unmount operations
   2) md5sum `find . -type f`

 drivers/staging/erofs/utils.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/erofs/utils.c b/drivers/staging/erofs/utils.c
index 595cf90..25ff39f 100644
--- a/drivers/staging/erofs/utils.c
+++ b/drivers/staging/erofs/utils.c
@@ -47,9 +47,7 @@ struct erofs_workgroup *erofs_find_workgroup(
 	rcu_read_lock();
 	grp = radix_tree_lookup(&sbi->workstn_tree, index);
 	if (grp != NULL) {
-		*tag = radix_tree_exceptional_entry(grp);
-		grp = (void *)((unsigned long)grp &
-			~RADIX_TREE_EXCEPTIONAL_ENTRY);
+		*tag = 0;
 
 		if (erofs_workgroup_get(grp, &oldcount)) {
 			/* prefer to relax rcu read side */
@@ -68,7 +66,7 @@ struct erofs_workgroup *erofs_find_workgroup(
 
 int erofs_register_workgroup(struct super_block *sb,
 			     struct erofs_workgroup *grp,
-			     bool tag)
+			     bool __maybe_unused tag)
 {
 	struct erofs_sb_info *sbi;
 	int err;
@@ -76,6 +74,11 @@ int erofs_register_workgroup(struct super_block *sb,
 	/* grp->refcount should not < 1 */
 	BUG_ON(!atomic_read(&grp->refcount));
 
+	if (tag) {
+		DBG_BUGON(1);
+		return -EINVAL;
+	}
+
 	err = radix_tree_preload(GFP_NOFS);
 	if (err)
 		return err;
@@ -83,10 +86,6 @@ int erofs_register_workgroup(struct super_block *sb,
 	sbi = EROFS_SB(sb);
 	erofs_workstn_lock(sbi);
 
-	if (tag)
-		grp = (void *)((unsigned long)grp |
-			1UL << RADIX_TREE_EXCEPTIONAL_SHIFT);
-
 	err = radix_tree_insert(&sbi->workstn_tree,
 		grp->index, grp);
 
@@ -131,9 +130,7 @@ unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
 
 	for (i = 0; i < found; ++i) {
 		int cnt;
-		struct erofs_workgroup *grp = (void *)
-			((unsigned long)batch[i] &
-				~RADIX_TREE_EXCEPTIONAL_ENTRY);
+		struct erofs_workgroup *grp = batch[i];
 
 		first_index = grp->index + 1;
 
-- 
1.9.1



More information about the Linux-erofs mailing list