* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-07-28 5:33 [PATCH v2] chattr/lsattr: Support dax attribute Xiao Yang
@ 2020-08-04 2:00 ` Xiao Yang
2020-08-07 16:03 ` Ira Weiny
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: Xiao Yang @ 2020-08-04 2:00 UTC (permalink / raw)
To: Xiao Yang; +Cc: darrick.wong, ira.weiny, tytso, ebiggers, linux-ext4
Hi,
Is there any comment on the v2 patch?
Thanks,
Xiao Yang
On 2020/7/28 13:33, Xiao Yang wrote:
> Use the letter 'x' to set/get dax attribute on a directory/file.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>
> V1->V2:
> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage.
> 2) Add more detailed description about 'x' attribute.
> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e.
> pagecache bypass) so remove the related info.
>
> lib/e2p/pf.c | 1 +
> lib/ext2fs/ext2_fs.h | 1 +
> misc/chattr.1.in | 15 ++++++++++++---
> misc/chattr.c | 3 ++-
> 4 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
> index 0c6998c4..e59cccff 100644
> --- a/lib/e2p/pf.c
> +++ b/lib/e2p/pf.c
> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
> { EXT4_EXTENTS_FL, "e", "Extents" },
> { FS_NOCOW_FL, "C", "No_COW" },
> + { FS_DAX_FL, "x", "Dax" },
> { EXT4_CASEFOLD_FL, "F", "Casefold" },
> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
> index 6c20ea77..88f510a3 100644
> --- a/lib/ext2fs/ext2_fs.h
> +++ b/lib/ext2fs/ext2_fs.h
> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
> index ff2fcf00..5a4928a5 100644
> --- a/misc/chattr.1.in
> +++ b/misc/chattr.1.in
> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
> .B chattr
> changes the file attributes on a Linux file system.
> .PP
> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
> .PP
> The operator '+' causes the selected attributes to be added to the
> existing attributes of the files; '-' causes them to be removed; and '='
> causes them to be the only attributes that the files have.
> .PP
> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
> append only (a),
> no atime updates (A),
> compressed (c),
> @@ -45,7 +45,8 @@ secure deletion (s),
> synchronous updates (S),
> no tail-merging (t),
> top of directory hierarchy (T),
> -and undeletable (u).
> +undeletable (u),
> +and direct access for files (x).
> .PP
> The following attributes are read-only, and may be listed by
> .BR lsattr (1)
> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
> make sure to read the bugs and limitations section at the end of this
> document.
> .TP
> +.B x
> +The 'x' attribute can be set on a directory or file. If the attribute
> +is set on an existing directory, it will be inherited by all files and
> +subdirectories that are subsequently created in the directory. If an
> +existing directory has contained some files and subdirectories, modifying
> +the attribute on the parent directory doesn't change the attributes on
> +these files and subdirectories.
> +.TP
> .B V
> A file with the 'V' attribute set has fs-verity enabled. It cannot be
> written to, and the filesystem will automatically verify all data read
> diff --git a/misc/chattr.c b/misc/chattr.c
> index a5d60170..c0337f86 100644
> --- a/misc/chattr.c
> +++ b/misc/chattr.c
> @@ -86,7 +86,7 @@ static unsigned long sf;
> static void usage(void)
> {
> fprintf(stderr,
> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
> program_name);
> exit(1);
> }
> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
> { EXT2_NOTAIL_FL, 't' },
> { EXT2_TOPDIR_FL, 'T' },
> { FS_NOCOW_FL, 'C' },
> + { FS_DAX_FL, 'x' },
> { EXT4_CASEFOLD_FL, 'F' },
> { 0, 0 }
> };
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-07-28 5:33 [PATCH v2] chattr/lsattr: Support dax attribute Xiao Yang
2020-08-04 2:00 ` Xiao Yang
@ 2020-08-07 16:03 ` Ira Weiny
2020-08-11 15:33 ` Xiao Yang
2020-08-12 23:25 ` Andreas Dilger
2020-08-12 23:29 ` Andreas Dilger
` (2 subsequent siblings)
4 siblings, 2 replies; 15+ messages in thread
From: Ira Weiny @ 2020-08-07 16:03 UTC (permalink / raw)
To: Xiao Yang; +Cc: darrick.wong, tytso, ebiggers, linux-ext4
On Tue, Jul 28, 2020 at 01:33:21PM +0800, Xiao Yang wrote:
> Use the letter 'x' to set/get dax attribute on a directory/file.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>
> V1->V2:
> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage.
> 2) Add more detailed description about 'x' attribute.
> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e.
> pagecache bypass) so remove the related info.
>
> lib/e2p/pf.c | 1 +
> lib/ext2fs/ext2_fs.h | 1 +
> misc/chattr.1.in | 15 ++++++++++++---
> misc/chattr.c | 3 ++-
> 4 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
> index 0c6998c4..e59cccff 100644
> --- a/lib/e2p/pf.c
> +++ b/lib/e2p/pf.c
> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
> { EXT4_EXTENTS_FL, "e", "Extents" },
> { FS_NOCOW_FL, "C", "No_COW" },
> + { FS_DAX_FL, "x", "Dax" },
> { EXT4_CASEFOLD_FL, "F", "Casefold" },
> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
> index 6c20ea77..88f510a3 100644
> --- a/lib/ext2fs/ext2_fs.h
> +++ b/lib/ext2fs/ext2_fs.h
> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
Per-file support is not supported on ext2...
So I'm suspicious of this change. It is probably not an issue but I just
wanted to check if you are trying to test on ext2?
Ira
> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
> index ff2fcf00..5a4928a5 100644
> --- a/misc/chattr.1.in
> +++ b/misc/chattr.1.in
> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
> .B chattr
> changes the file attributes on a Linux file system.
> .PP
> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
> .PP
> The operator '+' causes the selected attributes to be added to the
> existing attributes of the files; '-' causes them to be removed; and '='
> causes them to be the only attributes that the files have.
> .PP
> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
> append only (a),
> no atime updates (A),
> compressed (c),
> @@ -45,7 +45,8 @@ secure deletion (s),
> synchronous updates (S),
> no tail-merging (t),
> top of directory hierarchy (T),
> -and undeletable (u).
> +undeletable (u),
> +and direct access for files (x).
> .PP
> The following attributes are read-only, and may be listed by
> .BR lsattr (1)
> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
> make sure to read the bugs and limitations section at the end of this
> document.
> .TP
> +.B x
> +The 'x' attribute can be set on a directory or file. If the attribute
> +is set on an existing directory, it will be inherited by all files and
> +subdirectories that are subsequently created in the directory. If an
> +existing directory has contained some files and subdirectories, modifying
> +the attribute on the parent directory doesn't change the attributes on
> +these files and subdirectories.
> +.TP
> .B V
> A file with the 'V' attribute set has fs-verity enabled. It cannot be
> written to, and the filesystem will automatically verify all data read
> diff --git a/misc/chattr.c b/misc/chattr.c
> index a5d60170..c0337f86 100644
> --- a/misc/chattr.c
> +++ b/misc/chattr.c
> @@ -86,7 +86,7 @@ static unsigned long sf;
> static void usage(void)
> {
> fprintf(stderr,
> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
> program_name);
> exit(1);
> }
> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
> { EXT2_NOTAIL_FL, 't' },
> { EXT2_TOPDIR_FL, 'T' },
> { FS_NOCOW_FL, 'C' },
> + { FS_DAX_FL, 'x' },
> { EXT4_CASEFOLD_FL, 'F' },
> { 0, 0 }
> };
> --
> 2.21.0
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-08-07 16:03 ` Ira Weiny
@ 2020-08-11 15:33 ` Xiao Yang
2020-08-12 23:25 ` Andreas Dilger
1 sibling, 0 replies; 15+ messages in thread
From: Xiao Yang @ 2020-08-11 15:33 UTC (permalink / raw)
To: Ira Weiny; +Cc: darrick.wong, tytso, ebiggers, linux-ext4
On 2020/8/8 0:03, Ira Weiny wrote:
> On Tue, Jul 28, 2020 at 01:33:21PM +0800, Xiao Yang wrote:
>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>
>> V1->V2:
>> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage.
>> 2) Add more detailed description about 'x' attribute.
>> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e.
>> pagecache bypass) so remove the related info.
>>
>> lib/e2p/pf.c | 1 +
>> lib/ext2fs/ext2_fs.h | 1 +
>> misc/chattr.1.in | 15 ++++++++++++---
>> misc/chattr.c | 3 ++-
>> 4 files changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>> index 0c6998c4..e59cccff 100644
>> --- a/lib/e2p/pf.c
>> +++ b/lib/e2p/pf.c
>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>> { EXT4_EXTENTS_FL, "e", "Extents" },
>> { FS_NOCOW_FL, "C", "No_COW" },
>> + { FS_DAX_FL, "x", "Dax" },
>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>> index 6c20ea77..88f510a3 100644
>> --- a/lib/ext2fs/ext2_fs.h
>> +++ b/lib/ext2fs/ext2_fs.h
>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
> Per-file support is not supported on ext2...
>
> So I'm suspicious of this change. It is probably not an issue but I just
> wanted to check if you are trying to test on ext2?
Hi Ira,
Thanks for your reply. :-)
chattr failed to set the 'x' flag on ext2 sliently because ext2_ioctl()
in kernel drops
unsupported 'FS_DAX_FL' sliently:
----------------------------------------------
# touch file
# chattr +x file;echo $?
0
# lsattr file
--------------------- file
----------------------------------------------
ext2_ioctl() drops all unsupported flags sliently(see the following
code) so I am
not sure if we should return -EOPNOTSUPP for the unsupported FS_DAX_FL:
----------------------------------------------
long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
...
case EXT2_IOC_SETFLAGS: {
...
flags = flags & EXT2_FL_USER_MODIFIABLE;
flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE;
ei->i_flags = flags;
ext2_set_inode_flags(inode);
...
----------------------------------------------
Best Regards,
Xiao Yang
> Ira
>
>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>> index ff2fcf00..5a4928a5 100644
>> --- a/misc/chattr.1.in
>> +++ b/misc/chattr.1.in
>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
>> .B chattr
>> changes the file attributes on a Linux file system.
>> .PP
>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>> .PP
>> The operator '+' causes the selected attributes to be added to the
>> existing attributes of the files; '-' causes them to be removed; and '='
>> causes them to be the only attributes that the files have.
>> .PP
>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
>> append only (a),
>> no atime updates (A),
>> compressed (c),
>> @@ -45,7 +45,8 @@ secure deletion (s),
>> synchronous updates (S),
>> no tail-merging (t),
>> top of directory hierarchy (T),
>> -and undeletable (u).
>> +undeletable (u),
>> +and direct access for files (x).
>> .PP
>> The following attributes are read-only, and may be listed by
>> .BR lsattr (1)
>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
>> make sure to read the bugs and limitations section at the end of this
>> document.
>> .TP
>> +.B x
>> +The 'x' attribute can be set on a directory or file. If the attribute
>> +is set on an existing directory, it will be inherited by all files and
>> +subdirectories that are subsequently created in the directory. If an
>> +existing directory has contained some files and subdirectories, modifying
>> +the attribute on the parent directory doesn't change the attributes on
>> +these files and subdirectories.
>> +.TP
>> .B V
>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>> written to, and the filesystem will automatically verify all data read
>> diff --git a/misc/chattr.c b/misc/chattr.c
>> index a5d60170..c0337f86 100644
>> --- a/misc/chattr.c
>> +++ b/misc/chattr.c
>> @@ -86,7 +86,7 @@ static unsigned long sf;
>> static void usage(void)
>> {
>> fprintf(stderr,
>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
>> program_name);
>> exit(1);
>> }
>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>> { EXT2_NOTAIL_FL, 't' },
>> { EXT2_TOPDIR_FL, 'T' },
>> { FS_NOCOW_FL, 'C' },
>> + { FS_DAX_FL, 'x' },
>> { EXT4_CASEFOLD_FL, 'F' },
>> { 0, 0 }
>> };
>> --
>> 2.21.0
>>
>>
>>
>
> .
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-08-07 16:03 ` Ira Weiny
2020-08-11 15:33 ` Xiao Yang
@ 2020-08-12 23:25 ` Andreas Dilger
2020-08-13 1:06 ` Xiao Yang
1 sibling, 1 reply; 15+ messages in thread
From: Andreas Dilger @ 2020-08-12 23:25 UTC (permalink / raw)
To: Ira Weiny
Cc: Xiao Yang, Darrick J. Wong, Theodore Ts'o, Eric Biggers,
Ext4 Developers List
[-- Attachment #1: Type: text/plain, Size: 5212 bytes --]
On Aug 7, 2020, at 10:03 AM, Ira Weiny <ira.weiny@intel.com> wrote:
>
> On Tue, Jul 28, 2020 at 01:33:21PM +0800, Xiao Yang wrote:
>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>
>> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
>> ---
>>
>> V1->V2:
>> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage.
>> 2) Add more detailed description about 'x' attribute.
>> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e.
>> pagecache bypass) so remove the related info.
>>
>> lib/e2p/pf.c | 1 +
>> lib/ext2fs/ext2_fs.h | 1 +
>> misc/chattr.1.in | 15 ++++++++++++---
>> misc/chattr.c | 3 ++-
>> 4 files changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>> index 0c6998c4..e59cccff 100644
>> --- a/lib/e2p/pf.c
>> +++ b/lib/e2p/pf.c
>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>> { EXT4_EXTENTS_FL, "e", "Extents" },
>> { FS_NOCOW_FL, "C", "No_COW" },
>> + { FS_DAX_FL, "x", "Dax" },
>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>> index 6c20ea77..88f510a3 100644
>> --- a/lib/ext2fs/ext2_fs.h
>> +++ b/lib/ext2fs/ext2_fs.h
>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
>
> Per-file support is not supported on ext2...
>
> So I'm suspicious of this change. It is probably not an issue but I just
> wanted to check if you are trying to test on ext2?
It is up to the kernel to handle the various flags, definitely the chattr
command should not be trying to guess which flags are supported, since
this can definitely change between kernels and the underlying filesystems.
Note that the headers in e2fsprogs are all using "ext2" in the name,
regardless of the fact that the flags apply to ext3 and ext4.
Cheers, Andreas
>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>> index ff2fcf00..5a4928a5 100644
>> --- a/misc/chattr.1.in
>> +++ b/misc/chattr.1.in
>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
>> .B chattr
>> changes the file attributes on a Linux file system.
>> .PP
>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>> .PP
>> The operator '+' causes the selected attributes to be added to the
>> existing attributes of the files; '-' causes them to be removed; and '='
>> causes them to be the only attributes that the files have.
>> .PP
>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
>> append only (a),
>> no atime updates (A),
>> compressed (c),
>> @@ -45,7 +45,8 @@ secure deletion (s),
>> synchronous updates (S),
>> no tail-merging (t),
>> top of directory hierarchy (T),
>> -and undeletable (u).
>> +undeletable (u),
>> +and direct access for files (x).
>> .PP
>> The following attributes are read-only, and may be listed by
>> .BR lsattr (1)
>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
>> make sure to read the bugs and limitations section at the end of this
>> document.
>> .TP
>> +.B x
>> +The 'x' attribute can be set on a directory or file. If the attribute
>> +is set on an existing directory, it will be inherited by all files and
>> +subdirectories that are subsequently created in the directory. If an
>> +existing directory has contained some files and subdirectories, modifying
>> +the attribute on the parent directory doesn't change the attributes on
>> +these files and subdirectories.
>> +.TP
>> .B V
>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>> written to, and the filesystem will automatically verify all data read
>> diff --git a/misc/chattr.c b/misc/chattr.c
>> index a5d60170..c0337f86 100644
>> --- a/misc/chattr.c
>> +++ b/misc/chattr.c
>> @@ -86,7 +86,7 @@ static unsigned long sf;
>> static void usage(void)
>> {
>> fprintf(stderr,
>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
>> program_name);
>> exit(1);
>> }
>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>> { EXT2_NOTAIL_FL, 't' },
>> { EXT2_TOPDIR_FL, 'T' },
>> { FS_NOCOW_FL, 'C' },
>> + { FS_DAX_FL, 'x' },
>> { EXT4_CASEFOLD_FL, 'F' },
>> { 0, 0 }
>> };
>> --
>> 2.21.0
>>
>>
>>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-08-12 23:25 ` Andreas Dilger
@ 2020-08-13 1:06 ` Xiao Yang
0 siblings, 0 replies; 15+ messages in thread
From: Xiao Yang @ 2020-08-13 1:06 UTC (permalink / raw)
To: Andreas Dilger
Cc: Ira Weiny, Darrick J. Wong, Theodore Ts'o, Eric Biggers,
Ext4 Developers List
On 2020/8/13 7:25, Andreas Dilger wrote:
> On Aug 7, 2020, at 10:03 AM, Ira Weiny<ira.weiny@intel.com> wrote:
>> On Tue, Jul 28, 2020 at 01:33:21PM +0800, Xiao Yang wrote:
>>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>>
>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>> ---
>>>
>>> V1->V2:
>>> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage.
>>> 2) Add more detailed description about 'x' attribute.
>>> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e.
>>> pagecache bypass) so remove the related info.
>>>
>>> lib/e2p/pf.c | 1 +
>>> lib/ext2fs/ext2_fs.h | 1 +
>>> misc/chattr.1.in | 15 ++++++++++++---
>>> misc/chattr.c | 3 ++-
>>> 4 files changed, 16 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>>> index 0c6998c4..e59cccff 100644
>>> --- a/lib/e2p/pf.c
>>> +++ b/lib/e2p/pf.c
>>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>>> { EXT4_EXTENTS_FL, "e", "Extents" },
>>> { FS_NOCOW_FL, "C", "No_COW" },
>>> + { FS_DAX_FL, "x", "Dax" },
>>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>>> index 6c20ea77..88f510a3 100644
>>> --- a/lib/ext2fs/ext2_fs.h
>>> +++ b/lib/ext2fs/ext2_fs.h
>>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
>> Per-file support is not supported on ext2...
>>
>> So I'm suspicious of this change. It is probably not an issue but I just
>> wanted to check if you are trying to test on ext2?
> It is up to the kernel to handle the various flags, definitely the chattr
> command should not be trying to guess which flags are supported, since
> this can definitely change between kernels and the underlying filesystems.
Hi Andreas,
Agreed, the various flags are handled by kernel instead of chattr
command. :-)
Best Regards,
Xiao Yang
> Note that the headers in e2fsprogs are all using "ext2" in the name,
> regardless of the fact that the flags apply to ext3 and ext4.
>
> Cheers, Andreas
>
>>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
>>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
>>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
>>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>>> index ff2fcf00..5a4928a5 100644
>>> --- a/misc/chattr.1.in
>>> +++ b/misc/chattr.1.in
>>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
>>> .B chattr
>>> changes the file attributes on a Linux file system.
>>> .PP
>>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>>> .PP
>>> The operator '+' causes the selected attributes to be added to the
>>> existing attributes of the files; '-' causes them to be removed; and '='
>>> causes them to be the only attributes that the files have.
>>> .PP
>>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
>>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
>>> append only (a),
>>> no atime updates (A),
>>> compressed (c),
>>> @@ -45,7 +45,8 @@ secure deletion (s),
>>> synchronous updates (S),
>>> no tail-merging (t),
>>> top of directory hierarchy (T),
>>> -and undeletable (u).
>>> +undeletable (u),
>>> +and direct access for files (x).
>>> .PP
>>> The following attributes are read-only, and may be listed by
>>> .BR lsattr (1)
>>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
>>> make sure to read the bugs and limitations section at the end of this
>>> document.
>>> .TP
>>> +.B x
>>> +The 'x' attribute can be set on a directory or file. If the attribute
>>> +is set on an existing directory, it will be inherited by all files and
>>> +subdirectories that are subsequently created in the directory. If an
>>> +existing directory has contained some files and subdirectories, modifying
>>> +the attribute on the parent directory doesn't change the attributes on
>>> +these files and subdirectories.
>>> +.TP
>>> .B V
>>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>>> written to, and the filesystem will automatically verify all data read
>>> diff --git a/misc/chattr.c b/misc/chattr.c
>>> index a5d60170..c0337f86 100644
>>> --- a/misc/chattr.c
>>> +++ b/misc/chattr.c
>>> @@ -86,7 +86,7 @@ static unsigned long sf;
>>> static void usage(void)
>>> {
>>> fprintf(stderr,
>>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
>>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
>>> program_name);
>>> exit(1);
>>> }
>>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>>> { EXT2_NOTAIL_FL, 't' },
>>> { EXT2_TOPDIR_FL, 'T' },
>>> { FS_NOCOW_FL, 'C' },
>>> + { FS_DAX_FL, 'x' },
>>> { EXT4_CASEFOLD_FL, 'F' },
>>> { 0, 0 }
>>> };
>>> --
>>> 2.21.0
>>>
>>>
>>>
>
> Cheers, Andreas
>
>
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-07-28 5:33 [PATCH v2] chattr/lsattr: Support dax attribute Xiao Yang
2020-08-04 2:00 ` Xiao Yang
2020-08-07 16:03 ` Ira Weiny
@ 2020-08-12 23:29 ` Andreas Dilger
2020-08-13 1:42 ` Xiao Yang
2020-09-18 0:52 ` Ira Weiny
2020-10-01 20:56 ` Theodore Y. Ts'o
4 siblings, 1 reply; 15+ messages in thread
From: Andreas Dilger @ 2020-08-12 23:29 UTC (permalink / raw)
To: Xiao Yang
Cc: Darrick J. Wong, Ira Weiny, Theodore Ts'o, Eric Biggers,
Ext4 Developers List
[-- Attachment #1: Type: text/plain, Size: 4179 bytes --]
On Jul 27, 2020, at 11:33 PM, Xiao Yang <yangx.jy@cn.fujitsu.com> wrote:
>
> Use the letter 'x' to set/get dax attribute on a directory/file.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
One minor nit below, but otherwise looks OK.
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
> index 0c6998c4..e59cccff 100644
> --- a/lib/e2p/pf.c
> +++ b/lib/e2p/pf.c
> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
> { EXT4_EXTENTS_FL, "e", "Extents" },
> { FS_NOCOW_FL, "C", "No_COW" },
> + { FS_DAX_FL, "x", "Dax" },
Should this be "DAX" ? That is how it is commonly used in the kernel.
> { EXT4_CASEFOLD_FL, "F", "Casefold" },
> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
> index 6c20ea77..88f510a3 100644
> --- a/lib/ext2fs/ext2_fs.h
> +++ b/lib/ext2fs/ext2_fs.h
> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
> index ff2fcf00..5a4928a5 100644
> --- a/misc/chattr.1.in
> +++ b/misc/chattr.1.in
> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
> .B chattr
> changes the file attributes on a Linux file system.
> .PP
> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
> .PP
> The operator '+' causes the selected attributes to be added to the
> existing attributes of the files; '-' causes them to be removed; and '='
> causes them to be the only attributes that the files have.
> .PP
> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
> append only (a),
> no atime updates (A),
> compressed (c),
> @@ -45,7 +45,8 @@ secure deletion (s),
> synchronous updates (S),
> no tail-merging (t),
> top of directory hierarchy (T),
> -and undeletable (u).
> +undeletable (u),
> +and direct access for files (x).
> .PP
> The following attributes are read-only, and may be listed by
> .BR lsattr (1)
> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
> make sure to read the bugs and limitations section at the end of this
> document.
> .TP
> +.B x
> +The 'x' attribute can be set on a directory or file. If the attribute
> +is set on an existing directory, it will be inherited by all files and
> +subdirectories that are subsequently created in the directory. If an
> +existing directory has contained some files and subdirectories, modifying
> +the attribute on the parent directory doesn't change the attributes on
> +these files and subdirectories.
> +.TP
> .B V
> A file with the 'V' attribute set has fs-verity enabled. It cannot be
> written to, and the filesystem will automatically verify all data read
> diff --git a/misc/chattr.c b/misc/chattr.c
> index a5d60170..c0337f86 100644
> --- a/misc/chattr.c
> +++ b/misc/chattr.c
> @@ -86,7 +86,7 @@ static unsigned long sf;
> static void usage(void)
> {
> fprintf(stderr,
> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
> program_name);
> exit(1);
> }
> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
> { EXT2_NOTAIL_FL, 't' },
> { EXT2_TOPDIR_FL, 'T' },
> { FS_NOCOW_FL, 'C' },
> + { FS_DAX_FL, 'x' },
> { EXT4_CASEFOLD_FL, 'F' },
> { 0, 0 }
> };
> --
> 2.21.0
>
>
>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-08-12 23:29 ` Andreas Dilger
@ 2020-08-13 1:42 ` Xiao Yang
2020-08-28 1:33 ` Xiao Yang
0 siblings, 1 reply; 15+ messages in thread
From: Xiao Yang @ 2020-08-13 1:42 UTC (permalink / raw)
To: Andreas Dilger
Cc: Darrick J. Wong, Ira Weiny, Theodore Ts'o, Eric Biggers,
Ext4 Developers List
On 2020/8/13 7:29, Andreas Dilger wrote:
> On Jul 27, 2020, at 11:33 PM, Xiao Yang<yangx.jy@cn.fujitsu.com> wrote:
>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
> One minor nit below, but otherwise looks OK.
>
> Reviewed-by: Andreas Dilger<adilger@dilger.ca>
>
>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>> index 0c6998c4..e59cccff 100644
>> --- a/lib/e2p/pf.c
>> +++ b/lib/e2p/pf.c
>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>> { EXT4_EXTENTS_FL, "e", "Extents" },
>> { FS_NOCOW_FL, "C", "No_COW" },
>> + { FS_DAX_FL, "x", "Dax" },
> Should this be "DAX" ? That is how it is commonly used in the kernel.
Hi Andreas,
Thanks a lot for your review.
Either 'Dax' or 'DAX' is fine to me because it is just the output of
lsattr -v.
For example, xfs_io shows 'dax' instead of 'DAX':
# xfs_io -c "lsattr -v" file
[dax] file
BTW:
I just used 'Dax' to follow the current format of output(i.e. capitalize
the first letter).
Do you want me to send v3 patch with the 'DAX'? :-)
Best Regards,
Xiao Yang
>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>> index 6c20ea77..88f510a3 100644
>> --- a/lib/ext2fs/ext2_fs.h
>> +++ b/lib/ext2fs/ext2_fs.h
>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>> index ff2fcf00..5a4928a5 100644
>> --- a/misc/chattr.1.in
>> +++ b/misc/chattr.1.in
>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
>> .B chattr
>> changes the file attributes on a Linux file system.
>> .PP
>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>> .PP
>> The operator '+' causes the selected attributes to be added to the
>> existing attributes of the files; '-' causes them to be removed; and '='
>> causes them to be the only attributes that the files have.
>> .PP
>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
>> append only (a),
>> no atime updates (A),
>> compressed (c),
>> @@ -45,7 +45,8 @@ secure deletion (s),
>> synchronous updates (S),
>> no tail-merging (t),
>> top of directory hierarchy (T),
>> -and undeletable (u).
>> +undeletable (u),
>> +and direct access for files (x).
>> .PP
>> The following attributes are read-only, and may be listed by
>> .BR lsattr (1)
>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
>> make sure to read the bugs and limitations section at the end of this
>> document.
>> .TP
>> +.B x
>> +The 'x' attribute can be set on a directory or file. If the attribute
>> +is set on an existing directory, it will be inherited by all files and
>> +subdirectories that are subsequently created in the directory. If an
>> +existing directory has contained some files and subdirectories, modifying
>> +the attribute on the parent directory doesn't change the attributes on
>> +these files and subdirectories.
>> +.TP
>> .B V
>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>> written to, and the filesystem will automatically verify all data read
>> diff --git a/misc/chattr.c b/misc/chattr.c
>> index a5d60170..c0337f86 100644
>> --- a/misc/chattr.c
>> +++ b/misc/chattr.c
>> @@ -86,7 +86,7 @@ static unsigned long sf;
>> static void usage(void)
>> {
>> fprintf(stderr,
>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
>> program_name);
>> exit(1);
>> }
>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>> { EXT2_NOTAIL_FL, 't' },
>> { EXT2_TOPDIR_FL, 'T' },
>> { FS_NOCOW_FL, 'C' },
>> + { FS_DAX_FL, 'x' },
>> { EXT4_CASEFOLD_FL, 'F' },
>> { 0, 0 }
>> };
>> --
>> 2.21.0
>>
>>
>>
>
> Cheers, Andreas
>
>
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-08-13 1:42 ` Xiao Yang
@ 2020-08-28 1:33 ` Xiao Yang
2020-08-28 8:22 ` Andreas Dilger
0 siblings, 1 reply; 15+ messages in thread
From: Xiao Yang @ 2020-08-28 1:33 UTC (permalink / raw)
To: Andreas Dilger
Cc: Darrick J. Wong, Ira Weiny, Theodore Ts'o, Eric Biggers,
Ext4 Developers List
Hi,
Is there any comment on the patch? :-)
Thanks,
Xiao Yang
On 2020/8/13 9:42, Xiao Yang wrote:
> On 2020/8/13 7:29, Andreas Dilger wrote:
>> On Jul 27, 2020, at 11:33 PM, Xiao Yang<yangx.jy@cn.fujitsu.com> wrote:
>>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>>
>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> One minor nit below, but otherwise looks OK.
>>
>> Reviewed-by: Andreas Dilger<adilger@dilger.ca>
>>
>>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>>> index 0c6998c4..e59cccff 100644
>>> --- a/lib/e2p/pf.c
>>> +++ b/lib/e2p/pf.c
>>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>>> { EXT4_EXTENTS_FL, "e", "Extents" },
>>> { FS_NOCOW_FL, "C", "No_COW" },
>>> + { FS_DAX_FL, "x", "Dax" },
>> Should this be "DAX" ? That is how it is commonly used in the kernel.
> Hi Andreas,
>
> Thanks a lot for your review.
>
> Either 'Dax' or 'DAX' is fine to me because it is just the output of
> lsattr -v.
> For example, xfs_io shows 'dax' instead of 'DAX':
> # xfs_io -c "lsattr -v" file
> [dax] file
>
> BTW:
> I just used 'Dax' to follow the current format of output(i.e.
> capitalize the first letter).
>
> Do you want me to send v3 patch with the 'DAX'? :-)
>
> Best Regards,
> Xiao Yang
>>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>>> index 6c20ea77..88f510a3 100644
>>> --- a/lib/ext2fs/ext2_fs.h
>>> +++ b/lib/ext2fs/ext2_fs.h
>>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
>>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being
>>> deleted */
>>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot
>>> shrink has completed */
>>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline
>>> data */
>>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>>> index ff2fcf00..5a4928a5 100644
>>> --- a/misc/chattr.1.in
>>> +++ b/misc/chattr.1.in
>>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file
>>> system
>>> .B chattr
>>> changes the file attributes on a Linux file system.
>>> .PP
>>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>>> .PP
>>> The operator '+' causes the selected attributes to be added to the
>>> existing attributes of the files; '-' causes them to be removed; and
>>> '='
>>> causes them to be the only attributes that the files have.
>>> .PP
>>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the
>>> files:
>>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the
>>> files:
>>> append only (a),
>>> no atime updates (A),
>>> compressed (c),
>>> @@ -45,7 +45,8 @@ secure deletion (s),
>>> synchronous updates (S),
>>> no tail-merging (t),
>>> top of directory hierarchy (T),
>>> -and undeletable (u).
>>> +undeletable (u),
>>> +and direct access for files (x).
>>> .PP
>>> The following attributes are read-only, and may be listed by
>>> .BR lsattr (1)
>>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its
>>> undeletion. Note: please
>>> make sure to read the bugs and limitations section at the end of this
>>> document.
>>> .TP
>>> +.B x
>>> +The 'x' attribute can be set on a directory or file. If the attribute
>>> +is set on an existing directory, it will be inherited by all files and
>>> +subdirectories that are subsequently created in the directory. If an
>>> +existing directory has contained some files and subdirectories,
>>> modifying
>>> +the attribute on the parent directory doesn't change the attributes on
>>> +these files and subdirectories.
>>> +.TP
>>> .B V
>>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>>> written to, and the filesystem will automatically verify all data read
>>> diff --git a/misc/chattr.c b/misc/chattr.c
>>> index a5d60170..c0337f86 100644
>>> --- a/misc/chattr.c
>>> +++ b/misc/chattr.c
>>> @@ -86,7 +86,7 @@ static unsigned long sf;
>>> static void usage(void)
>>> {
>>> fprintf(stderr,
>>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version]
>>> files...\n"),
>>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version]
>>> files...\n"),
>>> program_name);
>>> exit(1);
>>> }
>>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>>> { EXT2_NOTAIL_FL, 't' },
>>> { EXT2_TOPDIR_FL, 'T' },
>>> { FS_NOCOW_FL, 'C' },
>>> + { FS_DAX_FL, 'x' },
>>> { EXT4_CASEFOLD_FL, 'F' },
>>> { 0, 0 }
>>> };
>>> --
>>> 2.21.0
>>>
>>>
>>>
>>
>> Cheers, Andreas
>>
>>
>>
>>
>>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-08-28 1:33 ` Xiao Yang
@ 2020-08-28 8:22 ` Andreas Dilger
2020-09-17 3:31 ` Xiao Yang
0 siblings, 1 reply; 15+ messages in thread
From: Andreas Dilger @ 2020-08-28 8:22 UTC (permalink / raw)
To: Xiao Yang
Cc: Darrick J. Wong, Ira Weiny, Theodore Ts'o, Eric Biggers,
Ext4 Developers List
[-- Attachment #1: Type: text/plain, Size: 5429 bytes --]
On Aug 27, 2020, at 7:33 PM, Xiao Yang <yangx.jy@cn.fujitsu.com> wrote:
>
> Hi,
>
> Is there any comment on the patch? :-)
I don't need a v3 for the Dax vs. DAX case, though I think DAX would be
better. The decision is up to Ted.
Cheers, Andreas
>
> Thanks,
> Xiao Yang
> On 2020/8/13 9:42, Xiao Yang wrote:
>> On 2020/8/13 7:29, Andreas Dilger wrote:
>>> On Jul 27, 2020, at 11:33 PM, Xiao Yang<yangx.jy@cn.fujitsu.com> wrote:
>>>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>>>
>>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>> One minor nit below, but otherwise looks OK.
>>>
>>> Reviewed-by: Andreas Dilger<adilger@dilger.ca>
>>>
>>>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>>>> index 0c6998c4..e59cccff 100644
>>>> --- a/lib/e2p/pf.c
>>>> +++ b/lib/e2p/pf.c
>>>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>>>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>>>> { EXT4_EXTENTS_FL, "e", "Extents" },
>>>> { FS_NOCOW_FL, "C", "No_COW" },
>>>> + { FS_DAX_FL, "x", "Dax" },
>>> Should this be "DAX" ? That is how it is commonly used in the kernel.
>> Hi Andreas,
>>
>> Thanks a lot for your review.
>>
>> Either 'Dax' or 'DAX' is fine to me because it is just the output of lsattr -v.
>> For example, xfs_io shows 'dax' instead of 'DAX':
>> # xfs_io -c "lsattr -v" file
>> [dax] file
>>
>> BTW:
>> I just used 'Dax' to follow the current format of output(i.e. capitalize the first letter).
>>
>> Do you want me to send v3 patch with the 'DAX'? :-)
>>
>> Best Regards,
>> Xiao Yang
>>>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>>>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>>>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>>>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>>>> index 6c20ea77..88f510a3 100644
>>>> --- a/lib/ext2fs/ext2_fs.h
>>>> +++ b/lib/ext2fs/ext2_fs.h
>>>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>>>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>>>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>>>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>>>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
>>>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
>>>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
>>>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
>>>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>>>> index ff2fcf00..5a4928a5 100644
>>>> --- a/misc/chattr.1.in
>>>> +++ b/misc/chattr.1.in
>>>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
>>>> .B chattr
>>>> changes the file attributes on a Linux file system.
>>>> .PP
>>>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>>>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>>>> .PP
>>>> The operator '+' causes the selected attributes to be added to the
>>>> existing attributes of the files; '-' causes them to be removed; and '='
>>>> causes them to be the only attributes that the files have.
>>>> .PP
>>>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
>>>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
>>>> append only (a),
>>>> no atime updates (A),
>>>> compressed (c),
>>>> @@ -45,7 +45,8 @@ secure deletion (s),
>>>> synchronous updates (S),
>>>> no tail-merging (t),
>>>> top of directory hierarchy (T),
>>>> -and undeletable (u).
>>>> +undeletable (u),
>>>> +and direct access for files (x).
>>>> .PP
>>>> The following attributes are read-only, and may be listed by
>>>> .BR lsattr (1)
>>>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
>>>> make sure to read the bugs and limitations section at the end of this
>>>> document.
>>>> .TP
>>>> +.B x
>>>> +The 'x' attribute can be set on a directory or file. If the attribute
>>>> +is set on an existing directory, it will be inherited by all files and
>>>> +subdirectories that are subsequently created in the directory. If an
>>>> +existing directory has contained some files and subdirectories, modifying
>>>> +the attribute on the parent directory doesn't change the attributes on
>>>> +these files and subdirectories.
>>>> +.TP
>>>> .B V
>>>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>>>> written to, and the filesystem will automatically verify all data read
>>>> diff --git a/misc/chattr.c b/misc/chattr.c
>>>> index a5d60170..c0337f86 100644
>>>> --- a/misc/chattr.c
>>>> +++ b/misc/chattr.c
>>>> @@ -86,7 +86,7 @@ static unsigned long sf;
>>>> static void usage(void)
>>>> {
>>>> fprintf(stderr,
>>>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
>>>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
>>>> program_name);
>>>> exit(1);
>>>> }
>>>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>>>> { EXT2_NOTAIL_FL, 't' },
>>>> { EXT2_TOPDIR_FL, 'T' },
>>>> { FS_NOCOW_FL, 'C' },
>>>> + { FS_DAX_FL, 'x' },
>>>> { EXT4_CASEFOLD_FL, 'F' },
>>>> { 0, 0 }
>>>> };
>>>> --
>>>> 2.21.0
>>>>
>>>>
>>>>
>>>
>>> Cheers, Andreas
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-08-28 8:22 ` Andreas Dilger
@ 2020-09-17 3:31 ` Xiao Yang
0 siblings, 0 replies; 15+ messages in thread
From: Xiao Yang @ 2020-09-17 3:31 UTC (permalink / raw)
To: Theodore Ts'o
Cc: Andreas Dilger, Darrick J. Wong, Ira Weiny, Eric Biggers,
Ext4 Developers List
Hi,
Ping :-)
Best Regards,
Xiao Yang
On 2020/8/28 16:22, Andreas Dilger wrote:
> On Aug 27, 2020, at 7:33 PM, Xiao Yang<yangx.jy@cn.fujitsu.com> wrote:
>> Hi,
>>
>> Is there any comment on the patch? :-)
> I don't need a v3 for the Dax vs. DAX case, though I think DAX would be
> better. The decision is up to Ted.
>
> Cheers, Andreas
>
>> Thanks,
>> Xiao Yang
>> On 2020/8/13 9:42, Xiao Yang wrote:
>>> On 2020/8/13 7:29, Andreas Dilger wrote:
>>>> On Jul 27, 2020, at 11:33 PM, Xiao Yang<yangx.jy@cn.fujitsu.com> wrote:
>>>>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>>>>
>>>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>>> One minor nit below, but otherwise looks OK.
>>>>
>>>> Reviewed-by: Andreas Dilger<adilger@dilger.ca>
>>>>
>>>>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>>>>> index 0c6998c4..e59cccff 100644
>>>>> --- a/lib/e2p/pf.c
>>>>> +++ b/lib/e2p/pf.c
>>>>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>>>>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>>>>> { EXT4_EXTENTS_FL, "e", "Extents" },
>>>>> { FS_NOCOW_FL, "C", "No_COW" },
>>>>> + { FS_DAX_FL, "x", "Dax" },
>>>> Should this be "DAX" ? That is how it is commonly used in the kernel.
>>> Hi Andreas,
>>>
>>> Thanks a lot for your review.
>>>
>>> Either 'Dax' or 'DAX' is fine to me because it is just the output of lsattr -v.
>>> For example, xfs_io shows 'dax' instead of 'DAX':
>>> # xfs_io -c "lsattr -v" file
>>> [dax] file
>>>
>>> BTW:
>>> I just used 'Dax' to follow the current format of output(i.e. capitalize the first letter).
>>>
>>> Do you want me to send v3 patch with the 'DAX'? :-)
>>>
>>> Best Regards,
>>> Xiao Yang
>>>>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>>>>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>>>>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>>>>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>>>>> index 6c20ea77..88f510a3 100644
>>>>> --- a/lib/ext2fs/ext2_fs.h
>>>>> +++ b/lib/ext2fs/ext2_fs.h
>>>>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>>>>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>>>>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>>>>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>>>>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
>>>>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
>>>>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
>>>>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
>>>>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>>>>> index ff2fcf00..5a4928a5 100644
>>>>> --- a/misc/chattr.1.in
>>>>> +++ b/misc/chattr.1.in
>>>>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
>>>>> .B chattr
>>>>> changes the file attributes on a Linux file system.
>>>>> .PP
>>>>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>>>>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>>>>> .PP
>>>>> The operator '+' causes the selected attributes to be added to the
>>>>> existing attributes of the files; '-' causes them to be removed; and '='
>>>>> causes them to be the only attributes that the files have.
>>>>> .PP
>>>>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
>>>>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
>>>>> append only (a),
>>>>> no atime updates (A),
>>>>> compressed (c),
>>>>> @@ -45,7 +45,8 @@ secure deletion (s),
>>>>> synchronous updates (S),
>>>>> no tail-merging (t),
>>>>> top of directory hierarchy (T),
>>>>> -and undeletable (u).
>>>>> +undeletable (u),
>>>>> +and direct access for files (x).
>>>>> .PP
>>>>> The following attributes are read-only, and may be listed by
>>>>> .BR lsattr (1)
>>>>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
>>>>> make sure to read the bugs and limitations section at the end of this
>>>>> document.
>>>>> .TP
>>>>> +.B x
>>>>> +The 'x' attribute can be set on a directory or file. If the attribute
>>>>> +is set on an existing directory, it will be inherited by all files and
>>>>> +subdirectories that are subsequently created in the directory. If an
>>>>> +existing directory has contained some files and subdirectories, modifying
>>>>> +the attribute on the parent directory doesn't change the attributes on
>>>>> +these files and subdirectories.
>>>>> +.TP
>>>>> .B V
>>>>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>>>>> written to, and the filesystem will automatically verify all data read
>>>>> diff --git a/misc/chattr.c b/misc/chattr.c
>>>>> index a5d60170..c0337f86 100644
>>>>> --- a/misc/chattr.c
>>>>> +++ b/misc/chattr.c
>>>>> @@ -86,7 +86,7 @@ static unsigned long sf;
>>>>> static void usage(void)
>>>>> {
>>>>> fprintf(stderr,
>>>>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
>>>>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
>>>>> program_name);
>>>>> exit(1);
>>>>> }
>>>>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>>>>> { EXT2_NOTAIL_FL, 't' },
>>>>> { EXT2_TOPDIR_FL, 'T' },
>>>>> { FS_NOCOW_FL, 'C' },
>>>>> + { FS_DAX_FL, 'x' },
>>>>> { EXT4_CASEFOLD_FL, 'F' },
>>>>> { 0, 0 }
>>>>> };
>>>>> --
>>>>> 2.21.0
>>>>>
>>>>>
>>>>>
>>>> Cheers, Andreas
>
> Cheers, Andreas
>
>
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-07-28 5:33 [PATCH v2] chattr/lsattr: Support dax attribute Xiao Yang
` (2 preceding siblings ...)
2020-08-12 23:29 ` Andreas Dilger
@ 2020-09-18 0:52 ` Ira Weiny
2020-09-21 2:15 ` Xiao Yang
2020-10-01 20:56 ` Theodore Y. Ts'o
4 siblings, 1 reply; 15+ messages in thread
From: Ira Weiny @ 2020-09-18 0:52 UTC (permalink / raw)
To: Xiao Yang; +Cc: darrick.wong, tytso, ebiggers, linux-ext4
On Mon, Jul 27, 2020 at 10:33:21PM -0700, Xiao Yang wrote:
> Use the letter 'x' to set/get dax attribute on a directory/file.
This may allow the flag to be set but I don't think this implements the logic
within ext2 to properly support the flag does it?
Just a quick look shows that ext2_ioctl() does not have any dax checks in it
and you don't add them here?
So how does this work? Does ext2 share all the code with ext4 to make it work?
Ira
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>
> V1->V2:
> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage.
> 2) Add more detailed description about 'x' attribute.
> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e.
> pagecache bypass) so remove the related info.
>
> lib/e2p/pf.c | 1 +
> lib/ext2fs/ext2_fs.h | 1 +
> misc/chattr.1.in | 15 ++++++++++++---
> misc/chattr.c | 3 ++-
> 4 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
> index 0c6998c4..e59cccff 100644
> --- a/lib/e2p/pf.c
> +++ b/lib/e2p/pf.c
> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
> { EXT4_EXTENTS_FL, "e", "Extents" },
> { FS_NOCOW_FL, "C", "No_COW" },
> + { FS_DAX_FL, "x", "Dax" },
> { EXT4_CASEFOLD_FL, "F", "Casefold" },
> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
> index 6c20ea77..88f510a3 100644
> --- a/lib/ext2fs/ext2_fs.h
> +++ b/lib/ext2fs/ext2_fs.h
> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
> index ff2fcf00..5a4928a5 100644
> --- a/misc/chattr.1.in
> +++ b/misc/chattr.1.in
> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
> .B chattr
> changes the file attributes on a Linux file system.
> .PP
> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
> .PP
> The operator '+' causes the selected attributes to be added to the
> existing attributes of the files; '-' causes them to be removed; and '='
> causes them to be the only attributes that the files have.
> .PP
> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
> append only (a),
> no atime updates (A),
> compressed (c),
> @@ -45,7 +45,8 @@ secure deletion (s),
> synchronous updates (S),
> no tail-merging (t),
> top of directory hierarchy (T),
> -and undeletable (u).
> +undeletable (u),
> +and direct access for files (x).
> .PP
> The following attributes are read-only, and may be listed by
> .BR lsattr (1)
> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
> make sure to read the bugs and limitations section at the end of this
> document.
> .TP
> +.B x
> +The 'x' attribute can be set on a directory or file. If the attribute
> +is set on an existing directory, it will be inherited by all files and
> +subdirectories that are subsequently created in the directory. If an
> +existing directory has contained some files and subdirectories, modifying
> +the attribute on the parent directory doesn't change the attributes on
> +these files and subdirectories.
> +.TP
> .B V
> A file with the 'V' attribute set has fs-verity enabled. It cannot be
> written to, and the filesystem will automatically verify all data read
> diff --git a/misc/chattr.c b/misc/chattr.c
> index a5d60170..c0337f86 100644
> --- a/misc/chattr.c
> +++ b/misc/chattr.c
> @@ -86,7 +86,7 @@ static unsigned long sf;
> static void usage(void)
> {
> fprintf(stderr,
> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
> program_name);
> exit(1);
> }
> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
> { EXT2_NOTAIL_FL, 't' },
> { EXT2_TOPDIR_FL, 'T' },
> { FS_NOCOW_FL, 'C' },
> + { FS_DAX_FL, 'x' },
> { EXT4_CASEFOLD_FL, 'F' },
> { 0, 0 }
> };
> --
> 2.21.0
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-09-18 0:52 ` Ira Weiny
@ 2020-09-21 2:15 ` Xiao Yang
0 siblings, 0 replies; 15+ messages in thread
From: Xiao Yang @ 2020-09-21 2:15 UTC (permalink / raw)
To: Ira Weiny; +Cc: darrick.wong, tytso, ebiggers, linux-ext4
On 2020/9/18 8:52, Ira Weiny wrote:
> On Mon, Jul 27, 2020 at 10:33:21PM -0700, Xiao Yang wrote:
>> Use the letter 'x' to set/get dax attribute on a directory/file.
> This may allow the flag to be set but I don't think this implements the logic
> within ext2 to properly support the flag does it?
Hi Ira,
In ext2, the dax flag cannot be set because ext2_ioctl() uses
EXT2_FL_USER_MODIFIABLE to drop
the unsupported flag.
> Just a quick look shows that ext2_ioctl() does not have any dax checks in it
> and you don't add them here?
The dax flag never be passed into ext2 actually so I don't think we need
some dax checks.
> So how does this work? Does ext2 share all the code with ext4 to make it work?
1) ext2 without CONFIG_EXT4_USE_FOR_EXT2 unsupports the dax flag and
ignores it sliently.
2) ext2 with CONFIG_EXT4_USE_FOR_EXT2 supports the dax flag.
Thanks,
Xiao Yang
> Ira
>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>
>> V1->V2:
>> 1) Define FS_DAX_FL in order and add missing 'x' letter in manpage.
>> 2) Add more detailed description about 'x' attribute.
>> 3) 'x' is a separate attribute and doesn't always affect S_DAX(i.e.
>> pagecache bypass) so remove the related info.
>>
>> lib/e2p/pf.c | 1 +
>> lib/ext2fs/ext2_fs.h | 1 +
>> misc/chattr.1.in | 15 ++++++++++++---
>> misc/chattr.c | 3 ++-
>> 4 files changed, 16 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
>> index 0c6998c4..e59cccff 100644
>> --- a/lib/e2p/pf.c
>> +++ b/lib/e2p/pf.c
>> @@ -44,6 +44,7 @@ static struct flags_name flags_array[] = {
>> { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" },
>> { EXT4_EXTENTS_FL, "e", "Extents" },
>> { FS_NOCOW_FL, "C", "No_COW" },
>> + { FS_DAX_FL, "x", "Dax" },
>> { EXT4_CASEFOLD_FL, "F", "Casefold" },
>> { EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
>> { EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
>> diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
>> index 6c20ea77..88f510a3 100644
>> --- a/lib/ext2fs/ext2_fs.h
>> +++ b/lib/ext2fs/ext2_fs.h
>> @@ -335,6 +335,7 @@ struct ext2_dx_tail {
>> /* EXT4_EOFBLOCKS_FL 0x00400000 was here */
>> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
>> #define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */
>> +#define FS_DAX_FL 0x02000000 /* Inode is DAX */
>> #define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */
>> #define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */
>> #define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */
>> diff --git a/misc/chattr.1.in b/misc/chattr.1.in
>> index ff2fcf00..5a4928a5 100644
>> --- a/misc/chattr.1.in
>> +++ b/misc/chattr.1.in
>> @@ -23,13 +23,13 @@ chattr \- change file attributes on a Linux file system
>> .B chattr
>> changes the file attributes on a Linux file system.
>> .PP
>> -The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
>> +The format of a symbolic mode is +-=[aAcCdDeFijPsStTux].
>> .PP
>> The operator '+' causes the selected attributes to be added to the
>> existing attributes of the files; '-' causes them to be removed; and '='
>> causes them to be the only attributes that the files have.
>> .PP
>> -The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
>> +The letters 'aAcCdDeFijPsStTux' select the new attributes for the files:
>> append only (a),
>> no atime updates (A),
>> compressed (c),
>> @@ -45,7 +45,8 @@ secure deletion (s),
>> synchronous updates (S),
>> no tail-merging (t),
>> top of directory hierarchy (T),
>> -and undeletable (u).
>> +undeletable (u),
>> +and direct access for files (x).
>> .PP
>> The following attributes are read-only, and may be listed by
>> .BR lsattr (1)
>> @@ -210,6 +211,14 @@ saved. This allows the user to ask for its undeletion. Note: please
>> make sure to read the bugs and limitations section at the end of this
>> document.
>> .TP
>> +.B x
>> +The 'x' attribute can be set on a directory or file. If the attribute
>> +is set on an existing directory, it will be inherited by all files and
>> +subdirectories that are subsequently created in the directory. If an
>> +existing directory has contained some files and subdirectories, modifying
>> +the attribute on the parent directory doesn't change the attributes on
>> +these files and subdirectories.
>> +.TP
>> .B V
>> A file with the 'V' attribute set has fs-verity enabled. It cannot be
>> written to, and the filesystem will automatically verify all data read
>> diff --git a/misc/chattr.c b/misc/chattr.c
>> index a5d60170..c0337f86 100644
>> --- a/misc/chattr.c
>> +++ b/misc/chattr.c
>> @@ -86,7 +86,7 @@ static unsigned long sf;
>> static void usage(void)
>> {
>> fprintf(stderr,
>> - _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuF] [-v version] files...\n"),
>> + _("Usage: %s [-pRVf] [-+=aAcCdDeijPsStTuFx] [-v version] files...\n"),
>> program_name);
>> exit(1);
>> }
>> @@ -112,6 +112,7 @@ static const struct flags_char flags_array[] = {
>> { EXT2_NOTAIL_FL, 't' },
>> { EXT2_TOPDIR_FL, 'T' },
>> { FS_NOCOW_FL, 'C' },
>> + { FS_DAX_FL, 'x' },
>> { EXT4_CASEFOLD_FL, 'F' },
>> { 0, 0 }
>> };
>> --
>> 2.21.0
>>
>>
>>
>
> .
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-07-28 5:33 [PATCH v2] chattr/lsattr: Support dax attribute Xiao Yang
` (3 preceding siblings ...)
2020-09-18 0:52 ` Ira Weiny
@ 2020-10-01 20:56 ` Theodore Y. Ts'o
2020-10-03 1:38 ` Xiao Yang
4 siblings, 1 reply; 15+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-01 20:56 UTC (permalink / raw)
To: Xiao Yang; +Cc: darrick.wong, ira.weiny, ebiggers, linux-ext4
On Tue, Jul 28, 2020 at 01:33:21PM +0800, Xiao Yang wrote:
> Use the letter 'x' to set/get dax attribute on a directory/file.
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Thanks, applied. Apologies for the delay.
- Ted
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] chattr/lsattr: Support dax attribute
2020-10-01 20:56 ` Theodore Y. Ts'o
@ 2020-10-03 1:38 ` Xiao Yang
0 siblings, 0 replies; 15+ messages in thread
From: Xiao Yang @ 2020-10-03 1:38 UTC (permalink / raw)
To: Theodore Y. Ts'o; +Cc: darrick.wong, ira.weiny, ebiggers, linux-ext4
On 2020/10/2 4:56, Theodore Y. Ts'o wrote:
> On Tue, Jul 28, 2020 at 01:33:21PM +0800, Xiao Yang wrote:
>> Use the letter 'x' to set/get dax attribute on a directory/file.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> Reviewed-by: Andreas Dilger<adilger@dilger.ca>
> Thanks, applied. Apologies for the delay.
Hi Ted,
Thank you for applying this patch. :-)
Could you apply another fix for fsdax on ext4?
https://www.spinics.net/lists/linux-ext4/msg73863.html
Best Regards,
Xiao Yang
> - Ted
>
>
> .
>
^ permalink raw reply [flat|nested] 15+ messages in thread