fstrim: Needs to fire at the mp, not bd
It's a filesystem thing from this perspective. +1b Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
This commit is contained in:
parent
b1489f97e0
commit
5e63776212
@ -60,7 +60,7 @@ int fstrim_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
|||||||
int fstrim_main(int argc UNUSED_PARAM, char **argv)
|
int fstrim_main(int argc UNUSED_PARAM, char **argv)
|
||||||
{
|
{
|
||||||
struct fstrim_range range;
|
struct fstrim_range range;
|
||||||
char *arg_o, *arg_l, *arg_m, *bd;
|
char *arg_o, *arg_l, *arg_m, *mp;
|
||||||
unsigned opts;
|
unsigned opts;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@ -94,15 +94,15 @@ int fstrim_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
if (opts & OPT_m)
|
if (opts & OPT_m)
|
||||||
range.minlen = xatoull_sfx(arg_m, fstrim_sfx);
|
range.minlen = xatoull_sfx(arg_m, fstrim_sfx);
|
||||||
|
|
||||||
bd = find_block_device(*(argv += optind));
|
mp = *(argv += optind);
|
||||||
if (bd) {
|
if (find_block_device(mp)) {
|
||||||
fd = xopen_nonblocking(bd);
|
fd = xopen_nonblocking(mp);
|
||||||
xioctl(fd, FITRIM, &range);
|
xioctl(fd, FITRIM, &range);
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (opts & OPT_v)
|
if (opts & OPT_v)
|
||||||
printf("%s: %llu bytes were trimmed\n", bd, range.len);
|
printf("%s: %llu bytes were trimmed\n", mp, range.len);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user