* [Updated PATCH] ext4: Use the correct block number when reading the super block.
@ 2007-12-31 8:29 Aneesh Kumar K.V
2007-12-31 8:42 ` Aneesh Kumar K.V
0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2007-12-31 8:29 UTC (permalink / raw)
To: cmm, tytso, akpm; +Cc: linux-ext4, Aneesh Kumar K.V
If the block device hard sector size is larger than EXT4_MIN_BLOCK_SIZE we
end up with wrong block number when reading super block.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ext4/super.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 1ca0f54..3095370 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1629,8 +1629,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
* block sizes. We need to calculate the offset from buffer start.
*/
if (blocksize != EXT4_MIN_BLOCK_SIZE) {
- logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;
- offset = do_div(logical_sb_block, blocksize);
+ logical_sb_block = (sb_block * EXT4_MIN_BLOCK_SIZE) / blocksize;
+ offset = do_div((sb_block * EXT4_MIN_BLOCK_SIZE), blocksize);
} else {
logical_sb_block = sb_block;
}
@@ -1747,8 +1747,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
brelse (bh);
sb_set_blocksize(sb, blocksize);
- logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;
- offset = do_div(logical_sb_block, blocksize);
+ logical_sb_block = (sb_block * EXT4_MIN_BLOCK_SIZE) / blocksize;
+ offset = do_div((sb_block * EXT4_MIN_BLOCK_SIZE), blocksize);
bh = sb_bread(sb, logical_sb_block);
if (!bh) {
printk(KERN_ERR
--
1.5.4.rc2-dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Updated PATCH] ext4: Use the correct block number when reading the super block.
2007-12-31 8:29 [Updated PATCH] ext4: Use the correct block number when reading the super block Aneesh Kumar K.V
@ 2007-12-31 8:42 ` Aneesh Kumar K.V
0 siblings, 0 replies; 2+ messages in thread
From: Aneesh Kumar K.V @ 2007-12-31 8:42 UTC (permalink / raw)
To: cmm, tytso, akpm; +Cc: linux-ext4
On Mon, Dec 31, 2007 at 01:59:22PM +0530, Aneesh Kumar K.V wrote:
> If the block device hard sector size is larger than EXT4_MIN_BLOCK_SIZE we
> end up with wrong block number when reading super block.
>
Ignore the patch. I got confused by the do_div syntax. The do_div already save
the division result in logical_sb_block;
-aneesh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-31 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-31 8:29 [Updated PATCH] ext4: Use the correct block number when reading the super block Aneesh Kumar K.V
2007-12-31 8:42 ` Aneesh Kumar K.V
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox