Skip to content

Commit c6d5f5f

Browse files
Christoph HellwigChristoph Hellwig
authored andcommitted
hfsplus: lift the 2TB size limit
Replace the hardcoded 2TB limit with a dynamic limit based on the block size now that we have fixed the few overflows preventing operation with large volumes. Signed-off-by: Christoph Hellwig <hch@tuxera.com>
1 parent 4ba2d5f commit c6d5f5f

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎fs/hfsplus/super.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
393393
if (!sbi->rsrc_clump_blocks)
394394
sbi->rsrc_clump_blocks = 1;
395395

396+
err = generic_check_addressable(sbi->alloc_blksz_shift,
397+
sbi->total_blocks);
398+
if (err) {
399+
printk(KERN_ERR "hfs: filesystem size too large.\n");
400+
goto out_free_vhdr;
401+
}
402+
396403
/* Set up operations so we can load metadata */
397404
sb->s_op = &hfsplus_sops;
398405
sb->s_maxbytes = MAX_LFS_FILESIZE;
@@ -417,6 +424,8 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
417424
sb->s_flags |= MS_RDONLY;
418425
}
419426

427+
err = -EINVAL;
428+
420429
/* Load metadata objects (B*Trees) */
421430
sbi->ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID);
422431
if (!sbi->ext_tree) {

‎fs/hfsplus/wrapper.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ int hfsplus_read_wrapper(struct super_block *sb)
141141

142142
if (hfsplus_get_last_session(sb, &part_start, &part_size))
143143
goto out;
144-
if ((u64)part_start + part_size > 0x100000000ULL) {
145-
pr_err("hfs: volumes larger than 2TB are not supported yet\n");
146-
goto out;
147-
}
148144

149145
error = -ENOMEM;
150146
sbi->s_vhdr = kmalloc(HFSPLUS_SECTOR_SIZE, GFP_KERNEL);

0 commit comments

Comments
 (0)