mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-23 07:31:31 +00:00
newfs_msdos: align to multiple of cluster size by default
A previous commit aligned the start of the data area to a multiple of the VM page size, in order to prevent extra buffers to be allocated (which failed for 64 KB cluster size without this alignment). Since a dependency on PAGE_SIZE caused compatibility issues, the alignment was made conditional on this macro being defined, in the previous commit. This lead to different behavior of this program when built on FreeBSD vs. Linux (which does not define PAGE_SIZE). This commit removes any use of PAGE_SIZE and instead always aligns the start of the data area to a multiple of the cluster size. The -A option is now implied, unless overridden by a specific number of reserved sectors with the -r option. Approved by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45436
This commit is contained in:
parent
ec69d23093
commit
17e85f5990
@ -568,14 +568,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
|
|||||||
x1 += (bpb.bpbBigFATsecs - 1) * bpb.bpbFATs;
|
x1 += (bpb.bpbBigFATsecs - 1) * bpb.bpbFATs;
|
||||||
}
|
}
|
||||||
if (set_res) {
|
if (set_res) {
|
||||||
if (o.align)
|
alignto = bpb.bpbSecPerClust;
|
||||||
alignto = bpb.bpbSecPerClust;
|
|
||||||
else
|
|
||||||
#ifdef PAGE_SIZE
|
|
||||||
alignto = PAGE_SIZE / bpb.bpbBytesPerSec;
|
|
||||||
#else
|
|
||||||
alignto = 1;
|
|
||||||
#endif
|
|
||||||
if (alignto > 1) {
|
if (alignto > 1) {
|
||||||
/* align data clusters */
|
/* align data clusters */
|
||||||
alignment = (bpb.bpbResSectors + bpb.bpbBigFATsecs * bpb.bpbFATs + rds) %
|
alignment = (bpb.bpbResSectors + bpb.bpbBigFATsecs * bpb.bpbFATs + rds) %
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd June 2, 2024
|
.Dd June 6, 2024
|
||||||
.Dt NEWFS_MSDOS 8
|
.Dt NEWFS_MSDOS 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -91,13 +91,11 @@ A suffix s, k, m, g (lower or upper case)
|
|||||||
appended to the offset specifies that the
|
appended to the offset specifies that the
|
||||||
number is in sectors, kilobytes, megabytes or gigabytes, respectively.
|
number is in sectors, kilobytes, megabytes or gigabytes, respectively.
|
||||||
.It Fl A
|
.It Fl A
|
||||||
Attempt to cluster align the data area, useful for SD card.
|
Attempt to cluster align the data area, useful for flash based storage.
|
||||||
If neither the
|
This option is enabled by default, unless a number of reserved sectors
|
||||||
.Fl A
|
is specified using the
|
||||||
nor
|
|
||||||
.Fl r
|
.Fl r
|
||||||
option is used, the number of reserved sectors is set to a value that aligns
|
option.
|
||||||
the start of the data area to a multiple of the page size of the host.
|
|
||||||
.It Fl B Ar boot
|
.It Fl B Ar boot
|
||||||
Get bootstrap from file.
|
Get bootstrap from file.
|
||||||
.It Fl C Ar create-size
|
.It Fl C Ar create-size
|
||||||
@ -173,12 +171,10 @@ is 2.
|
|||||||
Number of hidden sectors.
|
Number of hidden sectors.
|
||||||
.It Fl r Ar reserved
|
.It Fl r Ar reserved
|
||||||
Number of reserved sectors.
|
Number of reserved sectors.
|
||||||
If neither the
|
If the
|
||||||
.Fl A
|
|
||||||
nor
|
|
||||||
.Fl r
|
.Fl r
|
||||||
option is used, the number of reserved sectors is set to a value that aligns
|
option is not used, the number of reserved sectors is set to a value that
|
||||||
the start of the data area to a multiple of the page size of the host.
|
aligns the start of the data area to a multiple of the cluster size.
|
||||||
.It Fl s Ar total
|
.It Fl s Ar total
|
||||||
File system size.
|
File system size.
|
||||||
.It Fl u Ar track-size
|
.It Fl u Ar track-size
|
||||||
|
Loading…
Reference in New Issue
Block a user