diff options
author | Gao Xiang <hsiangkao@linux.alibaba.com> | 2024-11-15 15:46:25 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2024-11-18 18:50:14 +0800 |
commit | b49c0215b176e9c2e0998e7929eeb9261c9a7919 (patch) | |
tree | b1f3100a19d85e323654ac2ec29e8336ade1cc2b /fs/erofs/inode.c | |
parent | bae0854160939a64a092516ff1b2f221402b843b (diff) |
erofs: clarify direct I/O support
Currently, only filesystems backed by block devices support direct I/O.
Also remove the unnecessary strict checks that can be supported with iomap.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241115074625.2520728-1-hsiangkao@linux.alibaba.com
Diffstat (limited to 'fs/erofs/inode.c')
-rw-r--r-- | fs/erofs/inode.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index db29190656eb..d4b89407822a 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -318,6 +318,7 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path, unsigned int query_flags) { struct inode *const inode = d_inode(path->dentry); + struct block_device *bdev = inode->i_sb->s_bdev; bool compressed = erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout); @@ -330,15 +331,14 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path, /* * Return the DIO alignment restrictions if requested. * - * In EROFS, STATX_DIOALIGN is not supported in ondemand mode and - * compressed files, so in these cases we report no DIO support. + * In EROFS, STATX_DIOALIGN is only supported in bdev-based mode + * and uncompressed inodes, otherwise we report no DIO support. */ if ((request_mask & STATX_DIOALIGN) && S_ISREG(inode->i_mode)) { stat->result_mask |= STATX_DIOALIGN; - if (!erofs_is_fscache_mode(inode->i_sb) && !compressed) { - stat->dio_mem_align = - bdev_logical_block_size(inode->i_sb->s_bdev); - stat->dio_offset_align = stat->dio_mem_align; + if (bdev && !compressed) { + stat->dio_mem_align = bdev_dma_alignment(bdev) + 1; + stat->dio_offset_align = bdev_logical_block_size(bdev); } } generic_fillattr(idmap, request_mask, inode, stat); |