diff mbox series

fs: fat: allow FS and device to have mismatching sector sizes

Message ID 20241113044956.1836896-1-caleb.connolly@linaro.org
State New
Headers show
Series fs: fat: allow FS and device to have mismatching sector sizes | expand

Commit Message

Caleb Connolly Nov. 13, 2024, 4:49 a.m. UTC
The Qualcomm Robotics RB1 and RB2 boards feature MMC storage provisioned
with a 4k sector size GPT, with factory partitions formatted with
filesystems using 512 byte sector sizes.

Whilst certainly unusual, and really not ideal, this appears to work
fine in practise. So demote this failure condition to a debug log.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 fs/fat/fat.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Simon Glass Nov. 13, 2024, 1:39 p.m. UTC | #1
Hi Caleb,

On Tue, 12 Nov 2024 at 21:50, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> The Qualcomm Robotics RB1 and RB2 boards feature MMC storage provisioned
> with a 4k sector size GPT, with factory partitions formatted with
> filesystems using 512 byte sector sizes.
>
> Whilst certainly unusual, and really not ideal, this appears to work
> fine in practise. So demote this failure condition to a debug log.
>

Can you please take a look at [1] - this patch was not applied, but I
hit a similar problem.

> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>  fs/fat/fat.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> index e2570e816768..a84ca301cad1 100644
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> @@ -645,13 +645,12 @@ static int get_fs_info(fsdata *mydata)
>         mydata->rootdir_sect = mydata->fat_sect + mydata->fatlength * bs.fats;
>
>         mydata->sect_size = get_unaligned_le16(bs.sector_size);
>         mydata->clust_size = bs.cluster_size;
> -       if (mydata->sect_size != cur_part_info.blksz) {
> -               log_err("FAT sector size mismatch (fs=%u, dev=%lu)\n",
> +       if (mydata->sect_size != cur_part_info.blksz)
> +               log_debug("FAT sector size mismatch (fs=%u, dev=%lu)\n",
>                         mydata->sect_size, cur_part_info.blksz);
> -               return -1;
> -       }
> +
>         if (mydata->clust_size == 0) {
>                 log_err("FAT cluster size not set\n");
>                 return -1;
>         }
> --
> 2.47.0
>

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230730111516.v2.1.Ia13846500fab3d5a1d5573db11a040d233994fa6@changeid/
diff mbox series

Patch

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index e2570e816768..a84ca301cad1 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -645,13 +645,12 @@  static int get_fs_info(fsdata *mydata)
 	mydata->rootdir_sect = mydata->fat_sect + mydata->fatlength * bs.fats;
 
 	mydata->sect_size = get_unaligned_le16(bs.sector_size);
 	mydata->clust_size = bs.cluster_size;
-	if (mydata->sect_size != cur_part_info.blksz) {
-		log_err("FAT sector size mismatch (fs=%u, dev=%lu)\n",
+	if (mydata->sect_size != cur_part_info.blksz)
+		log_debug("FAT sector size mismatch (fs=%u, dev=%lu)\n",
 			mydata->sect_size, cur_part_info.blksz);
-		return -1;
-	}
+
 	if (mydata->clust_size == 0) {
 		log_err("FAT cluster size not set\n");
 		return -1;
 	}