@@ -318,6 +318,7 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path,
318
318
unsigned int query_flags )
319
319
{
320
320
struct inode * const inode = d_inode (path -> dentry );
321
+ struct block_device * bdev = inode -> i_sb -> s_bdev ;
321
322
bool compressed =
322
323
erofs_inode_is_data_compressed (EROFS_I (inode )-> datalayout );
323
324
@@ -330,15 +331,14 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path,
330
331
/*
331
332
* Return the DIO alignment restrictions if requested.
332
333
*
333
- * In EROFS, STATX_DIOALIGN is not supported in ondemand mode and
334
- * compressed files, so in these cases we report no DIO support.
334
+ * In EROFS, STATX_DIOALIGN is only supported in bdev-based mode
335
+ * and uncompressed inodes, otherwise we report no DIO support.
335
336
*/
336
337
if ((request_mask & STATX_DIOALIGN ) && S_ISREG (inode -> i_mode )) {
337
338
stat -> result_mask |= STATX_DIOALIGN ;
338
- if (!erofs_is_fscache_mode (inode -> i_sb ) && !compressed ) {
339
- stat -> dio_mem_align =
340
- bdev_logical_block_size (inode -> i_sb -> s_bdev );
341
- stat -> dio_offset_align = stat -> dio_mem_align ;
339
+ if (bdev && !compressed ) {
340
+ stat -> dio_mem_align = bdev_dma_alignment (bdev ) + 1 ;
341
+ stat -> dio_offset_align = bdev_logical_block_size (bdev );
342
342
}
343
343
}
344
344
generic_fillattr (idmap , request_mask , inode , stat );
0 commit comments