From b7c31e6f14779324a39927cdaf493dc193576da1 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 24 Jan 2023 11:40:28 +0100 Subject: udf: Unify .read_folio for normal and in-ICB files Switching address_space_operations while a file is used is difficult to do in a race-free way. To be able to use single address_space_operations in UDF, make udf_read_folio() handle both normal and in-ICB files. Reviewed-by: Christoph Hellwig Signed-off-by: Jan Kara --- fs/udf/inode.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'fs/udf/inode.c') diff --git a/fs/udf/inode.c b/fs/udf/inode.c index ee440d16411e..a1816f067c14 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -191,8 +191,15 @@ static int udf_writepages(struct address_space *mapping, return mpage_writepages(mapping, wbc, udf_get_block_wb); } -static int udf_read_folio(struct file *file, struct folio *folio) +int udf_read_folio(struct file *file, struct folio *folio) { + struct udf_inode_info *iinfo = UDF_I(file_inode(file)); + + if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { + udf_adinicb_readpage(&folio->page); + folio_unlock(folio); + return 0; + } return mpage_read_folio(folio, udf_get_block); } -- cgit v1.2.3-73-gaa49b