btrfs-progs: defrag: fix threshold overflow again
Commitdedb1ebeee
broke commit96cfbbf0ea
. Casting thresh value greater than (u32)-1 simply truncates bits while desired value is (u32)-1 for max defrag threshold. I.e. "btrfs fi defrag -t 4g" is trimmed/truncated to 0 and "-t 5g" to 1073741824. Also added a missing newline. Signed-off-by: Patrik Lundquist <patrik.lundquist@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
8cb5ff857a
commit
44de34b14d
1 changed files with 2 additions and 1 deletions
|
@ -1172,8 +1172,9 @@ static int cmd_filesystem_defrag(int argc, char **argv)
|
|||
thresh = parse_size(optarg);
|
||||
if (thresh > (u32)-1) {
|
||||
fprintf(stderr,
|
||||
"WARNING: target extent size %llu too big, trimmed to %u",
|
||||
"WARNING: target extent size %llu too big, trimmed to %u\n",
|
||||
thresh, (u32)-1);
|
||||
thresh = (u32)-1;
|
||||
}
|
||||
defrag_global_fancy_ioctl = 1;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue