erofs: support STATX_DIOALIGN
Subsystems (2)
PATCH v2 1/1 erofs: support STATX_DIOALIGN
Add support for STATX_DIOALIGN to erofs, so that direct I/O alignment restrictions are exposed to userspace in a generic way.
[Before]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:0 dio offset align:0 ```
[After]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:512 dio offset align:512 ```
---
v2:
- Removing the non-bdev case for obtaining the bsize.
v1: https://lore.kernel.org/all/[email protected]/T/
--- fs/erofs/inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
fs/erofs/inode.c +17 -0
@@ -342,6 +342,23 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path, stat->attributes_mask |= (STATX_ATTR_COMPRESSED |STATX_ATTR_IMMUTABLE ); +/* +* Return the DIO alignment restrictions if requested. +* +* In erofs, STATX_DIOALIGN is not supported in ondemand mode and +* the compressed file, so in these cases 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) && + !erofs_inode_is_data_compressed (EROFS_I (inode)->datalayout)) { +struct block_device *bdev = inode->i_sb->s_bdev; + + stat->dio_mem_align =bdev_logical_block_size (bdev); + stat->dio_offset_align = stat->dio_mem_align; + } + } +generic_fillattr (idmap, request_mask, inode, stat);return 0 ; }
Signature · 1 line
2.34.1
PATCH v3 1/1 erofs: support STATX_DIOALIGN
From: Hongbo Li via Linux-erofs <[email protected]>
Add support for STATX_DIOALIGN to erofs, so that direct I/O alignment restrictions are exposed to userspace in a generic way.
[Before]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:0 dio offset align:0 ```
[After]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:512 dio offset align:512 ```
---
Hi Hongbo,
I tidy up the patch a bit according to the current codebase, I will apply this later for this cycle.
Also r-v-bs are always welcome...
Thanks,
Gao Xiang
fs/erofs/inode.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
fs/erofs/inode.c +17 -2
@@ -334,14 +334,29 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path, unsigned int query_flags) {struct inode *const inode =d_inode (path->dentry); +bool compressed = +erofs_inode_is_data_compressed (EROFS_I (inode)->datalayout); -if (erofs_inode_is_data_compressed (EROFS_I (inode)->datalayout)) +if (compressed) stat->attributes |=STATX_ATTR_COMPRESSED ; - stat->attributes |=STATX_ATTR_IMMUTABLE ; stat->attributes_mask |= (STATX_ATTR_COMPRESSED |STATX_ATTR_IMMUTABLE ); +/* +* 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. +*/ +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; + } + }generic_fillattr (idmap, request_mask, inode, stat);return 0 ; }
Signature · 1 line
2.43.5
Quoted 1 line · Gao Xiang
From: Hongbo Li via Linux-erofs <[email protected]>
Also I will fix the email address issue (Hongbo Li <[email protected]>) when applying too.
Quoted 73 lines
Add support for
STATX_DIOALIGNto erofs, so that direct I/O alignment restrictions are exposed to userspace in a generic way.[Before]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:0 dio offset align:0 ```[After]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:512 dio offset align:512 ```Signed-off-by Hongbo Li <[email protected]>Signed-off-by Gao Xiang <[email protected]>---
Hi Hongbo,I tidy up the patch a bit according to the current codebase, I will apply this later for this cycle.
Also r-v-bs are always welcome...
Thanks,
Gao Xiangfs/erofs/inode.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)fs/erofs/inode.c +17
-2@@ -334,14 +334,29 @@ int erofs_getattr(struct mnt_idmap *idmap, const struct path *path, unsigned int query_flags) {struct inode *const inode =d_inode (path->dentry); +bool compressed = +erofs_inode_is_data_compressed (EROFS_I (inode)->datalayout); -if (erofs_inode_is_data_compressed (EROFS_I (inode)->datalayout)) +if (compressed) stat->attributes |=STATX_ATTR_COMPRESSED ; - stat->attributes |=STATX_ATTR_IMMUTABLE ; stat->attributes_mask |= (STATX_ATTR_COMPRESSED |STATX_ATTR_IMMUTABLE ); +/* +* 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. +*/ +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; + } + }generic_fillattr (idmap, request_mask, inode, stat);return 0 ; }
Quoted 36 lines · Gao Xiang
Quoted 1 line · Gao Xiang
From: Hongbo Li via Linux-erofs <[email protected]>
Also I will fix the email address issue (Hongbo Li <[email protected]>) when applying too.
Quoted 28 lines
Add support for
STATX_DIOALIGNto erofs, so that direct I/O alignment restrictions are exposed to userspace in a generic way.[Before]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:0 dio offset align:0 ```[After]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:512 dio offset align:512 ```Signed-off-by Hongbo Li <[email protected]>Signed-off-by Gao Xiang <[email protected]>---
Hi Hongbo,I tidy up the patch a bit according to the current codebase, I will apply this later for this cycle.
it's ok, and thank you!
Thanks,
Hongbo
Quoted 44 lines
Quoted 44 lines
Also r-v-bs are always welcome...
Thanks,
Gao Xiang
fs/erofs/inode.c| 19 +++++++++++++++++--1 file changed, 17 insertions(+), 2 deletions(-)fs/erofs/inode.c +3
-2@@ -334,14 +334,29 @@ int erofs_getattr(struct mnt_idmap *idmap, conststruct path *path, unsigned int query_flags) { struct inode *const inode = d_inode(path->dentry); + bool compressed = + erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout); - if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) + if (compressed) stat->attributes |= STATX_ATTR_COMPRESSED; - stat->attributes |= STATX_ATTR_IMMUTABLE;
stat->attributes_mask|= (STATX_ATTR_COMPRESSED|STATX_ATTR_IMMUTABLE);
+ /*
+ * Return the DIO alignment restrictions if requested. + *
+ * In EROFS,STATX_DIOALIGNis not supported in ondemand mode and + * compressed files, so in these cases 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; + }
+ }
generic_fillattr(idmap, request_mask, inode, stat); return 0;
}
Quoted 31 lines · Gao Xiang
Quoted 1 line · Gao Xiang
From: Hongbo Li via Linux-erofs <[email protected]>
Also I will fix the email address issue (Hongbo Li <[email protected]>) when applying too.
Quoted 23 lines
Add support for
STATX_DIOALIGNto erofs, so that direct I/O alignment restrictions are exposed to userspace in a generic way.[Before]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:0 dio offset align:0 ```[After]
``` ./statx_test /mnt/erofs/testfile statx(/mnt/erofs/testfile) = 0 dio mem align:512 dio offset align:512 ```Signed-off-by Hongbo Li <[email protected]>Signed-off-by Gao Xiang <[email protected]>
Thanks,