public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* ext4_wait_block_bitmap() and ext4_read_block_bitmap_nowait() handle bitmap verification differently
@ 2013-10-04  2:45 jon ernst
  2013-10-04 14:04 ` Carlos Maiolino
  2013-10-07 12:45 ` Lukáš Czerner
  0 siblings, 2 replies; 5+ messages in thread
From: jon ernst @ 2013-10-04  2:45 UTC (permalink / raw)
  To: linux-ext4@vger.kernel.org List

Hi,

I found that ext4_wait_block_bitmap() and
ext4_read_block_bitmap_nowait() handle bitmap verification
differently.
wait_block_bitmap() calls ext4_validate_block_bitmap() all the time.
But  read_block_bitmap_nowait() checks EXT4_BG_BLOCK_UNINIT, if it
meets, it will skip ext4_validate_block_bitmap()

In my opinion, they'd better do same thing.
In that way, we can also return "fail" in ext4_valid_block_bitmap()
method when we meet FLEX_BG.



diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index dc5d572..366807a 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -319,7 +319,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct
super_block *sb,
                 * or it has to also read the block group where the bitmaps
                 * are located to verify they are set.
                 */
-               return 0;
+               return 1;
        }
        group_first_block = ext4_group_first_block_no(sb, block_group);

@@ -472,8 +472,12 @@ int ext4_wait_block_bitmap(struct super_block
*sb, ext4_group_t block_group,
                return 1;
        }
        clear_buffer_new(bh);
-       /* Panic or remount fs read-only if block bitmap is invalid */
-       ext4_validate_block_bitmap(sb, desc, block_group, bh);
+
+       if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
+        return 0;
+        }
+       /* Panic or remount fs read-only if block bitmap is invalid */
+       ext4_validate_block_bitmap(sb, desc, block_group, bh);
        /* ...but check for error just in case errors=continue. */
        return !buffer_verified(bh);
 }

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

end of thread, other threads:[~2013-10-07 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-04  2:45 ext4_wait_block_bitmap() and ext4_read_block_bitmap_nowait() handle bitmap verification differently jon ernst
2013-10-04 14:04 ` Carlos Maiolino
2013-10-07 12:45 ` Lukáš Czerner
2013-10-07 14:03   ` jon ernst
2013-10-07 14:11     ` Lukáš Czerner

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