* [U-Boot] [PATCH 0/1] ext4 fixes for BE machine
@ 2013-07-21 8:53 Andreas Bießmann
2013-07-21 8:53 ` [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field Andreas Bießmann
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Andreas Bießmann @ 2013-07-21 8:53 UTC (permalink / raw)
To: u-boot
I just copied the patch provided by Rommel and tested reading an ext4 on avr32
machine. List content and read data from it worked, but I can't say anything
about ext4write which Rommel says to fix with that patch.
@sjg: We should add Series-notes switch to avoid cover letter for single
patch submission ...
Rommel Custodio (1):
ext4fs: le32_to_cpu() used on a 16-bit field
fs/ext4/ext4_common.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 8+ messages in thread* [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field 2013-07-21 8:53 [U-Boot] [PATCH 0/1] ext4 fixes for BE machine Andreas Bießmann @ 2013-07-21 8:53 ` Andreas Bießmann 2013-07-21 18:13 ` Simon Glass ` (2 more replies) 2013-07-21 18:20 ` [U-Boot] [PATCH 0/1] ext4 fixes for BE machine Simon Glass 2013-07-21 20:09 ` Rommel G Custodio 2 siblings, 3 replies; 8+ messages in thread From: Andreas Bießmann @ 2013-07-21 8:53 UTC (permalink / raw) To: u-boot From: Rommel Custodio <sessyargc+uboot@gmail.com> Fix reading ext4_extent_header struture on BE machines. Some 16 bit fields where converted to 32 bit fields, due to the byte swap on BE machines the containing value was corrupted. Therefore reading ext4 filesystems on BE machines where broken before. Signed-off-by: Rommel Custodio <sessyargc+uboot@gmail.com> [sent via git-send-email; rework commit message] Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com> --- fs/ext4/ext4_common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 2776293..ff9c4ec 100644 --- a/fs/ext4/ext4_common.c +++ b/fs/ext4/ext4_common.c @@ -1432,7 +1432,7 @@ static struct ext4_extent_header *ext4fs_get_extent_block while (1) { index = (struct ext4_extent_idx *)(ext_block + 1); - if (le32_to_cpu(ext_block->eh_magic) != EXT4_EXT_MAGIC) + if (le16_to_cpu(ext_block->eh_magic) != EXT4_EXT_MAGIC) return 0; if (ext_block->eh_depth == 0) @@ -1440,14 +1440,14 @@ static struct ext4_extent_header *ext4fs_get_extent_block i = -1; do { i++; - if (i >= le32_to_cpu(ext_block->eh_entries)) + if (i >= le16_to_cpu(ext_block->eh_entries)) break; } while (fileblock > le32_to_cpu(index[i].ei_block)); if (--i < 0) return 0; - block = le32_to_cpu(index[i].ei_leaf_hi); + block = le16_to_cpu(index[i].ei_leaf_hi); block = (block << 32) + le32_to_cpu(index[i].ei_leaf_lo); if (ext4fs_devread((lbaint_t)block << log2_blksz, 0, fs->blksz, @@ -1548,17 +1548,17 @@ long int read_allocated_block(struct ext2_inode *inode, int fileblock) do { i++; - if (i >= le32_to_cpu(ext_block->eh_entries)) + if (i >= le16_to_cpu(ext_block->eh_entries)) break; } while (fileblock >= le32_to_cpu(extent[i].ee_block)); if (--i >= 0) { fileblock -= le32_to_cpu(extent[i].ee_block); - if (fileblock >= le32_to_cpu(extent[i].ee_len)) { + if (fileblock >= le16_to_cpu(extent[i].ee_len)) { free(buf); return 0; } - start = le32_to_cpu(extent[i].ee_start_hi); + start = le16_to_cpu(extent[i].ee_start_hi); start = (start << 32) + le32_to_cpu(extent[i].ee_start_lo); free(buf); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field 2013-07-21 8:53 ` [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field Andreas Bießmann @ 2013-07-21 18:13 ` Simon Glass 2013-07-22 6:43 ` Lukasz Majewski 2013-07-22 14:11 ` [U-Boot] " Tom Rini 2 siblings, 0 replies; 8+ messages in thread From: Simon Glass @ 2013-07-21 18:13 UTC (permalink / raw) To: u-boot Hi Andreas, On Sun, Jul 21, 2013 at 2:53 AM, Andreas Bie?mann < andreas.devel@googlemail.com> wrote: > From: Rommel Custodio <sessyargc+uboot@gmail.com> > > Fix reading ext4_extent_header struture on BE machines. > Some 16 bit fields where converted to 32 bit fields, due to the byte swap > on BE > machines the containing value was corrupted. Therefore reading ext4 > filesystems > on BE machines where broken before. > > Signed-off-by: Rommel Custodio <sessyargc+uboot@gmail.com> > [sent via git-send-email; rework commit message] > Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com> > Reviewed-by: Simon Glass <sjg@chromium.org> I tested it on sandbox with the sandbox block patch (not yet merged). It worked fine with my simple test (loading a kernel and a 70MB executable) with and without this patch unfortunately, but anyway: Tested-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field 2013-07-21 8:53 ` [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field Andreas Bießmann 2013-07-21 18:13 ` Simon Glass @ 2013-07-22 6:43 ` Lukasz Majewski 2013-07-22 7:07 ` Andreas Bießmann 2013-07-22 14:11 ` [U-Boot] " Tom Rini 2 siblings, 1 reply; 8+ messages in thread From: Lukasz Majewski @ 2013-07-22 6:43 UTC (permalink / raw) To: u-boot On Sun, 21 Jul 2013 10:53:25 +0200 Andreas Bie?mann andreas.devel at googlemail.com wrote, Hi Andreas, > From: Rommel Custodio <sessyargc+uboot@gmail.com> > > Fix reading ext4_extent_header struture on BE machines. > Some 16 bit fields where converted to 32 bit fields, due to the byte > swap on BE machines the containing value was corrupted. Therefore > reading ext4 filesystems on BE machines where broken before. > > Signed-off-by: Rommel Custodio <sessyargc+uboot@gmail.com> > [sent via git-send-email; rework commit message] > Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com> > > --- > fs/ext4/ext4_common.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c > index 2776293..ff9c4ec 100644 > --- a/fs/ext4/ext4_common.c > +++ b/fs/ext4/ext4_common.c > @@ -1432,7 +1432,7 @@ static struct ext4_extent_header > *ext4fs_get_extent_block while (1) { > index = (struct ext4_extent_idx *)(ext_block + 1); > > - if (le32_to_cpu(ext_block->eh_magic) != > EXT4_EXT_MAGIC) > + if (le16_to_cpu(ext_block->eh_magic) != > EXT4_EXT_MAGIC) return 0; > > if (ext_block->eh_depth == 0) > @@ -1440,14 +1440,14 @@ static struct ext4_extent_header > *ext4fs_get_extent_block i = -1; > do { > i++; > - if (i >= le32_to_cpu(ext_block->eh_entries)) > + if (i >= le16_to_cpu(ext_block->eh_entries)) > break; > } while (fileblock > le32_to_cpu(index[i].ei_block)); > > if (--i < 0) > return 0; > > - block = le32_to_cpu(index[i].ei_leaf_hi); > + block = le16_to_cpu(index[i].ei_leaf_hi); > block = (block << 32) + > le32_to_cpu(index[i].ei_leaf_lo); > if (ext4fs_devread((lbaint_t)block << log2_blksz, 0, > fs->blksz, @@ -1548,17 +1548,17 @@ long int > read_allocated_block(struct ext2_inode *inode, int fileblock) > do { > i++; > - if (i >= le32_to_cpu(ext_block->eh_entries)) > + if (i >= le16_to_cpu(ext_block->eh_entries)) > break; > } while (fileblock >= > le32_to_cpu(extent[i].ee_block)); if (--i >= 0) { > fileblock -= le32_to_cpu(extent[i].ee_block); > - if (fileblock >= > le32_to_cpu(extent[i].ee_len)) { > + if (fileblock >= > le16_to_cpu(extent[i].ee_len)) { free(buf); > return 0; > } > > - start = le32_to_cpu(extent[i].ee_start_hi); > + start = le16_to_cpu(extent[i].ee_start_hi); > start = (start << 32) + > le32_to_cpu(extent[i].ee_start_lo); > free(buf); I've tested this patch at LE Samsung Trats board. The code worked as before (ext4ls, ext4load, ext4write) - also taking into account limitation of our platform. Tested-by: Lukasz Majewski <l.majewski@samsung.com> However, we will not run out from refactoring this code. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field 2013-07-22 6:43 ` Lukasz Majewski @ 2013-07-22 7:07 ` Andreas Bießmann 0 siblings, 0 replies; 8+ messages in thread From: Andreas Bießmann @ 2013-07-22 7:07 UTC (permalink / raw) To: u-boot Hi Lukasz, On 22.07.13 08:43, Lukasz Majewski wrote: > On Sun, 21 Jul 2013 10:53:25 +0200 Andreas Bie?mann > andreas.devel at googlemail.com wrote, <snip> > I've tested this patch at LE Samsung Trats board. The code worked as > before (ext4ls, ext4load, ext4write) - also taking into account > limitation of our platform. I'm glad to hear that your proposed unaligned access problems not apply. > However, we will not run out from refactoring this code. I'm fine with that for later releases, this fix should go into 2013.07. Best regards, Andreas Bie?mann ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] ext4fs: le32_to_cpu() used on a 16-bit field 2013-07-21 8:53 ` [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field Andreas Bießmann 2013-07-21 18:13 ` Simon Glass 2013-07-22 6:43 ` Lukasz Majewski @ 2013-07-22 14:11 ` Tom Rini 2 siblings, 0 replies; 8+ messages in thread From: Tom Rini @ 2013-07-22 14:11 UTC (permalink / raw) To: u-boot On Sun, Jul 21, 2013 at 10:53:25AM +0200, Andreas Bie??mann wrote: > From: Rommel Custodio <sessyargc+uboot@gmail.com> > > Fix reading ext4_extent_header struture on BE machines. > Some 16 bit fields where converted to 32 bit fields, due to the byte > swap on BE machines the containing value was corrupted. Therefore > reading ext4 filesystems on BE machines where broken before. > > Signed-off-by: Rommel Custodio <sessyargc+uboot@gmail.com> > [sent via git-send-email; rework commit message] > Signed-off-by: Andreas Bie??mann <andreas.devel@googlemail.com> > Reviewed-by: Simon Glass <sjg@chromium.org> > Tested-by: Simon Glass <sjg@chromium.org> > Tested-by: Lukasz Majewski <l.majewski@samsung.com> So I gave the changes a review myself based on how the kernel accesses these fields and agree the changes are correct. I also did a quick test on beaglebone black and was able to read (and confirmed crc32) a few files correctly still. Applied to u-boot/master with a re-wrapping of the commit message, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130722/3f2ba1b3/attachment.pgp> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 0/1] ext4 fixes for BE machine 2013-07-21 8:53 [U-Boot] [PATCH 0/1] ext4 fixes for BE machine Andreas Bießmann 2013-07-21 8:53 ` [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field Andreas Bießmann @ 2013-07-21 18:20 ` Simon Glass 2013-07-21 20:09 ` Rommel G Custodio 2 siblings, 0 replies; 8+ messages in thread From: Simon Glass @ 2013-07-21 18:20 UTC (permalink / raw) To: u-boot Hi Andreas, On Sun, Jul 21, 2013 at 2:53 AM, Andreas Bie?mann < andreas.devel@googlemail.com> wrote: > I just copied the patch provided by Rommel and tested reading an ext4 on > avr32 > machine. List content and read data from it worked, but I can't say > anything > about ext4write which Rommel says to fix with that patch. > > @sjg: We should add Series-notes switch to avoid cover letter for single > patch submission ... > Yes agreed, There is Series-notes, but it's not quite what you want, I think. Regards, Simon ^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot] [PATCH 0/1] ext4 fixes for BE machine 2013-07-21 8:53 [U-Boot] [PATCH 0/1] ext4 fixes for BE machine Andreas Bießmann 2013-07-21 8:53 ` [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field Andreas Bießmann 2013-07-21 18:20 ` [U-Boot] [PATCH 0/1] ext4 fixes for BE machine Simon Glass @ 2013-07-21 20:09 ` Rommel G Custodio 2 siblings, 0 replies; 8+ messages in thread From: Rommel G Custodio @ 2013-07-21 20:09 UTC (permalink / raw) To: u-boot Dear Andreas Bie?mann On 2013.07/21, Andreas Bie?mann wrote: > I just copied the patch provided by Rommel and tested reading an ext4 on avr32 > machine. List content and read data from it worked, but I can't say anything > about ext4write which Rommel says to fix with that patch. Thanks for update. This patch doesn't fix ext4write in BE. It just correctly accesses the ext3/ext4 formatted partition so that ext4ls/ext4load can work correctly. I'm still checking. I'll submit a patch when I got it working. Thank you. > > @sjg: We should add Series-notes switch to avoid cover letter for single > patch submission ... > > Rommel Custodio (1): > ext4fs: le32_to_cpu() used on a 16-bit field > > fs/ext4/ext4_common.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > -- > 1.7.10.4 > > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-07-22 14:11 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-21 8:53 [U-Boot] [PATCH 0/1] ext4 fixes for BE machine Andreas Bießmann 2013-07-21 8:53 ` [U-Boot] [PATCH] ext4fs: le32_to_cpu() used on a 16-bit field Andreas Bießmann 2013-07-21 18:13 ` Simon Glass 2013-07-22 6:43 ` Lukasz Majewski 2013-07-22 7:07 ` Andreas Bießmann 2013-07-22 14:11 ` [U-Boot] " Tom Rini 2013-07-21 18:20 ` [U-Boot] [PATCH 0/1] ext4 fixes for BE machine Simon Glass 2013-07-21 20:09 ` Rommel G Custodio
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox