The ioends are offloaded to workqueue for further processing of completed BIOs. Use read end ioends for fsverity verification. Signed-off-by: Andrey Albershteyn --- fs/xfs/xfs_aops.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index f95dc51eb044..9d4fc3322ec7 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -204,11 +204,15 @@ xfs_end_io( io_list))) { list_del_init(&ioend->io_list); iomap_ioend_try_merge(ioend, &tmp); - if (bio_op(&ioend->io_bio) == REQ_OP_READ) + if (bio_op(&ioend->io_bio) == REQ_OP_READ) { + if (xfs_fsverity_sealed_data(ip, ioend->io_offset)) + fsverity_verify_bio(ioend->io_vi, + &ioend->io_bio); iomap_finish_ioends(ioend, blk_status_to_errno(ioend->io_bio.bi_status)); - else + } else { xfs_end_ioend_write(ioend); + } cond_resched(); } } @@ -766,9 +770,12 @@ xfs_bio_submit_read( struct iomap_read_folio_ctx *ctx) { struct bio *bio = ctx->read_ctx; + struct iomap_ioend *ioend; /* delay read completions to the ioend workqueue */ - iomap_init_ioend(iter->inode, bio, ctx->read_ctx_file_offset, 0); + ioend = iomap_init_ioend(iter->inode, bio, ctx->read_ctx_file_offset, 0); + ioend->io_vi = ctx->vi; + bio->bi_end_io = xfs_end_bio; submit_bio(bio); } @@ -781,10 +788,13 @@ static const struct iomap_read_ops xfs_bio_read_integrity_ops = { static inline const struct iomap_read_ops * xfs_bio_read_ops( - const struct xfs_inode *ip) + const struct xfs_inode *ip, + loff_t offset) { if (bdev_has_integrity_csum(xfs_inode_buftarg(ip)->bt_bdev)) return &xfs_bio_read_integrity_ops; + if (xfs_fsverity_sealed_data(ip, offset)) + return &xfs_bio_read_integrity_ops; return &iomap_bio_read_ops; } @@ -793,9 +803,11 @@ xfs_vm_read_folio( struct file *file, struct folio *folio) { + const struct iomap_read_ops *ops = xfs_bio_read_ops( + XFS_I(folio->mapping->host), folio_pos(folio)); struct iomap_read_folio_ctx ctx = { .cur_folio = folio, - .ops = xfs_bio_read_ops(XFS_I(folio->mapping->host)), + .ops = ops, }; iomap_read_folio(&xfs_read_iomap_ops, &ctx); @@ -806,9 +818,11 @@ STATIC void xfs_vm_readahead( struct readahead_control *rac) { + const struct iomap_read_ops *ops = xfs_bio_read_ops( + XFS_I(rac->mapping->host), readahead_pos(rac)); struct iomap_read_folio_ctx ctx = { .rac = rac, - .ops = xfs_bio_read_ops(XFS_I(rac->mapping->host)), + .ops = ops, }; iomap_readahead(&xfs_read_iomap_ops, &ctx); -- 2.51.2