* [PATCH] make affs root lookup from blkdev logical size
@ 2015-07-07 6:59 Pranay Kr. Srivastava
2015-07-07 22:05 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Pranay Kr. Srivastava @ 2015-07-07 6:59 UTC (permalink / raw)
To: zippel, akpm, linux-fsdevel, linux-kernel; +Cc: Pranay Kr. Srivastava
This patch resolves Bug 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>
Fix Suggessted By: Mark <markk@clara.co.uk>
---
fs/affs/super.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 3f89c9e..5b50c4c 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -18,6 +18,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/writeback.h>
+#include <linux/blkdev.h>
#include "affs.h"
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)
* blocks, we will have to change it.
*/
- size = sb->s_bdev->bd_inode->i_size >> 9;
+ size = i_size_read(sb->s_bdev->bd_inode) >> 9;
pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size);
affs_set_blocksize(sb, PAGE_SIZE);
/* Try to find root block. Its location depends on the block size. */
- i = 512;
- j = 4096;
+ i = bdev_logical_block_size(sb->s_bdev);
+ j = PAGE_SIZE;
if (blocksize > 0) {
i = j = blocksize;
size = size / (blocksize / 512);
}
+
for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) {
sbi->s_root_block = root_block;
if (root_block < 0)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] make affs root lookup from blkdev logical size
2015-07-07 6:59 [PATCH] make affs root lookup from blkdev logical size Pranay Kr. Srivastava
@ 2015-07-07 22:05 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2015-07-07 22:05 UTC (permalink / raw)
To: Pranay Kr. Srivastava; +Cc: zippel, linux-fsdevel, linux-kernel
On Tue, 7 Jul 2015 12:29:02 +0530 "Pranay Kr. Srivastava" <pranjas@gmail.com> wrote:
> This patch resolves Bug 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>
> Fix Suggessted By: Mark <markk@clara.co.uk>
Can you please send your Signed-off-by: for this? It is described in
Documentation/SubmittingPatches section 11.
> --- a/fs/affs/super.c
> +++ b/fs/affs/super.c
> @@ -18,6 +18,7 @@
> #include <linux/sched.h>
> #include <linux/slab.h>
> #include <linux/writeback.h>
> +#include <linux/blkdev.h>
> #include "affs.h"
>
> 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)
> * blocks, we will have to change it.
> */
>
> - size = sb->s_bdev->bd_inode->i_size >> 9;
> + size = i_size_read(sb->s_bdev->bd_inode) >> 9;
> pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size);
>
> affs_set_blocksize(sb, PAGE_SIZE);
> /* Try to find root block. Its location depends on the block size. */
>
> - i = 512;
> - j = 4096;
> + i = bdev_logical_block_size(sb->s_bdev);
> + j = PAGE_SIZE;
Some architectures have PAGE_SIZE larger than 4k. What effect will
that have?
> if (blocksize > 0) {
> i = j = blocksize;
> size = size / (blocksize / 512);
> }
> +
> for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) {
> sbi->s_root_block = root_block;
> if (root_block < 0)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-07 22:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07 6:59 [PATCH] make affs root lookup from blkdev logical size Pranay Kr. Srivastava
2015-07-07 22:05 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).