Merge branch 'maint' into next

Conflicts:
	misc/tune2fs.c
This commit is contained in:
Theodore Ts'o 2012-11-29 19:54:46 -05:00
commit ccea20f62d
16 changed files with 434 additions and 148 deletions

2
configure vendored
View File

@ -1498,7 +1498,7 @@ Optional Features:
--disable-testio-debug disable the use of the test I/O manager for debugging
--disable-libuuid do not build private uuid library
--disable-libblkid do not build private blkid library
--enable-libquota enable quota support
--enable-quota enable quota support
--disable-debugfs disable support of debugfs program
--disable-imager disable support of e2image program
--disable-resizer disable support of e2resize program

View File

@ -568,7 +568,7 @@ dnl
PKG_PROG_PKG_CONFIG
AH_TEMPLATE([CONFIG_QUOTA], [Define to 1 to enable quota support])
AC_ARG_ENABLE([quota],
[ --enable-libquota enable quota support],
[ --enable-quota enable quota support],
if test "$enableval" = "no"
then
AC_MSG_RESULT([Disabling quota support])

View File

@ -1500,6 +1500,16 @@ static _INLINE_ void mark_block_used(e2fsck_t ctx, blk64_t block)
}
}
static _INLINE_ void mark_blocks_used(e2fsck_t ctx, blk64_t block,
unsigned int num)
{
if (ext2fs_test_block_bitmap_range2(ctx->block_found_map, block, num))
ext2fs_mark_block_bitmap_range2(ctx->block_found_map, block, num);
else
while (num--)
mark_block_used(ctx, block++);
}
/*
* Adjust the extended attribute block's reference counts at the end
* of pass 1, either by subtracting out references for EA blocks that
@ -1985,11 +1995,15 @@ fix_problem_now:
goto failed_add_dir_block;
}
}
if (!ctx->fs->cluster_ratio_bits) {
mark_blocks_used(ctx, extent.e_pblk, extent.e_len);
pb->num_blocks += extent.e_len;
}
for (blk = extent.e_pblk, blockcnt = extent.e_lblk, i = 0;
i < extent.e_len;
blk++, blockcnt++, i++) {
if (!(ctx->fs->cluster_ratio_bits &&
pb->previous_block &&
if (ctx->fs->cluster_ratio_bits &&
!(pb->previous_block &&
(EXT2FS_B2C(ctx->fs, blk) ==
EXT2FS_B2C(ctx->fs, pb->previous_block)) &&
(blk & EXT2FS_CLUSTER_MASK(ctx->fs)) ==

View File

@ -337,6 +337,12 @@ static void check_block_bitmaps(e2fsck_t ctx)
int cmp_block = 0;
int redo_flag = 0;
blk64_t super_blk, old_desc_blk, new_desc_blk;
char *actual_buf, *bitmap_buf;
actual_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize,
"actual bitmap buffer");
bitmap_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize,
"bitmap block buffer");
clear_problem_context(&pctx);
free_array = (unsigned int *) e2fsck_allocate_memory(ctx,
@ -383,11 +389,53 @@ redo_counts:
for (i = B2C(fs->super->s_first_data_block);
i < ext2fs_blocks_count(fs->super);
i += EXT2FS_CLUSTER_RATIO(fs)) {
int first_block_in_bg = (B2C(i) -
B2C(fs->super->s_first_data_block)) %
fs->super->s_clusters_per_group == 0;
int n, nbytes = fs->super->s_clusters_per_group / 8;
actual = ext2fs_fast_test_block_bitmap2(ctx->block_found_map, i);
/*
* Try to optimize pass5 by extracting a bitmap block
* as expected from what we have on disk, and then
* comparing the two. If they are identical, then
* update the free block counts and go on to the next
* block group. This is much faster than doing the
* individual bit-by-bit comparison. The one downside
* is that this doesn't work if we are asking e2fsck
* to do a discard operation.
*/
if (!first_block_in_bg ||
(group == (int)fs->group_desc_count - 1) ||
(ctx->options & E2F_OPT_DISCARD))
goto no_optimize;
retval = ext2fs_get_block_bitmap_range2(ctx->block_found_map,
B2C(i), fs->super->s_clusters_per_group,
actual_buf);
if (retval)
goto no_optimize;
if (ext2fs_bg_flags_test(fs, group, EXT2_BG_BLOCK_UNINIT))
memset(bitmap_buf, 0, nbytes);
else {
retval = ext2fs_get_block_bitmap_range2(fs->block_map,
B2C(i), fs->super->s_clusters_per_group,
bitmap_buf);
if (retval)
goto no_optimize;
}
if (memcmp(actual_buf, bitmap_buf, nbytes) != 0)
goto no_optimize;
n = ext2fs_bitcount(actual_buf, nbytes);
group_free = fs->super->s_clusters_per_group - n;
free_blocks += group_free;
i += fs->super->s_clusters_per_group - 1;
goto next_group;
no_optimize:
if (skip_group) {
if ((B2C(i) - B2C(fs->super->s_first_data_block)) %
fs->super->s_clusters_per_group == 0) {
if (first_block_in_bg) {
super_blk = 0;
old_desc_blk = 0;
new_desc_blk = 0;
@ -525,6 +573,7 @@ redo_counts:
if (!bitmap && i >= first_free)
e2fsck_discard_blocks(ctx, first_free,
(i - first_free) + 1);
next_group:
first_free = ext2fs_blocks_count(fs->super);
free_array[group] = group_free;
@ -599,6 +648,8 @@ redo_counts:
}
errout:
ext2fs_free_mem(&free_array);
ext2fs_free_mem(&actual_buf);
ext2fs_free_mem(&bitmap_buf);
}
static void check_inode_bitmaps(e2fsck_t ctx)

View File

@ -75,52 +75,46 @@ static int valid_offset(int fd, blkid_loff_t offset)
*/
blkid_loff_t blkid_get_dev_size(int fd)
{
int valid_blkgetsize64 = 1;
#ifdef __linux__
struct utsname ut;
#endif
unsigned long long size64;
unsigned long size;
blkid_loff_t high, low;
#ifdef FDGETPRM
struct floppy_struct this_floppy;
#endif
#ifdef HAVE_SYS_DISKLABEL_H
int part = -1;
struct disklabel lab;
struct partition *pp;
char ch;
struct stat st;
#endif /* HAVE_SYS_DISKLABEL_H */
#ifdef DKIOCGETBLOCKCOUNT /* For Apple Darwin */
if (ioctl(fd, DKIOCGETBLOCKCOUNT, &size64) >= 0) {
if ((sizeof(blkid_loff_t) < sizeof(unsigned long long))
&& (size64 << 9 > 0xFFFFFFFF))
if (sizeof(blkid_loff_t) < sizeof(unsigned long long) &&
(size64 << 9) > 0xFFFFFFFF)
return 0; /* EFBIG */
return (blkid_loff_t) size64 << 9;
return (blkid_loff_t)size64 << 9;
}
#endif
#ifdef BLKGETSIZE64
{
int valid_blkgetsize64 = 1;
#ifdef __linux__
if ((uname(&ut) == 0) &&
((ut.release[0] == '2') && (ut.release[1] == '.') &&
(ut.release[2] < '6') && (ut.release[3] == '.')))
valid_blkgetsize64 = 0;
struct utsname ut;
if ((uname(&ut) == 0) &&
((ut.release[0] == '2') && (ut.release[1] == '.') &&
(ut.release[2] < '6') && (ut.release[3] == '.')))
valid_blkgetsize64 = 0;
#endif
if (valid_blkgetsize64 &&
ioctl(fd, BLKGETSIZE64, &size64) >= 0) {
if ((sizeof(blkid_loff_t) < sizeof(unsigned long long))
&& ((size64) > 0xFFFFFFFF))
return 0; /* EFBIG */
return size64;
if (valid_blkgetsize64 &&
ioctl(fd, BLKGETSIZE64, &size64) >= 0) {
if (sizeof(blkid_loff_t) < sizeof(unsigned long long) &&
(size64 > 0xFFFFFFFF))
return 0; /* EFBIG */
return size64;
}
}
#endif /* BLKGETSIZE64 */
#ifdef BLKGETSIZE
if (ioctl(fd, BLKGETSIZE, &size) >= 0)
return (blkid_loff_t)size << 9;
{
unsigned long size;
if (ioctl(fd, BLKGETSIZE, &size) >= 0)
return (blkid_loff_t)size << 9;
}
#endif
/* tested on FreeBSD 6.1-RELEASE i386 */
@ -130,26 +124,39 @@ blkid_loff_t blkid_get_dev_size(int fd)
#endif /* DIOCGMEDIASIZE */
#ifdef FDGETPRM
if (ioctl(fd, FDGETPRM, &this_floppy) >= 0)
return (blkid_loff_t)this_floppy.size << 9;
{
struct floppy_struct this_floppy;
if (ioctl(fd, FDGETPRM, &this_floppy) >= 0)
return (blkid_loff_t)this_floppy.size << 9;
}
#endif
#ifdef HAVE_SYS_DISKLABEL_H
/*
* This code works for FreeBSD 4.11 i386, except for the full device
* (such as /dev/ad0). It doesn't work properly for newer FreeBSD
* though. FreeBSD >= 5.0 should be covered by the DIOCGMEDIASIZE
* above however.
*
* Note that FreeBSD >= 4.0 has disk devices as unbuffered (raw,
* character) devices, so we need to check for S_ISCHR, too.
*/
if (fstat(fd, &st) >= 0 && (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)))
part = st.st_rdev & 7;
{
int part = -1;
struct disklabel lab;
struct partition *pp;
char ch;
struct stat st;
if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
pp = &lab.d_partitions[part];
if (pp->p_size)
return pp->p_size << 9;
/*
* This code works for FreeBSD 4.11 i386, except for the full
* device (such as /dev/ad0). It doesn't work properly for
* newer FreeBSD though. FreeBSD >= 5.0 should be covered by
* the DIOCGMEDIASIZE above however.
*
* Note that FreeBSD >= 4.0 has disk devices as unbuffered (raw,
* character) devices, so we need to check for S_ISCHR, too.
*/
if (fstat(fd, &st) >= 0 &&
(S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)))
part = st.st_rdev & 7;
if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
pp = &lab.d_partitions[part];
if (pp->p_size)
return pp->p_size << 9;
}
}
#endif /* HAVE_SYS_DISKLABEL_H */
{

View File

@ -116,3 +116,43 @@ int ext2fs_test_bit64(__u64 nr, const void * addr)
return (mask & *ADDR);
}
static unsigned int popcount8(unsigned int w)
{
unsigned int res = w - ((w >> 1) & 0x55);
res = (res & 0x33) + ((res >> 2) & 0x33);
return (res + (res >> 4)) & 0x0F;
}
static unsigned int popcount32(unsigned int w)
{
unsigned int res = w - ((w >> 1) & 0x55555555);
res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
res = (res + (res >> 4)) & 0x0F0F0F0F;
res = res + (res >> 8);
return (res + (res >> 16)) & 0x000000FF;
}
unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes)
{
const unsigned char *cp = addr;
const __u32 *p;
unsigned int res = 0;
while (((((unsigned long) cp) & 3) != 0) && (nbytes > 0)) {
res += popcount8(*cp++);
nbytes--;
}
p = (__u32 *) cp;
while (nbytes > 4) {
res += popcount32(*p++);
nbytes -= 4;
}
cp = (const unsigned char *) p;
while (nbytes > 0) {
res += popcount8(*cp++);
nbytes--;
}
return res;
}

View File

@ -686,6 +686,7 @@ extern int ext2fs_test_bit(unsigned int nr, const void * addr);
extern int ext2fs_set_bit64(__u64 nr,void * addr);
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
extern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes);
#ifdef NO_INLINE_FUNCS
extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);

View File

@ -672,16 +672,42 @@ static errcode_t rb_set_bmap_range(ext2fs_generic_bitmap bitmap,
__u64 start, size_t num, void *in)
{
struct ext2fs_rb_private *bp;
unsigned char *cp = in;
size_t i;
int first_set = -1;
int ret;
bp = (struct ext2fs_rb_private *) bitmap->private;
for (i = 0; i < num; i++) {
ret = ext2fs_test_bit(i, in);
if (ret)
rb_insert_extent(start + i - bitmap->start, 1, bp);
if (i & 7 == 0) {
unsigned char c = cp[i/8];
if (c == 0xFF) {
if (first_set == -1)
first_set = i;
i += 7;
continue;
}
if ((c == 0x00) && (first_set == -1)) {
i += 7;
continue;
}
}
if (ext2fs_test_bit(i, in)) {
if (first_set == -1)
first_set = i;
continue;
}
if (first_set == -1)
continue;
rb_insert_extent(start + first_set - bitmap->start,
i - first_set, bp);
first_set = -1;
}
if (first_set != -1)
rb_insert_extent(start + first_set - bitmap->start,
num - first_set, bp);
return 0;
}
@ -693,6 +719,7 @@ static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap bitmap,
struct rb_node *parent = NULL, *next, **n;
struct ext2fs_rb_private *bp;
struct bmap_rb_extent *ext;
int count;
__u64 pos;
bp = (struct ext2fs_rb_private *) bitmap->private;
@ -713,32 +740,41 @@ static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap bitmap,
break;
}
pos = start;
memset(out, 0, (num + 7) >> 3);
for (; parent != NULL; parent = next) {
next = ext2fs_rb_next(parent);
ext = ext2fs_rb_entry(parent, struct bmap_rb_extent, node);
while (((pos - start) < num) &&
(pos < ext->start)) {
ext2fs_fast_clear_bit64((pos - start), out);
pos++;
pos = ext->start;
count = ext->count;
if (pos >= start + num)
break;
if (pos < start) {
count -= start - pos;
if (count < 0)
continue;
pos = start;
}
if (pos + count > start + num)
count = start + num - pos;
if ((pos - start) >= num)
return 0;
while (count > 0) {
if ((count >= 8) &&
((pos - start) % 8) == 0) {
int nbytes = count >> 3;
int offset = (pos - start) >> 3;
while (((pos - start) < num) &&
(pos < (ext->start + ext->count))) {
memset(out + offset, 0xFF, nbytes);
pos += nbytes << 3;
count -= nbytes << 3;
continue;
}
ext2fs_fast_set_bit64((pos - start), out);
pos++;
count--;
}
}
while ((pos - start) < num) {
ext2fs_fast_clear_bit64((pos - start), out);
pos++;
}
return 0;
}

View File

@ -140,25 +140,11 @@ static int valid_offset (int fd, ext2_loff_t offset)
* Returns the number of blocks in a partition
*/
errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
blk64_t *retblocks)
blk64_t *retblocks)
{
int fd, rc = 0;
int valid_blkgetsize64 = 1;
#ifdef __linux__
struct utsname ut;
#endif
unsigned long long size64;
unsigned long size;
ext2_loff_t high, low;
#ifdef FDGETPRM
struct floppy_struct this_floppy;
#endif
#ifdef HAVE_SYS_DISKLABEL_H
int part;
struct disklabel lab;
struct partition *pp;
char ch;
#endif /* HAVE_SYS_DISKLABEL_H */
fd = ext2fs_open_file(file, O_RDONLY, 0);
if (fd < 0)
@ -172,63 +158,83 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
#endif
#ifdef BLKGETSIZE64
{
int valid_blkgetsize64 = 1;
#ifdef __linux__
if ((uname(&ut) == 0) &&
((ut.release[0] == '2') && (ut.release[1] == '.') &&
(ut.release[2] < '6') && (ut.release[3] == '.')))
valid_blkgetsize64 = 0;
struct utsname ut;
if ((uname(&ut) == 0) &&
((ut.release[0] == '2') && (ut.release[1] == '.') &&
(ut.release[2] < '6') && (ut.release[3] == '.')))
valid_blkgetsize64 = 0;
#endif
if (valid_blkgetsize64 &&
ioctl(fd, BLKGETSIZE64, &size64) >= 0) {
*retblocks = size64 / blocksize;
goto out;
if (valid_blkgetsize64 &&
ioctl(fd, BLKGETSIZE64, &size64) >= 0) {
*retblocks = size64 / blocksize;
goto out;
}
}
#endif /* BLKGETSIZE64 */
#ifdef BLKGETSIZE
if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
*retblocks = size / (blocksize / 512);
goto out;
{
unsigned long size;
if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
*retblocks = size / (blocksize / 512);
goto out;
}
}
#endif
#ifdef FDGETPRM
if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) {
*retblocks = this_floppy.size / (blocksize / 512);
goto out;
{
struct floppy_struct this_floppy;
if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) {
*retblocks = this_floppy.size / (blocksize / 512);
goto out;
}
}
#endif
#ifdef HAVE_SYS_DISKLABEL_H
#if defined(DIOCGMEDIASIZE)
{
off_t ms;
u_int bs;
if (ioctl(fd, DIOCGMEDIASIZE, &ms) >= 0) {
*retblocks = ms / blocksize;
goto out;
}
}
#elif defined(DIOCGDINFO)
/* old disklabel interface */
part = strlen(file) - 1;
if (part >= 0) {
ch = file[part];
if (isdigit(ch))
part = 0;
else if (ch >= 'a' && ch <= 'h')
part = ch - 'a';
else
part = -1;
}
if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
pp = &lab.d_partitions[part];
if (pp->p_size) {
*retblocks = pp->p_size / (blocksize / 512);
goto out;
int part;
struct disklabel lab;
struct partition *pp;
char ch;
#if defined(DIOCGMEDIASIZE)
{
off_t ms;
u_int bs;
if (ioctl(fd, DIOCGMEDIASIZE, &ms) >= 0) {
*retblocks = ms / blocksize;
goto out;
}
}
#elif defined(DIOCGDINFO)
/* old disklabel interface */
part = strlen(file) - 1;
if (part >= 0) {
ch = file[part];
if (isdigit(ch))
part = 0;
else if (ch >= 'a' && ch <= 'h')
part = ch - 'a';
else
part = -1;
}
if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
pp = &lab.d_partitions[part];
if (pp->p_size) {
*retblocks = pp->p_size / (blocksize / 512);
goto out;
}
}
}
#endif /* defined(DIOCG*) */
}
#endif /* HAVE_SYS_DISKLABEL_H */
{
@ -247,10 +253,9 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
* find the size of the partition.
*/
low = 0;
for (high = 1024; valid_offset (fd, high); high *= 2)
for (high = 1024; valid_offset(fd, high); high *= 2)
low = high;
while (low < high - 1)
{
while (low < high - 1) {
const ext2_loff_t mid = (low + high) / 2;
if (valid_offset (fd, mid))
@ -258,7 +263,7 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
else
high = mid;
}
valid_offset (fd, 0);
valid_offset(fd, 0);
size64 = low + 1;
*retblocks = size64 / blocksize;
out:

View File

@ -4,8 +4,8 @@
* Copyright (C) 2011 Whamcloud, Inc.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/

View File

@ -270,6 +270,7 @@ void dump_bitmap(ext2fs_generic_bitmap bmap, unsigned int start, unsigned num)
for (i=0; i < len; i++)
printf("%02x", buf[i]);
printf("\n");
printf("bits set: %u\n", ext2fs_bitcount(buf, len));
free(buf);
}

View File

@ -53,5 +53,47 @@ cleari 5
testi 17
testi 6
testi 4
clearb 7 12
dump_bb
setb 1
dump_bb
setb 2
dump_bb
setb 3
dump_bb
setb 4
dump_bb
setb 5
dump_bb
setb 6
dump_bb
setb 7
dump_bb
setb 8
dump_bb
setb 10
setb 12
setb 14
setb 17
setb 19
setb 24
setb 26
setb 27
setb 30
setb 31
setb 32
setb 35
setb 39
setb 40
setb 44
setb 46
setb 47
setb 49
setb 51
setb 52
clearb 2
clearb 3
clearb 7
dump_bb
quit

View File

@ -36,6 +36,7 @@ tst_bitmaps: testb 16
Block 16 is set
tst_bitmaps: dump_bb
block bitmap: 00f80000000000000000000000000000
bits set: 5
tst_bitmaps: ffzb 11 16
First unmarked block is 11
tst_bitmaps: ffzb 12 16
@ -64,6 +65,7 @@ tst_bitmaps: setb 12 7
Marking blocks 12 to 18
tst_bitmaps: dump_bb
block bitmap: 00f80300000000000000000000000000
bits set: 7
tst_bitmaps: seti 2
Setting inode 2, was clear before
tst_bitmaps: seti 5
@ -82,6 +84,7 @@ tst_bitmaps: testi 1
Inode 1 is clear
tst_bitmaps: dump_ib
inode bitmap: 1e000000
bits set: 4
tst_bitmaps: ffzi 1 6
First unmarked inode is 1
tst_bitmaps: ffzi 2 5
@ -110,5 +113,99 @@ tst_bitmaps: testi 6
Inode 6 is clear
tst_bitmaps: testi 4
Inode 4 is clear
tst_bitmaps: clearb 7 12
Clearing blocks 7 to 18
tst_bitmaps: dump_bb
block bitmap: 00000000000000000000000000000000
bits set: 0
tst_bitmaps: setb 1
Setting block 1, was clear before
tst_bitmaps: dump_bb
block bitmap: 01000000000000000000000000000000
bits set: 1
tst_bitmaps: setb 2
Setting block 2, was clear before
tst_bitmaps: dump_bb
block bitmap: 03000000000000000000000000000000
bits set: 2
tst_bitmaps: setb 3
Setting block 3, was clear before
tst_bitmaps: dump_bb
block bitmap: 07000000000000000000000000000000
bits set: 3
tst_bitmaps: setb 4
Setting block 4, was clear before
tst_bitmaps: dump_bb
block bitmap: 0f000000000000000000000000000000
bits set: 4
tst_bitmaps: setb 5
Setting block 5, was clear before
tst_bitmaps: dump_bb
block bitmap: 1f000000000000000000000000000000
bits set: 5
tst_bitmaps: setb 6
Setting block 6, was clear before
tst_bitmaps: dump_bb
block bitmap: 3f000000000000000000000000000000
bits set: 6
tst_bitmaps: setb 7
Setting block 7, was clear before
tst_bitmaps: dump_bb
block bitmap: 7f000000000000000000000000000000
bits set: 7
tst_bitmaps: setb 8
Setting block 8, was clear before
tst_bitmaps: dump_bb
block bitmap: ff000000000000000000000000000000
bits set: 8
tst_bitmaps: setb 10
Setting block 10, was clear before
tst_bitmaps: setb 12
Setting block 12, was clear before
tst_bitmaps: setb 14
Setting block 14, was clear before
tst_bitmaps: setb 17
Setting block 17, was clear before
tst_bitmaps: setb 19
Setting block 19, was clear before
tst_bitmaps: setb 24
Setting block 24, was clear before
tst_bitmaps: setb 26
Setting block 26, was clear before
tst_bitmaps: setb 27
Setting block 27, was clear before
tst_bitmaps: setb 30
Setting block 30, was clear before
tst_bitmaps: setb 31
Setting block 31, was clear before
tst_bitmaps: setb 32
Setting block 32, was clear before
tst_bitmaps: setb 35
Setting block 35, was clear before
tst_bitmaps: setb 39
Setting block 39, was clear before
tst_bitmaps: setb 40
Setting block 40, was clear before
tst_bitmaps: setb 44
Setting block 44, was clear before
tst_bitmaps: setb 46
Setting block 46, was clear before
tst_bitmaps: setb 47
Setting block 47, was clear before
tst_bitmaps: setb 49
Setting block 49, was clear before
tst_bitmaps: setb 51
Setting block 51, was clear before
tst_bitmaps: setb 52
Setting block 52, was clear before
tst_bitmaps: clearb 2
Clearing block 2, was set before
tst_bitmaps: clearb 3
Clearing block 3, was set before
tst_bitmaps: clearb 7
Clearing block 7, was set before
tst_bitmaps: dump_bb
block bitmap: b92a85e6c4680d000000000000000000
bits set: 25
tst_bitmaps: quit
tst_bitmaps:

View File

@ -145,7 +145,9 @@ static __u32 ok_features[3] = {
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM |
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER |
#ifdef CONFIG_QUOTA
EXT4_FEATURE_RO_COMPAT_QUOTA |
#endif
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM
};
@ -164,7 +166,9 @@ static __u32 clear_ok_features[3] = {
EXT4_FEATURE_RO_COMPAT_DIR_NLINK|
EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|
EXT4_FEATURE_RO_COMPAT_GDT_CSUM |
#ifdef CONFIG_QUOTA
EXT4_FEATURE_RO_COMPAT_QUOTA |
#endif
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM
};

View File

@ -102,7 +102,7 @@ static void determine_fs_stride(ext2_filsys fs)
{
unsigned int group;
unsigned long long sum;
unsigned int has_sb, prev_has_sb, num;
unsigned int has_sb, prev_has_sb = 0, num;
int i_stride, b_stride;
if (fs->stride)

View File

@ -293,8 +293,8 @@ errcode_t adjust_fs_info(ext2_filsys fs, ext2_filsys old_fs,
blk64_t rem;
blk64_t blk, group_block;
blk64_t real_end;
blk64_t adj, old_numblocks, numblocks, adjblocks;
unsigned long i, j, old_desc_blocks, max_group;
blk64_t old_numblocks, numblocks, adjblocks;
unsigned long i, j, old_desc_blocks;
unsigned int meta_bg, meta_bg_size;
int has_super, csum_flag;
unsigned long long new_inodes; /* u64 to check for overflow */
@ -482,8 +482,6 @@ retry:
csum_flag = ext2fs_has_group_desc_csum(fs);
if (access("/sys/fs/ext4/features/lazy_itable_init", F_OK) == 0)
lazy_itable_init = 1;
adj = old_fs->group_desc_count;
max_group = fs->group_desc_count - adj;
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
old_desc_blocks = fs->super->s_first_meta_bg;
else
@ -696,15 +694,7 @@ static errcode_t mark_table_blocks(ext2_filsys fs,
blk64_t b;
unsigned int j;
dgrp_t i;
unsigned long meta_bg_size;
unsigned int old_desc_blocks;
meta_bg_size = EXT2_DESC_PER_BLOCK(fs->super);
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
old_desc_blocks = fs->super->s_first_meta_bg;
else
old_desc_blocks = fs->desc_blocks +
fs->super->s_reserved_gdt_blocks;
for (i = 0; i < fs->group_desc_count; i++) {
ext2fs_reserve_super_and_bgd(fs, i, bmap);
@ -1722,7 +1712,7 @@ static errcode_t fix_resize_inode(ext2_filsys fs)
{
struct ext2_inode inode;
errcode_t retval;
char * block_buf;
char *block_buf = NULL;
if (!(fs->super->s_feature_compat &
EXT2_FEATURE_COMPAT_RESIZE_INODE))
@ -1924,8 +1914,6 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs)
blk64_t blks_needed, groups, data_blocks;
blk64_t grp, data_needed, last_start;
blk64_t overhead = 0;
int num_of_superblocks = 0;
blk64_t super_overhead = 0;
int old_desc_blocks;
int extra_groups = 0;
int flexbg_size = 1 << fs->super->s_log_groups_per_flex;