aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-06-25 19:36:06 +0200
committerDavid Sterba <dsterba@suse.cz>2015-06-25 19:36:06 +0200
commitdedb1ebeee847e3c4d71e14d0c1077887630e44a (patch)
tree4eb7a46f146ad4ed262a9fb9bfd08810c4d942cc /cmds-filesystem.c
parent96cfbbf0ea9fce7ecaa9e03964474f407f6e76ab (diff)
downloadbtrfs-progs-dedb1ebeee847e3c4d71e14d0c1077887630e44a.tar.gz
btrfs-progs-dedb1ebeee847e3c4d71e14d0c1077887630e44a.tar.xz
btrfs-progs-dedb1ebeee847e3c4d71e14d0c1077887630e44a.zip
btrfs-progs: defrag, check target extent earlier
Print a warning if the target extent size (option -t) is larger than 4G. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 72bb45b..675e41d 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -1170,6 +1170,11 @@ static int cmd_defrag(int argc, char **argv)
break;
case 't':
thresh = parse_size(optarg);
+ if (thresh > (u32)-1) {
+ fprintf(stderr,
+ "WARNING: target extent size %llu too big, trimmed to %u",
+ thresh, (u32)-1);
+ }
defrag_global_fancy_ioctl = 1;
break;
case 'r':
@@ -1186,7 +1191,7 @@ static int cmd_defrag(int argc, char **argv)
memset(&defrag_global_range, 0, sizeof(range));
defrag_global_range.start = start;
defrag_global_range.len = len;
- defrag_global_range.extent_thresh = thresh > (u32)-1 ? (u32)-1 : (u32)thresh;
+ defrag_global_range.extent_thresh = (u32)thresh;
if (compress_type) {
defrag_global_range.flags |= BTRFS_DEFRAG_RANGE_COMPRESS;
defrag_global_range.compress_type = compress_type;