09e732016e806a124ba78daf2400f9641de89aa6
[openwrt/openwrt.git] / tools / dosfstools / patches / 0001-mkfs-Default-to-64-32-heads-sectors-for-targets-smal.patch
1 From 1e76e5778a1885452939a79d9145b80634a5b023 Mon Sep 17 00:00:00 2001
2 From: Andreas Bombe <aeb@debian.org>
3 Date: Wed, 11 May 2016 03:44:58 +0200
4 Subject: [PATCH] mkfs: Default to 64/32 heads/sectors for targets smaller than
5 512 MB
6
7 This may put defaults in certain use cases a little bit more in line
8 with the old defaults in versions up to 3.0.28. It has mostly aesthetic
9 value in most cases.
10
11 Signed-off-by: Andreas Bombe <aeb@debian.org>
12 ---
13 src/mkfs.fat.c | 10 ++++++++++
14 1 file changed, 10 insertions(+)
15
16 diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c
17 index 8a320fd..bad492b 100644
18 --- a/src/mkfs.fat.c
19 +++ b/src/mkfs.fat.c
20 @@ -519,6 +519,16 @@ static void establish_params(struct device_info *info)
21 unsigned int cluster_size = 4; /* starting point for FAT12 and FAT16 */
22 int def_root_dir_entries = 512;
23
24 + if (info->size < 512 * 1024 * 1024) {
25 + /*
26 + * These values are more or less meaningless, but we can at least
27 + * use less extreme values for smaller filesystems where the large
28 + * dummy values signifying LBA only access are not needed.
29 + */
30 + sec_per_track = 32;
31 + heads = 64;
32 + }
33 +
34 if (info->type != TYPE_FIXED) {
35 /* enter default parameters for floppy disks if the size matches */
36 switch (info->size / 1024) {
37 --
38 2.1.4
39