mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
reiserfs: ignore on disk s_bmap_nr value
Implement support for file systems larger than 8 TiB. The reiserfs superblock contains a 16 bit value for counting the number of bitmap blocks. The rest of the disk format supports file systems up to 2^32 blocks, but the bitmap block limitation artificially limits this to 8 TiB with a 4KiB block size. Rather than trust the superblock's 16-bit bitmap block count, we calculate it dynamically based on the number of blocks in the file system. When an incorrect value is observed in the superblock, it is zeroed out, ensuring that older kernels will not be able to mount the file system. Userspace support has already been implemented and shipped in reiserfsprogs 3.6.20. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4d20851d37
commit
cb680c1be6
5 changed files with 56 additions and 23 deletions
|
@ -61,7 +61,8 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
|
|||
}
|
||||
|
||||
/* count used bits in last bitmap block */
|
||||
block_r = SB_BLOCK_COUNT(s) - (SB_BMAP_NR(s) - 1) * s->s_blocksize * 8;
|
||||
block_r = SB_BLOCK_COUNT(s) -
|
||||
(reiserfs_bmap_count(s) - 1) * s->s_blocksize * 8;
|
||||
|
||||
/* count bitmap blocks in new fs */
|
||||
bmap_nr_new = block_count_new / (s->s_blocksize * 8);
|
||||
|
@ -73,7 +74,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
|
|||
|
||||
/* save old values */
|
||||
block_count = SB_BLOCK_COUNT(s);
|
||||
bmap_nr = SB_BMAP_NR(s);
|
||||
bmap_nr = reiserfs_bmap_count(s);
|
||||
|
||||
/* resizing of reiserfs bitmaps (journal and real), if needed */
|
||||
if (bmap_nr_new > bmap_nr) {
|
||||
|
@ -200,7 +201,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
|
|||
free_blocks + (block_count_new - block_count -
|
||||
(bmap_nr_new - bmap_nr)));
|
||||
PUT_SB_BLOCK_COUNT(s, block_count_new);
|
||||
PUT_SB_BMAP_NR(s, bmap_nr_new);
|
||||
PUT_SB_BMAP_NR(s, bmap_would_wrap(bmap_nr_new) ? : bmap_nr_new);
|
||||
s->s_dirt = 1;
|
||||
|
||||
journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue