Initial blk64_t capable API calls.
cover Initial blk64_t capable API calls.
The following series of patches implement API call needed to handle 64-bit block numbers. Im concentrating mainly in providing the API call first and if the interfaces are sane, we can go ahead and start using them in the rest of libext2fs and the user space programs.
I've run checkpatch and make check on each individual patch in the series so they should be ready to add to the main repository if the interfaces are acceptable.
-JRS
PATCH 1/10 Add ext2_off64_t type.
From: Jose R. Santos <[email protected]>
Add ext2_off64_t type.
The ext2_off_t is u32. Creating a new 64-bit ext2_off64_t for 64bit offsets.
--
lib/ext2fs/ext2fs.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
lib/ext2fs/ext2fs.h +1 -0
@@ -68,6 +68,7 @@ typedef __u32 blk_t;typedef __u64 blk64_t ;typedef __u32 dgrp_t ;typedef __u32 ext2_off_t ; +typedef __u64 ext2_off64_t ;typedef __s64 e2_blkcnt_t ;typedef __u32 ext2_dirhash_t ;
PATCH 2/10 Add new blk64_t handling functions
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Add new blk64_t handling functions
Add new blknum.c file which contains funtions to handle blk64_t and low/high values in super blocks and inodes.
--
lib/ext2fs/Makefile.in | 1 lib/ext2fs/blknum.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/ext2fs/ext2fs.h | 33 +++++-- 3 files changed, 237 insertions(+), 11 deletions(-)
lib/ext2fs/Makefile.in +1 -0
@@ -26,6 +26,7 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \ bb_inode.o \ bitmaps.o \ bitops.o \ + blknum.o \ block.o \ bmap.o \ check_desc.o \
lib/ext2fs/blknum.c new file +214 -0
214 lines not on this page · raw message
lib/ext2fs/ext2fs.h +22 -11
@@ -650,6 +650,24 @@ extern errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap, blk_t start, unsigned int num, void *out); +/* blknum.c */ +extern dgrp_t ext2fs_group_of_blk2 (ext2_filsys fs,blk64_t ); +extern blk64_t ext2fs_group_first_block2 (ext2_filsys fs,dgrp_t group); +extern blk64_t ext2fs_group_last_block2 (ext2_filsys fs,dgrp_t group); +extern blk64_t ext2fs_inode_data_blocks2 (ext2_filsys fs, +struct ext2_inode *inode); +extern blk64_t ext2fs_blocks_count (ext2_filsys fs); +extern void ext2_blocks_count_set (ext2_filsys fs,blk64_t blk); +extern blk64_t ext2_r_blocks_count (ext2_filsys fs); +extern void ext2_r_blocks_count_set (ext2_filsys fs,blk64_t blk); +extern blk64_t ext2_free_blocks_count (ext2_filsys fs); +extern void ext2_free_blocks_count_set (ext2_filsys fs,blk64_t blk); +extern blk64_t ext2_block_bitmap (ext2_filsys fs,dgrp_t group); +extern void ext2_block_bitmap_set (ext2_filsys fs,dgrp_t group,blk_t blk); +extern blk64_t ext2_inode_bitmap (ext2_filsys fs,dgrp_t group); +extern void ext2_inode_bitmap_set (ext2_filsys fs,dgrp_t group,blk_t blk); +extern blk64_t ext2_inode_table (ext2_filsys fs,dgrp_t group); +extern void ext2_inode_table_set (ext2_filsys fs,dgrp_t group,blk_t blk);/* block.c */ extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
@@ -1281,10 +1299,8 @@ _INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)*/ _INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk) { -return (blk - fs->super->s_first_data_block) / - fs->super->s_blocks_per_group; +return ext2fs_group_of_blk2 (fs, blk); } -/* * Return the group # of an inode number */
@@ -1298,8 +1314,7 @@ _INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)*/ _INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group) { -return fs->super->s_first_data_block + - (group * fs->super->s_blocks_per_group); +return ext2fs_group_first_block2 (fs, group); }/*
@@ -1307,17 +1322,13 @@ _INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)*/ _INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group) { -return (group == fs->group_desc_count -1 ? - fs->super->s_blocks_count -1 : -ext2fs_group_first_block (fs, group) + - (fs->super->s_blocks_per_group -1 )); +return ext2fs_group_last_block2 (fs, group); } _INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,struct ext2_inode *inode) { -return inode->i_blocks - - (inode->i_file_acl ? fs->blocksize >>9 :0 ); +return ext2fs_inode_data_blocks2 (fs, inode); }/*
PATCH 3/10 Use blk64_t for blocks in struct ext2_file.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Use blk64_t for blocks in struct ext2_file.
The ext2_file structure is never exposed through the libext2fs API so it is safe to use 64-bit blocks for blockno and physclock without breaking the ABI.
--
lib/ext2fs/fileio.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
lib/ext2fs/fileio.c +6 -6
@@ -25,8 +25,8 @@ struct ext2_file {struct ext2_inode inode;int flags;__u64 pos; -blk_t blockno; -blk_t physblock; +blk64_t blockno; +blk64_t physblock;char *buf; };
@@ -116,9 +116,9 @@ errcode_t ext2fs_file_flush(ext2_file_t file)* Allocate it. */ if (!file->physblock) { - retval =ext2fs_bmap (fs, file->ino, &file->inode, + retval =ext2fs_bmap2 (fs, file->ino, &file->inode,BMAP_BUFFER , file->ino ?BMAP_ALLOC :0 , - file->blockno, &file->physblock); + file->blockno,0 , &file->physblock);if (retval)return retval; }
@@ -168,8 +168,8 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill)errcode_t retval;if (!(file->flags &EXT2_FILE_BUF_VALID )) { - retval =ext2fs_bmap (fs, file->ino, &file->inode, -BMAP_BUFFER ,0 , file->blockno, + retval =ext2fs_bmap2 (fs, file->ino, &file->inode, +BMAP_BUFFER ,0 , file->blockno,0 , &file->physblock);if (retval)return retval;
PATCH 4/10 Add 64-bit dirblock interface.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Add 64-bit dirblock interface.
Add new ext2fs_(read|write)_dir_block3() routines that take blk64_t as an input.
--
lib/ext2fs/dirblock.c | 23 +++++++++++++++++------ lib/ext2fs/ext2fs.h | 4 ++++ 2 files changed, 21 insertions(+), 6 deletions(-)
lib/ext2fs/dirblock.c +17 -6
@@ -19,7 +19,7 @@#include "ext2_fs.h" #include "ext2fs.h" -errcode_t ext2fs_read_dir_block2 (ext2_filsys fs,blk_t block, +errcode_t ext2fs_read_dir_block3 (ext2_filsys fs,blk64_t block, void *buf, int flags EXT2FS_ATTR((unused))) {errcode_t retval;
@@ -28,7 +28,7 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,unsigned int name_len, rec_len; - retval =io_channel_read_blk (fs->io, block,1 , buf); + retval =io_channel_read_blk64 (fs->io, block,1 , buf);if (retval)return retval;
@@ -58,14 +58,20 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,return retval; } +errcode_t ext2fs_read_dir_block2 (ext2_filsys fs,blk_t block, + void *buf, int flags EXT2FS_ATTR((unused))) +{ +return ext2fs_read_dir_block3 (fs, block, buf, flags); +} +errcode_t ext2fs_read_dir_block (ext2_filsys fs,blk_t block,void *buf) { -return ext2fs_read_dir_block2 (fs, block, buf,0 ); +return ext2fs_read_dir_block3 (fs, block, buf,0 ); } -errcode_t ext2fs_write_dir_block2 (ext2_filsys fs,blk_t block, +errcode_t ext2fs_write_dir_block3 (ext2_filsys fs,blk64_t block, void *inbuf, int flags EXT2FS_ATTR((unused))) {#ifdef WORDS_BIGENDIAN
@@ -95,7 +101,7 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,if (flags &EXT2_DIRBLOCK_V2_STRUCT ) dirent->name_len = ext2fs_swab16(dirent->name_len); } - retval =io_channel_write_blk (fs->io, block,1 , buf); + retval =io_channel_write_blk64 (fs->io, block,1 , buf);ext2fs_free_mem (&buf);return retval;#else
@@ -103,10 +109,15 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,#endif } +errcode_t ext2fs_write_dir_block2 (ext2_filsys fs,blk_t block, + void *inbuf, int flags EXT2FS_ATTR((unused))) +{ +return ext2fs_write_dir_block3 (fs, block, inbuf, flags); +}errcode_t ext2fs_write_dir_block (ext2_filsys fs,blk_t block,void *inbuf) { -return ext2fs_write_dir_block2 (fs, block, inbuf,0 ); +return ext2fs_write_dir_block3 (fs, block, inbuf,0 ); }
lib/ext2fs/ext2fs.h +4 -0
@@ -770,10 +770,14 @@ extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block, void *buf);extern errcode_t ext2fs_read_dir_block2 (ext2_filsys fs,blk_t block,void *buf,int flags); +extern errcode_t ext2fs_read_dir_block3 (ext2_filsys fs,blk64_t block, +void *buf,int flags);extern errcode_t ext2fs_write_dir_block (ext2_filsys fs,blk_t block,void *buf);extern errcode_t ext2fs_write_dir_block2 (ext2_filsys fs,blk_t block,void *buf,int flags); +extern errcode_t ext2fs_write_dir_block3 (ext2_filsys fs,blk64_t block, +void *buf,int flags);/* dirhash.c */ extern errcode_t ext2fs_dirhash(int version, const char *name, int len,
PATCH 5/10 Add 64-bit alloc_stats interface.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Add 64-bit alloc_stats interface.
Add new ext2fs_block_alloc_stats2() routine that takes blk64_t as an input.
--
lib/ext2fs/alloc_stats.c | 11 +++++++++-- lib/ext2fs/ext2fs.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-)
lib/ext2fs/alloc_stats.c +9 -2
@@ -54,13 +54,15 @@ void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse)ext2fs_inode_alloc_stats2 (fs, ino, inuse,0 ); } -void ext2fs_block_alloc_stats (ext2_filsys fs,blk_t blk,int inuse) +void ext2fs_block_alloc_stats2 (ext2_filsys fs,blk64_t blk,int inuse) { -int group =ext2fs_group_of_blk (fs, blk); +int group =ext2fs_group_of_blk2 (fs, blk);if (inuse >0 ) +/* FIXME-64 */ ext2fs_mark_block_bitmap (fs->block_map, blk);else +/* FIXME-64 */ ext2fs_unmark_block_bitmap (fs->block_map, blk); fs->group_desc[group].bg_free_blocks_count -= inuse; fs->group_desc[group].bg_flags &= ~EXT2_BG_BLOCK_UNINIT ;
@@ -70,3 +72,8 @@ void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse)ext2fs_mark_super_dirty (fs);ext2fs_mark_bb_dirty (fs); } + +void ext2fs_block_alloc_stats (ext2_filsys fs,blk_t blk,int inuse) +{ +ext2fs_block_alloc_stats2 (fs, blk, inuse); +}
lib/ext2fs/ext2fs.h +1 -0
@@ -554,6 +554,7 @@ void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse);void ext2fs_inode_alloc_stats2 (ext2_filsys fs,ext2_ino_t ino,int inuse,int isdir);void ext2fs_block_alloc_stats (ext2_filsys fs,blk_t blk,int inuse); +void ext2fs_block_alloc_stats2 (ext2_filsys fs,blk64_t blk,int inuse);/* alloc_tables.c */ extern errcode_t ext2fs_allocate_tables (ext2_filsys fs);
PATCH 6/10 Add 64-bit alloc interface.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Add 64-bit alloc interface.
Add new ext2fs_new_block2(), ext2fs_get_free_blocks2() and ext2fs_alloc_block2() that take and return blk64_t.
--
lib/ext2fs/alloc.c | 59 +++++++++++++++++++++++++++++++++++++++++---------- lib/ext2fs/ext2fs.h | 8 +++++++ 2 files changed, 55 insertions(+), 12 deletions(-)
lib/ext2fs/alloc.c +47 -12
@@ -73,10 +73,10 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir,* Stupid algorithm --- we now just search forward starting from the * goal. Should put in a smarter one someday.... */ -errcode_t ext2fs_new_block (ext2_filsys fs,blk_t goal, -ext2fs_block_bitmap map,blk_t *ret) +errcode_t ext2fs_new_block2 (ext2_filsys fs,blk64_t goal, +ext2fs_block_bitmap map,blk64_t *ret) { -blk_t i; +blk64_t i;EXT2_CHECK_MAGIC (fs,EXT2_ET_MAGIC_EXT2FS_FILSYS );
@@ -88,6 +88,7 @@ errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, goal = fs->super->s_first_data_block; i = goal; do { + /* FIXME-64 */ if (!ext2fs_fast_test_block_bitmap(map, i)) { *ret = i; return 0;
@@ -99,15 +100,26 @@ errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,return EXT2_ET_BLOCK_ALLOC_FAIL ; } +errcode_t ext2fs_new_block (ext2_filsys fs,blk_t goal, +ext2fs_block_bitmap map,blk_t *ret) +{ +errcode_t retval; +blk64_t val; + retval =ext2fs_new_block2 (fs, goal, map, &val); +if (!retval) + *ret = (blk_t ) val; +return retval; +} +/* * This function zeros out the allocated block, and updates all of the * appropriate filesystem records. */ -errcode_t ext2fs_alloc_block (ext2_filsys fs,blk_t goal, -char *block_buf,blk_t *ret) +errcode_t ext2fs_alloc_block2 (ext2_filsys fs,blk64_t goal, +char *block_buf,blk64_t *ret) {errcode_t retval; -blk_t block; +blk64_t block;char *buf =0 ;if (!block_buf) {
@@ -119,20 +131,21 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,memset (block_buf,0 , fs->blocksize);if (!fs->block_map) { +/* FIXME-64 */ retval =ext2fs_read_block_bitmap (fs);if (retval) goto fail; } - retval =ext2fs_new_block (fs, goal,0 , &block); + retval =ext2fs_new_block2 (fs, goal,0 , &block);if (retval) goto fail; - retval =io_channel_write_blk (fs->io, block,1 , block_buf); + retval =io_channel_write_blk64 (fs->io, block,1 , block_buf);if (retval) goto fail; -ext2fs_block_alloc_stats (fs, block,+1 ); +ext2fs_block_alloc_stats2 (fs, block,1 ); *ret = block; fail:
@@ -141,10 +154,21 @@ fail:return retval; } -errcode_t ext2fs_get_free_blocks (ext2_filsys fs,blk_t start,blk_t finish, -int num,ext2fs_block_bitmap map,blk_t *ret) +errcode_t ext2fs_alloc_block (ext2_filsys fs,blk_t goal, +char *block_buf,blk_t *ret) +{ +errcode_t retval; +blk64_t val; + retval =ext2fs_alloc_block2 (fs, goal, block_buf, &val); +if (!retval) + *ret = (blk_t ) val; +return retval; +} + +errcode_t ext2fs_get_free_blocks2 (ext2_filsys fs,blk64_t start,blk64_t finish, +int num,ext2fs_block_bitmap map,blk64_t *ret) { -blk_t b = start; +blk64_t b = start;EXT2_CHECK_MAGIC (fs,EXT2_ET_MAGIC_EXT2FS_FILSYS );
@@ -161,6 +185,7 @@ errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, do { if (b+num-1 > fs->super->s_blocks_count) b = fs->super->s_first_data_block; + /* FIXME-64 */ if (ext2fs_fast_test_block_bitmap_range(map, b, num)) { *ret = b; return 0;
@@ -170,3 +195,13 @@ errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish,return EXT2_ET_BLOCK_ALLOC_FAIL ; } +errcode_t ext2fs_get_free_blocks (ext2_filsys fs,blk_t start,blk_t finish, +int num,ext2fs_block_bitmap map,blk_t *ret) +{ +errcode_t retval; +blk64_t val; + retval =ext2fs_get_free_blocks2 (fs, start, finish, num, map, &val); +if (!retval) + *ret = (blk_t ) val; +return retval; +}
lib/ext2fs/ext2fs.h +8 -0
@@ -537,12 +537,20 @@ extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode, ext2fs_inode_bitmap map, ext2_ino_t *ret);extern errcode_t ext2fs_new_block (ext2_filsys fs,blk_t goal,ext2fs_block_bitmap map,blk_t *ret); +extern errcode_t ext2fs_new_block2 (ext2_filsys fs,blk64_t goal, +ext2fs_block_bitmap map,blk64_t *ret);extern errcode_t ext2fs_get_free_blocks (ext2_filsys fs,blk_t start,blk_t finish,int num,ext2fs_block_bitmap map,blk_t *ret); +extern errcode_t ext2fs_get_free_blocks2 (ext2_filsys fs,blk64_t start, +blk64_t finish,int num, +ext2fs_block_bitmap map, +blk64_t *ret);extern errcode_t ext2fs_alloc_block (ext2_filsys fs,blk_t goal,char *block_buf,blk_t *ret); +extern errcode_t ext2fs_alloc_block2 (ext2_filsys fs,blk64_t goal, +char *block_buf,blk64_t *ret);/* alloc_sb.c */ extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs,
Re: [Take2 PATCH 06/10][e2fsprogs] Add 64-bit alloc interface.
Quoted 7 lines · On Wed, 21 May 2008 12:54:04 -0500 "Jose R. Santos" <[email protected]> wrote:
From: Jose R. Santos <[email protected]>
Add 64-bit alloc interface.
Add new
ext2fs_new_block2(),ext2fs_get_free_blocks2()andext2fs_alloc_block2()that take and returnblk64_t.
Quoted 7 lines
Signed-off-by Jose R. Santos <[email protected]>--
lib/ext2fs/alloc.c | 59+++++++++++++++++++++++++++++++++++++++++----------
lib/ext2fs/ext2fs.h| 8 +++++++ 2 files changed, 55 insertions(+),
12 deletions(-)
Hi Ted,
This patch seems like it was added incorrectly into the pu branch. None of the changes to alloc.c show up.
Commit: db1856299023306583f6ca8bcb450c01735da8cb
Thanks
-JRS
Re: [Take2 PATCH 06/10][e2fsprogs] Add 64-bit alloc interface.
Quoted 20 lines · On Fri, 13 Jun 2008 14:31:44 -0500 "Jose R. Santos" <[email protected]> wrote:
Quoted 7 lines · On Wed, 21 May 2008 12:54:04 -0500 "Jose R. Santos" <[email protected]> wrote:
From: Jose R. Santos <[email protected]>
Add 64-bit alloc interface.
Add new
ext2fs_new_block2(),ext2fs_get_free_blocks2()andext2fs_alloc_block2()that take and returnblk64_t.Quoted 7 lines
Signed-off-by Jose R. Santos <[email protected]>--
lib/ext2fs/alloc.c | 59+++++++++++++++++++++++++++++++++++++++++----------
lib/ext2fs/ext2fs.h| 8 +++++++ 2 files changed, 55
insertions(+), 12 deletions(-)Hi Ted,
Quoted 8 lines
This patch seems like it was added incorrectly into the pu branch. None of the changes to
alloc.cshow up.Commit:
db1856299023306583f6ca8bcb450c01735da8cbThanks
-JRS
Looks like this was caused by a conflict with Commit:f5c562e2324a8950d659ebfc8db4356121d6104e. Fix patch bellow
-JRS
commit 397367a12d29703e9a056770c2ce39cbaa585a70
Author: Jose R. Santos <[email protected]> Date: Fri Jun 13 15:37:55 2008 -0500
Add 64-bit alloc interface.
Add new ext2fs_new_block2(), ext2fs_get_free_blocks2() and ext2fs_alloc_block2() that take and return blk64_t.
--
lib/ext2fs/alloc.c | 59 +++++++++++++++++++++++++++++++++++++++++----------lib/ext2fs/ext2fs.h | 8 +++++++
2 files changed, 55 insertions(+), 12 deletions(-)
lib/ext2fs/alloc.c +49 -16
@@ -73,10 +73,10 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir,* Stupid algorithm --- we now just search forward starting from the * goal. Should put in a smarter one someday.... */ -errcode_t ext2fs_new_block (ext2_filsys fs,blk_t goal, -ext2fs_block_bitmap map,blk_t *ret) +errcode_t ext2fs_new_block2 (ext2_filsys fs,blk64_t goal, +ext2fs_block_bitmap map,blk64_t *ret) { -blk_t i; +blk64_t i;EXT2_CHECK_MAGIC (fs,EXT2_ET_MAGIC_EXT2FS_FILSYS );
@@ -88,6 +88,7 @@ errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, goal = fs->super->s_first_data_block; i = goal; do { + /* FIXME-64 */ if (!ext2fs_fast_test_block_bitmap(map, i)) { *ret = i; return 0;
@@ -99,15 +100,26 @@ errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,return EXT2_ET_BLOCK_ALLOC_FAIL ; } +errcode_t ext2fs_new_block (ext2_filsys fs,blk_t goal, +ext2fs_block_bitmap map,blk_t *ret) +{ +errcode_t retval; +blk64_t val; + retval =ext2fs_new_block2 (fs, goal, map, &val); +if (!retval) + *ret = (blk_t ) val; +return retval; +} +/* * This function zeros out the allocated block, and updates all of the * appropriate filesystem records. */ -errcode_t ext2fs_alloc_block (ext2_filsys fs,blk_t goal, -char *block_buf,blk_t *ret) +errcode_t ext2fs_alloc_block2 (ext2_filsys fs,blk64_t goal, +char *block_buf,blk64_t *ret) {errcode_t retval; -blk_t block; +blk64_t block;char *buf =0 ;if (!block_buf) {
@@ -119,29 +131,27 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,memset (block_buf,0 , fs->blocksize);if (fs->get_alloc_block) { -blk64_t new; - - retval = (fs->get_alloc_block)(fs, (blk64_t ) goal, &new); + retval = (fs->get_alloc_block)(fs, goal, &block);if (retval) goto fail; - block = (blk_t ) new; }else {if (!fs->block_map) { +/* FIXME-64 */ retval =ext2fs_read_block_bitmap (fs);if (retval) goto fail; } - retval =ext2fs_new_block (fs, goal,0 , &block); + retval =ext2fs_new_block2 (fs, goal,0 , &block);if (retval) goto fail; } - retval =io_channel_write_blk (fs->io, block,1 , block_buf); + retval =io_channel_write_blk64 (fs->io, block,1 , block_buf);if (retval) goto fail; -ext2fs_block_alloc_stats (fs, block,+1 ); +ext2fs_block_alloc_stats2 (fs, block,+1 ); *ret = block; fail:
@@ -150,10 +160,21 @@ fail:return retval; } -errcode_t ext2fs_get_free_blocks (ext2_filsys fs,blk_t start,blk_t finish, -int num,ext2fs_block_bitmap map,blk_t *ret) +errcode_t ext2fs_alloc_block (ext2_filsys fs,blk_t goal, +char *block_buf,blk_t *ret) +{ +errcode_t retval; +blk64_t val; + retval =ext2fs_alloc_block2 (fs, goal, block_buf, &val); +if (!retval) + *ret = (blk_t ) val; +return retval; +} + +errcode_t ext2fs_get_free_blocks2 (ext2_filsys fs,blk64_t start,blk64_t finish, +int num,ext2fs_block_bitmap map,blk64_t *ret) { -blk_t b = start; +blk64_t b = start;EXT2_CHECK_MAGIC (fs,EXT2_ET_MAGIC_EXT2FS_FILSYS );
@@ -170,6 +191,7 @@ errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, do { if (b+num-1 > fs->super->s_blocks_count) b = fs->super->s_first_data_block; + /* FIXME-64 */ if (ext2fs_fast_test_block_bitmap_range(map, b, num)) { *ret = b; return 0;
@@ -179,6 +201,17 @@ errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish,return EXT2_ET_BLOCK_ALLOC_FAIL ; } +errcode_t ext2fs_get_free_blocks (ext2_filsys fs,blk_t start,blk_t finish, +int num,ext2fs_block_bitmap map,blk_t *ret) +{ +errcode_t retval; +blk64_t val; + retval =ext2fs_get_free_blocks2 (fs, start, finish, num, map, &val); +if (!retval) + *ret = (blk_t ) val; +return retval; +} + void ext2fs_set_alloc_block_callback(ext2_filsys fs, errcode_t (*func)(ext2_filsys fs, blk64_t goal,
lib/ext2fs/ext2fs.h +8 -0
@@ -554,12 +554,20 @@ extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode, ext2fs_inode_bitmap map, ext2_ino_t *ret);extern errcode_t ext2fs_new_block (ext2_filsys fs,blk_t goal,ext2fs_block_bitmap map,blk_t *ret); +extern errcode_t ext2fs_new_block2 (ext2_filsys fs,blk64_t goal, +ext2fs_block_bitmap map,blk64_t *ret);extern errcode_t ext2fs_get_free_blocks (ext2_filsys fs,blk_t start,blk_t finish,int num,ext2fs_block_bitmap map,blk_t *ret); +extern errcode_t ext2fs_get_free_blocks2 (ext2_filsys fs,blk64_t start, +blk64_t finish,int num, +ext2fs_block_bitmap map, +blk64_t *ret);extern errcode_t ext2fs_alloc_block (ext2_filsys fs,blk_t goal,char *block_buf,blk_t *ret); +extern errcode_t ext2fs_alloc_block2 (ext2_filsys fs,blk64_t goal, +char *block_buf,blk64_t *ret); extern void ext2fs_set_alloc_block_callback(ext2_filsys fs, errcode_t (*func)(ext2_filsys fs, blk64_t goal,
PATCH 7/10 Add 64-bit ext_attr interface.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Add 64-bit ext_attr interface.
Add ext2fs_read_ext_attr2(), ext2fs_write_ext_attr2() and ext2fs_adjust_ea_refcount2() that take blk64_t as an input.
--
lib/ext2fs/ext2fs.h | 7 +++++++ lib/ext2fs/ext_attr.c | 31 ++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-)
lib/ext2fs/ext2fs.h +7 -0
@@ -829,11 +829,18 @@ extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir);extern __u32 ext2fs_ext_attr_hash_entry (struct ext2_ext_attr_entry *entry,void *data);extern errcode_t ext2fs_read_ext_attr (ext2_filsys fs,blk_t block,void *buf); +extern errcode_t ext2fs_read_ext_attr2 (ext2_filsys fs,blk64_t block, +void *buf);extern errcode_t ext2fs_write_ext_attr (ext2_filsys fs,blk_t block,void *buf); +extern errcode_t ext2fs_write_ext_attr2 (ext2_filsys fs,blk64_t block, +void *buf);extern errcode_t ext2fs_adjust_ea_refcount (ext2_filsys fs,blk_t blk,char *block_buf,int adjust,__u32 *newcount); +extern errcode_t ext2fs_adjust_ea_refcount2 (ext2_filsys fs,blk64_t blk, +char *block_buf, +int adjust,__u32 *newcount);/* extent.c */ extern errcode_t ext2fs_extent_header_verify (void *ptr,int size);
lib/ext2fs/ext_attr.c +24 -7
@@ -60,11 +60,11 @@ __u32 ext2fs_ext_attr_hash_entry(struct ext2_ext_attr_entry *entry, void *data)#undef NAME_HASH_SHIFT#undef VALUE_HASH_SHIFT -errcode_t ext2fs_read_ext_attr (ext2_filsys fs,blk_t block,void *buf) +errcode_t ext2fs_read_ext_attr2 (ext2_filsys fs,blk64_t block,void *buf) {errcode_t retval; - retval =io_channel_read_blk (fs->io, block,1 , buf); + retval =io_channel_read_blk64 (fs->io, block,1 , buf);if (retval)return retval;#ifdef WORDS_BIGENDIAN
@@ -73,7 +73,12 @@ errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf)return 0 ; } -errcode_t ext2fs_write_ext_attr (ext2_filsys fs,blk_t block,void *inbuf) +errcode_t ext2fs_read_ext_attr (ext2_filsys fs,blk_t block,void *buf) +{ +return ext2fs_read_ext_attr2 (fs, block, buf); +} + +errcode_t ext2fs_write_ext_attr2 (ext2_filsys fs,blk64_t block,void *inbuf) {errcode_t retval;char *write_buf;
@@ -88,7 +93,7 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf)#else write_buf = (char *) inbuf;#endif - retval =io_channel_write_blk (fs->io, block,1 , write_buf); + retval =io_channel_write_blk64 (fs->io, block,1 , write_buf);if (buf)ext2fs_free_mem (&buf);if (!retval)
@@ -96,10 +101,15 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf)return retval; } +errcode_t ext2fs_write_ext_attr (ext2_filsys fs,blk_t block,void *inbuf) +{ +return ext2fs_write_ext_attr2 (fs, block, inbuf); +} +/* * This function adjusts the reference count of the EA block. */ -errcode_t ext2fs_adjust_ea_refcount (ext2_filsys fs,blk_t blk, +errcode_t ext2fs_adjust_ea_refcount2 (ext2_filsys fs,blk64_t blk,char *block_buf,int adjust,__u32 *newcount) {
@@ -118,7 +128,7 @@ errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk, block_buf = buf; } - retval =ext2fs_read_ext_attr (fs, blk, block_buf); + retval =ext2fs_read_ext_attr2 (fs, blk, block_buf);if (retval) goto errout;
@@ -127,7 +137,7 @@ errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,if (newcount) *newcount = header->h_refcount; - retval =ext2fs_write_ext_attr (fs, blk, block_buf); + retval =ext2fs_write_ext_attr2 (fs, blk, block_buf);if (retval) goto errout;
@@ -136,3 +146,10 @@ errout:ext2fs_free_mem (&buf);return retval; } + +errcode_t ext2fs_adjust_ea_refcount (ext2_filsys fs,blk_t blk, +char *block_buf,int adjust, +__u32 *newcount) +{ +return ext2fs_adjust_ea_refcount (fs, blk, block_buf, adjust, newcount); +}
PATCH 8/10 Add 64-bit closefs interface.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Add 64-bit closefs interface.
Add new ext2fs_super_and_bgd_loc2() that returns blk64_t pointers. The function now returns the number of blocks used by super block and group descriptors since with flex_bg, it can no longer be assumed that bitmaps and inode tables still resided within the block group.
--
lib/ext2fs/closefs.c | 120 +++++++++++++++++++++++++++++++++++--------------- lib/ext2fs/ext2fs.h | 6 +++ 2 files changed, 90 insertions(+), 36 deletions(-)
lib/ext2fs/closefs.c +84 -36
@@ -46,31 +46,33 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block) }/* -* This function returns the location of the superblock, block group -* descriptors for a given block group. It currently returns the -* number of free blocks assuming that inode table and allocation -* bitmaps will be in the group. This is not necessarily the case -* when the flex_bg feature is enabled, so callers should take care! -* It was only really intended for use by mke2fs, and even there it's -* not that useful. In the future, when we redo this function for -* 64-bit block numbers, we should probably return the number of -* blocks used by the super block and group descriptors instead. +* ext2fs_super_and_bgd_loc2() +* @fs: ext2 fs pointer +* @group given block group +* @ret_super_blk: if !NULL, returns super block location +* @ret_old_desc_blk: if !NULL, returns location of the old block +* group descriptor +* @ret_new_desc_blk: if !NULL, returns location of meta_bg block +* group descriptor +* @ret_used_blks: if !NULL, returns number of blocks used by +* super block and group_descriptors. * -* See also the comment for ext2fs_reserve_super_and_bgd() +* Returns errcode_t of 0 */ -int ext2fs_super_and_bgd_loc (ext2_filsys fs, -dgrp_t group, -blk_t *ret_super_blk, -blk_t *ret_old_desc_blk, -blk_t *ret_new_desc_blk, -int *ret_meta_bg) +errcode_t ext2fs_super_and_bgd_loc2 (ext2_filsys fs, +dgrp_t group, +blk64_t *ret_super_blk, +blk64_t *ret_old_desc_blk, +blk64_t *ret_new_desc_blk, +blk_t *ret_used_blks) { -blk_t group_block, super_blk =0 , old_desc_blk =0 , new_desc_blk =0 ; +blk64_t group_block, super_blk =0 , old_desc_blk =0 , new_desc_blk =0 ;unsigned int meta_bg, meta_bg_size; -blk_t numblocks, old_desc_blocks; +blk_t numblocks =0 ; +blk64_t old_desc_blocks;int has_super; - group_block =ext2fs_group_first_block (fs, group); + group_block =ext2fs_group_first_block2 (fs, group);if (fs->super->s_feature_incompat &EXT2_FEATURE_INCOMPAT_META_BG ) old_desc_blocks = fs->super->s_first_meta_bg;
@@ -78,20 +80,11 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; -if (group == fs->group_desc_count-1 ) { - numblocks = (fs->super->s_blocks_count - - fs->super->s_first_data_block) % - fs->super->s_blocks_per_group; -if (!numblocks) - numblocks = fs->super->s_blocks_per_group; - }else - numblocks = fs->super->s_blocks_per_group; - has_super =ext2fs_bg_has_super (fs, group);if (has_super) { super_blk = group_block; - numblocks--; + numblocks++; } meta_bg_size =EXT2_DESC_PER_BLOCK (fs->super); meta_bg = group / meta_bg_size;
@@ -100,7 +93,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, (meta_bg < fs->super->s_first_meta_bg)) { if (has_super) { old_desc_blk = group_block + 1; - numblocks -= old_desc_blocks; + numblocks += old_desc_blocks; } } else { if (((group % meta_bg_size) == 0) ||
@@ -109,11 +102,9 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs,if (has_super) has_super =1 ; new_desc_blk = group_block + has_super; - numblocks--; + numblocks++; } } - - numblocks -=2 + fs->inode_blocks_per_group;if (ret_super_blk) *ret_super_blk = super_blk;
@@ -121,11 +112,68 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, *ret_old_desc_blk = old_desc_blk;if (ret_new_desc_blk) *ret_new_desc_blk = new_desc_blk; -if (ret_meta_bg) - *ret_meta_bg = meta_bg; -return (numblocks); +if (ret_used_blks) + *ret_used_blks = numblocks; + +return 0 ; } +/* +* This function returns the location of the superblock, block group +* descriptors for a given block group. It currently returns the +* number of free blocks assuming that inode table and allocation +* bitmaps will be in the group. This is not necessarily the case +* when the flex_bg feature is enabled, so callers should take care! +* It was only really intended for use by mke2fs, and even there it's +* not that useful. +* +* The ext2fs_super_and_bgd_loc2() function is 64-bit block number +* capable and returns the number of blocks used by super block and +* group descriptors. +*/ +int ext2fs_super_and_bgd_loc (ext2_filsys fs, +dgrp_t group, +blk_t *ret_super_blk, +blk_t *ret_old_desc_blk, +blk_t *ret_new_desc_blk, +int *ret_meta_bg) +{ +blk64_t ret_super_blk2; +blk64_t ret_old_desc_blk2; +blk64_t ret_new_desc_blk2; +blk_t ret_used_blks; +blk_t numblocks; +unsigned int meta_bg_size; + +ext2fs_super_and_bgd_loc2 (fs, group, &ret_super_blk2, + &ret_old_desc_blk2, + &ret_new_desc_blk2, + &ret_used_blks); + +if (group == fs->group_desc_count-1 ) { + numblocks = (fs->super->s_blocks_count - + fs->super->s_first_data_block) % + fs->super->s_blocks_per_group; +if (!numblocks) + numblocks = fs->super->s_blocks_per_group; + }else + numblocks = fs->super->s_blocks_per_group; + +if (ret_super_blk) + *ret_super_blk = (blk_t )ret_super_blk2; +if (ret_old_desc_blk) + *ret_old_desc_blk = (blk_t )ret_old_desc_blk2; +if (ret_new_desc_blk) + *ret_new_desc_blk = (blk_t )ret_new_desc_blk2; +if (ret_meta_bg) { + meta_bg_size =EXT2_DESC_PER_BLOCK (fs->super); + *ret_meta_bg = group / meta_bg_size; + } + + numblocks -=2 + fs->inode_blocks_per_group + ret_used_blks; + +return numblocks; +}/* * This function forces out the primary superblock. We need to only
lib/ext2fs/ext2fs.h +6 -0
@@ -725,6 +725,12 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs);extern errcode_t ext2fs_close (ext2_filsys fs);extern errcode_t ext2fs_flush (ext2_filsys fs);extern int ext2fs_bg_has_super (ext2_filsys fs,int group_block); +extern errcode_t ext2fs_super_and_bgd_loc2 (ext2_filsys fs, +dgrp_t group, +blk64_t *ret_super_blk, +blk64_t *ret_old_desc_blk, +blk64_t *ret_new_desc_blk, +blk_t *ret_used_blks); extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, dgrp_t group, blk_t *ret_super_blk,
PATCH 9/10 Use new ext2fs_super_and_bgd_loc2 call in libext2fs.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
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.
--
e2fsck/pass5.c | 7 ++++--- lib/ext2fs/alloc_sb.c | 23 +++++++++++++++++++---- lib/ext2fs/closefs.c | 9 +++++---- 3 files changed, 28 insertions(+), 11 deletions(-)
e2fsck/pass5.c +4 -3
@@ -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 &
lib/ext2fs/alloc_sb.c +19 -4
@@ -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,16 +58,30 @@ 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) {if (fs->super->s_reserved_gdt_blocks && fs->block_map == bmap) fs->group_desc[group].bg_flags &= ~EXT2_BG_BLOCK_UNINIT ;for (j=0 ; j < old_desc_blocks; j++) +/* 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 ; }
lib/ext2fs/closefs.c +5 -4
@@ -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)
PATCH 10/10 Add 64-bit openfs interface.
In reply to Jose R. SantosFrom: Jose R. Santos <[email protected]>
Add 64-bit openfs interface.
Add new ext2fs_descriptor_block_loc2() routine that takes blk64_t as an input.
--
lib/ext2fs/ext2fs.h | 2 ++ lib/ext2fs/openfs.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
lib/ext2fs/ext2fs.h +2 -0
@@ -1078,6 +1078,8 @@ extern errcode_t ext2fs_open2(const char *name, const char *io_options, int flags, int superblock, unsigned int block_size, io_manager manager, ext2_filsys *ret_fs); +extern blk64_t ext2fs_descriptor_block_loc2 (ext2_filsys fs, +blk64_t group_block,dgrp_t i);extern blk_t ext2fs_descriptor_block_loc (ext2_filsys fs,blk_t group_block,dgrp_t i);errcode_t ext2fs_get_data_io (ext2_filsys fs,io_channel *old_io);
lib/ext2fs/openfs.c +9 -3
@@ -29,11 +29,12 @@#include "ext2fs.h" #include "e2image.h" -blk_t ext2fs_descriptor_block_loc (ext2_filsys fs,blk_t group_block,dgrp_t i) +blk64_t ext2fs_descriptor_block_loc2 (ext2_filsys fs,blk64_t group_block, +dgrp_t i) {int bg;int has_super =0 ; -int ret_blk; +blk64_t ret_blk;if (!(fs->super->s_feature_incompat &EXT2_FEATURE_INCOMPAT_META_BG ) || (i < fs->super->s_first_meta_bg))
@@ -42,7 +43,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) bg =EXT2_DESC_PER_BLOCK (fs->super) * i;if (ext2fs_bg_has_super (fs, bg)) has_super =1 ; - ret_blk =ext2fs_group_first_block (fs, bg) + has_super; + ret_blk =ext2fs_group_first_block2 (fs, bg) + has_super;/* * If group_block is not the normal value, we're trying to use * the backup group descriptors and superblock --- so use the
@@ -58,6 +59,11 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i)return ret_blk; } +blk_t ext2fs_descriptor_block_loc (ext2_filsys fs,blk_t group_block,dgrp_t i) +{ +return ext2fs_descriptor_block_loc2 (fs, group_block, i); +} +errcode_t ext2fs_open (const char *name,int flags,int superblock,unsigned int block_size,io_manager manager,ext2_filsys *ret_fs)
Quoted 9 lines · Jose R. Santos
The following series of patches implement API call needed to handle 64-bit block numbers. Im concentrating mainly in providing the API call first and if the interfaces are sane, we can go ahead and start using them in the rest of libext2fs and the user space programs.
I've run checkpatch and make check on each individual patch in the series so they should be ready to add to the main repository if the interfaces are acceptable.
Jose, running "make check" with these configure options resulted in a failure:
'--enable-elf-shlibs' '--enable-blkid-debug' '--enable-testio-debug' '--enable-maintainer-mode' '--enable-blkid-devmapper' '--enable-jbd-debug'
Part of the problem was the test_io manager didn't have 64-bit support. I fixed that, and rebased your patch series, but it still died with a seg fault in the test u_undoe2fs_mke2fs.
Checking out the undo_io manager, it's obvious why; it doesn't yet have 64-bit support. I'm not sure how you missed this, if you were running "make check" after each patch. What version of e2fsprogs was your patches based off of?
- Ted
% more u_undoe2fs_mke2fs.log
mke2fs -q -F -o Linux -b 1024 test.img
mke2fs 1.41-WIP (27-Apr-2008)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
64 inodes, 512 blocks
25 blocks (4.88%) reserved for the super user
First data block=1
Maximum filesystem blocks=524288
1 block group
8192 blocks per group, 8192 fragments per group
64 inodes per group
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
md5sum before mke2fs 4a393ac4351a41501aca1ad2917430b9
using mke2fs to test undoe2fs
Overwriting existing filesystem; this can be undone using the command:
e2undo .//mke2fs-test.img.e2undo ./test.img
md5sum after mke2fs a34e9c16307770eb318a6afa39e127f6check_filesystem: Unknown code ext2 104 Failed tdb_fetch Record does not exist
md5sum after undoe2fs a34e9c16307770eb318a6afa39e127f6
Quoted 16 lines · On Sat, 24 May 2008 19:28:36 -0400 Theodore Tso <[email protected]> wrote:
Quoted 9 lines · Jose R. Santos
The following series of patches implement API call needed to handle 64-bit block numbers. Im concentrating mainly in providing the API call first and if the interfaces are sane, we can go ahead and start using them in the rest of libext2fs and the user space programs.
I've run checkpatch and make check on each individual patch in the series so they should be ready to add to the main repository if the interfaces are acceptable.
Jose, running "make check" with these configure options resulted in a failure:
'--enable-elf-shlibs' '--enable-blkid-debug' '--enable-testio-debug' '--enable-maintainer-mode' '--enable-blkid-devmapper' '--enable-jbd-debug'
Quoted 8 lines
Part of the problem was the
test_iomanager didn't have 64-bit support. I fixed that, and rebased your patch series, but it still died with a seg fault in the testu_undoe2fs_mke2fs.Checking out the
undo_iomanager, it's obvious why; it doesn't yet have 64-bit support. I'm not sure how you missed this, if you were running "make check" after each patch. What version of e2fsprogs was your patches based off of?
I did this off the "next" branch which has undo_io manager support but after "make check", the last line looks like this:
u_undoe2fs_mke2fs: undoe2fs with mke2fs: u_undoe2fs_tune2fs: undoe2fs with tune2fs: 97 tests succeeded 0 tests failed
There is no log file for any of the undo manager test case so it seems that they didn't even run. I ran this on a system using Ubuntu, so it may be a bash vs. dash issues.
Quoted 25 lines
- Ted
% more u_undoe2fs_mke2fs.log
mke2fs -q -F -o Linux -b 1024 test.img
mke2fs 1.41-WIP (27-Apr-2008)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
64 inodes, 512 blocks
25 blocks (4.88%) reserved for the super user
First data block=1
Maximum filesystem blocks=524288
1 block group
8192 blocks per group, 8192 fragments per group
64 inodes per groupWriting inode tables: done
Writing superblocks and filesystem accounting information: donemd5sum before mke2fs
4a393ac4351a41501aca1ad2917430b9
using mke2fs to test undoe2fs
Overwriting existing filesystem; this can be undone using the command:
Quoted 6 lines
e2undo .//mke2fs-test.img.e2undo ./test.imgmd5sum after mke2fs
a34e9c16307770eb318a6afa39e127f6check_filesystem: Unknown code ext2 104 Failedtdb_fetchRecord does not existmd5sum after undoe2fs
a34e9c16307770eb318a6afa39e127f6
-JRS