1997-10-26 02:37:42 +04:00
|
|
|
/*
|
ChangeLog, debugfs.c:
debugfs.c (dump_inode): Remove #ifdef for i_version vs. i_generation
since we know it will always be i_generation now.
ChangeLog, e2fsck.h, flushb.c, scantest.c:
e2fsck.h, flushb.c, scantest.c: Remove uneeded include of linux/fs.h
bmap.c:
Fix silly spelling typo.
ChangeLog, getsize.c, ismounted.c, swapfs.c:
getsize.c, ismounted.c: Remove unneeded include of linux/fs.h
swapfs.c: Remove #ifdef HAVE_EXT2_INODE_VERSION since it's not needed
any more; we know it will always be i_generation. Add support for
swapping the high bits of the uid and gid.
2000-02-02 19:19:59 +03:00
|
|
|
* bmap.c --- logical to physical block mapping
|
1997-10-26 02:37:42 +04:00
|
|
|
*
|
|
|
|
* Copyright (C) 1997 Theodore Ts'o.
|
|
|
|
*
|
|
|
|
* %Begin-Header%
|
|
|
|
* This file may be redistributed under the terms of the GNU Public
|
|
|
|
* License.
|
|
|
|
* %End-Header%
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#if HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
2008-02-18 22:59:45 +03:00
|
|
|
#include <errno.h>
|
1997-10-26 02:37:42 +04:00
|
|
|
|
Many files:
inode.c (ext2fs_open_inode_scan): Initialize the group variables
so that we don't need to call get_next_blockgroup() the first
time around. Saves a bit of time, and prevents us from
needing to assign -1 to current_group (which is an unsigned
value).
icount.c (insert_icount_el): Cast the estimated number of inodes
from a float to an ino_t.
alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c, expanddir.c,
ext2fs.h, fileio.c, freefs.c, get_pathname.c, getsize.c,
icount.c, initialize.c, inline.c, inode.c, irel_ma.c,
ismounted.c, link.c, lookup.c, mkdir.c, namei.c, native.c,
newdir.c, openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c, valid_blk.c,
version.c: If EXT2_FLAT_INCLUDES is defined, then assume all
of the ext2-specific header files are in a flat directory.
block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
all assignments from void * to be compatible with C++.
closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
make sure the contents of the disk are flushed to disk.
dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
avoid C++ namespace clash.
bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
avoid C++ namespace clash.
ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
unlink.c: Change private to be priv_data (to avoid C++
namespace clash)
1998-01-19 17:47:53 +03:00
|
|
|
#include "ext2_fs.h"
|
1997-10-26 02:37:42 +04:00
|
|
|
#include "ext2fs.h"
|
|
|
|
|
1997-10-26 04:53:39 +03:00
|
|
|
#if defined(__GNUC__) && !defined(NO_INLINE_FUNCS)
|
1997-10-26 02:37:42 +04:00
|
|
|
#define _BMAP_INLINE_ __inline__
|
|
|
|
#else
|
|
|
|
#define _BMAP_INLINE_
|
|
|
|
#endif
|
|
|
|
|
Many files:
alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
to protect applications that attempt to compile
-D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?). So
we use ext2_ino_t to avoid an unexpected ABI change.
2001-01-11 07:54:39 +03:00
|
|
|
extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
|
1997-10-26 02:37:42 +04:00
|
|
|
struct ext2_inode *inode,
|
|
|
|
char *block_buf, int bmap_flags,
|
|
|
|
blk_t block, blk_t *phys_blk);
|
|
|
|
|
|
|
|
#define inode_bmap(inode, nr) ((inode)->i_block[(nr)])
|
|
|
|
|
2002-03-08 07:52:56 +03:00
|
|
|
static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags,
|
1997-10-26 02:37:42 +04:00
|
|
|
blk_t ind, char *block_buf,
|
|
|
|
int *blocks_alloc,
|
|
|
|
blk_t nr, blk_t *ret_blk)
|
|
|
|
{
|
|
|
|
errcode_t retval;
|
|
|
|
blk_t b;
|
|
|
|
|
|
|
|
if (!ind) {
|
2004-12-23 21:55:34 +03:00
|
|
|
if (flags & BMAP_SET)
|
|
|
|
return EXT2_ET_SET_BMAP_NO_IND;
|
1997-10-26 02:37:42 +04:00
|
|
|
*ret_blk = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
retval = io_channel_read_blk(fs->io, ind, 1, block_buf);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
2004-12-23 21:55:34 +03:00
|
|
|
if (flags & BMAP_SET) {
|
|
|
|
b = *ret_blk;
|
2007-08-11 09:56:48 +04:00
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
b = ext2fs_swab32(b);
|
2004-12-23 21:55:34 +03:00
|
|
|
#endif
|
|
|
|
((blk_t *) block_buf)[nr] = b;
|
|
|
|
return io_channel_write_blk(fs->io, ind, 1, block_buf);
|
|
|
|
}
|
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
b = ((blk_t *) block_buf)[nr];
|
|
|
|
|
2007-08-11 09:56:48 +04:00
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
b = ext2fs_swab32(b);
|
ChangeLog, Makefile.in, swapfs.c, unix.c:
Makefile.in: Add message.c and swapfs.c to the list of source files to
build the make depend.
swapfs.c, unix.c: Only support the -s and -S options to e2fsck if
ENABLE_SWAPFS is defined.
Many files:
ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c, inode.c,
native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only include the
byte-swapping logic if ENABLE_SWAPFS is turned on or if we're on a
big-endian machine.
initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to set
EXT2_FLAG_SWAP_BYTES, instead of using ext2fs_native_flag.
native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
autoconf to determine whether or not return EXT2_FLAG_SWAP_BYTES.
2001-06-11 11:00:04 +04:00
|
|
|
#endif
|
1997-10-26 02:37:42 +04:00
|
|
|
|
|
|
|
if (!b && (flags & BMAP_ALLOC)) {
|
|
|
|
b = nr ? ((blk_t *) block_buf)[nr-1] : 0;
|
|
|
|
retval = ext2fs_alloc_block(fs, b,
|
|
|
|
block_buf + fs->blocksize, &b);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
2007-08-11 09:56:48 +04:00
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
((blk_t *) block_buf)[nr] = ext2fs_swab32(b);
|
|
|
|
#else
|
|
|
|
((blk_t *) block_buf)[nr] = b;
|
ChangeLog, Makefile.in, swapfs.c, unix.c:
Makefile.in: Add message.c and swapfs.c to the list of source files to
build the make depend.
swapfs.c, unix.c: Only support the -s and -S options to e2fsck if
ENABLE_SWAPFS is defined.
Many files:
ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c, inode.c,
native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only include the
byte-swapping logic if ENABLE_SWAPFS is turned on or if we're on a
big-endian machine.
initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to set
EXT2_FLAG_SWAP_BYTES, instead of using ext2fs_native_flag.
native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
autoconf to determine whether or not return EXT2_FLAG_SWAP_BYTES.
2001-06-11 11:00:04 +04:00
|
|
|
#endif
|
1997-10-26 02:37:42 +04:00
|
|
|
|
|
|
|
retval = io_channel_write_blk(fs->io, ind, 1, block_buf);
|
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
(*blocks_alloc)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ret_blk = b;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-03-08 07:52:56 +03:00
|
|
|
static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags,
|
1997-10-26 02:37:42 +04:00
|
|
|
blk_t dind, char *block_buf,
|
|
|
|
int *blocks_alloc,
|
|
|
|
blk_t nr, blk_t *ret_blk)
|
|
|
|
{
|
|
|
|
blk_t b;
|
|
|
|
errcode_t retval;
|
1998-09-03 05:22:57 +04:00
|
|
|
blk_t addr_per_block;
|
1997-10-26 02:37:42 +04:00
|
|
|
|
1998-09-03 05:22:57 +04:00
|
|
|
addr_per_block = (blk_t) fs->blocksize >> 2;
|
1997-10-26 02:37:42 +04:00
|
|
|
|
2004-12-23 21:55:34 +03:00
|
|
|
retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf,
|
|
|
|
blocks_alloc, nr / addr_per_block, &b);
|
1997-10-26 02:37:42 +04:00
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
retval = block_ind_bmap(fs, flags, b, block_buf, blocks_alloc,
|
|
|
|
nr % addr_per_block, ret_blk);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2002-03-08 07:52:56 +03:00
|
|
|
static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags,
|
1997-10-26 02:37:42 +04:00
|
|
|
blk_t tind, char *block_buf,
|
|
|
|
int *blocks_alloc,
|
|
|
|
blk_t nr, blk_t *ret_blk)
|
|
|
|
{
|
|
|
|
blk_t b;
|
|
|
|
errcode_t retval;
|
1998-09-03 05:22:57 +04:00
|
|
|
blk_t addr_per_block;
|
1997-10-26 02:37:42 +04:00
|
|
|
|
1998-09-03 05:22:57 +04:00
|
|
|
addr_per_block = (blk_t) fs->blocksize >> 2;
|
1997-10-26 02:37:42 +04:00
|
|
|
|
2004-12-23 21:55:34 +03:00
|
|
|
retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf,
|
|
|
|
blocks_alloc, nr / addr_per_block, &b);
|
1997-10-26 02:37:42 +04:00
|
|
|
if (retval)
|
|
|
|
return retval;
|
|
|
|
retval = block_ind_bmap(fs, flags, b, block_buf, blocks_alloc,
|
|
|
|
nr % addr_per_block, ret_blk);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-02-18 22:59:45 +03:00
|
|
|
errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
|
|
|
|
char *block_buf, int bmap_flags, blk64_t block,
|
|
|
|
int *ret_flags, blk64_t *phys_blk)
|
1997-10-26 02:37:42 +04:00
|
|
|
{
|
|
|
|
struct ext2_inode inode_buf;
|
2008-02-18 22:59:45 +03:00
|
|
|
ext2_extent_handle_t handle = 0;
|
1998-09-03 05:22:57 +04:00
|
|
|
blk_t addr_per_block;
|
2008-02-18 22:59:45 +03:00
|
|
|
blk_t b, blk32;
|
1997-10-26 02:37:42 +04:00
|
|
|
char *buf = 0;
|
|
|
|
errcode_t retval = 0;
|
2004-12-23 21:55:34 +03:00
|
|
|
int blocks_alloc = 0, inode_dirty = 0;
|
1997-10-26 02:37:42 +04:00
|
|
|
|
2004-12-23 21:55:34 +03:00
|
|
|
if (!(bmap_flags & BMAP_SET))
|
|
|
|
*phys_blk = 0;
|
1997-10-26 02:37:42 +04:00
|
|
|
|
2008-02-18 22:59:45 +03:00
|
|
|
if (ret_flags)
|
|
|
|
*ret_flags = 0;
|
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
/* Read inode structure if necessary */
|
|
|
|
if (!inode) {
|
|
|
|
retval = ext2fs_read_inode(fs, ino, &inode_buf);
|
2002-05-12 06:13:20 +04:00
|
|
|
if (retval)
|
1997-10-26 02:37:42 +04:00
|
|
|
return retval;
|
|
|
|
inode = &inode_buf;
|
|
|
|
}
|
1998-09-03 05:22:57 +04:00
|
|
|
addr_per_block = (blk_t) fs->blocksize >> 2;
|
1997-10-26 02:37:42 +04:00
|
|
|
|
2008-02-18 22:59:45 +03:00
|
|
|
if (inode->i_flags & EXT4_EXTENTS_FL) {
|
|
|
|
struct ext2fs_extent extent;
|
2008-03-18 06:17:13 +03:00
|
|
|
unsigned int offset;
|
2008-02-18 22:59:45 +03:00
|
|
|
|
|
|
|
if (bmap_flags & BMAP_SET) {
|
|
|
|
retval = EXT2_ET_EXTENT_NOT_SUPPORTED;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
retval = ext2fs_extent_open(fs, ino, &handle);
|
|
|
|
if (retval)
|
|
|
|
goto done;
|
|
|
|
retval = ext2fs_extent_goto(handle, block);
|
|
|
|
if (retval) {
|
|
|
|
/* If the extent is not found, return phys_blk = 0 */
|
|
|
|
if (retval == EXT2_ET_EXTENT_NOT_FOUND)
|
|
|
|
retval = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
retval = ext2fs_extent_get(handle, EXT2_EXTENT_CURRENT, &extent);
|
|
|
|
if (retval)
|
|
|
|
goto done;
|
|
|
|
offset = block - extent.e_lblk;
|
|
|
|
if (block >= extent.e_lblk && (offset <= extent.e_len)) {
|
|
|
|
*phys_blk = extent.e_pblk + offset;
|
|
|
|
if (ret_flags && extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT)
|
|
|
|
*ret_flags |= BMAP_RET_UNINIT;
|
|
|
|
}
|
|
|
|
retval = 0;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
if (!block_buf) {
|
2007-11-10 03:01:06 +03:00
|
|
|
retval = ext2fs_get_array(2, fs->blocksize, &buf);
|
1997-10-26 06:41:24 +03:00
|
|
|
if (retval)
|
|
|
|
return retval;
|
1997-10-26 02:37:42 +04:00
|
|
|
block_buf = buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (block < EXT2_NDIR_BLOCKS) {
|
2004-12-23 21:55:34 +03:00
|
|
|
if (bmap_flags & BMAP_SET) {
|
|
|
|
b = *phys_blk;
|
2007-08-11 09:56:48 +04:00
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
b = ext2fs_swab32(b);
|
2004-12-23 21:55:34 +03:00
|
|
|
#endif
|
|
|
|
inode_bmap(inode, block) = b;
|
|
|
|
inode_dirty++;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
1997-10-26 02:37:42 +04:00
|
|
|
*phys_blk = inode_bmap(inode, block);
|
|
|
|
b = block ? inode_bmap(inode, block-1) : 0;
|
|
|
|
|
|
|
|
if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) {
|
|
|
|
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
|
|
|
|
if (retval)
|
|
|
|
goto done;
|
|
|
|
inode_bmap(inode, block) = b;
|
|
|
|
blocks_alloc++;
|
|
|
|
*phys_blk = b;
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Indirect block */
|
|
|
|
block -= EXT2_NDIR_BLOCKS;
|
2008-02-18 22:59:45 +03:00
|
|
|
blk32 = *phys_blk;
|
1997-10-26 02:37:42 +04:00
|
|
|
if (block < addr_per_block) {
|
|
|
|
b = inode_bmap(inode, EXT2_IND_BLOCK);
|
|
|
|
if (!b) {
|
2004-12-23 21:55:34 +03:00
|
|
|
if (!(bmap_flags & BMAP_ALLOC)) {
|
|
|
|
if (bmap_flags & BMAP_SET)
|
|
|
|
retval = EXT2_ET_SET_BMAP_NO_IND;
|
|
|
|
goto done;
|
|
|
|
}
|
1997-10-26 02:37:42 +04:00
|
|
|
|
|
|
|
b = inode_bmap(inode, EXT2_IND_BLOCK-1);
|
|
|
|
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
|
|
|
|
if (retval)
|
|
|
|
goto done;
|
|
|
|
inode_bmap(inode, EXT2_IND_BLOCK) = b;
|
|
|
|
blocks_alloc++;
|
|
|
|
}
|
|
|
|
retval = block_ind_bmap(fs, bmap_flags, b, block_buf,
|
2008-02-18 22:59:45 +03:00
|
|
|
&blocks_alloc, block, &blk32);
|
|
|
|
if (retval == 0)
|
|
|
|
*phys_blk = blk32;
|
1997-10-26 02:37:42 +04:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Doubly indirect block */
|
|
|
|
block -= addr_per_block;
|
|
|
|
if (block < addr_per_block * addr_per_block) {
|
|
|
|
b = inode_bmap(inode, EXT2_DIND_BLOCK);
|
|
|
|
if (!b) {
|
2004-12-23 21:55:34 +03:00
|
|
|
if (!(bmap_flags & BMAP_ALLOC)) {
|
|
|
|
if (bmap_flags & BMAP_SET)
|
|
|
|
retval = EXT2_ET_SET_BMAP_NO_IND;
|
|
|
|
goto done;
|
|
|
|
}
|
1997-10-26 02:37:42 +04:00
|
|
|
|
|
|
|
b = inode_bmap(inode, EXT2_IND_BLOCK);
|
|
|
|
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
|
|
|
|
if (retval)
|
|
|
|
goto done;
|
|
|
|
inode_bmap(inode, EXT2_DIND_BLOCK) = b;
|
|
|
|
blocks_alloc++;
|
|
|
|
}
|
|
|
|
retval = block_dind_bmap(fs, bmap_flags, b, block_buf,
|
2008-02-18 22:59:45 +03:00
|
|
|
&blocks_alloc, block, &blk32);
|
|
|
|
if (retval == 0)
|
|
|
|
*phys_blk = blk32;
|
1997-10-26 02:37:42 +04:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Triply indirect block */
|
|
|
|
block -= addr_per_block * addr_per_block;
|
|
|
|
b = inode_bmap(inode, EXT2_TIND_BLOCK);
|
|
|
|
if (!b) {
|
2004-12-23 21:55:34 +03:00
|
|
|
if (!(bmap_flags & BMAP_ALLOC)) {
|
|
|
|
if (bmap_flags & BMAP_SET)
|
|
|
|
retval = EXT2_ET_SET_BMAP_NO_IND;
|
1997-10-26 02:37:42 +04:00
|
|
|
goto done;
|
2004-12-23 21:55:34 +03:00
|
|
|
}
|
1997-10-26 02:37:42 +04:00
|
|
|
|
|
|
|
b = inode_bmap(inode, EXT2_DIND_BLOCK);
|
|
|
|
retval = ext2fs_alloc_block(fs, b, block_buf, &b);
|
|
|
|
if (retval)
|
|
|
|
goto done;
|
|
|
|
inode_bmap(inode, EXT2_TIND_BLOCK) = b;
|
|
|
|
blocks_alloc++;
|
|
|
|
}
|
|
|
|
retval = block_tind_bmap(fs, bmap_flags, b, block_buf,
|
2008-02-18 22:59:45 +03:00
|
|
|
&blocks_alloc, block, &blk32);
|
|
|
|
if (retval == 0)
|
|
|
|
*phys_blk = blk32;
|
1997-10-26 02:37:42 +04:00
|
|
|
done:
|
|
|
|
if (buf)
|
2003-08-01 17:41:07 +04:00
|
|
|
ext2fs_free_mem(&buf);
|
2008-02-18 22:59:45 +03:00
|
|
|
if (handle)
|
|
|
|
ext2fs_extent_free(handle);
|
2004-12-23 21:55:34 +03:00
|
|
|
if ((retval == 0) && (blocks_alloc || inode_dirty)) {
|
2008-04-09 19:39:11 +04:00
|
|
|
ext2fs_iblk_add_blocks(fs, inode, blocks_alloc);
|
1997-10-26 02:37:42 +04:00
|
|
|
retval = ext2fs_write_inode(fs, ino, inode);
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-02-18 22:59:45 +03:00
|
|
|
errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
|
|
|
|
char *block_buf, int bmap_flags, blk_t block,
|
|
|
|
blk_t *phys_blk)
|
|
|
|
{
|
|
|
|
errcode_t ret;
|
|
|
|
blk64_t ret_blk;
|
|
|
|
|
|
|
|
ret = ext2fs_bmap2(fs, ino, inode, block_buf, bmap_flags, block,
|
|
|
|
0, &ret_blk);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
if (ret_blk >= ((long long) 1 << 32))
|
|
|
|
return EOVERFLOW;
|
|
|
|
*phys_blk = ret_blk;
|
|
|
|
return 0;
|
|
|
|
}
|