summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-07-05 20:35:46 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-07-05 20:35:46 -0400
commit062cc472e6cae60a1fa43976bcc6ff39f8351ccb (patch)
treee6c93e78620c401d35846d7022d6554d3b015c87
parent41e102a4d1be1aed9bdd002e03b4d244b5446036 (diff)
downloade2fsprogs-062cc472e6cae60a1fa43976bcc6ff39f8351ccb.tar.gz
libext2fs: fix 64-bit support in ext2fs_bmap2()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--lib/ext2fs/bmap.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index fbcb3753..90d9e72d 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -135,6 +135,7 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
{
struct ext2_inode inode_buf;
ext2_extent_handle_t handle = 0;
+ blk64_t blk64;
blk_t addr_per_block;
blk_t b, blk32;
char *buf = 0;
@@ -186,11 +187,16 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
}
got_block:
if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) {
- retval = ext2fs_alloc_block(fs, b, block_buf, &b);
+ retval = ext2fs_bmap2(fs, ino, inode, block_buf,
+ 0, block-1, 0, &blk64);
+ if (retval)
+ blk64 = 0;
+ retval = ext2fs_alloc_block2(fs, blk64, block_buf,
+ &blk64);
if (retval)
goto done;
retval = ext2fs_extent_set_bmap(handle, block,
- (blk64_t) b, 0);
+ blk64, 0);
if (retval)
goto done;
/* Update inode after setting extent */
@@ -198,7 +204,7 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
if (retval)
return retval;
blocks_alloc++;
- *phys_blk = b;
+ *phys_blk = blk64;
}
retval = 0;
goto done;