Skip to content

Commit 7eb742f

Browse files
committed
nilfs-resize: output the minimum device size in insufficient free space message
Change nilfs_resize_check_free_space() to output the required device size instead of the total byte size of the required segments when free space is insufficient. This gives a guideline for the device size to be specified when respecifying the device size and retrying shrinking. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
1 parent 276d85e commit 7eb742f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sbin/nilfs-resize.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,12 @@ static int nilfs_resize_check_free_space(struct nilfs *nilfs,
456456

457457
nsegs = (sustat.ss_nsegs - newnsegs) - sustat.ss_ncleansegs
458458
+ nrsvsegs;
459-
nbytes = nilfs_resize_calc_size_of_segments(nsegs);
460-
myprintf("Error: the filesystem does not have enough free space.\n"
461-
" At least %llu more segment%s (%llu bytes) %s required.\n",
462-
nsegs, nsegs != 1 ? "s" : "", nbytes,
463-
nsegs != 1 ? "are" : "is");
459+
nbytes = nilfs_resize_calc_size_of_segments(newnsegs + nsegs) +
460+
4096;
461+
462+
myprintf("Error: Insufficient free space (needs %llu more segment%s).\n"
463+
" The device size must be at least %llu bytes.\n",
464+
nsegs, nsegs != 1 ? "s" : "", nbytes);
464465
return -1;
465466
} else if (verbose) {
466467
nsegs = sustat.ss_ncleansegs - (sustat.ss_nsegs - newnsegs)

0 commit comments

Comments
 (0)