Skip to content

Commit 99634bf

Browse files
Gao Xianggregkh
authored andcommitted
erofs: add "erofs_" prefix for common and short functions
Add erofs_ prefix to free_inode, alloc_inode, ... Reported-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Link: https://lore.kernel.org/r/20190904020912.63925-19-gaoxiang25@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 94e4e15 commit 99634bf

7 files changed

Lines changed: 54 additions & 53 deletions

File tree

‎fs/erofs/data.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <trace/events/erofs.h>
1111

12-
static inline void read_endio(struct bio *bio)
12+
static void erofs_readendio(struct bio *bio)
1313
{
1414
struct super_block *const sb = bio->bi_private;
1515
struct bio_vec *bvec;
@@ -45,7 +45,7 @@ static struct bio *erofs_grab_raw_bio(struct super_block *sb,
4545
{
4646
struct bio *bio = bio_alloc(GFP_NOIO, nr_pages);
4747

48-
bio->bi_end_io = read_endio;
48+
bio->bi_end_io = erofs_readendio;
4949
bio_set_dev(bio, sb->s_bdev);
5050
bio->bi_iter.bi_sector = (sector_t)blkaddr << LOG_SECTORS_PER_BLOCK;
5151
bio->bi_private = sb;

‎fs/erofs/decompressor.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ static bool use_vmap;
3232
module_param(use_vmap, bool, 0444);
3333
MODULE_PARM_DESC(use_vmap, "Use vmap() instead of vm_map_ram() (default 0)");
3434

35-
static int lz4_prepare_destpages(struct z_erofs_decompress_req *rq,
36-
struct list_head *pagepool)
35+
static int z_erofs_lz4_prepare_destpages(struct z_erofs_decompress_req *rq,
36+
struct list_head *pagepool)
3737
{
3838
const unsigned int nr =
3939
PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT;
@@ -114,7 +114,7 @@ static void *generic_copy_inplace_data(struct z_erofs_decompress_req *rq,
114114
return tmp;
115115
}
116116

117-
static int lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out)
117+
static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out)
118118
{
119119
unsigned int inputmargin, inlen;
120120
u8 *src;
@@ -188,8 +188,8 @@ static struct z_erofs_decompressor decompressors[] = {
188188
.name = "shifted"
189189
},
190190
[Z_EROFS_COMPRESSION_LZ4] = {
191-
.prepare_destpages = lz4_prepare_destpages,
192-
.decompress = lz4_decompress,
191+
.prepare_destpages = z_erofs_lz4_prepare_destpages,
192+
.decompress = z_erofs_lz4_decompress,
193193
.name = "lz4"
194194
},
195195
};
@@ -247,8 +247,8 @@ static void erofs_vunmap(const void *mem, unsigned int count)
247247
vunmap(mem);
248248
}
249249

250-
static int decompress_generic(struct z_erofs_decompress_req *rq,
251-
struct list_head *pagepool)
250+
static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq,
251+
struct list_head *pagepool)
252252
{
253253
const unsigned int nrpages_out =
254254
PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT;
@@ -308,8 +308,8 @@ static int decompress_generic(struct z_erofs_decompress_req *rq,
308308
return ret;
309309
}
310310

311-
static int shifted_decompress(const struct z_erofs_decompress_req *rq,
312-
struct list_head *pagepool)
311+
static int z_erofs_shifted_transform(const struct z_erofs_decompress_req *rq,
312+
struct list_head *pagepool)
313313
{
314314
const unsigned int nrpages_out =
315315
PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT;
@@ -353,7 +353,7 @@ int z_erofs_decompress(struct z_erofs_decompress_req *rq,
353353
struct list_head *pagepool)
354354
{
355355
if (rq->alg == Z_EROFS_COMPRESSION_SHIFTED)
356-
return shifted_decompress(rq, pagepool);
357-
return decompress_generic(rq, pagepool);
356+
return z_erofs_shifted_transform(rq, pagepool);
357+
return z_erofs_decompress_generic(rq, pagepool);
358358
}
359359

‎fs/erofs/inode.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <trace/events/erofs.h>
1010

1111
/* no locking */
12-
static int read_inode(struct inode *inode, void *data)
12+
static int erofs_read_inode(struct inode *inode, void *data)
1313
{
1414
struct erofs_inode *vi = EROFS_I(inode);
1515
struct erofs_inode_compact *dic = data;
@@ -163,7 +163,7 @@ static int erofs_fill_symlink(struct inode *inode, void *data,
163163
return 0;
164164
}
165165

166-
static int fill_inode(struct inode *inode, int isdir)
166+
static int erofs_fill_inode(struct inode *inode, int isdir)
167167
{
168168
struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
169169
struct erofs_inode *vi = EROFS_I(inode);
@@ -193,7 +193,7 @@ static int fill_inode(struct inode *inode, int isdir)
193193
DBG_BUGON(!PageUptodate(page));
194194
data = page_address(page);
195195

196-
err = read_inode(inode, data + ofs);
196+
err = erofs_read_inode(inode, data + ofs);
197197
if (!err) {
198198
/* setup the new inode */
199199
switch (inode->i_mode & S_IFMT) {
@@ -286,7 +286,7 @@ struct inode *erofs_iget(struct super_block *sb,
286286

287287
vi->nid = nid;
288288

289-
err = fill_inode(inode, isdir);
289+
err = erofs_fill_inode(inode, isdir);
290290
if (!err)
291291
unlock_new_inode(inode);
292292
else {

‎fs/erofs/internal.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ struct erofs_inode {
308308
#define EROFS_I(ptr) \
309309
container_of(ptr, struct erofs_inode, vfs_inode)
310310

311-
static inline unsigned long inode_datablocks(struct inode *inode)
311+
static inline unsigned long erofs_inode_datablocks(struct inode *inode)
312312
{
313313
/* since i_size cannot be changed */
314314
return DIV_ROUND_UP(inode->i_size, EROFS_BLKSIZ);

‎fs/erofs/namei.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ struct erofs_qstr {
1414
};
1515

1616
/* based on the end of qn is accurate and it must have the trailing '\0' */
17-
static inline int dirnamecmp(const struct erofs_qstr *qn,
18-
const struct erofs_qstr *qd,
19-
unsigned int *matched)
17+
static inline int erofs_dirnamecmp(const struct erofs_qstr *qn,
18+
const struct erofs_qstr *qd,
19+
unsigned int *matched)
2020
{
2121
unsigned int i = *matched;
2222

@@ -71,7 +71,7 @@ static struct erofs_dirent *find_target_dirent(struct erofs_qstr *name,
7171
};
7272

7373
/* string comparison without already matched prefix */
74-
int ret = dirnamecmp(name, &dname, &matched);
74+
int ret = erofs_dirnamecmp(name, &dname, &matched);
7575

7676
if (!ret) {
7777
return de + mid;
@@ -98,7 +98,7 @@ static struct page *find_target_block_classic(struct inode *dir,
9898

9999
startprfx = endprfx = 0;
100100
head = 0;
101-
back = inode_datablocks(dir) - 1;
101+
back = erofs_inode_datablocks(dir) - 1;
102102

103103
while (head <= back) {
104104
const int mid = head + (back - head) / 2;
@@ -134,7 +134,7 @@ static struct page *find_target_block_classic(struct inode *dir,
134134
EROFS_BLKSIZ);
135135

136136
/* string comparison without already matched prefix */
137-
diff = dirnamecmp(name, &dname, &matched);
137+
diff = erofs_dirnamecmp(name, &dname, &matched);
138138
kunmap_atomic(de);
139139

140140
if (!diff) {

‎fs/erofs/super.c‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
static struct kmem_cache *erofs_inode_cachep __read_mostly;
1818

19-
static void init_once(void *ptr)
19+
static void erofs_inode_init_once(void *ptr)
2020
{
2121
struct erofs_inode *vi = ptr;
2222

2323
inode_init_once(&vi->vfs_inode);
2424
}
2525

26-
static struct inode *alloc_inode(struct super_block *sb)
26+
static struct inode *erofs_alloc_inode(struct super_block *sb)
2727
{
2828
struct erofs_inode *vi =
2929
kmem_cache_alloc(erofs_inode_cachep, GFP_KERNEL);
@@ -36,7 +36,7 @@ static struct inode *alloc_inode(struct super_block *sb)
3636
return &vi->vfs_inode;
3737
}
3838

39-
static void free_inode(struct inode *inode)
39+
static void erofs_free_inode(struct inode *inode)
4040
{
4141
struct erofs_inode *vi = EROFS_I(inode);
4242

@@ -64,7 +64,7 @@ static bool check_layout_compatibility(struct super_block *sb,
6464
return true;
6565
}
6666

67-
static int superblock_read(struct super_block *sb)
67+
static int erofs_read_superblock(struct super_block *sb)
6868
{
6969
struct erofs_sb_info *sbi;
7070
struct buffer_head *bh;
@@ -218,7 +218,7 @@ static int erofs_build_cache_strategy(struct erofs_sb_info *sbi,
218218
#endif
219219

220220
/* set up default EROFS parameters */
221-
static void default_options(struct erofs_sb_info *sbi)
221+
static void erofs_default_options(struct erofs_sb_info *sbi)
222222
{
223223
#ifdef CONFIG_EROFS_FS_ZIP
224224
sbi->cache_strategy = EROFS_ZIP_CACHE_READAROUND;
@@ -252,7 +252,7 @@ static match_table_t erofs_tokens = {
252252
{Opt_err, NULL}
253253
};
254254

255-
static int parse_options(struct super_block *sb, char *options)
255+
static int erofs_parse_options(struct super_block *sb, char *options)
256256
{
257257
substring_t args[MAX_OPT_ARGS];
258258
char *p;
@@ -322,7 +322,7 @@ static int parse_options(struct super_block *sb, char *options)
322322
#ifdef CONFIG_EROFS_FS_ZIP
323323
static const struct address_space_operations managed_cache_aops;
324324

325-
static int managed_cache_releasepage(struct page *page, gfp_t gfp_mask)
325+
static int erofs_managed_cache_releasepage(struct page *page, gfp_t gfp_mask)
326326
{
327327
int ret = 1; /* 0 - busy */
328328
struct address_space *const mapping = page->mapping;
@@ -336,9 +336,9 @@ static int managed_cache_releasepage(struct page *page, gfp_t gfp_mask)
336336
return ret;
337337
}
338338

339-
static void managed_cache_invalidatepage(struct page *page,
340-
unsigned int offset,
341-
unsigned int length)
339+
static void erofs_managed_cache_invalidatepage(struct page *page,
340+
unsigned int offset,
341+
unsigned int length)
342342
{
343343
const unsigned int stop = length + offset;
344344

@@ -348,13 +348,13 @@ static void managed_cache_invalidatepage(struct page *page,
348348
DBG_BUGON(stop > PAGE_SIZE || stop < length);
349349

350350
if (offset == 0 && stop == PAGE_SIZE)
351-
while (!managed_cache_releasepage(page, GFP_NOFS))
351+
while (!erofs_managed_cache_releasepage(page, GFP_NOFS))
352352
cond_resched();
353353
}
354354

355355
static const struct address_space_operations managed_cache_aops = {
356-
.releasepage = managed_cache_releasepage,
357-
.invalidatepage = managed_cache_invalidatepage,
356+
.releasepage = erofs_managed_cache_releasepage,
357+
.invalidatepage = erofs_managed_cache_invalidatepage,
358358
};
359359

360360
static int erofs_init_managed_cache(struct super_block *sb)
@@ -396,7 +396,7 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
396396
return -ENOMEM;
397397

398398
sb->s_fs_info = sbi;
399-
err = superblock_read(sb);
399+
err = erofs_read_superblock(sb);
400400
if (err)
401401
return err;
402402

@@ -410,9 +410,9 @@ static int erofs_fill_super(struct super_block *sb, void *data, int silent)
410410
sb->s_xattr = erofs_xattr_handlers;
411411
#endif
412412
/* set erofs default mount options */
413-
default_options(sbi);
413+
erofs_default_options(sbi);
414414

415-
err = parse_options(sb, data);
415+
err = erofs_parse_options(sb, data);
416416
if (err)
417417
return err;
418418

@@ -512,7 +512,7 @@ static int __init erofs_module_init(void)
512512
erofs_inode_cachep = kmem_cache_create("erofs_inode",
513513
sizeof(struct erofs_inode), 0,
514514
SLAB_RECLAIM_ACCOUNT,
515-
init_once);
515+
erofs_inode_init_once);
516516
if (!erofs_inode_cachep) {
517517
err = -ENOMEM;
518518
goto icache_err;
@@ -619,7 +619,7 @@ static int erofs_remount(struct super_block *sb, int *flags, char *data)
619619
int err;
620620

621621
DBG_BUGON(!sb_rdonly(sb));
622-
err = parse_options(sb, data);
622+
err = erofs_parse_options(sb, data);
623623
if (err)
624624
goto out;
625625

@@ -639,8 +639,8 @@ static int erofs_remount(struct super_block *sb, int *flags, char *data)
639639

640640
const struct super_operations erofs_sops = {
641641
.put_super = erofs_put_super,
642-
.alloc_inode = alloc_inode,
643-
.free_inode = free_inode,
642+
.alloc_inode = erofs_alloc_inode,
643+
.free_inode = erofs_free_inode,
644644
.statfs = erofs_statfs,
645645
.show_options = erofs_show_options,
646646
.remount_fs = erofs_remount,

‎fs/erofs/zdata.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void z_erofs_exit_zip_subsystem(void)
4040
kmem_cache_destroy(pcluster_cachep);
4141
}
4242

43-
static inline int init_unzip_workqueue(void)
43+
static inline int z_erofs_init_workqueue(void)
4444
{
4545
const unsigned int onlinecpus = num_possible_cpus();
4646
const unsigned int flags = WQ_UNBOUND | WQ_HIGHPRI | WQ_CPU_INTENSIVE;
@@ -54,7 +54,7 @@ static inline int init_unzip_workqueue(void)
5454
return z_erofs_workqueue ? 0 : -ENOMEM;
5555
}
5656

57-
static void init_once(void *ptr)
57+
static void z_erofs_pcluster_init_once(void *ptr)
5858
{
5959
struct z_erofs_pcluster *pcl = ptr;
6060
struct z_erofs_collection *cl = z_erofs_primarycollection(pcl);
@@ -67,7 +67,7 @@ static void init_once(void *ptr)
6767
pcl->compressed_pages[i] = NULL;
6868
}
6969

70-
static void init_always(struct z_erofs_pcluster *pcl)
70+
static void z_erofs_pcluster_init_always(struct z_erofs_pcluster *pcl)
7171
{
7272
struct z_erofs_collection *cl = z_erofs_primarycollection(pcl);
7373

@@ -81,9 +81,10 @@ int __init z_erofs_init_zip_subsystem(void)
8181
{
8282
pcluster_cachep = kmem_cache_create("erofs_compress",
8383
Z_EROFS_WORKGROUP_SIZE, 0,
84-
SLAB_RECLAIM_ACCOUNT, init_once);
84+
SLAB_RECLAIM_ACCOUNT,
85+
z_erofs_pcluster_init_once);
8586
if (pcluster_cachep) {
86-
if (!init_unzip_workqueue())
87+
if (!z_erofs_init_workqueue())
8788
return 0;
8889

8990
kmem_cache_destroy(pcluster_cachep);
@@ -272,8 +273,8 @@ int erofs_try_to_free_cached_page(struct address_space *mapping,
272273
}
273274

274275
/* page_type must be Z_EROFS_PAGE_TYPE_EXCLUSIVE */
275-
static inline bool try_inplace_io(struct z_erofs_collector *clt,
276-
struct page *page)
276+
static inline bool z_erofs_try_inplace_io(struct z_erofs_collector *clt,
277+
struct page *page)
277278
{
278279
struct z_erofs_pcluster *const pcl = clt->pcl;
279280
const unsigned int clusterpages = BIT(pcl->clusterbits);
@@ -296,7 +297,7 @@ static int z_erofs_attach_page(struct z_erofs_collector *clt,
296297
/* give priority for inplaceio */
297298
if (clt->mode >= COLLECT_PRIMARY &&
298299
type == Z_EROFS_PAGE_TYPE_EXCLUSIVE &&
299-
try_inplace_io(clt, page))
300+
z_erofs_try_inplace_io(clt, page))
300301
return 0;
301302

302303
ret = z_erofs_pagevec_enqueue(&clt->vector,
@@ -409,7 +410,7 @@ static struct z_erofs_collection *clregister(struct z_erofs_collector *clt,
409410
if (!pcl)
410411
return ERR_PTR(-ENOMEM);
411412

412-
init_always(pcl);
413+
z_erofs_pcluster_init_always(pcl);
413414
pcl->obj.index = map->m_pa >> PAGE_SHIFT;
414415

415416
pcl->length = (map->m_llen << Z_EROFS_PCLUSTER_LENGTH_BIT) |

0 commit comments

Comments
 (0)