[DragonFlyBSD - Submit #3099] disklabel64: Fix partition 1MiB phsycial alignment; with other minor updates and cleanups

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Wed Nov 8 13:54:05 PST 2017


Issue #3099 has been updated by dillon.


The malloc/free stuff is less critical, since program execution is short lived.  In fact its reasonable to not bother to free() things in such situations as it burns cpu cycles for no reason (not that anyone would notice).  One of those things that just doesn't matter a whole lot.  But to be correct, adding missing free()'s is fine.

I'll clarify my last remark.  We should leave the disk type (and packname) support in, even though nobody uses it any more.  There's a historical context there that might trip a program up here and there if it is missing, and it doesn't hurt anything.  Well, I guess the disk type might actually be used for anyone who still has a floppy drive connected (which is hopefully nobody) <grin>.

If you want to clean up the manual page please go ahead.  You don't have to submit patches via the bug system, just commit them to your tree and I will cherry pick from your GIT repo when you think it is all ready for commit.  Always easier to work with GIT repos rather than manual patches :-).

-Matt


----------------------------------------
Submit #3099: disklabel64: Fix partition 1MiB phsycial alignment; with other minor updates and cleanups
http://bugs.dragonflybsd.org/issues/3099#change-13313

* Author: liweitianux
* Status: In Progress
* Priority: Normal
* Assignee: dillon
* Category: Kernel
* Target version: 
----------------------------------------
Hello,

According to disklabel64(8), the partitions within a slice are physically aligned to 1MiB (PALIGN_SIZE).  However, there is a mistake in l64_makevirginlabel() in kern/subr_disklabel64.c, which causes the partitions are actually only 32KiB aligned.  The proposed patches here fix this issue, and introduce some more updates and cleanups:

* Calculate d_pbase and d_pstop to make them both physically aligned to 1MiB;
* Defined BOOT2SIZE64 in sys/disklabel64.h to replace the use of 32768;
* Reserve space for the backup label at the slice end (after d_pstop), though the backup functionality not implemented;
* Make the "auto" disk type optional, since the disk type support is not implement;
* Update several comments, displayed disklabel descriptions;
* Fix two compilation warnings due to the mismatched type in strncpy();
* Add "static" keyword; cleanup unused variables and definitions.

I also pushed these patches to my GitHub at:
https://github.com/liweitianux/dragonflybsd/tree/disklabel

Here is a comparison of the virgin labels generated:

diskinfo:
/dev/ad4s1       blksize=512  offset=0x000000007e00 size=0x002543158200  149.05 GB

Before:
------------------------------------------------------------------------------
# boot space:    1044992 bytes
# data space:  156287323 blocks # 152624.34 MB (160038219264 bytes)

boot2 data base:      0x000000001000
partitions data base: 0x000000100200
partitions data stop: 0x002543157000
backup label:         0x002543157000
total size:           0x002543158200    # 152625.34 MB
------------------------------------------------------------------------------

After:
------------------------------------------------------------------------------
# boot space:    1012224 bytes
# data space:  156286976 blocks # 152624.00 MB (160037863424 bytes)

boot2 data base:      0x000000001000
partitions data base: 0x0000000f8200
partitions data stop: 0x0025430f8200
backup label:         0x0025430f8200
total size:           0x002543158200    # 152625.34 MB
------------------------------------------------------------------------------

Thanks for reviewing these patches.

Aly

---Files--------------------------------
0002-kern-disklabel64-Fix-physically-alignment-to-1-MiB-f.patch (4.83 KB)
0001-sys-disklabel64.h-Define-BOOT2SIZE64-to-32-KB-for-bo.patch (3.76 KB)
0003-disklabel64-8-Clean-up-unused-definitions-and-variab.patch (3.98 KB)
0004-disklabel64-8-Fix-error-message-to-indicate-no-disk-.patch (941 Bytes)
0005-disklabel64-8-Make-the-auto-disk-type-argument-optio.patch (2.25 KB)
0006-disklabel64-8-Update-displayed-label-comments-and-an.patch (2.23 KB)
0008-disklabel64-8-free-allocated-boot1buf-on-error.patch (976 Bytes)
0007-disklabel64-8-Add-various-static-keyword-Fix-compila.patch (7.81 KB)
0009-diskinfo-8-Print-0x-prefix-for-hex-numbers-Change-of.patch (1.07 KB)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Submit mailing list