Skip to content

Commit 958b9f8

Browse files
author
Al Viro
committed
erofs_buf: store address_space instead of inode
... seeing that ->i_mapping is the only thing we want from the inode. Signed-off-by: Al Viro <[email protected]>
1 parent 469ad58 commit 958b9f8

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

fs/erofs/data.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ void erofs_put_metabuf(struct erofs_buf *buf)
3232
void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset,
3333
enum erofs_kmap_type type)
3434
{
35-
struct inode *inode = buf->inode;
3635
pgoff_t index = offset >> PAGE_SHIFT;
3736
struct page *page = buf->page;
3837
struct folio *folio;
@@ -42,7 +41,7 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset,
4241
erofs_put_metabuf(buf);
4342

4443
nofs_flag = memalloc_nofs_save();
45-
folio = read_cache_folio(inode->i_mapping, index, NULL, NULL);
44+
folio = read_cache_folio(buf->mapping, index, NULL, NULL);
4645
memalloc_nofs_restore(nofs_flag);
4746
if (IS_ERR(folio))
4847
return folio;
@@ -67,9 +66,9 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset,
6766
void erofs_init_metabuf(struct erofs_buf *buf, struct super_block *sb)
6867
{
6968
if (erofs_is_fscache_mode(sb))
70-
buf->inode = EROFS_SB(sb)->s_fscache->inode;
69+
buf->mapping = EROFS_SB(sb)->s_fscache->inode->i_mapping;
7170
else
72-
buf->inode = sb->s_bdev->bd_inode;
71+
buf->mapping = sb->s_bdev->bd_inode->i_mapping;
7372
}
7473

7574
void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb,

fs/erofs/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
5858
int err = 0;
5959
bool initial = true;
6060

61-
buf.inode = dir;
61+
buf.mapping = dir->i_mapping;
6262
while (ctx->pos < dirsize) {
6363
struct erofs_dirent *de;
6464
unsigned int nameoff, maxsize;

fs/erofs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ enum erofs_kmap_type {
223223
};
224224

225225
struct erofs_buf {
226-
struct inode *inode;
226+
struct address_space *mapping;
227227
struct page *page;
228228
void *base;
229229
enum erofs_kmap_type kmap_type;

fs/erofs/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void *erofs_find_target_block(struct erofs_buf *target,
9999
struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
100100
struct erofs_dirent *de;
101101

102-
buf.inode = dir;
102+
buf.mapping = dir->i_mapping;
103103
de = erofs_bread(&buf, erofs_pos(dir->i_sb, mid), EROFS_KMAP);
104104
if (!IS_ERR(de)) {
105105
const int nameoff = nameoff_from_disk(de->nameoff, bsz);
@@ -171,7 +171,7 @@ int erofs_namei(struct inode *dir, const struct qstr *name, erofs_nid_t *nid,
171171

172172
qn.name = name->name;
173173
qn.end = name->name + name->len;
174-
buf.inode = dir;
174+
buf.mapping = dir->i_mapping;
175175

176176
ndirents = 0;
177177
de = erofs_find_target_block(&buf, dir, &qn, &ndirents);

fs/erofs/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ int erofs_xattr_prefixes_init(struct super_block *sb)
483483
return -ENOMEM;
484484

485485
if (sbi->packed_inode)
486-
buf.inode = sbi->packed_inode;
486+
buf.mapping = sbi->packed_inode->i_mapping;
487487
else
488488
erofs_init_metabuf(&buf, sb);
489489

fs/erofs/zdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ static int z_erofs_read_fragment(struct super_block *sb, struct page *page,
936936
if (!packed_inode)
937937
return -EFSCORRUPTED;
938938

939-
buf.inode = packed_inode;
939+
buf.mapping = packed_inode->i_mapping;
940940
for (; cur < end; cur += cnt, pos += cnt) {
941941
cnt = min_t(unsigned int, end - cur,
942942
sb->s_blocksize - erofs_blkoff(sb, pos));

0 commit comments

Comments
 (0)