From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH 7/7] ext4: Use correct descriptor size when reading the block group descriptor
Date: Mon, 20 Mar 2017 15:35:32 +0300 [thread overview]
Message-ID: <20170320123532.24059-8-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20170320123532.24059-1-antonynpavlov@gmail.com>
This is an adoption of the U-Boot commit
| commit f798b1dda1c5de818b806189e523d1b75db7e72d
| Author: Stefan Brüns <stefan.bruens@rwth-aachen.de>
| Date: Sat Sep 17 02:10:09 2016 +0200
|
| ext4: Use correct descriptor size when reading the block group descriptor
|
| The correct descriptor size must be used when calculating offsets, and
| also to read the correct amount of data.
|
| Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
fs/ext4/ext4_common.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index f35eebc21..55e837b4b 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -83,19 +83,19 @@ static int ext4fs_blockgroup(struct ext2_data *data, int group,
long int blkno;
unsigned int blkoff, desc_per_blk;
struct ext_filesystem *fs = data->fs;
+ int desc_size = fs->gdsize;
- desc_per_blk = EXT2_BLOCK_SIZE(data) / sizeof(struct ext2_block_group);
+ desc_per_blk = EXT2_BLOCK_SIZE(data) / desc_size;
blkno = le32_to_cpu(data->sblock.first_data_block) + 1 +
group / desc_per_blk;
- blkoff = (group % desc_per_blk) * sizeof(struct ext2_block_group);
+ blkoff = (group % desc_per_blk) * desc_size;
dev_dbg(fs->dev, "read %d group descriptor (blkno %ld blkoff %u)\n",
group, blkno, blkoff);
return ext4fs_devread(fs, blkno << LOG2_EXT2_BLOCK_SIZE(data),
- blkoff, sizeof(struct ext2_block_group),
- (char *)blkgrp);
+ blkoff, desc_size, (char *)blkgrp);
}
int ext4fs_read_inode(struct ext2_data *data, int ino, struct ext2_inode *inode)
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-03-20 12:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 12:35 [PATCH 0/7] fix ext4 support for volumes greater than 4 GiB Antony Pavlov
2017-03-20 12:35 ` [PATCH 1/7] ext4: change structure fields to __le/__be types Antony Pavlov
2017-03-20 12:35 ` [PATCH 2/7] ext4: use kernel names for byte swaps Antony Pavlov
2017-03-20 12:35 ` [PATCH 3/7] ext4: drop unused and misdefined INODE_SIZE_FILESYSTEM macro Antony Pavlov
2017-03-20 12:35 ` [PATCH 4/7] ext4: fix wrong usage of le32_to_cpu() Antony Pavlov
2017-03-20 12:35 ` [PATCH 5/7] ext4: Update ext2/3/4 superblock, group descriptor and inode structures Antony Pavlov
2017-03-20 12:35 ` [PATCH 6/7] ext4: determine group descriptor size for 64bit feature Antony Pavlov
2017-03-20 12:35 ` Antony Pavlov [this message]
2017-03-22 6:57 ` [PATCH 0/7] fix ext4 support for volumes greater than 4 GiB Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170320123532.24059-8-antonynpavlov@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox