From: Karel Zak Date: Thu, 4 Feb 2010 14:02:16 +0000 (+0100) Subject: fdisk: cleanup warnings X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8a86a1c5e13d64a668c6b4347addc61be24b54b;p=util-linux fdisk: cleanup warnings * don't print: The number of cylinders for this disk is set to 12161. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) we really don't care about MS-DOS or extremely old LILO. * inform users that DOS-compatible mode is bad and deprecated thing (It's difficult to use 2048 sectors grain or 4KiB sectors or alignment_offset in DOS mode where all is based on cylinders...) * don't check for cylinders boundary in non-DOS mode * inform about sector and I/O sizes Signed-off-by: Karel Zak --- diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index ddfd24d1..c1868c01 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -753,19 +753,6 @@ void update_units(void) units_per_sector = 1; /* in sectors */ } -static void -warn_cylinders(void) { - if (dos_label && cylinders > 1024 && !nowarn) - fprintf(stderr, _("\n" -"The number of cylinders for this disk is set to %d.\n" -"There is nothing wrong with that, but this is larger than 1024,\n" -"and could in certain setups cause problems with:\n" -"1) software that runs at boot time (e.g., old versions of LILO)\n" -"2) booting and partitioning software from other OSs\n" -" (e.g., DOS FDISK, OS/2 FDISK)\n"), - cylinders); -} - static void warn_limits(void) { if (total_number_of_sectors > UINT_MAX && !nowarn) { @@ -786,29 +773,26 @@ warn_limits(void) { static void warn_alignment(void) { - if (nowarn || !alignment_required) + if (nowarn) return; - fprintf(stderr, _("\n" + if (sector_size != phy_sector_size) + fprintf(stderr, _("\n" "The device presents a logical sector size that is smaller than\n" -"the optimal I/O size (often physical sector size). Aligning to a optimal\n" -"I/O size boundary is recommended, or performance may be impacted.\n\n")); - - /* - * Print warning when sector_offset is not aligned for DOS mode - */ - if (alignment_offset == 0 && dos_compatible_flag && - !lba_is_aligned(sector_offset)) +"the physical sector size. Aligning to a physical sector (or optimal\n" +"I/O) size boundary is recommended, or performance may be impacted.\n")); - fprintf(stderr, _( -"WARNING: The device does not provide compensation (alignment_offset)\n" -"for DOS-compatible partitioning, but DOS-compatible mode is enabled.\n" -"Use command 'c' to switch-off DOS mode.\n\n")); - - if (display_in_cyl_units) - fprintf(stderr, _( -"It's recommended to change display units to sectors (command 'u').\n\n")); + if (dos_compatible_flag) { + fprintf(stderr, _("\n" +"WARNING: DOS-compatible mode is deprecated. It's strongly recommended to\n" +" switch off the mode (command 'c')")); + if (display_in_cyl_units) + fprintf(stderr, _(" and change display units to\n" +" sectors (command 'u').\n")); + else + fprintf(stderr, ".\n"); + } } static void @@ -1285,7 +1269,6 @@ got_dos_table: } } - warn_cylinders(); warn_geometry(); warn_limits(); warn_alignment(); @@ -1787,6 +1770,9 @@ static void check_consistency(struct partition *p, int partition) { unsigned int lbc, lbh, lbs; /* logical beginning c, h, s */ unsigned int lec, leh, les; /* logical ending c, h, s */ + if (!dos_compatible_flag) + return; + if (!heads || !sectors || (partition >= 4)) return; /* do not check extended partitions */ @@ -1848,7 +1834,7 @@ static void check_alignment(unsigned long long lba, int partition) { if (!lba_is_aligned(lba)) - printf(_("Partition %i does not start on optimal I/O size boundary.\n"), + printf(_("Partition %i does not start on physical sector boundary.\n"), partition + 1); } @@ -1875,8 +1861,10 @@ list_disk_geometry(void) { str_units(PLURAL), units_per_sector, sector_size, units_per_sector * sector_size); - printf(_("Sector size (logical / optimal IO): %u bytes / %lu bytes\n"), - sector_size, io_size); + printf(_("Sector size (logical/physical): %u bytes / %u bytes\n"), + sector_size, phy_sector_size); + printf(_("I/O size (minimum/optimal): %lu bytes / %lu bytes\n"), + min_io_size, io_size); if (alignment_offset) printf(_("Alignment offset: %lu bytes\n"), alignment_offset); if (dos_label) @@ -2667,8 +2655,6 @@ xselect(void) { _("Number of cylinders")); if (sun_label) sun_set_ncyl(cylinders); - if (dos_label) - warn_cylinders(); break; case 'd': print_raw();