aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-25 12:33:35 -0500
committerTheodore Ts'o <tytso@mit.edu>2021-02-25 12:34:40 -0500
commit1f4a5aba59f39a33a84152b5ae3ec0a5657b12a1 (patch)
tree62feb709269178088f9316b6d005da32fffbc553
parent989a4189698c4efa53b521b6ad8236bbfc3452c3 (diff)
downloade2fsprogs-1f4a5aba59f39a33a84152b5ae3ec0a5657b12a1.tar.gz
chattr/lsattr: expose FS_NOCOMP_FL (aka EXT2_NOCOMPR_FL)
This adds support for setting/querying the FS_NOCOMP_FL/EXT2_NOCOMPR_FL file flag to chattr/lsattr. I picked the character "m" because it was so far unused and all other characters that were more obvious candidates were already taken. The flag is available on btrfs, and with this patch it is possible to manage it correctly. Signed-off-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/e2p/pf.c2
-rw-r--r--misc/chattr.1.in9
-rw-r--r--misc/chattr.c1
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
index 61fd4ab70..81e3bb263 100644
--- a/lib/e2p/pf.c
+++ b/lib/e2p/pf.c
@@ -49,6 +49,7 @@ static struct flags_name flags_array[] = {
{ EXT4_INLINE_DATA_FL, "N", "Inline_Data" },
{ EXT4_PROJINHERIT_FL, "P", "Project_Hierarchy" },
{ EXT4_VERITY_FL, "V", "Verity" },
+ { EXT2_NOCOMPR_FL, "m", "Dont_Compress" },
{ 0, NULL, NULL }
};
@@ -76,4 +77,3 @@ void print_flags (FILE * f, unsigned long flags, unsigned options)
if (long_opt && first)
fputs("---", f);
}
-
diff --git a/misc/chattr.1.in b/misc/chattr.1.in
index 5bc76a981..5e1eeb79c 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 +-=[aAcCdDeFijPsStTux].
+The format of a symbolic mode is +-=[aAcCdDeFijmPsStTux].
.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 'aAcCdDeFijPsStTux' select the new attributes for the files:
+The letters 'aAcCdDeFijmPsStTux' select the new attributes for the files:
append only (a),
no atime updates (A),
compressed (c),
@@ -40,6 +40,7 @@ extent format (e),
case-insensitive directory lookups (F),
immutable (i),
data journalling (j),
+don't compress (m),
project hierarchy (P),
secure deletion (s),
synchronous updates (S),
@@ -161,6 +162,10 @@ file system has a journal. When the filesystem is mounted with the
attribute has no effect. Only the superuser or a process possessing the
CAP_SYS_RESOURCE capability can set or clear this attribute.
.TP
+.B m
+A file with the 'm' attribute is excluded from compression on file
+systems that support per-file compression.
+.TP
.B N
A file with the 'N' attribute set indicates that the file has data
stored inline, within the inode itself. It may not be set or cleared
diff --git a/misc/chattr.c b/misc/chattr.c
index c0337f86b..14b57348c 100644
--- a/misc/chattr.c
+++ b/misc/chattr.c
@@ -102,6 +102,7 @@ static const struct flags_char flags_array[] = {
{ EXT2_DIRSYNC_FL, 'D' },
{ EXT2_APPEND_FL, 'a' },
{ EXT2_COMPR_FL, 'c' },
+ { EXT2_NOCOMPR_FL, 'm' },
{ EXT2_NODUMP_FL, 'd' },
{ EXT4_EXTENTS_FL, 'e'},
{ EXT2_IMMUTABLE_FL, 'i' },