public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 07/13] ext4: only update number of of unused inodes if GDT_CSUM feature is set
Date: Mon, 29 Aug 2016 16:03:55 +0200	[thread overview]
Message-ID: <20160829160355.53b0ae5d@amdc2363> (raw)
In-Reply-To: <c14b728052574dd0bc62c62b9c1c3489@rwthex-w2-b.rwth-ad.de>

Hi Stefan,

> e2fsck warns about "Group descriptor 0 marked uninitialized without
> feature set."
> The bg_itable_unused field is only defined if
> FEATURE_RO_COMPAT_GDT_CSUM is set, and should be set (kept) zero
> otherwise.
> 
> Signed-off-by: Stefan Br?ns <stefan.bruens@rwth-aachen.de>
> ---
>  fs/ext4/ext4_common.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> v3: Patch added to series
> 
> diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
> index eae23b7..0018937 100644
> --- a/fs/ext4/ext4_common.c
> +++ b/fs/ext4/ext4_common.c
> @@ -980,12 +980,13 @@ int ext4fs_get_new_inode_no(void)
>  	if (!journal_buffer || !zero_buffer)
>  		goto fail;
>  	struct ext2_block_group *bgd = (struct ext2_block_group
> *)fs->gdtable;
> +	int has_gdt_chksum = le32_to_cpu(fs->sb->feature_ro_compat) &
> +		EXT4_FEATURE_RO_COMPAT_GDT_CSUM ? 1 : 0;
>  
>  	if (fs->first_pass_ibmap == 0) {
>  		for (i = 0; i < fs->no_blkgrp; i++) {
>  			if (bgd[i].free_inodes) {
> -				if (bgd[i].bg_itable_unused !=
> -						bgd[i].free_inodes)
> +				if (has_gdt_chksum)
>  					bgd[i].bg_itable_unused =
>  						bgd[i].free_inodes;
>  				if (le16_to_cpu(bgd[i].bg_flags) &
> EXT4_BG_INODE_UNINIT) { @@ -1006,7 +1007,8 @@ int
> ext4fs_get_new_inode_no(void) (i * inodes_per_grp);
>  				fs->first_pass_ibmap++;
>  				ext4fs_bg_free_inodes_dec(&bgd[i]);
> -				ext4fs_bg_itable_unused_dec(&bgd[i]);
> +				if (has_gdt_chksum)
> +
> ext4fs_bg_itable_unused_dec(&bgd[i]);
> ext4fs_sb_free_inodes_dec(fs->sb); status = ext4fs_devread(
>  							(lbaint_t)le32_to_cpu(bgd[i].inode_id)
> * @@ -1061,12 +1063,10 @@ restart:
>  				goto fail;
>  			prev_inode_bitmap_index = ibmap_idx;
>  		}
> -		if (bgd[ibmap_idx].bg_itable_unused !=
> -				bgd[ibmap_idx].free_inodes)
> +		ext4fs_bg_free_inodes_dec(&bgd[ibmap_idx]);
> +		if (has_gdt_chksum)
>  			bgd[ibmap_idx].bg_itable_unused =
>  					bgd[ibmap_idx].free_inodes;
> -		ext4fs_bg_free_inodes_dec(&bgd[ibmap_idx]);
> -		ext4fs_bg_itable_unused_dec(&bgd[ibmap_idx]);
>  		ext4fs_sb_free_inodes_dec(fs->sb);
>  		goto success;
>  	}

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> 

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2016-08-29 14:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160828204238.10809-1-stefan.bruens@rwth-aachen.de>
2016-08-28 20:42 ` [U-Boot] [PATCH v3 01/13] ext4: fix possible crash on directory traversal, ignore deleted entries Stefan Brüns
2016-08-28 20:42 ` [U-Boot] [PATCH v3 02/13] ext4: propagate error if creation of directory entry fails Stefan Brüns
2016-08-28 20:42 ` [U-Boot] [PATCH v3 03/13] ext4: Do not crash when trying to grow a directory using extents Stefan Brüns
2016-08-28 20:42 ` [U-Boot] [PATCH v3 04/13] ext4: Scan all directory blocks for space when inserting a new entry Stefan Brüns
2016-08-29 13:56   ` Lukasz Majewski
2016-08-28 20:42 ` [U-Boot] [PATCH v3 05/13] ext4: Avoid corruption of directories with hash tree indexes Stefan Brüns
2016-08-28 20:42 ` [U-Boot] [PATCH v3 06/13] ext4: scan all directory blocks when looking up an entry Stefan Brüns
2016-08-28 20:42 ` [U-Boot] [PATCH v3 07/13] ext4: only update number of of unused inodes if GDT_CSUM feature is set Stefan Brüns
2016-08-29 14:03   ` Lukasz Majewski [this message]
2016-08-28 20:42 ` [U-Boot] [PATCH v3 08/13] ext4: do not clear zalloc'ed buffers a second time Stefan Brüns
2016-08-29 14:04   ` Lukasz Majewski
2016-08-28 20:42 ` [U-Boot] [PATCH v3 09/13] ext4: After completely filled group, scan next group from the beginning Stefan Brüns
2016-08-29 14:06   ` Lukasz Majewski
2016-08-28 20:42 ` [U-Boot] [PATCH v3 10/13] ext4: Avoid out-of-bounds access of block bitmap Stefan Brüns
2016-08-29 14:08   ` Lukasz Majewski
2016-08-28 20:42 ` [U-Boot] [PATCH v3 11/13] ext4: Fix memory leak in case of failure Stefan Brüns
2016-08-29 14:09   ` Lukasz Majewski
2016-08-28 20:42 ` [U-Boot] [PATCH v3 12/13] ext4: Use correct value for inode size even on revision 0 filesystems Stefan Brüns
2016-08-29 14:09   ` Lukasz Majewski
2016-08-28 20:42 ` [U-Boot] [PATCH v3 13/13] ext4: initialize full inode for inodes bigger than 128 bytes Stefan Brüns
2016-08-29 14:11   ` Lukasz Majewski
     [not found] ` <20160828204238.10809-14-stefan.bruens@rwth-aachen.de>
2016-09-05 23:56   ` Stefan Bruens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160829160355.53b0ae5d@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox