summaryrefslogtreecommitdiff
path: root/resize
AgeCommit message (Collapse)AuthorFilesLines
2011-11-20resize2fs: treat EINVAL to mean the new resize ioctl does not existTheodore Ts'o1-1/+10
Linux's compat_sys_ioctl() function, which is run when executing a ioctl using a 32-bit binary on a 64-bit kernel, returns EINVAL when an inode does not exist. Sigh. See /usr/src/linux/fs/compat_ioctl.c. This is probably a kernel bug, but work around it for now. Addresses-Debian-Bug: #644989 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-16libext2fs: ext2fs_[set_]file_acl_block needs to check for 64-bit feature flagTheodore Ts'o1-4/+5
The ext2fs_file_acl_block() and ext2fs_set_file_acl_block() needs to only check i_file_acl_high if the 64-bit flag is set. This is needed because otherwise we will run into problems on Hurd systems which actually use that field for h_i_mode_high. This involves an ABI change since we need to pass ext2_filsys to these functions. Fortunately these functions were first included in the 1.42-WIP series, so it's OK for us to change them now. (This is why we have 1.42-WIP releases. :-) Addresses-Sourceforge-Bug: #3379227 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-16resize2fs: don't fail when shrinking an empty file systemTheodore Ts'o1-1/+1
This commit fixes a failure when running the commands: dd if=/dev/zero of=fs bs=1k count=100k; mke2fs fs; resize2fs -Mp fs We should not try truncating the file system if there is only a single block group in the file system. Addresses-Sourceforge-Bug: #3404051 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-16resize2fs: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't existLukas Czerner1-1/+6
Commit 9f6ba888f027ba added support for new online resize ioctl EXT4_IOC_RESIZE_FS. It is also trying to avoid failure when this ioctl() is not supported by the kernel however it is checking wrong error code (EINVAL). When the ioctl does not exist, errno is set to ENOTTY, so we should check for that, rather than EINVAL which means that ioctl arguments are not valid. So change the code to check for ENOTTY and allow resize2fs to try to use the old approach. Also add some comments. Addresses-Red-Hat-Bugzilla: #746284 Addresses-Debian-Bug: #644989 Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-09Fix more spelling errors found by translators and add pluralizationTheodore Ts'o1-1/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-08Fix spelling errors pointed out by translatorsTheodore Ts'o1-1/+1
Also remove the _("<foo>") marker from a string that was all numbers and hence didn't need punctuation. Thanks to Philipp Thomas and Goeran Uddeborg for reporting these buglets. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-06libext2fs: make ext2fs_open_file() always use 3 arguments instead of varargsTheodore Ts'o1-1/+1
Some architectures have narrow mode_t's which can cause some portability warnings with varargs. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05Pass the gettext() function to libcom_errTheodore Ts'o1-0/+1
For those e2fsprogs programs which use libcom_err and are internationalized, pass the gettext() function to libcom_err during program initialization. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03resize2fs: fix on-line resizingTheodore Ts'o1-4/+12
On-line resizing has been broken in the 1.42 series for two reasons: (a) the call to the new EXT4_IOC_RESIZE_FS ioctl checked for ENOTTY to indicate that the ioctl does not exist, when in fact EINVAL is what is returned if the ioctl doesn't exist. (b) resize2fs was passing in a pointer to a 64-bit value, when the ioctl expected a 32-bit value. This was OK on little-endian systems, but it wouldn't work at all on big-endian systems. Fix both problems. Addresses-Debian-Bug: #451388 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18Shorten compile commands run by the build systemTheodore Ts'o6-0/+6
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and this was starting to cause some tools heartburn. It also made "make V=1" almost useless, since trying to following the individual commands run by make was lost in the noise of all of the defines. So fix this by putting the configure-generated defines in lib/config.h and the directory pathnames to lib/dirpaths.h. In addition, clean up some vestigal defines in configure.in and in the Makefiles to further shorten the cc command lines. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-16e2fsprogs: add ext2fs_group_blocks_count helperEric Sandeen2-18/+5
Code to count the number of blocks in the last partial group is cut and pasted around the e2fsprogs codebase a few times. Making this a helper function should improve matters. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-15e2fsprogs: create open() and stat() helpersLukas Czerner1-5/+1
In many places we are using #ifdef HAVE_OPEN64 to determine if we can use open64() but that's ugly. This commit creates two new helpers ext2fs_open_file() for open() and ext2fs_stat() for stat(). Also we need new typedef ext2fs_struct_stat for struct stat. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-14resize2fs: add support for new in-kernel online resize ioctlYongqiang Yang1-1/+18
This is needed to support online resizing for > 32-bit file systems Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-11ext2fs: Handle internal journal over 2^32 bytesAndreas Dilger1-0/+1
The write_journal_inode() code is only setting the low 32-bit i_size for the journal size, even though it is possible to specify a journal up to 10M blocks in size. Trying to create a journal larger than 2GB will succeed, but an immediate e2fsck would fail. Store i_size_high for the journal inode when creating it, and load it upon access. Use s_jnl_blocks[15] to store the journal i_size_high backup. This field is currently unused, as EXT2_N_BLOCKS is 15, so it is using s_jnl_blocks[0..14], and i_size is in s_jnl_blocks[16]. Rename the "size" argument "num_blocks" for the journal creation functions to clarify this parameter is in units of filesystem blocks and not bytes. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-01-07resize2fs: fix computation of the real end of the bitmap to be 64-bitTheodore Ts'o1-4/+4
real_end had been previously declared with a bogus type, which is why this was missed earlier. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-22Merge branch 'maint' into nextTheodore Ts'o1-15/+0
Conflicts: resize/resize2fs.c
2010-12-22resize2fs: do not clear resize inode for 0 resvd blocksEric Sandeen1-15/+0
I ran into odd behavior where mkfs.ext4 of a 16T filesystem would create a resize inode with 0 reserved blocks, and mark the resize_inode feature. A subsequent slight downward resize of the filesystem would remove the resize inode, making any further offline resizing impossible. This is especially odd in light of the fact that a large downward resize (say, to 8T) will actually add blocks to the resize inode - so a small resize removes it, a large resize expands it ... commit 8ade268cf2fde8629b51bfd1c044a83db88234cd had added this: If the filesystem is grown to the point where the resize_inode is no longer needed, clean it up properly so e2fsck doesn't have to. but, it seems e2fsck does not care about this situation, either. So, simply leave the resize_inode intact in this case, and everything seems to be happy. Note, this is for the 1.41.xx branch. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-20Merge branch 'maint' into nextTheodore Ts'o1-0/+8
Conflicts: lib/ext2fs/block.c lib/ext2fs/csum.c resize/main.c
2010-12-16resize2fs: handle exactly-16T filesystems in resize2fsEric Sandeen1-3/+11
Before we go whole-hog on 64-bit e2fsprogs, I wonder if this is worth considering as a last-minute addition to the 1.41 stream. Currently, mke2fs will shave a block off an exactly-16T device to fit*, but resize2fs does not do the same, leading to some asymmetry. This patch fixes that up, and allows 16T devices to be handled more gracefully in offline resize. (in fact resize2fs will not even open a 16T device, today). *commit 37d17a65ecb4615546b417038190a41bafca7c51 Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-12-13Merge branch 'maint' into nextTheodore Ts'o2-4/+11
Conflicts: e2fsck/pass4.c misc/dumpe2fs.c resize/online.c
2010-11-26resize2fs: Clarify error explaining on-line shrinking is not supported at allTheodore Ts'o1-2/+1
Addresses-Debian-Bug: #599786 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-11-26resize2fs.8.in: Document that resize2fs -p only works on offline resizesTheodore Ts'o1-2/+2
Addresses-Launchpad-Bug: #505719 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-25resize2fs.8: Make it clear that power-of-2 units are meant by kilobytesTheodore Ts'o1-0/+8
It's sad that this needs to be made clear.... Addresses-Debian-Bug: #594004 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-19Merge branch 'maint' into nextTheodore Ts'o3-4/+8
Conflicts: resize/extent.c
2010-07-19resize2fs.8: Update man page to indicate ext4 supports on-line resizeTheodore Ts'o1-1/+1
Addresses-Debian-Bug: #589345 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-17resize2fs: relax requirements for -P output a bitEric Sandeen1-2/+1
Requiring an immediate pre-fsck before printing a minimum resize size seems a bit draconian; if the fs isn't clean or marked with error, then certainly, but for an informational minimum size, I don't think we need to require a fsck since last mount. I had simply copied the checks from the actual resize path, previously. Installers use this option (-P) to gather minimum resize info, and requiring an actual fsck before use just seems to go too far. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-07-05e2fsck, resize2fs: fix a fp precision error that can lead to a seg faultTheodore Ts'o1-1/+6
Commit 641b66b fixed a floating point precision error which can result in a search algorithm looping forever. It can also result in an array index being out of bounds and causing a segfault. Here are two more cases in e2fsck and resize2fs that need to be fixed. I've just used the same fix from the that commit. Signed-off-by: Lachlan McIlroy <lmcilroy@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13resize2fs: Fix up to be 64-bit block number safeValerie Aurora Henson6-111/+115
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-07Merge branch 'maint' into nextTheodore Ts'o1-0/+8
Conflicts: e2fsck/journal.c e2fsck/pass1.c e2fsck/pass2.c misc/mke2fs.c
2010-05-12resize2fs: don't print minimum size if fs is not cleanEric Sandeen1-0/+8
Right now, resize2fs -P on a dirty filesystem will give you a number; however, it's probably wrong if the fs is not clean: # resize2fs -P myimage.img resize2fs 1.41.9 (22-Aug-2009) Estimated minimum size of the filesystem: 75623 # e2fsck -fy myimage.img e2fsck 1.41.9 (22-Aug-2009) myimage.img: recovering journal Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information myimage.img: ***** FILE SYSTEM WAS MODIFIED ***** myimage.img: 9530/53760 files (0.1% non-contiguous), 24737/98304 blocks # resize2fs -P myimage.img resize2fs 1.41.9 (22-Aug-2009) Estimated minimum size of the filesystem: 32165 We should issue the same "Please run e2fsck ..." message for -P as we do for an actual resize request. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-02-10Merge branch 'maint' into nextTheodore Ts'o1-0/+4
Conflicts: e2fsck/pass1.c
2010-02-05resize2fs: Fix fix uninit group test accessing invalid memoryTheodore Ts'o1-0/+4
Commit 74128f8 added tests for uninit groups, but it could access past the end of the group_desc[] array after processing the last group: ==19668== Invalid read of size 2 ==19668== at 0x40518C: resize_fs (resize2fs.c:1824) ==19668== by 0x405A46: main (main.c:451) ==19668== Address 0x5a0d002 is not stack'd, malloc'd or (recently) free'd ==19668== ==19668== Invalid read of size 2 ==19668== at 0x405391: resize_fs (resize2fs.c:1864) ==19668== by 0x405A46: main (main.c:451) ==19668== Address 0x5a0d002 is not stack'd, malloc'd or (recently) free'd ==19668== It was found by Eric Sandeen running the regression suite through valgrind. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-16Merge branch 'maint' into nextTheodore Ts'o1-0/+4
Conflicts: misc/mke2fs.c
2009-11-12resize2fs: exit fix_sb_journal_backup early for external journalEric Sandeen1-0/+4
Resizing a filesystem with an external journal fails when it tries to read inode 0: # touch testfs # truncate testfs 1342177280 # touch testjournal # truncate testjournal 134217728 # mke2fs -O journal_dev testjournal # losetup /dev/loop0 testjournal # mkfs.ext4 -J device=/dev/loop0 testfs 127680 # resize2fs testfs resize2fs 1.41.9 (22-Aug-2009) Resizing the filesystem on testfs to 327680 (4k) blocks. resize2fs: Illegal inode number while trying to resize testfs Please run 'e2fsck -fy testfs' to fix the filesystem after the aborted resize operation. I think the right, simple thing to do is just bail out early for an external journal here, as there are no backup blocks to update. Reported-by: mjevans1983@gmail.com Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-10-25Convert ext2fs_group_of_blk() to ext2fs_group_of_blk2()Theodore Ts'o1-1/+1
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert ext2fs_block_alloc_stats() calls to block_alloc_stats2()Valerie Aurora Henson1-11/+11
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert to use block group accessor functionsValerie Aurora Henson3-65/+60
Convert direct accesses to use the following block group accessor functions: ext2fs_block_bitmap_loc(), ext2fs_inode_bitmap_loc(), ext2fs_inode_table_loc(), ext2fs_bg_itable_unused(), ext2fs_block_bitmap_loc_set(), ext2fs_inode_bitmap_loc_set(), ext2fs_inode_table_loc_set(), ext2fs_bg_free_inodes_count(), ext2fs_ext2fs_bg_used_dirs_count(), ext2fs_bg_free_inodes_count_set(), ext2fs_bg_free_blocks_count_set(), ext2fs_bg_used_dirs_count_set() Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25libext2fs: Convert ext2fs_bg_flag_test() to ext2fs_bg_flags_test()Theodore Ts'o1-8/+7
After cleaning up ext2fs_bg_flag_set() and ext2fs_bg_flag_clear(), we're left with ext2fs_bg_flag_test(). Convert it to ext2fs_bg_flags_test(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25libext2fs: clean up ext2fs_bg_flags_ interfacesEric Sandeen1-6/+5
The ext2fs_bg_flag* functions were confusing. Currently we have this: void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags); void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags); (_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags) and these, which can twiddle individual bits in bg_flags: void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag); void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag); A better interface, after the patch below, is just: ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */ ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */ ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */ and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04Merge branch 'maint' into nextTheodore Ts'o1-10/+19
Conflicts: configure configure.in misc/mke2fs.c
2009-10-04Don't use in-tree header files if using system uuid or blkid librariesTheodore Ts'o1-10/+19
This commit forces the use of the system-provided blkid or uuid header files if we are using the system-provided blkid or uuid libraries. This avoids using the in-tree header files with the system libraries. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()Valerie Aurora Henson3-57/+64
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Use ext2fs_file_acl_block() instead of using .i_file_acl directlyValerie Aurora Henson1-3/+3
This provides support for 48-bit file acl blocks. Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07resize2fs: fix minimum resize size calculation with flex_bgPeng Tao1-3/+17
When flex_bg is on, calculate_minimum_resize_size() should add more meta blocks for newly added flex_bg. Addresses-RedHat-Bugzilla: #519131 Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-09-07resize2fs: calculate minimal fs size only oncePeng Tao1-1/+1
When running resize2fs -M, no need to recalculate the minimal fs size. Signed-off-by: "Peng Tao" <bergwolf@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-09-07Use accessor functions fields for bg_flags in the block group descriptorsTheodore Ts'o1-16/+16
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Convert to use io_channel_read_blk64() and io_channel_write_blk64()Valerie Aurora Henson1-18/+18
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Merge branch 'maint' into nextTheodore Ts'o2-4/+18
2009-08-22resize2fs: Move everything to new bitmap interfaceValerie Aurora Henson1-41/+41
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-11resize2fs: If resize2fs fails, tell the user to run e2fsckTheodore Ts'o2-2/+12
If the resize operation fails in the middle of the operation, mark the filesystem as needing to be checked, and tell the user that they should run e2fsck -fy on the device. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>