Many files:
alloc_tables.c (ext2fs_allocate_group_table): Fix bug so that if the
stride length hits a bad value, we retry the block allocation starting
at the beginning of the block group.
ext2fs.h, bb_inode.c, block.c, bmove.c, dir_iterate.c, expanddir.c,
ext2fsP.h, read_bb.c: Change blkcnt_t to be e2_blkcnt_t to avoid
collision with LFS API.
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 74ed690..b8675fa 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,13 @@
+1998-06-10 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * alloc_tables.c (ext2fs_allocate_group_table): Fix bug so that if
+ the stride length hits a bad value, we retry the block
+ allocation starting at the beginning of the block group.
+
+ * ext2fs.h, bb_inode.c, block.c, bmove.c, dir_iterate.c,
+ expanddir.c, ext2fsP.h, read_bb.c: Change blkcnt_t to be
+ e2_blkcnt_t to avoid collision with LFS API.
+
1998-05-01 Theodore Ts'o <tytso@rsts-11.mit.edu>
* initialize.c (ext2fs_initialize): Initialize s_inodes_count in a
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index 3a05759..3660c5e 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -85,6 +85,9 @@
if (!fs->group_desc[group].bg_block_bitmap) {
retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
1, bmap, &new_blk);
+ if (retval == EXT2_ET_BLOCK_ALLOC_FAIL)
+ retval = ext2fs_get_free_blocks(fs, group_blk,
+ last_blk, 1, bmap, &new_blk);
if (retval)
return retval;
ext2fs_mark_block_bitmap(bmap, new_blk);
@@ -94,6 +97,9 @@
if (!fs->group_desc[group].bg_inode_bitmap) {
retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
1, bmap, &new_blk);
+ if (retval == EXT2_ET_BLOCK_ALLOC_FAIL)
+ retval = ext2fs_get_free_blocks(fs, group_blk,
+ last_blk, 1, bmap, &new_blk);
if (retval)
return retval;
ext2fs_mark_block_bitmap(bmap, new_blk);
diff --git a/lib/ext2fs/bb_inode.c b/lib/ext2fs/bb_inode.c
index 38d1052..e6ce776 100644
--- a/lib/ext2fs/bb_inode.c
+++ b/lib/ext2fs/bb_inode.c
@@ -47,11 +47,11 @@
};
static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_block, int ref_offset,
void *priv_data);
static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_block, int ref_offset,
void *priv_data);
@@ -166,7 +166,7 @@
#pragma argsused
#endif
static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_block, int ref_offset,
void *priv_data)
{
@@ -228,7 +228,7 @@
#pragma argsused
#endif
static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
- blkcnt_t blockcnt, blk_t ref_block,
+ e2_blkcnt_t blockcnt, blk_t ref_block,
int ref_offset, void *priv_data)
{
struct set_badblock_record *rec = (struct set_badblock_record *)
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 16a97c8..72cbb4a 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -27,11 +27,11 @@
ext2_filsys fs;
int (*func)(ext2_filsys fs,
blk_t *blocknr,
- blkcnt_t bcount,
+ e2_blkcnt_t bcount,
blk_t ref_blk,
int ref_offset,
void *priv_data);
- blkcnt_t bcount;
+ e2_blkcnt_t bcount;
int bsize;
int flags;
errcode_t errcode;
@@ -307,7 +307,7 @@
char *block_buf,
int (*func)(ext2_filsys fs,
blk_t *blocknr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_blk,
int ref_offset,
void *priv_data),
@@ -445,7 +445,7 @@
#ifdef __TURBOC__
#pragma argsused
#endif
-static int xlate_func(ext2_filsys fs, blk_t *blocknr, blkcnt_t blockcnt,
+static int xlate_func(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
blk_t ref_block, int ref_offset, void *priv_data)
{
struct xlate *xl = (struct xlate *) priv_data;
diff --git a/lib/ext2fs/bmove.c b/lib/ext2fs/bmove.c
index 2745307..fbb5f9b 100644
--- a/lib/ext2fs/bmove.c
+++ b/lib/ext2fs/bmove.c
@@ -38,7 +38,7 @@
};
static int process_block(ext2_filsys fs, blk_t *block_nr,
- blkcnt_t blockcnt, blk_t ref_block,
+ e2_blkcnt_t blockcnt, blk_t ref_block,
int ref_offset, void *priv_data)
{
struct process_block_struct *pb;
diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
index 869c13b..9aff315 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -74,7 +74,7 @@
*/
extern int ext2fs_process_dir_block(ext2_filsys fs,
blk_t *blocknr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_block,
int ref_offset,
void *priv_data)
diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c
index e2d8c35..bdfc257 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -30,7 +30,7 @@
static int expand_dir_proc(ext2_filsys fs,
blk_t *blocknr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_block,
int ref_offset,
void *priv_data)
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 83ca4df..9a28af5 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -54,7 +54,7 @@
typedef __u32 blk_t;
typedef unsigned int dgrp_t;
typedef __u32 ext2_off_t;
-typedef __s64 blkcnt_t;
+typedef __s64 e2_blkcnt_t;
#if EXT2_FLAT_INCLUDES
#include "com_err.h"
@@ -554,7 +554,7 @@
char *block_buf,
int (*func)(ext2_filsys fs,
blk_t *blocknr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_blk,
int ref_offset,
void *priv_data),
diff --git a/lib/ext2fs/ext2fsP.h b/lib/ext2fs/ext2fsP.h
index 129cf90..b2b593d 100644
--- a/lib/ext2fs/ext2fsP.h
+++ b/lib/ext2fs/ext2fsP.h
@@ -85,7 +85,7 @@
extern int ext2fs_process_dir_block(ext2_filsys fs,
blk_t *blocknr,
- blkcnt_t blockcnt,
+ e2_blkcnt_t blockcnt,
blk_t ref_block,
int ref_offset,
void *priv_data);
diff --git a/lib/ext2fs/read_bb.c b/lib/ext2fs/read_bb.c
index c43f97c..c005d42 100644
--- a/lib/ext2fs/read_bb.c
+++ b/lib/ext2fs/read_bb.c
@@ -43,7 +43,7 @@
#pragma argsused
#endif
static int mark_bad_block(ext2_filsys fs, blk_t *block_nr,
- blkcnt_t blockcnt, blk_t ref_block,
+ e2_blkcnt_t blockcnt, blk_t ref_block,
int ref_offset, void *priv_data)
{
struct read_bb_record *rb = (struct read_bb_record *) priv_data;