File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,7 +203,6 @@ static int erofs_read_inode(struct inode *inode)
203203
204204static int erofs_fill_inode (struct inode * inode )
205205{
206- struct erofs_inode * vi = EROFS_I (inode );
207206 int err ;
208207
209208 trace_erofs_fill_inode (inode );
@@ -235,28 +234,7 @@ static int erofs_fill_inode(struct inode *inode)
235234 }
236235
237236 mapping_set_large_folios (inode -> i_mapping );
238- if (erofs_inode_is_data_compressed (vi -> datalayout )) {
239- #ifdef CONFIG_EROFS_FS_ZIP
240- DO_ONCE_LITE_IF (inode -> i_blkbits != PAGE_SHIFT ,
241- erofs_info , inode -> i_sb ,
242- "EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!" );
243- inode -> i_mapping -> a_ops = & z_erofs_aops ;
244- #else
245- err = - EOPNOTSUPP ;
246- #endif
247- } else {
248- inode -> i_mapping -> a_ops = & erofs_aops ;
249- #ifdef CONFIG_EROFS_FS_ONDEMAND
250- if (erofs_is_fscache_mode (inode -> i_sb ))
251- inode -> i_mapping -> a_ops = & erofs_fscache_access_aops ;
252- #endif
253- #ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
254- if (erofs_is_fileio_mode (EROFS_SB (inode -> i_sb )))
255- inode -> i_mapping -> a_ops = & erofs_fileio_aops ;
256- #endif
257- }
258-
259- return err ;
237+ return erofs_inode_set_aops (inode , inode , false);
260238}
261239
262240/*
Original file line number Diff line number Diff line change @@ -452,6 +452,28 @@ static inline void *erofs_vm_map_ram(struct page **pages, unsigned int count)
452452 return NULL ;
453453}
454454
455+ static inline int erofs_inode_set_aops (struct inode * inode ,
456+ struct inode * realinode , bool no_fscache )
457+ {
458+ if (erofs_inode_is_data_compressed (EROFS_I (realinode )-> datalayout )) {
459+ if (!IS_ENABLED (CONFIG_EROFS_FS_ZIP ))
460+ return - EOPNOTSUPP ;
461+ DO_ONCE_LITE_IF (realinode -> i_blkbits != PAGE_SHIFT ,
462+ erofs_info , realinode -> i_sb ,
463+ "EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!" );
464+ inode -> i_mapping -> a_ops = & z_erofs_aops ;
465+ return 0 ;
466+ }
467+ inode -> i_mapping -> a_ops = & erofs_aops ;
468+ if (IS_ENABLED (CONFIG_EROFS_FS_ONDEMAND ) && !no_fscache &&
469+ erofs_is_fscache_mode (realinode -> i_sb ))
470+ inode -> i_mapping -> a_ops = & erofs_fscache_access_aops ;
471+ if (IS_ENABLED (CONFIG_EROFS_FS_BACKED_BY_FILE ) &&
472+ erofs_is_fileio_mode (EROFS_SB (realinode -> i_sb )))
473+ inode -> i_mapping -> a_ops = & erofs_fileio_aops ;
474+ return 0 ;
475+ }
476+
455477int erofs_register_sysfs (struct super_block * sb );
456478void erofs_unregister_sysfs (struct super_block * sb );
457479int __init erofs_init_sysfs (void );
You can’t perform that action at this time.
0 commit comments