public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] ext4: add support for filesystems without JOURNAL
       [not found] <CGME20190621133551eucas1p210d2a66b8ee29eaf250fe63a053c9cb4@eucas1p2.samsung.com>
@ 2019-06-21 13:35 ` Marek Szyprowski
  2019-06-24  9:32   ` Lukasz Majewski
  2019-07-18 23:56   ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Szyprowski @ 2019-06-21 13:35 UTC (permalink / raw)
  To: u-boot

JOURNAL is optional for EXT4 (and EXT3) filesystems, so add support for
skipping it. This fixes corrupting EXT4 volumes without JOURNAL after
using uboot's 'ext4write' command.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 fs/ext4/ext4_journal.c | 4 ++++
 fs/ext4/ext4_journal.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c
index 6adbab93a68..3559daf11d2 100644
--- a/fs/ext4/ext4_journal.c
+++ b/fs/ext4/ext4_journal.c
@@ -645,6 +645,10 @@ void ext4fs_update_journal(void)
 	struct ext_filesystem *fs = get_fs();
 	long int blknr;
 	int i;
+
+	if (!(fs->sb->feature_compatibility & EXT4_FEATURE_COMPAT_HAS_JOURNAL))
+		return;
+
 	ext4fs_read_inode(ext4fs_root, EXT2_JOURNAL_INO, &inode_journal);
 	blknr = read_allocated_block(&inode_journal, jrnl_blk_idx++, NULL);
 	update_descriptor_block(blknr);
diff --git a/fs/ext4/ext4_journal.h b/fs/ext4/ext4_journal.h
index c9cf195f333..43fb8e76641 100644
--- a/fs/ext4/ext4_journal.h
+++ b/fs/ext4/ext4_journal.h
@@ -17,6 +17,8 @@
 #ifndef __EXT4_JRNL__
 #define __EXT4_JRNL__
 
+#define EXT4_FEATURE_COMPAT_HAS_JOURNAL		0x0004
+
 #define EXT2_JOURNAL_INO		8	/* Journal inode */
 #define EXT2_JOURNAL_SUPERBLOCK	0	/* Journal  Superblock number */
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] ext4: add support for filesystems without JOURNAL
  2019-06-21 13:35 ` [U-Boot] [PATCH] ext4: add support for filesystems without JOURNAL Marek Szyprowski
@ 2019-06-24  9:32   ` Lukasz Majewski
  2019-07-18 23:56   ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2019-06-24  9:32 UTC (permalink / raw)
  To: u-boot

On Fri, 21 Jun 2019 15:35:35 +0200
Marek Szyprowski <m.szyprowski@samsung.com> wrote:

> JOURNAL is optional for EXT4 (and EXT3) filesystems, so add support
> for skipping it. This fixes corrupting EXT4 volumes without JOURNAL
> after using uboot's 'ext4write' command.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  fs/ext4/ext4_journal.c | 4 ++++
>  fs/ext4/ext4_journal.h | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c
> index 6adbab93a68..3559daf11d2 100644
> --- a/fs/ext4/ext4_journal.c
> +++ b/fs/ext4/ext4_journal.c
> @@ -645,6 +645,10 @@ void ext4fs_update_journal(void)
>  	struct ext_filesystem *fs = get_fs();
>  	long int blknr;
>  	int i;
> +
> +	if (!(fs->sb->feature_compatibility &
> EXT4_FEATURE_COMPAT_HAS_JOURNAL))
> +		return;
> +
>  	ext4fs_read_inode(ext4fs_root, EXT2_JOURNAL_INO,
> &inode_journal); blknr = read_allocated_block(&inode_journal,
> jrnl_blk_idx++, NULL); update_descriptor_block(blknr);
> diff --git a/fs/ext4/ext4_journal.h b/fs/ext4/ext4_journal.h
> index c9cf195f333..43fb8e76641 100644
> --- a/fs/ext4/ext4_journal.h
> +++ b/fs/ext4/ext4_journal.h
> @@ -17,6 +17,8 @@
>  #ifndef __EXT4_JRNL__
>  #define __EXT4_JRNL__
>  
> +#define EXT4_FEATURE_COMPAT_HAS_JOURNAL		0x0004
> +
>  #define EXT2_JOURNAL_INO		8	/* Journal inode */
>  #define EXT2_JOURNAL_SUPERBLOCK	0	/* Journal
> Superblock number */ 

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190624/eb614aaf/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] ext4: add support for filesystems without JOURNAL
  2019-06-21 13:35 ` [U-Boot] [PATCH] ext4: add support for filesystems without JOURNAL Marek Szyprowski
  2019-06-24  9:32   ` Lukasz Majewski
@ 2019-07-18 23:56   ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2019-07-18 23:56 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 21, 2019 at 03:35:35PM +0200, Marek Szyprowski wrote:

> JOURNAL is optional for EXT4 (and EXT3) filesystems, so add support for
> skipping it. This fixes corrupting EXT4 volumes without JOURNAL after
> using uboot's 'ext4write' command.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Reviewed-by: Lukasz Majewski <lukma@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/89618a09/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-18 23:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20190621133551eucas1p210d2a66b8ee29eaf250fe63a053c9cb4@eucas1p2.samsung.com>
2019-06-21 13:35 ` [U-Boot] [PATCH] ext4: add support for filesystems without JOURNAL Marek Szyprowski
2019-06-24  9:32   ` Lukasz Majewski
2019-07-18 23:56   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox