diff options
author | Pranay Kr. Srivastava <pranjas@gmail.com> | 2015-09-09 18:39:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-10 16:29:01 -0400 |
commit | e852d82a5b55b44ce8be89078d0dfbddbeae3211 (patch) | |
tree | 51b340100592465cea55ca9350725e11d5d81b8a /fs | |
parent | 9a5bc726d559221a3394bb8ef97d0abc1ee94d00 (diff) |
fs/affs: make root lookup from blkdev logical size
This patch resolves https://bugzilla.kernel.org/show_bug.cgi?id=16531.
When logical blkdev size > 512 then sector numbers become larger than the
device can support.
Make affs start lookup based on the device's logical sector size instead
of 512.
Reported-by: Mark <markk@clara.co.uk>
Suggested-by: Mark <markk@clara.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/affs/super.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/affs/super.c b/fs/affs/super.c index 3f89c9e05b40..5b50c4ca43a7 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/writeback.h> | 20 | #include <linux/writeback.h> |
21 | #include <linux/blkdev.h> | ||
21 | #include "affs.h" | 22 | #include "affs.h" |
22 | 23 | ||
23 | static int affs_statfs(struct dentry *dentry, struct kstatfs *buf); | 24 | static int affs_statfs(struct dentry *dentry, struct kstatfs *buf); |
@@ -352,18 +353,19 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
352 | * blocks, we will have to change it. | 353 | * blocks, we will have to change it. |
353 | */ | 354 | */ |
354 | 355 | ||
355 | size = sb->s_bdev->bd_inode->i_size >> 9; | 356 | size = i_size_read(sb->s_bdev->bd_inode) >> 9; |
356 | pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size); | 357 | pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size); |
357 | 358 | ||
358 | affs_set_blocksize(sb, PAGE_SIZE); | 359 | affs_set_blocksize(sb, PAGE_SIZE); |
359 | /* Try to find root block. Its location depends on the block size. */ | 360 | /* Try to find root block. Its location depends on the block size. */ |
360 | 361 | ||
361 | i = 512; | 362 | i = bdev_logical_block_size(sb->s_bdev); |
362 | j = 4096; | 363 | j = PAGE_SIZE; |
363 | if (blocksize > 0) { | 364 | if (blocksize > 0) { |
364 | i = j = blocksize; | 365 | i = j = blocksize; |
365 | size = size / (blocksize / 512); | 366 | size = size / (blocksize / 512); |
366 | } | 367 | } |
368 | |||
367 | for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) { | 369 | for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) { |
368 | sbi->s_root_block = root_block; | 370 | sbi->s_root_block = root_block; |
369 | if (root_block < 0) | 371 | if (root_block < 0) |