Skip to content

Commit a5876e2

Browse files
Gao Xianggregkh
authored andcommitted
erofs: use erofs_inode naming
As Christoph suggested [1], "Why is this called vnode instead of inode? That seems like a rather odd naming for a Linux file system." [1] https://lore.kernel.org/r/20190829101545.GC20598@infradead.org/ Reported-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com> Link: https://lore.kernel.org/r/20190904020912.63925-10-gaoxiang25@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1c2dfbf commit a5876e2

11 files changed

Lines changed: 61 additions & 64 deletions

File tree

‎fs/erofs/data.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
112112
int err = 0;
113113
erofs_blk_t nblocks, lastblk;
114114
u64 offset = map->m_la;
115-
struct erofs_vnode *vi = EROFS_V(inode);
115+
struct erofs_inode *vi = EROFS_I(inode);
116116
bool tailendpacking = (vi->datalayout == EROFS_INODE_FLAT_INLINE);
117117

118118
trace_erofs_map_blocks_flatmode_enter(inode, map, flags);
@@ -170,7 +170,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
170170
int erofs_map_blocks(struct inode *inode,
171171
struct erofs_map_blocks *map, int flags)
172172
{
173-
if (erofs_inode_is_data_compressed(EROFS_V(inode)->datalayout)) {
173+
if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) {
174174
int err = z_erofs_map_blocks_iter(inode, map, flags);
175175

176176
if (map->mpage) {
@@ -365,7 +365,7 @@ static int erofs_raw_access_readpages(struct file *filp,
365365
if (IS_ERR(bio)) {
366366
pr_err("%s, readahead error at page %lu of nid %llu\n",
367367
__func__, page->index,
368-
EROFS_V(mapping->host)->nid);
368+
EROFS_I(mapping->host)->nid);
369369

370370
bio = NULL;
371371
}
@@ -404,7 +404,7 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block)
404404
{
405405
struct inode *inode = mapping->host;
406406

407-
if (EROFS_V(inode)->datalayout == EROFS_INODE_FLAT_INLINE) {
407+
if (EROFS_I(inode)->datalayout == EROFS_INODE_FLAT_INLINE) {
408408
erofs_blk_t blks = i_size_read(inode) >> LOG_BLOCK_SIZE;
409409

410410
if (block >> LOG_SECTORS_PER_BLOCK >= blks)

‎fs/erofs/dir.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int erofs_fill_dentries(struct inode *dir, struct dir_context *ctx,
4747
/* a corrupted entry is found */
4848
if (nameoff + de_namelen > maxsize ||
4949
de_namelen > EROFS_NAME_LEN) {
50-
errln("bogus dirent @ nid %llu", EROFS_V(dir)->nid);
50+
errln("bogus dirent @ nid %llu", EROFS_I(dir)->nid);
5151
DBG_BUGON(1);
5252
return -EFSCORRUPTED;
5353
}
@@ -85,7 +85,7 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
8585
break;
8686
} else if (IS_ERR(dentry_page)) {
8787
errln("fail to readdir of logical block %u of nid %llu",
88-
i, EROFS_V(dir)->nid);
88+
i, EROFS_I(dir)->nid);
8989
err = -EFSCORRUPTED;
9090
break;
9191
}
@@ -97,7 +97,7 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
9797
if (nameoff < sizeof(struct erofs_dirent) ||
9898
nameoff >= PAGE_SIZE) {
9999
errln("%s, invalid de[0].nameoff %u @ nid %llu",
100-
__func__, nameoff, EROFS_V(dir)->nid);
100+
__func__, nameoff, EROFS_I(dir)->nid);
101101
err = -EFSCORRUPTED;
102102
goto skip_this;
103103
}

‎fs/erofs/inode.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/* no locking */
1212
static int read_inode(struct inode *inode, void *data)
1313
{
14-
struct erofs_vnode *vi = EROFS_V(inode);
14+
struct erofs_inode *vi = EROFS_I(inode);
1515
struct erofs_inode_compact *dic = data;
1616
struct erofs_inode_extended *die;
1717

@@ -140,7 +140,7 @@ static int read_inode(struct inode *inode, void *data)
140140
static int fill_inline_data(struct inode *inode, void *data,
141141
unsigned int m_pofs)
142142
{
143-
struct erofs_vnode *vi = EROFS_V(inode);
143+
struct erofs_inode *vi = EROFS_I(inode);
144144
struct erofs_sb_info *sbi = EROFS_I_SB(inode);
145145

146146
/* should be tail-packing data inline */
@@ -178,7 +178,7 @@ static int fill_inline_data(struct inode *inode, void *data,
178178
static int fill_inode(struct inode *inode, int isdir)
179179
{
180180
struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
181-
struct erofs_vnode *vi = EROFS_V(inode);
181+
struct erofs_inode *vi = EROFS_I(inode);
182182
struct page *page;
183183
void *data;
184184
int err;
@@ -260,7 +260,7 @@ static int erofs_ilookup_test_actor(struct inode *inode, void *opaque)
260260
{
261261
const erofs_nid_t nid = *(erofs_nid_t *)opaque;
262262

263-
return EROFS_V(inode)->nid == nid;
263+
return EROFS_I(inode)->nid == nid;
264264
}
265265

266266
static int erofs_iget_set_actor(struct inode *inode, void *opaque)
@@ -297,7 +297,7 @@ struct inode *erofs_iget(struct super_block *sb,
297297

298298
if (inode->i_state & I_NEW) {
299299
int err;
300-
struct erofs_vnode *vi = EROFS_V(inode);
300+
struct erofs_inode *vi = EROFS_I(inode);
301301

302302
vi->nid = nid;
303303

@@ -317,7 +317,7 @@ int erofs_getattr(const struct path *path, struct kstat *stat,
317317
{
318318
struct inode *const inode = d_inode(path->dentry);
319319

320-
if (erofs_inode_is_data_compressed(EROFS_V(inode)->datalayout))
320+
if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout))
321321
stat->attributes |= STATX_ATTR_COMPRESSED;
322322

323323
stat->attributes |= STATX_ATTR_IMMUTABLE;

‎fs/erofs/internal.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@ static inline erofs_off_t iloc(struct erofs_sb_info *sbi, erofs_nid_t nid)
272272
}
273273

274274
/* atomic flag definitions */
275-
#define EROFS_V_EA_INITED_BIT 0
276-
#define EROFS_V_Z_INITED_BIT 1
275+
#define EROFS_I_EA_INITED_BIT 0
276+
#define EROFS_I_Z_INITED_BIT 1
277277

278278
/* bitlock definitions (arranged in reverse order) */
279-
#define EROFS_V_BL_XATTR_BIT (BITS_PER_LONG - 1)
280-
#define EROFS_V_BL_Z_BIT (BITS_PER_LONG - 2)
279+
#define EROFS_I_BL_XATTR_BIT (BITS_PER_LONG - 1)
280+
#define EROFS_I_BL_Z_BIT (BITS_PER_LONG - 2)
281281

282-
struct erofs_vnode {
282+
struct erofs_inode {
283283
erofs_nid_t nid;
284284

285285
/* atomic flags (including bitlocks) */
@@ -307,8 +307,8 @@ struct erofs_vnode {
307307
struct inode vfs_inode;
308308
};
309309

310-
#define EROFS_V(ptr) \
311-
container_of(ptr, struct erofs_vnode, vfs_inode)
310+
#define EROFS_I(ptr) \
311+
container_of(ptr, struct erofs_inode, vfs_inode)
312312

313313
static inline unsigned long inode_datablocks(struct inode *inode)
314314
{

‎fs/erofs/namei.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static struct page *find_target_block_classic(struct inode *dir,
117117
kunmap_atomic(de);
118118
put_page(page);
119119
errln("corrupted dir block %d @ nid %llu",
120-
mid, EROFS_V(dir)->nid);
120+
mid, EROFS_I(dir)->nid);
121121
DBG_BUGON(1);
122122
page = ERR_PTR(-EFSCORRUPTED);
123123
goto out;

‎fs/erofs/super.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ static struct kmem_cache *erofs_inode_cachep __read_mostly;
1818

1919
static void init_once(void *ptr)
2020
{
21-
struct erofs_vnode *vi = ptr;
21+
struct erofs_inode *vi = ptr;
2222

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

2626
static struct inode *alloc_inode(struct super_block *sb)
2727
{
28-
struct erofs_vnode *vi =
28+
struct erofs_inode *vi =
2929
kmem_cache_alloc(erofs_inode_cachep, GFP_KERNEL);
3030

3131
if (!vi)
3232
return NULL;
3333

3434
/* zero out everything except vfs_inode */
35-
memset(vi, 0, offsetof(struct erofs_vnode, vfs_inode));
35+
memset(vi, 0, offsetof(struct erofs_inode, vfs_inode));
3636
return &vi->vfs_inode;
3737
}
3838

3939
static void free_inode(struct inode *inode)
4040
{
41-
struct erofs_vnode *vi = EROFS_V(inode);
41+
struct erofs_inode *vi = EROFS_I(inode);
4242

4343
/* be careful RCU symlink path (see ext4_inode_info->i_data)! */
4444
if (is_inode_fast_symlink(inode))
@@ -517,7 +517,7 @@ static int __init erofs_module_init(void)
517517
infoln("initializing erofs " EROFS_VERSION);
518518

519519
erofs_inode_cachep = kmem_cache_create("erofs_inode",
520-
sizeof(struct erofs_vnode), 0,
520+
sizeof(struct erofs_inode), 0,
521521
SLAB_RECLAIM_ACCOUNT,
522522
init_once);
523523
if (!erofs_inode_cachep) {

‎fs/erofs/xattr.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static inline void xattr_iter_end_final(struct xattr_iter *it)
3838

3939
static int init_inode_xattrs(struct inode *inode)
4040
{
41-
struct erofs_vnode *const vi = EROFS_V(inode);
41+
struct erofs_inode *const vi = EROFS_I(inode);
4242
struct xattr_iter it;
4343
unsigned int i;
4444
struct erofs_xattr_ibody_header *ih;
@@ -48,14 +48,14 @@ static int init_inode_xattrs(struct inode *inode)
4848
int ret = 0;
4949

5050
/* the most case is that xattrs of this inode are initialized. */
51-
if (test_bit(EROFS_V_EA_INITED_BIT, &vi->flags))
51+
if (test_bit(EROFS_I_EA_INITED_BIT, &vi->flags))
5252
return 0;
5353

54-
if (wait_on_bit_lock(&vi->flags, EROFS_V_BL_XATTR_BIT, TASK_KILLABLE))
54+
if (wait_on_bit_lock(&vi->flags, EROFS_I_BL_XATTR_BIT, TASK_KILLABLE))
5555
return -ERESTARTSYS;
5656

5757
/* someone has initialized xattrs for us? */
58-
if (test_bit(EROFS_V_EA_INITED_BIT, &vi->flags))
58+
if (test_bit(EROFS_I_EA_INITED_BIT, &vi->flags))
5959
goto out_unlock;
6060

6161
/*
@@ -136,10 +136,10 @@ static int init_inode_xattrs(struct inode *inode)
136136
}
137137
xattr_iter_end(&it, atomic_map);
138138

139-
set_bit(EROFS_V_EA_INITED_BIT, &vi->flags);
139+
set_bit(EROFS_I_EA_INITED_BIT, &vi->flags);
140140

141141
out_unlock:
142-
clear_and_wake_up_bit(EROFS_V_BL_XATTR_BIT, &vi->flags);
142+
clear_and_wake_up_bit(EROFS_I_BL_XATTR_BIT, &vi->flags);
143143
return ret;
144144
}
145145

@@ -184,7 +184,7 @@ static inline int xattr_iter_fixup(struct xattr_iter *it)
184184
static int inline_xattr_iter_begin(struct xattr_iter *it,
185185
struct inode *inode)
186186
{
187-
struct erofs_vnode *const vi = EROFS_V(inode);
187+
struct erofs_inode *const vi = EROFS_I(inode);
188188
struct erofs_sb_info *const sbi = EROFS_SB(inode->i_sb);
189189
unsigned int xattr_header_sz, inline_xattr_ofs;
190190

@@ -385,7 +385,7 @@ static int inline_getxattr(struct inode *inode, struct getxattr_iter *it)
385385

386386
static int shared_getxattr(struct inode *inode, struct getxattr_iter *it)
387387
{
388-
struct erofs_vnode *const vi = EROFS_V(inode);
388+
struct erofs_inode *const vi = EROFS_I(inode);
389389
struct super_block *const sb = inode->i_sb;
390390
struct erofs_sb_info *const sbi = EROFS_SB(sb);
391391
unsigned int i;
@@ -608,7 +608,7 @@ static int inline_listxattr(struct listxattr_iter *it)
608608
static int shared_listxattr(struct listxattr_iter *it)
609609
{
610610
struct inode *const inode = d_inode(it->dentry);
611-
struct erofs_vnode *const vi = EROFS_V(inode);
611+
struct erofs_inode *const vi = EROFS_I(inode);
612612
struct super_block *const sb = inode->i_sb;
613613
struct erofs_sb_info *const sbi = EROFS_SB(sb);
614614
unsigned int i;

‎fs/erofs/xattr.h‎

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

1717
static inline unsigned int inlinexattr_header_size(struct inode *inode)
1818
{
19-
return sizeof(struct erofs_xattr_ibody_header)
20-
+ sizeof(u32) * EROFS_V(inode)->xattr_shared_count;
19+
return sizeof(struct erofs_xattr_ibody_header) +
20+
sizeof(u32) * EROFS_I(inode)->xattr_shared_count;
2121
}
2222

2323
static inline erofs_blk_t xattrblock_addr(struct erofs_sb_info *sbi,

‎fs/erofs/zdata.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static struct z_erofs_collection *clregister(struct z_erofs_collector *clt,
421421
else
422422
pcl->algorithmformat = Z_EROFS_COMPRESSION_SHIFTED;
423423

424-
pcl->clusterbits = EROFS_V(inode)->z_physical_clusterbits[0];
424+
pcl->clusterbits = EROFS_I(inode)->z_physical_clusterbits[0];
425425
pcl->clusterbits -= PAGE_SHIFT;
426426

427427
/* new pclusters should be claimed as type 1, primary and followed */
@@ -1404,12 +1404,9 @@ static int z_erofs_vle_normalaccess_readpages(struct file *filp,
14041404
head = (void *)page_private(page);
14051405

14061406
err = z_erofs_do_read_page(&f, page, &pagepool);
1407-
if (err) {
1408-
struct erofs_vnode *vi = EROFS_V(inode);
1409-
1407+
if (err)
14101408
errln("%s, readahead error at page %lu of nid %llu",
1411-
__func__, page->index, vi->nid);
1412-
}
1409+
__func__, page->index, EROFS_I(inode)->nid);
14131410
put_page(page);
14141411
}
14151412

0 commit comments

Comments
 (0)