Whamcloud - gitweb
chattr/lsattr: expose FS_NOCOMP_FL (aka EXT2_NOCOMPR_FL)
authorLennart Poettering <lennart@poettering.net>
Thu, 25 Feb 2021 17:33:35 +0000 (12:33 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 25 Feb 2021 17:34:40 +0000 (12:34 -0500)
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>
lib/e2p/pf.c
misc/chattr.1.in
misc/chattr.c

index 61fd4ab..81e3bb2 100644 (file)
@@ -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);
 }
-
index 5bc76a9..5e1eeb7 100644 (file)
@@ -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
index c0337f8..14b5734 100644 (file)
@@ -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' },