Signed-off-by: Karel Zak <kzak@redhat.com>
if (stop > limit)
stop = limit;
- if (isrel && stop - start < cxt->grain)
+ if (isrel && stop - start < (cxt->grain / fdisk_get_sector_size(cxt))) {
/* Don't try to be smart on very small partitions and don't
* align so small sizes, just follow the resurst */
isrel = 0;
+ DBG(LABEL, ul_debug("DOS: don't align end os tiny partition [start=%ju, stop=%ju, grain=%ju]",
+ start, stop, cxt->grain));
+ }
if (stop < limit) {
if (isrel && alignment_required(cxt)) {
DBG(LABEL, ul_debug("size defined: %ju, end: %ju (last possible: %ju)",
pa->size, user_l, dflt_l));
if (user_l != dflt_l && !pa->size_explicit
- && user_l - user_f > cxt->grain) {
+ && user_l - user_f > (cxt->grain / fdisk_get_sector_size(cxt))) {
user_l = fdisk_align_lba_in_range(cxt, user_l, user_f, dflt_l);
if (user_l > user_f)
user_l -= 1;