From bb21ddf59611cc883eeb3c3d149eae35eae9ae30 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 22 Feb 2013 22:23:05 -0500 Subject: [PATCH] chattr: allow clearing the extent flag In order to support kernels which support conversion of extent-mapped files to direct/indirect mapped files, remove the sanity check which prevented clearing the extent flag in chattr. Kernels which don't support this will simply give an Operation Not Supported error. Signed-off-by: "Theodore Ts'o" --- misc/chattr.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/misc/chattr.c b/misc/chattr.c index 1b137fe..6bb33e6 100644 --- a/misc/chattr.c +++ b/misc/chattr.c @@ -194,7 +194,6 @@ static int change_attributes(const char * name) { unsigned long flags; STRUCT_STAT st; - int extent_file = 0; if (LSTAT (name, &st) == -1) { if (!silent) @@ -209,16 +208,7 @@ static int change_attributes(const char * name) _("while reading flags on %s"), name); return -1; } - if (flags & EXT4_EXTENTS_FL) - extent_file = 1; if (set) { - if (extent_file && !(sf & EXT4_EXTENTS_FL)) { - if (!silent) - com_err(program_name, 0, - _("Clearing extent flag not supported on %s"), - name); - return -1; - } if (verbose) { printf (_("Flags of %s set as "), name); print_flags (stdout, sf, 0); @@ -231,13 +221,6 @@ static int change_attributes(const char * name) flags &= ~rf; if (add) flags |= af; - if (extent_file && !(flags & EXT4_EXTENTS_FL)) { - if (!silent) - com_err(program_name, 0, - _("Clearing extent flag not supported on %s"), - name); - return -1; - } if (verbose) { printf(_("Flags of %s set as "), name); print_flags(stdout, flags, 0); -- 1.8.3.1