Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/ntfs3: Initiliaze sb blocksize only in one place + refactor

Right now sb blocksize first get initiliazed in fill_super but in can be
changed in helper function. It makes more sense to that this happened
only in one place.

Because we move this to helper function it makes more sense that
s_maxbytes will also be there. I rather have every sb releted thing in
fill_super, but because there is already sb releted stuff in this
helper. This will have to do for now.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

authored by

Kari Argillander and committed by
Konstantin Komarov
28861e3b 0e59a87e

+3 -10
+3 -10
fs/ntfs3/super.c
··· 840 840 rec->total = cpu_to_le32(sbi->record_size); 841 841 ((struct ATTRIB *)Add2Ptr(rec, ao))->type = ATTR_END; 842 842 843 - if (sbi->cluster_size < PAGE_SIZE) 844 - sb_set_blocksize(sb, sbi->cluster_size); 843 + sb_set_blocksize(sb, min_t(u32, sbi->cluster_size, PAGE_SIZE)); 845 844 846 845 sbi->block_mask = sb->s_blocksize - 1; 847 846 sbi->blocks_per_cluster = sbi->cluster_size >> sb->s_blocksize_bits; ··· 853 854 if (clusters >= (1ull << (64 - sbi->cluster_bits))) 854 855 sbi->maxbytes = -1; 855 856 sbi->maxbytes_sparse = -1; 857 + sb->s_maxbytes = MAX_LFS_FILESIZE; 856 858 #else 857 859 /* Maximum size for sparse file. */ 858 860 sbi->maxbytes_sparse = (1ull << (sbi->cluster_bits + 32)) - 1; 861 + sb->s_maxbytes = 0xFFFFFFFFull << sbi->cluster_bits; 859 862 #endif 860 863 861 864 err = 0; ··· 912 911 ~(u64)(sbi->discard_granularity - 1); 913 912 } 914 913 915 - sb_set_blocksize(sb, PAGE_SIZE); 916 - 917 914 /* Parse boot. */ 918 915 err = ntfs_init_from_boot(sb, rq ? queue_logical_block_size(rq) : 512, 919 916 bdev->bd_inode->i_size); 920 917 if (err) 921 918 return err; 922 - 923 - #ifdef CONFIG_NTFS3_64BIT_CLUSTER 924 - sb->s_maxbytes = MAX_LFS_FILESIZE; 925 - #else 926 - sb->s_maxbytes = 0xFFFFFFFFull << sbi->cluster_bits; 927 - #endif 928 919 929 920 /* 930 921 * Load $Volume. This should be done before $LogFile