* [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree
@ 2020-01-02 12:01 Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 1/3] erofs: remove unused tag argument while finding a workgroup Vladimir Zapolskiy
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Vladimir Zapolskiy @ 2020-01-02 12:01 UTC (permalink / raw)
To: Gao Xiang, Chao Yu
Cc: linux-fsdevel, linux-erofs, Matthew Wilcox, Anton Altaparmakov
The changeset simplifies a couple of internal interfaces and removes
excessive tagging and untagging of workgroup pointers stored in a radix
tree.
All the changes in the series are non-functional.
Vladimir Zapolskiy (3):
erofs: remove unused tag argument while finding a workgroup
erofs: remove unused tag argument while registering a workgroup
erofs: remove void tagging/untagging of workgroup pointers
fs/erofs/internal.h | 4 ++--
fs/erofs/utils.c | 15 ++++-----------
fs/erofs/zdata.c | 5 ++---
3 files changed, 8 insertions(+), 16 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] erofs: remove unused tag argument while finding a workgroup
2020-01-02 12:01 [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Vladimir Zapolskiy
@ 2020-01-02 12:01 ` Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 2/3] erofs: remove unused tag argument while registering " Vladimir Zapolskiy
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Zapolskiy @ 2020-01-02 12:01 UTC (permalink / raw)
To: Gao Xiang, Chao Yu
Cc: linux-fsdevel, linux-erofs, Matthew Wilcox, Anton Altaparmakov
It is feasible to simplify erofs_find_workgroup() interface by removing
an unused function argument. While formally the argument is used in the
function itself, its assigned value is ignored on the caller side.
Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
---
fs/erofs/internal.h | 2 +-
fs/erofs/utils.c | 3 +--
fs/erofs/zdata.c | 3 +--
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index a5fac25db6af..55f7560cf1b4 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -401,7 +401,7 @@ static inline void *erofs_get_pcpubuf(unsigned int pagenr)
#ifdef CONFIG_EROFS_FS_ZIP
int erofs_workgroup_put(struct erofs_workgroup *grp);
struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
- pgoff_t index, bool *tag);
+ pgoff_t index);
int erofs_register_workgroup(struct super_block *sb,
struct erofs_workgroup *grp, bool tag);
void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
diff --git a/fs/erofs/utils.c b/fs/erofs/utils.c
index 1e8e1450d5b0..4d1cf4d00dab 100644
--- a/fs/erofs/utils.c
+++ b/fs/erofs/utils.c
@@ -59,7 +59,7 @@ static int erofs_workgroup_get(struct erofs_workgroup *grp)
}
struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
- pgoff_t index, bool *tag)
+ pgoff_t index)
{
struct erofs_sb_info *sbi = EROFS_SB(sb);
struct erofs_workgroup *grp;
@@ -68,7 +68,6 @@ struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
rcu_read_lock();
grp = radix_tree_lookup(&sbi->workstn_tree, index);
if (grp) {
- *tag = xa_pointer_tag(grp);
grp = xa_untag_pointer(grp);
if (erofs_workgroup_get(grp)) {
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index ca99425a4536..052d28391ce6 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -345,9 +345,8 @@ static int z_erofs_lookup_collection(struct z_erofs_collector *clt,
struct z_erofs_pcluster *pcl;
struct z_erofs_collection *cl;
unsigned int length;
- bool tag;
- grp = erofs_find_workgroup(inode->i_sb, map->m_pa >> PAGE_SHIFT, &tag);
+ grp = erofs_find_workgroup(inode->i_sb, map->m_pa >> PAGE_SHIFT);
if (!grp)
return -ENOENT;
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] erofs: remove unused tag argument while registering a workgroup
2020-01-02 12:01 [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 1/3] erofs: remove unused tag argument while finding a workgroup Vladimir Zapolskiy
@ 2020-01-02 12:01 ` Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 3/3] erofs: remove void tagging/untagging of workgroup pointers Vladimir Zapolskiy
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Zapolskiy @ 2020-01-02 12:01 UTC (permalink / raw)
To: Gao Xiang, Chao Yu
Cc: linux-fsdevel, linux-erofs, Matthew Wilcox, Anton Altaparmakov
All workgroups are registered with tag value set to 0, to simplify
erofs_register_workgroup() interface the tag argument can be removed,
if its only value is sent down to the function body.
Signed-off-by: Vladimir Zapolskiy <vladimir@tuxera.com>
---
fs/erofs/internal.h | 2 +-
fs/erofs/utils.c | 5 ++---
fs/erofs/zdata.c | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 55f7560cf1b4..926824578954 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -403,7 +403,7 @@ int erofs_workgroup_put(struct erofs_workgroup *grp);
struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
pgoff_t index);
int erofs_register_workgroup(struct super_block *sb,
- struct erofs_workgroup *grp, bool tag);
+ struct erofs_workgroup *grp);
void erofs_workgroup_free_rcu(struct erofs_workgroup *grp);
void erofs_shrinker_register(struct super_block *sb);
void erofs_shrinker_unregister(struct super_block *sb);
diff --git a/fs/erofs/utils.c b/fs/erofs/utils.c
index 4d1cf4d00dab..7b47c56b89b7 100644
--- a/fs/erofs/utils.c
+++ b/fs/erofs/utils.c
@@ -83,8 +83,7 @@ struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
}
int erofs_register_workgroup(struct super_block *sb,
- struct erofs_workgroup *grp,
- bool tag)
+ struct erofs_workgroup *grp)
{
struct erofs_sb_info *sbi;
int err;
@@ -102,7 +101,7 @@ int erofs_register_workgroup(struct super_block *sb,
sbi = EROFS_SB(sb);
xa_lock(&sbi->workstn_tree);
- grp = xa_tag_pointer(grp, tag);
+ grp = xa_tag_pointer(grp, 0);
/*
* Bump up reference count before making this workgroup
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 052d28391ce6..4fedeb4496e4 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -437,7 +437,7 @@ static int z_erofs_register_collection(struct z_erofs_collector *clt,
*/
mutex_trylock(&cl->lock);
- err = erofs_register_workgroup(inode->i_sb, &pcl->obj, 0);
+ err = erofs_register_workgroup(inode->i_sb, &pcl->obj);
if (err) {
mutex_unlock(&cl->lock);
kmem_cache_free(pcluster_cachep, pcl);
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] erofs: remove void tagging/untagging of workgroup pointers
2020-01-02 12:01 [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 1/3] erofs: remove unused tag argument while finding a workgroup Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 2/3] erofs: remove unused tag argument while registering " Vladimir Zapolskiy
@ 2020-01-02 12:01 ` Vladimir Zapolskiy
2020-01-02 12:55 ` [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Gao Xiang
2020-01-03 7:08 ` Chao Yu
4 siblings, 0 replies; 6+ messages in thread
From: Vladimir Zapolskiy @ 2020-01-02 12:01 UTC (permalink / raw)
To: Gao Xiang, Chao Yu
Cc: linux-fsdevel, linux-erofs, Matthew Wilcox, Anton Altaparmakov
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 <vladimir@tuxera.com>
---
fs/erofs/utils.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/fs/erofs/utils.c b/fs/erofs/utils.c
index 7b47c56b89b7..fddc5059c930 100644
--- a/fs/erofs/utils.c
+++ b/fs/erofs/utils.c
@@ -68,8 +68,6 @@ struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb,
rcu_read_lock();
grp = radix_tree_lookup(&sbi->workstn_tree, index);
if (grp) {
- grp = xa_untag_pointer(grp);
-
if (erofs_workgroup_get(grp)) {
/* prefer to relax rcu read side */
rcu_read_unlock();
@@ -101,8 +99,6 @@ int erofs_register_workgroup(struct super_block *sb,
sbi = EROFS_SB(sb);
xa_lock(&sbi->workstn_tree);
- grp = xa_tag_pointer(grp, 0);
-
/*
* Bump up reference count before making this workgroup
* 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,
* however in order to avoid some race conditions, add a
* DBG_BUGON to observe this in advance.
*/
- DBG_BUGON(xa_untag_pointer(radix_tree_delete(&sbi->workstn_tree,
- grp->index)) != grp);
+ DBG_BUGON(radix_tree_delete(&sbi->workstn_tree, grp->index) != grp);
/*
* If managed cache is on, last refcount should indicate
@@ -199,7 +194,7 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
batch, first_index, PAGEVEC_SIZE);
for (i = 0; i < found; ++i) {
- struct erofs_workgroup *grp = xa_untag_pointer(batch[i]);
+ struct erofs_workgroup *grp = batch[i];
first_index = grp->index + 1;
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree
2020-01-02 12:01 [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Vladimir Zapolskiy
` (2 preceding siblings ...)
2020-01-02 12:01 ` [PATCH 3/3] erofs: remove void tagging/untagging of workgroup pointers Vladimir Zapolskiy
@ 2020-01-02 12:55 ` Gao Xiang
2020-01-03 7:08 ` Chao Yu
4 siblings, 0 replies; 6+ messages in thread
From: Gao Xiang @ 2020-01-02 12:55 UTC (permalink / raw)
To: Vladimir Zapolskiy
Cc: Miao Xie, Matthew Wilcox, linux-fsdevel, Gao Xiang, linux-erofs,
Anton Altaparmakov
Hi Vladimir,
On Thu, Jan 02, 2020 at 02:01:15PM +0200, Vladimir Zapolskiy wrote:
> The changeset simplifies a couple of internal interfaces and removes
> excessive tagging and untagging of workgroup pointers stored in a radix
> tree.
>
> All the changes in the series are non-functional.
This radix tree tag was planned to be reserved for other use in order
to differ it from the current fixed-sized output compression management
structure. I agree that it can be simplified for now, so I will test
this series and apply. However, I think such XArray tagged pointer
usage is useful.
p.s. I'm converting this radix tree to XArray and cleaning up
related functions for the next cycle as well.
Thanks,
Gao Xiang
>
> Vladimir Zapolskiy (3):
> erofs: remove unused tag argument while finding a workgroup
> erofs: remove unused tag argument while registering a workgroup
> erofs: remove void tagging/untagging of workgroup pointers
>
> fs/erofs/internal.h | 4 ++--
> fs/erofs/utils.c | 15 ++++-----------
> fs/erofs/zdata.c | 5 ++---
> 3 files changed, 8 insertions(+), 16 deletions(-)
>
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree
2020-01-02 12:01 [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Vladimir Zapolskiy
` (3 preceding siblings ...)
2020-01-02 12:55 ` [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Gao Xiang
@ 2020-01-03 7:08 ` Chao Yu
4 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2020-01-03 7:08 UTC (permalink / raw)
To: Vladimir Zapolskiy, Gao Xiang, Chao Yu
Cc: linux-fsdevel, linux-erofs, Matthew Wilcox, Anton Altaparmakov
On 2020/1/2 20:01, Vladimir Zapolskiy wrote:
> The changeset simplifies a couple of internal interfaces and removes
> excessive tagging and untagging of workgroup pointers stored in a radix
> tree.
>
> All the changes in the series are non-functional.
>
> Vladimir Zapolskiy (3):
> erofs: remove unused tag argument while finding a workgroup
> erofs: remove unused tag argument while registering a workgroup
> erofs: remove void tagging/untagging of workgroup pointers
>
> fs/erofs/internal.h | 4 ++--
> fs/erofs/utils.c | 15 ++++-----------
> fs/erofs/zdata.c | 5 ++---
> 3 files changed, 8 insertions(+), 16 deletions(-)
>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-01-03 7:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02 12:01 [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 1/3] erofs: remove unused tag argument while finding a workgroup Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 2/3] erofs: remove unused tag argument while registering " Vladimir Zapolskiy
2020-01-02 12:01 ` [PATCH 3/3] erofs: remove void tagging/untagging of workgroup pointers Vladimir Zapolskiy
2020-01-02 12:55 ` [PATCH 0/3] erofs: remove tags of pointers stored in a radix tree Gao Xiang
2020-01-03 7:08 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).