diff mbox

[U-Boot,V2] fs/ext4: fix log2blksz un-initialized error, by cacaulating its value from blksz

Message ID 1374279479-19326-1-git-send-email-dennis.yxun@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Dennis Lan (dlan) July 20, 2013, 12:17 a.m. UTC
From: "Lan Yixun (dlan)" <dennis.yxun@gmail.com>

The problem here is that uboot can't mount ext4 filesystem with
commit "50ce4c07df1" applied. We use hard-coded "SECTOR_SIZE"(512)
before this commit, now we introduce (block_dev_desc_t *)->log2blksz
to replace this macro. And after we calling do_ls()->fs_set_blk_dev(),
the variable log2blksz is not initialized, which it's not correct.

And this patch try to solve the problem by caculating the value of
log2blksz from variable blksz.

---
the console output after commit "50ce4c07df1" applied:

lt703a # ext4ls nand 3:0
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **

Signed-off-by: Lan Yixun (dlan) <dennis.yxun@gmail.com>
---
 disk/part.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Tom Rini July 22, 2013, 2:12 p.m. UTC | #1
On Sat, Jul 20, 2013 at 08:17:59AM +0800, Dennis Lan (dlan) wrote:

> From: "Lan Yixun (dlan)" <dennis.yxun@gmail.com>
> 
> The problem here is that uboot can't mount ext4 filesystem with
> commit "50ce4c07df1" applied. We use hard-coded "SECTOR_SIZE"(512)
> before this commit, now we introduce (block_dev_desc_t *)->log2blksz
> to replace this macro. And after we calling do_ls()->fs_set_blk_dev(),
> the variable log2blksz is not initialized, which it's not correct.
> 
> And this patch try to solve the problem by caculating the value of
> log2blksz from variable blksz.
> 
> ---
> the console output after commit "50ce4c07df1" applied:
> 
> lt703a # ext4ls nand 3:0
> Failed to mount ext2 filesystem...
> ** Unrecognized filesystem type **
> 
> Signed-off-by: Lan Yixun (dlan) <dennis.yxun@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/disk/part.c b/disk/part.c
index d73625c..9400a97 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -548,6 +548,8 @@  int get_device_and_partition(const char *ifname, const char *dev_part_str,
 			goto cleanup;
 		}
 
+		(*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz);
+
 		info->start = 0;
 		info->size = (*dev_desc)->lba;
 		info->blksz = (*dev_desc)->blksz;
@@ -631,6 +633,8 @@  int get_device_and_partition(const char *ifname, const char *dev_part_str,
 		goto cleanup;
 	}
 
+	(*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz);
+
 	ret = part;
 	goto cleanup;