]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/ext4/block_validity.c
ext4: Save error information to the superblock for analysis
[net-next-2.6.git] / fs / ext4 / block_validity.c
index 5b6973fbf1bdde32bb1c2a4b6ff73a9d2df9d692..3db5084db9bd06c2d492cd76dd2a014e7bb07bf6 100644 (file)
@@ -229,16 +229,20 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
 
        if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
            (start_blk + count < start_blk) ||
-           (start_blk + count > ext4_blocks_count(sbi->s_es)))
+           (start_blk + count > ext4_blocks_count(sbi->s_es))) {
+               sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
                return 0;
+       }
        while (n) {
                entry = rb_entry(n, struct ext4_system_zone, node);
                if (start_blk + count - 1 < entry->start_blk)
                        n = n->rb_left;
                else if (start_blk >= (entry->start_blk + entry->count))
                        n = n->rb_right;
-               else
+               else {
+                       sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
                        return 0;
+               }
        }
        return 1;
 }