]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/ext4/super.c
block: Do away with the notion of hardsect_size
[mv-sheeva.git] / fs / ext4 / super.c
index 9987bba99db3cc62c2faa887b95783676f83b480..a30549f7a3053eade6cc042abe5d9c2bef726ddc 100644 (file)
@@ -2508,6 +2508,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
        if (EXT4_BLOCKS_PER_GROUP(sb) == 0)
                goto cantfind_ext4;
 
+       /* check blocks count against device size */
+       blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
+       if (blocks_count && ext4_blocks_count(es) > blocks_count) {
+               printk(KERN_WARNING "EXT4-fs: bad geometry: block count %llu "
+                      "exceeds size of device (%llu blocks)\n",
+                      ext4_blocks_count(es), blocks_count);
+               goto failed_mount;
+       }
+
         /*
          * It makes no sense for the first data block to be beyond the end
          * of the filesystem.
@@ -2953,7 +2962,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
        }
 
        blocksize = sb->s_blocksize;
-       hblock = bdev_hardsect_size(bdev);
+       hblock = bdev_logical_block_size(bdev);
        if (blocksize < hblock) {
                printk(KERN_ERR
                        "EXT4-fs: blocksize too small for journal device.\n");