@@ -374,66 +374,6 @@ void ext4_update_dynamic_rev(struct super_block *sb)
374
374
*/
375
375
}
376
376
377
- int ext4_update_compat_feature (handle_t * handle ,
378
- struct super_block * sb , __u32 compat )
379
- {
380
- int err = 0 ;
381
- if (!EXT4_HAS_COMPAT_FEATURE (sb , compat )) {
382
- err = ext4_journal_get_write_access (handle ,
383
- EXT4_SB (sb )-> s_sbh );
384
- if (err )
385
- return err ;
386
- EXT4_SET_COMPAT_FEATURE (sb , compat );
387
- sb -> s_dirt = 1 ;
388
- handle -> h_sync = 1 ;
389
- BUFFER_TRACE (EXT4_SB (sb )-> s_sbh ,
390
- "call ext4_journal_dirty_met adata" );
391
- err = ext4_journal_dirty_metadata (handle ,
392
- EXT4_SB (sb )-> s_sbh );
393
- }
394
- return err ;
395
- }
396
-
397
- int ext4_update_rocompat_feature (handle_t * handle ,
398
- struct super_block * sb , __u32 rocompat )
399
- {
400
- int err = 0 ;
401
- if (!EXT4_HAS_RO_COMPAT_FEATURE (sb , rocompat )) {
402
- err = ext4_journal_get_write_access (handle ,
403
- EXT4_SB (sb )-> s_sbh );
404
- if (err )
405
- return err ;
406
- EXT4_SET_RO_COMPAT_FEATURE (sb , rocompat );
407
- sb -> s_dirt = 1 ;
408
- handle -> h_sync = 1 ;
409
- BUFFER_TRACE (EXT4_SB (sb )-> s_sbh ,
410
- "call ext4_journal_dirty_met adata" );
411
- err = ext4_journal_dirty_metadata (handle ,
412
- EXT4_SB (sb )-> s_sbh );
413
- }
414
- return err ;
415
- }
416
-
417
- int ext4_update_incompat_feature (handle_t * handle ,
418
- struct super_block * sb , __u32 incompat )
419
- {
420
- int err = 0 ;
421
- if (!EXT4_HAS_INCOMPAT_FEATURE (sb , incompat )) {
422
- err = ext4_journal_get_write_access (handle ,
423
- EXT4_SB (sb )-> s_sbh );
424
- if (err )
425
- return err ;
426
- EXT4_SET_INCOMPAT_FEATURE (sb , incompat );
427
- sb -> s_dirt = 1 ;
428
- handle -> h_sync = 1 ;
429
- BUFFER_TRACE (EXT4_SB (sb )-> s_sbh ,
430
- "call ext4_journal_dirty_met adata" );
431
- err = ext4_journal_dirty_metadata (handle ,
432
- EXT4_SB (sb )-> s_sbh );
433
- }
434
- return err ;
435
- }
436
-
437
377
/*
438
378
* Open the external journal device
439
379
*/
@@ -1771,13 +1711,13 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1771
1711
*
1772
1712
* Note, this does *not* consider any metadata overhead for vfs i_blocks.
1773
1713
*/
1774
- static loff_t ext4_max_size (int blkbits )
1714
+ static loff_t ext4_max_size (int blkbits , int has_huge_files )
1775
1715
{
1776
1716
loff_t res ;
1777
1717
loff_t upper_limit = MAX_LFS_FILESIZE ;
1778
1718
1779
1719
/* small i_blocks in vfs inode? */
1780
- if (sizeof (blkcnt_t ) < sizeof (u64 )) {
1720
+ if (! has_huge_files || sizeof (blkcnt_t ) < sizeof (u64 )) {
1781
1721
/*
1782
1722
* CONFIG_LSF is not enabled implies the inode
1783
1723
* i_block represent total blocks in 512 bytes
@@ -1807,7 +1747,7 @@ static loff_t ext4_max_size(int blkbits)
1807
1747
* block limit, and also a limit of (2^48 - 1) 512-byte sectors in i_blocks.
1808
1748
* We need to be 1 filesystem block less than the 2^48 sector limit.
1809
1749
*/
1810
- static loff_t ext4_max_bitmap_size (int bits )
1750
+ static loff_t ext4_max_bitmap_size (int bits , int has_huge_files )
1811
1751
{
1812
1752
loff_t res = EXT4_NDIR_BLOCKS ;
1813
1753
int meta_blocks ;
@@ -1820,11 +1760,11 @@ static loff_t ext4_max_bitmap_size(int bits)
1820
1760
* total number of 512 bytes blocks of the file
1821
1761
*/
1822
1762
1823
- if (sizeof (blkcnt_t ) < sizeof (u64 )) {
1763
+ if (! has_huge_files || sizeof (blkcnt_t ) < sizeof (u64 )) {
1824
1764
/*
1825
- * CONFIG_LSF is not enabled implies the inode
1826
- * i_block represent total blocks in 512 bytes
1827
- * 32 == size of vfs inode i_blocks * 8
1765
+ * !has_huge_files or CONFIG_LSF is not enabled
1766
+ * implies the inode i_block represent total blocks in
1767
+ * 512 bytes 32 == size of vfs inode i_blocks * 8
1828
1768
*/
1829
1769
upper_limit = (1LL << 32 ) - 1 ;
1830
1770
@@ -1933,7 +1873,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
1933
1873
int blocksize ;
1934
1874
int db_count ;
1935
1875
int i ;
1936
- int needs_recovery ;
1876
+ int needs_recovery , has_huge_files ;
1937
1877
__le32 features ;
1938
1878
__u64 blocks_count ;
1939
1879
int err ;
@@ -2074,7 +2014,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2074
2014
sb -> s_id , le32_to_cpu (features ));
2075
2015
goto failed_mount ;
2076
2016
}
2077
- if (EXT4_HAS_RO_COMPAT_FEATURE (sb , EXT4_FEATURE_RO_COMPAT_HUGE_FILE )) {
2017
+ has_huge_files = EXT4_HAS_RO_COMPAT_FEATURE (sb ,
2018
+ EXT4_FEATURE_RO_COMPAT_HUGE_FILE );
2019
+ if (has_huge_files ) {
2078
2020
/*
2079
2021
* Large file size enabled file system can only be
2080
2022
* mount if kernel is build with CONFIG_LSF
@@ -2124,8 +2066,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2124
2066
}
2125
2067
}
2126
2068
2127
- sbi -> s_bitmap_maxbytes = ext4_max_bitmap_size (sb -> s_blocksize_bits );
2128
- sb -> s_maxbytes = ext4_max_size (sb -> s_blocksize_bits );
2069
+ sbi -> s_bitmap_maxbytes = ext4_max_bitmap_size (sb -> s_blocksize_bits ,
2070
+ has_huge_files );
2071
+ sb -> s_maxbytes = ext4_max_size (sb -> s_blocksize_bits , has_huge_files );
2129
2072
2130
2073
if (le32_to_cpu (es -> s_rev_level ) == EXT4_GOOD_OLD_REV ) {
2131
2074
sbi -> s_inode_size = EXT4_GOOD_OLD_INODE_SIZE ;
0 commit comments