diff options
author | Gao Xiang <gaoxiang25@huawei.com> | 2019-01-16 16:59:53 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-18 10:34:01 +0100 |
commit | d60eff4396f1f7423945f01acc274043c1370bc7 (patch) | |
tree | f47a61bc3179cb27adf9c422f0f99f258311f910 | |
parent | 61c9314fdd303b99c8cd52bd64998d7296b36a3e (diff) |
staging: erofs: localize erofs_workgroup_get
Staticize erofs_workgroup_get since no external user
out of utils.c directly calls erofs_workgroup_get.
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/erofs/internal.h | 21 | ||||
-rw-r--r-- | drivers/staging/erofs/utils.c | 19 |
2 files changed, 19 insertions, 21 deletions
diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h index 80cc09ea787d..967ec1a56726 100644 --- a/drivers/staging/erofs/internal.h +++ b/drivers/staging/erofs/internal.h @@ -252,28 +252,7 @@ static inline int erofs_wait_on_workgroup_freezed(struct erofs_workgroup *grp) } #endif -static inline int erofs_workgroup_get(struct erofs_workgroup *grp, int *ocnt) -{ - int o; - -repeat: - o = erofs_wait_on_workgroup_freezed(grp); - - if (unlikely(o <= 0)) - return -1; - - if (unlikely(atomic_cmpxchg(&grp->refcount, o, o + 1) != o)) - goto repeat; - - *ocnt = o; - return 0; -} - -#define __erofs_workgroup_get(grp) atomic_inc(&(grp)->refcount) -#define __erofs_workgroup_put(grp) atomic_dec(&(grp)->refcount) - extern int erofs_workgroup_put(struct erofs_workgroup *grp); - extern struct erofs_workgroup *erofs_find_workgroup( struct super_block *sb, pgoff_t index, bool *tag); diff --git a/drivers/staging/erofs/utils.c b/drivers/staging/erofs/utils.c index aed211cd5875..d24945aab133 100644 --- a/drivers/staging/erofs/utils.c +++ b/drivers/staging/erofs/utils.c @@ -31,6 +31,25 @@ struct page *erofs_allocpage(struct list_head *pool, gfp_t gfp) static atomic_long_t erofs_global_shrink_cnt; #ifdef CONFIG_EROFS_FS_ZIP +#define __erofs_workgroup_get(grp) atomic_inc(&(grp)->refcount) +#define __erofs_workgroup_put(grp) atomic_dec(&(grp)->refcount) + +static int erofs_workgroup_get(struct erofs_workgroup *grp, int *ocnt) +{ + int o; + +repeat: + o = erofs_wait_on_workgroup_freezed(grp); + + if (unlikely(o <= 0)) + return -1; + + if (unlikely(atomic_cmpxchg(&grp->refcount, o, o + 1) != o)) + goto repeat; + + *ocnt = o; + return 0; +} struct erofs_workgroup *erofs_find_workgroup( struct super_block *sb, pgoff_t index, bool *tag) |