From: Theodore Ts'o Date: Sat, 23 Feb 2013 03:23:05 +0000 (-0500) Subject: chattr: allow clearing the extent flag X-Git-Tag: v1.42.8~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb21ddf59611cc883eeb3c3d149eae35eae9ae30;p=thirdparty%2Fe2fsprogs.git 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" --- diff --git a/misc/chattr.c b/misc/chattr.c index 1b137fe71..6bb33e686 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);