tabs, todo
parent
553e1273ea
commit
46fc23e2d1
18
bmove.c
18
bmove.c
|
@ -1,6 +1,5 @@
|
|||
/*
|
||||
* bmove.c --- Move blocks around to make way for a particular
|
||||
* filesystem structure.
|
||||
* bmove.c --- Move blocks around to make way for a particular filesystem structure.
|
||||
*
|
||||
* Copyright (C) 1997 Theodore Ts'o.
|
||||
*
|
||||
|
@ -17,7 +16,7 @@
|
|||
|
||||
struct process_block_struct {
|
||||
ext2_ino_t ino;
|
||||
struct ext2_inode * inode;
|
||||
struct ext2_inode *inode;
|
||||
ext2fs_block_bitmap reserve;
|
||||
ext2fs_block_bitmap alloc_map;
|
||||
errcode_t error;
|
||||
|
@ -80,8 +79,7 @@ static int process_block(ext2_filsys fs, blk64_t *block_nr,
|
|||
(unsigned long long) block);
|
||||
}
|
||||
if (pb->add_dir) {
|
||||
retval = ext2fs_add_dir_block2(fs->dblist, pb->ino,
|
||||
block, blockcnt);
|
||||
retval = ext2fs_add_dir_block2(fs->dblist, pb->ino, block, blockcnt);
|
||||
if (retval) {
|
||||
pb->error = retval;
|
||||
ret |= BLOCK_ABORT;
|
||||
|
@ -136,18 +134,15 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs,
|
|||
return retval;
|
||||
|
||||
while (ino) {
|
||||
if ((inode.i_links_count == 0) ||
|
||||
!ext2fs_inode_has_valid_blocks2(fs, &inode))
|
||||
if ((inode.i_links_count == 0) || !ext2fs_inode_has_valid_blocks2(fs, &inode))
|
||||
goto next;
|
||||
|
||||
pb.ino = ino;
|
||||
pb.inode = &inode;
|
||||
|
||||
pb.add_dir = (LINUX_S_ISDIR(inode.i_mode) &&
|
||||
flags & EXT2_BMOVE_GET_DBLIST);
|
||||
pb.add_dir = (LINUX_S_ISDIR(inode.i_mode) && flags & EXT2_BMOVE_GET_DBLIST);
|
||||
|
||||
retval = ext2fs_block_iterate3(fs, ino, 0, block_buf,
|
||||
process_block, &pb);
|
||||
retval = ext2fs_block_iterate3(fs, ino, 0, block_buf, process_block, &pb);
|
||||
if (retval)
|
||||
return retval;
|
||||
if (pb.error)
|
||||
|
@ -160,4 +155,3 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* TODO fix reallocation for the case when inode tables for flex_bg do not fit into a single block group
|
||||
* TODO bigalloc compatibility
|
||||
* TODO write some tests: for inode moving (image with many files),
|
||||
* for block moving, including extent blocks (one sparse file with many extents),
|
||||
|
|
Loading…
Reference in New Issue