From: "Jose R. Santos" <jrs@us.ibm.com>
To: "Jose R. Santos" <jrs@us.ibm.com>,
"Theodore Ts'o" <tytso@mit.edu>,
linux-ext4@vger.kernel.org
Subject: [PATCH 10/15][e2fsprogs] Use new ext2fs_super_and_bgd_loc2 call in libext2fs.
Date: Tue, 15 Jul 2008 11:51:01 -0500 [thread overview]
Message-ID: <20080715165101.28567.63362.stgit@ichigo> (raw)
In-Reply-To: <20080715164332.28567.27913.stgit@ichigo>
From: Jose R. Santos <jrs@us.ibm.com>
Use new ext2fs_super_and_bgd_loc2 call in libext2fs.
The new ext2fs_super_and_bgd_loc2() function has some changes aside
from just blk64_t support. Lets make sure that the interfaces are
sane by adding libext2fs support early to get the new API tested here.
Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
--
e2fsck/pass5.c | 7 ++++---
lib/ext2fs/alloc_sb.c | 23 +++++++++++++++++++----
lib/ext2fs/closefs.c | 9 +++++----
3 files changed, 28 insertions(+), 11 deletions(-)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
--
e2fsck/pass5.c | 7 ++++---
lib/ext2fs/alloc_sb.c | 23 +++++++++++++++++++----
lib/ext2fs/closefs.c | 9 +++++----
3 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index cc17820..a729308 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -111,7 +111,8 @@ static void print_bitmap_problem(e2fsck_t ctx, int problem,
static void check_block_bitmaps(e2fsck_t ctx)
{
ext2_filsys fs = ctx->fs;
- blk_t i, super;
+ blk64_t i;
+ blk_t super;
int *free_array;
int group = 0;
blk_t blocks = 0;
@@ -174,10 +175,10 @@ redo_counts:
actual = ext2fs_fast_test_block_bitmap(ctx->block_found_map, i);
if (skip_group) {
- blk_t super_blk, old_desc_blk, new_desc_blk;
+ blk64_t super_blk, old_desc_blk, new_desc_blk;
int old_desc_blocks;
- ext2fs_super_and_bgd_loc(fs, group, &super_blk,
+ ext2fs_super_and_bgd_loc2(fs, group, &super_blk,
&old_desc_blk, &new_desc_blk, 0);
if (fs->super->s_feature_incompat &
diff --git a/lib/ext2fs/alloc_sb.c b/lib/ext2fs/alloc_sb.c
index cdcb866..94a79c2 100644
--- a/lib/ext2fs/alloc_sb.c
+++ b/lib/ext2fs/alloc_sb.c
@@ -44,11 +44,12 @@ int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
dgrp_t group,
ext2fs_block_bitmap bmap)
{
- blk_t super_blk, old_desc_blk, new_desc_blk;
+ blk64_t super_blk, old_desc_blk, new_desc_blk;
+ blk_t used_blks;
int j, old_desc_blocks, num_blocks;
- num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk,
- &old_desc_blk, &new_desc_blk, 0);
+ ext2fs_super_and_bgd_loc2(fs, group, &super_blk,
+ &old_desc_blk, &new_desc_blk, &used_blks);
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
old_desc_blocks = fs->super->s_first_meta_bg;
@@ -57,6 +58,7 @@ int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
if (super_blk || (group == 0))
+ /* FIXME-64 */
ext2fs_mark_block_bitmap(bmap, super_blk);
if (old_desc_blk) {
@@ -64,11 +66,24 @@ int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
fs->group_desc[group].bg_flags &= ~EXT2_BG_BLOCK_UNINIT;
for (j=0; j < old_desc_blocks; j++)
if (old_desc_blk + j < fs->super->s_blocks_count)
+ /* FIXME-64 */
ext2fs_mark_block_bitmap(bmap,
old_desc_blk + j);
}
if (new_desc_blk)
+ /* FIXME-64 */
ext2fs_mark_block_bitmap(bmap, new_desc_blk);
- return num_blocks;
+ if (group == fs->group_desc_count-1) {
+ num_blocks = (fs->super->s_blocks_count -
+ fs->super->s_first_data_block) %
+ fs->super->s_blocks_per_group;
+ if (!num_blocks)
+ num_blocks = fs->super->s_blocks_per_group;
+ } else
+ num_blocks = fs->super->s_blocks_per_group;
+
+ num_blocks -= 2 + fs->inode_blocks_per_group + used_blks;
+
+ return num_blocks ;
}
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 8231ca6..b61556e 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -338,11 +338,10 @@ errcode_t ext2fs_flush(ext2_filsys fs)
old_desc_blocks = fs->desc_blocks;
for (i = 0; i < fs->group_desc_count; i++) {
- blk_t super_blk, old_desc_blk, new_desc_blk;
- int meta_bg;
+ blk64_t super_blk, old_desc_blk, new_desc_blk;
- ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk,
- &new_desc_blk, &meta_bg);
+ ext2fs_super_and_bgd_loc2(fs, i, &super_blk, &old_desc_blk,
+ &new_desc_blk, 0);
if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) {
retval = write_backup_super(fs, i, super_blk,
@@ -360,6 +359,8 @@ errcode_t ext2fs_flush(ext2_filsys fs)
goto errout;
}
if (new_desc_blk) {
+ int meta_bg = i / EXT2_DESC_PER_BLOCK(fs->super);
+
retval = io_channel_write_blk(fs->io, new_desc_blk,
1, group_ptr + (meta_bg*fs->blocksize));
if (retval)
next prev parent reply other threads:[~2008-07-15 16:51 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-15 16:50 [PATCH 00/15][e2fsprogs] Initial blk64_t capable API calls Jose R. Santos
2008-07-15 16:50 ` [PATCH 01/15][e2fsprogs] libext2fs: Add 64-bit support to the undo manager Jose R. Santos
2008-07-16 11:16 ` Goswin von Brederlow
2008-07-16 13:26 ` Theodore Tso
2008-07-15 16:50 ` [PATCH 02/15][e2fsprogs] Add ext2_off64_t type Jose R. Santos
2008-07-15 16:50 ` [PATCH 03/15][e2fsprogs] Add new blk64_t handling functions Jose R. Santos
2008-07-15 16:50 ` [PATCH 04/15][e2fsprogs] Use blk64_t for blocks in struct ext2_file Jose R. Santos
2008-07-15 16:50 ` [PATCH 05/15][e2fsprogs] Add 64-bit dirblock interface Jose R. Santos
2008-07-15 16:50 ` [PATCH 06/15][e2fsprogs] Add 64-bit alloc_stats interface Jose R. Santos
2008-07-15 16:50 ` [PATCH 07/15][e2fsprogs] Add 64-bit alloc interface Jose R. Santos
2008-07-15 16:50 ` [PATCH 08/15][e2fsprogs] Add 64-bit ext_attr interface Jose R. Santos
2008-07-15 16:50 ` [PATCH 09/15][e2fsprogs] Add 64-bit closefs interface Jose R. Santos
2008-07-15 16:51 ` Jose R. Santos [this message]
2008-07-15 16:51 ` [PATCH 11/15][e2fsprogs] Add 64-bit openfs interface Jose R. Santos
2008-07-15 16:51 ` [PATCH 12/15][e2fsprogs] Add ext2fs_div64_ceil() Jose R. Santos
2008-07-15 16:51 ` [PATCH 13/15][e2fsprogs] Add 64-bit getsize interface Jose R. Santos
2008-07-15 16:51 ` [PATCH 14/15][e2fsprogs] Add 64-bit mkjournal.c interface Jose R. Santos
2008-07-15 16:51 ` [PATCH 15/15][e2fsprogs] 64-bit mke2fs cleanup Jose R. Santos
2008-07-16 12:50 ` Goswin von Brederlow
2008-07-16 13:52 ` Goswin von Brederlow
2008-07-16 14:18 ` Jose R. Santos
2008-07-16 15:23 ` Goswin von Brederlow
2008-07-16 16:02 ` Jose R. Santos
2008-07-16 17:18 ` Theodore Tso
2008-07-16 18:03 ` Jose R. Santos
2008-07-16 18:58 ` Goswin von Brederlow
2008-07-16 14:09 ` Jose R. Santos
2008-07-16 14:54 ` Theodore Tso
2008-07-16 15:18 ` Jose R. Santos
2008-07-16 16:31 ` Theodore Tso
2008-07-16 17:26 ` Jose R. Santos
2008-07-16 19:07 ` Goswin von Brederlow
2008-07-16 19:40 ` Jose R. Santos
2008-07-16 15:21 ` Goswin von Brederlow
2008-07-16 15:30 ` Jose R. Santos
2008-07-16 15:13 ` Goswin von Brederlow
2008-07-16 17:44 ` Jose R. Santos
2008-07-16 16:31 ` Goswin von Brederlow
2008-07-17 20:46 ` [PATCH 15/15][e2fsprogs] 64-bit mke2fs cleanup [NEW Version] Jose R. Santos
2008-07-18 11:35 ` Goswin von Brederlow
2008-07-18 15:15 ` Jose R. Santos
2008-07-18 19:59 ` Goswin von Brederlow
2008-07-21 5:04 ` Andreas Dilger
-- strict thread matches above, loose matches on Subject: below --
2008-08-20 17:32 [PATCH 00/15] [e2fsprogs] Initial blk64_t capable API calls Jose R. Santos
2008-08-20 17:33 ` [PATCH 10/15][e2fsprogs] Use new ext2fs_super_and_bgd_loc2 call in libext2fs Jose R. Santos
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=20080715165101.28567.63362.stgit@ichigo \
--to=jrs@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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