@@ -649,6 +649,9 @@ static int _ext4_get_block(struct inode *inode, sector_t iblock,
649649 int ret = 0 , started = 0 ;
650650 int dio_credits ;
651651
652+ if (ext4_has_inline_data (inode ))
653+ return - ERANGE ;
654+
652655 map .m_lblk = iblock ;
653656 map .m_len = bh -> b_size >> inode -> i_blkbits ;
654657
@@ -2687,6 +2690,12 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
26872690 journal_t * journal ;
26882691 int err ;
26892692
2693+ /*
2694+ * We can get here for an inline file via the FIBMAP ioctl
2695+ */
2696+ if (ext4_has_inline_data (inode ))
2697+ return 0 ;
2698+
26902699 if (mapping_tagged (mapping , PAGECACHE_TAG_DIRTY ) &&
26912700 test_opt (inode -> i_sb , DELALLOC )) {
26922701 /*
@@ -2732,14 +2741,30 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
27322741
27332742static int ext4_readpage (struct file * file , struct page * page )
27342743{
2744+ int ret = - EAGAIN ;
2745+ struct inode * inode = page -> mapping -> host ;
2746+
27352747 trace_ext4_readpage (page );
2736- return mpage_readpage (page , ext4_get_block );
2748+
2749+ if (ext4_has_inline_data (inode ))
2750+ ret = ext4_readpage_inline (inode , page );
2751+
2752+ if (ret == - EAGAIN )
2753+ return mpage_readpage (page , ext4_get_block );
2754+
2755+ return ret ;
27372756}
27382757
27392758static int
27402759ext4_readpages (struct file * file , struct address_space * mapping ,
27412760 struct list_head * pages , unsigned nr_pages )
27422761{
2762+ struct inode * inode = mapping -> host ;
2763+
2764+ /* If the file has inline data, no need to do readpages. */
2765+ if (ext4_has_inline_data (inode ))
2766+ return 0 ;
2767+
27432768 return mpage_readpages (mapping , pages , nr_pages , ext4_get_block );
27442769}
27452770
@@ -3078,6 +3103,10 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
30783103 if (ext4_should_journal_data (inode ))
30793104 return 0 ;
30803105
3106+ /* Let buffer I/O handle the inline data case. */
3107+ if (ext4_has_inline_data (inode ))
3108+ return 0 ;
3109+
30813110 trace_ext4_direct_IO_enter (inode , offset , iov_length (iov , nr_segs ), rw );
30823111 if (ext4_test_inode_flag (inode , EXT4_INODE_EXTENTS ))
30833112 ret = ext4_ext_direct_IO (rw , iocb , iov , offset , nr_segs );
0 commit comments