Skip to content

Commit 69368d2

Browse files
Hongbo Lihsiangkao
authored andcommitted
erofs: pass inode to trace_erofs_read_folio
The trace_erofs_read_folio accesses inode information through folio, but this method fails if the real inode is not associated with the folio(such as in the upcoming page cache sharing case). Therefore, we pass the real inode to it so that the inode information can be printed out in that case. Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 parent 5ef3208 commit 69368d2

4 files changed

Lines changed: 9 additions & 11 deletions

File tree

fs/erofs/data.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,7 @@ static int erofs_read_folio(struct file *file, struct folio *folio)
385385
};
386386
struct erofs_iomap_iter_ctx iter_ctx = {};
387387

388-
trace_erofs_read_folio(folio, true);
389-
388+
trace_erofs_read_folio(folio_inode(folio), folio, true);
390389
iomap_read_folio(&erofs_iomap_ops, &read_ctx, &iter_ctx);
391390
return 0;
392391
}
@@ -400,8 +399,7 @@ static void erofs_readahead(struct readahead_control *rac)
400399
struct erofs_iomap_iter_ctx iter_ctx = {};
401400

402401
trace_erofs_readahead(rac->mapping->host, readahead_index(rac),
403-
readahead_count(rac), true);
404-
402+
readahead_count(rac), true);
405403
iomap_readahead(&erofs_iomap_ops, &read_ctx, &iter_ctx);
406404
}
407405

fs/erofs/fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int erofs_fileio_read_folio(struct file *file, struct folio *folio)
161161
struct erofs_fileio io = {};
162162
int err;
163163

164-
trace_erofs_read_folio(folio, true);
164+
trace_erofs_read_folio(folio_inode(folio), folio, true);
165165
err = erofs_fileio_scan_folio(&io, folio);
166166
erofs_fileio_rq_submit(io.rq);
167167
return err;

fs/erofs/zdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1879,7 +1879,7 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio)
18791879
Z_EROFS_DEFINE_FRONTEND(f, inode, folio_pos(folio));
18801880
int err;
18811881

1882-
trace_erofs_read_folio(folio, false);
1882+
trace_erofs_read_folio(inode, folio, false);
18831883
z_erofs_pcluster_readmore(&f, NULL, true);
18841884
err = z_erofs_scan_folio(&f, folio, false);
18851885
z_erofs_pcluster_readmore(&f, NULL, false);

include/trace/events/erofs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ TRACE_EVENT(erofs_fill_inode,
8282

8383
TRACE_EVENT(erofs_read_folio,
8484

85-
TP_PROTO(struct folio *folio, bool raw),
85+
TP_PROTO(struct inode *inode, struct folio *folio, bool raw),
8686

87-
TP_ARGS(folio, raw),
87+
TP_ARGS(inode, folio, raw),
8888

8989
TP_STRUCT__entry(
9090
__field(dev_t, dev )
@@ -96,9 +96,9 @@ TRACE_EVENT(erofs_read_folio,
9696
),
9797

9898
TP_fast_assign(
99-
__entry->dev = folio->mapping->host->i_sb->s_dev;
100-
__entry->nid = EROFS_I(folio->mapping->host)->nid;
101-
__entry->dir = S_ISDIR(folio->mapping->host->i_mode);
99+
__entry->dev = inode->i_sb->s_dev;
100+
__entry->nid = EROFS_I(inode)->nid;
101+
__entry->dir = S_ISDIR(inode->i_mode);
102102
__entry->index = folio->index;
103103
__entry->uptodate = folio_test_uptodate(folio);
104104
__entry->raw = raw;

0 commit comments

Comments
 (0)