aboutsummaryrefslogtreecommitdiff
path: root/fs/ext4/resize.c
AgeCommit message (Collapse)AuthorFilesLines
2009-09-09ext4: Clarify the locking details in mballocAneesh Kumar K.V1-6/+1
We don't need to take the alloc_sem lock when we are adding new groups, since mballoc won't see the new group added until we bump sbi->s_groups_count. Signed-off-by: "Theodore Ts'o" <[email protected]> Signed-off-by: Aneesh Kumar K.V <[email protected]>
2009-06-19block: rename CONFIG_LBD to CONFIG_LBDAFBartlomiej Zolnierkiewicz1-1/+1
Follow-up to "block: enable by default support for large devices and files on 32-bit archs". Rename CONFIG_LBD to CONFIG_LBDAF to: - allow update of existing [def]configs for "default y" change - reflect that it is used also for large files support nowadays Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2009-05-01ext4: Move fs/ext4/group.h into ext4.hTheodore Ts'o1-1/+0
Move the function prototypes in group.h into ext4.h so they are all defined in one place. Signed-off-by: "Theodore Ts'o" <[email protected]>
2009-04-25ext4: Replace lock/unlock_super() with an explicit lock for resizingTheodore Ts'o1-17/+18
Use a separate lock to protect s_groups_count and the other block group descriptors which get changed via an on-line resize operation, so we can stop overloading the use of lock_super(). Signed-off-by: "Theodore Ts'o" <[email protected]>
2009-03-04ext4: Use atomic_t's in struct flex_groupsTheodore Ts'o1-4/+4
Reduce pressure on the sb_bgl_lock family of locks by using atomic_t's to track the number of free blocks and inodes in each flex_group. Signed-off-by: "Theodore Ts'o" <[email protected]>
2009-01-26ext4: Initialize the new group descriptor when resizing the filesystemTheodore Ts'o1-1/+2
Make sure all of the fields of the group descriptor are properly initialized. Previously, we allowed bg_flags field to be contain random garbage, which could trigger non-deterministic behavior, including a kernel OOPS. http://bugzilla.kernel.org/show_bug.cgi?id=12433 Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
2009-01-05ext4: mark the blocks/inode bitmap beyond end of group as usedAneesh Kumar K.V1-4/+2
We need to mark the block/inode bitmap beyond the end of the group with '1'. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
2009-01-05ext4: Use high 16 bits of the block group descriptor's free counts fieldsAneesh Kumar K.V1-2/+2
Rename the lower bits with suffix _lo and add helper to access the values. Also rename bg_itable_unused_hi to bg_pad as in e2fsprogs. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2009-01-05ext4: Use EXT4_GROUP_INFO_NEED_INIT_BIT during resizeAneesh Kumar K.V1-41/+8
The new groups added during resize are flagged as need_init group. Make sure we properly initialize these groups. When we have block size < page size and we are adding new groups the page may still be marked uptodate even though we haven't initialized the group. While forcing the init of buddy cache we need to make sure other groups part of the same page of buddy cache is not using the cache. group_info->alloc_sem is added to ensure the same. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> cc: [email protected]
2009-01-05ext4: Add blocks added during resize to bitmapAneesh Kumar K.V1-9/+2
With this change new blocks added during resize are marked as free in the block bitmap and the group is flagged with EXT4_GROUP_INFO_NEED_INIT_BIT flag. This makes sure when mballoc tries to allocate blocks from the new group we would reload the buddy information using the bitmap present in the disk. Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
2009-01-05ext4: Make ext4_group_t be an unsigned intTheodore Ts'o1-2/+2
Nearly all places in the ext3/4 code which uses "unsigned long" is probably a bug, since on 32-bit systems a ulong a 32-bits, which means we are wasting stack space on 64-bit systems. Signed-off-by: "Theodore Ts'o" <[email protected]>
2009-01-05ext4: remove extraneous newlines from calls to ext4_error() and ext4_warning()Theodore Ts'o1-4/+3
This removes annoying blank syslog entries emitted by ext4_error() or ext4_warning(), since these functions add their own newline. Signed-off-by: Nick Warne <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2009-01-07ext4: Allow ext4 to run without a journalFrank Mayhar1-15/+16
A few weeks ago I posted a patch for discussion that allowed ext4 to run without a journal. Since that time I've integrated the excellent comments from Andreas and fixed several serious bugs. We're currently running with this patch and generating some performance numbers against both ext2 (with backported reservations code) and ext4 with and without a journal. It just so happens that running without a journal is slightly faster for most everything. We did iozone -T -t 4 s 2g -r 256k -T -I -i0 -i1 -i2 which creates 4 threads, each of which create and do reads and writes on a 2G file, with a buffer size of 256K, using O_DIRECT for all file opens to bypass the page cache. Results: ext2 ext4, default ext4, no journal initial writes 13.0 MB/s 15.4 MB/s 15.7 MB/s rewrites 13.1 MB/s 15.6 MB/s 15.9 MB/s reads 15.2 MB/s 16.9 MB/s 17.2 MB/s re-reads 15.3 MB/s 16.9 MB/s 17.2 MB/s random readers 5.6 MB/s 5.6 MB/s 5.7 MB/s random writers 5.1 MB/s 5.3 MB/s 5.4 MB/s So it seems that, so far, this was a useful exercise. Signed-off-by: Frank Mayhar <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-11-26ext4: When resizing set the EXT4_BG_INODE_ZEROED flag for new block groups[email protected]1-0/+1
The inode table has been zeroed in setup_new_group_blocks(). Mark it as such in ext4_group_add(). Since we are currently clearing inode table for the new block group, we should set the EXT4_BG_INODE_ZEROED flag. If at some point in the future we don't immediately zero out the inode table as part of the resize operation, then obviously we shouldn't do this. Signed-off-by: [email protected] Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-10-10ext4: Remove old legacy block allocatorTheodore Ts'o1-6/+12
Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-09-08Update flex_bg free blocks and free inodes counters when resizing.Frederic Bohe1-0/+9
This fixes a bug which prevented the newly created inodes after a resize from being used on filesystems with flex_bg. Signed-off-by: Frederic Bohe <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-09-08ext4: Fix whitespace checkpatch warnings/errorsTheodore Ts'o1-3/+3
Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-08-19ext4: don't try to resize if there are no reserved gdt blocks leftJosef Bacik1-1/+2
When trying to resize an ext4 fs and you run out of reserved gdt blocks, you get an error that doesn't actually tell you what went wrong, it just says that the gdb it picked is not correct, which is the case since you don't have any reserved gdt blocks left. This patch adds a check to make sure you have reserved gdt blocks to use, and if not prints out a more relevant error. Signed-off-by: Josef Bacik <[email protected]> Cc: <[email protected]> Cc: Andreas Dilger <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-07-26ext4: Cleanup whitespace and other miscellaneous style issuesTheodore Ts'o1-39/+40
Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-07-11ext4: fix online resize with mballocFrederic Bohe1-1/+51
Update group infos when updating a group's descriptor. Add group infos when adding a group's descriptor. Refresh cache pages used by mb_alloc when changes occur. This will probably need modifications when META_BG resizing will be allowed. Signed-off-by: Frederic Bohe <[email protected]> Signed-off-by: Mingming Cao <[email protected]>
2008-06-20Ext4: Fix online resize block group descriptor corruptionFrederic Bohe1-1/+2
This is the patch for the group descriptor table corruption during online resize pointed out by Theodore Tso. The problem was caused by the fact that the ext4 group descriptor can be either 32 or 64 bytes long. Only the 64 bytes structure was taken into account. Signed-off-by: Frederic Bohe <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-06-06ext4: fix online resize bugJosef Bacik1-1/+2
There is a bug when we are trying to verify that the reserve inode's double indirect blocks point back to the primary gdt blocks. The fix is obvious, we need to mod the gdb count by the addr's per block. This was verified using the same testcase as with the ext3 equivalent of this patch. Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-04-29ext4: move headers out of include/linuxChristoph Hellwig1-2/+1
Move ext4 headers out of include/linux. This is just the trivial move, there's some more thing that could be done later. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-04-29ext4: fix wrong gfp type under transactionJosef Bacik1-2/+2
This fixes the allocations with GFP_KERNEL while under a transaction problems in ext4. This patch is the same as its ext3 counterpart, just switches these to GFP_NOFS. Signed-off-by: Josef Bacik <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-04-17ext4: replace remaining __FUNCTION__ occurrencesHarvey Harrison1-35/+35
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
2008-04-17ext4: le*_add_cpu conversionMarcin Slusarz1-4/+2
replace all: little_endian_variable = cpu_to_leX(leX_to_cpu(little_endian_variable) + expression_in_cpu_byteorder); with: leX_add_cpu(&little_endian_variable, expression_in_cpu_byteorder); generated with semantic patch Signed-off-by: Marcin Slusarz <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Andrew Morton <[email protected]> Cc: [email protected] Cc: Mingming Cao <[email protected]>
2008-02-25ext4: add missing ext4_journal_stop()Akinobu Mita1-0/+1
Add missing ext4_journal_stop() in error handling. Signed-off-by: Akinobu Mita <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: Stephen Tweedie <[email protected]> Cc: [email protected] Cc: Andrew Morton <[email protected]> Cc: Mingming Cao <[email protected]>
2008-02-07iget: stop EXT4 from using iget() and read_inode()David Howells1-4/+3
Stop the EXT4 filesystem from using iget() and read_inode(). Replace ext4_read_inode() with ext4_iget(), and call that instead of iget(). ext4_iget() then uses iget_locked() directly and returns a proper error code instead of an inode in the event of an error. ext4_fill_super() returns any error incurred when getting the root inode instead of EINVAL. Signed-off-by: David Howells <[email protected]> Acked-by: "Theodore Ts'o" <[email protected]> Acked-by: Jan Kara <[email protected]> Cc: <[email protected]> Acked-by: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-01-28ext4: fix up EXT4FS_DEBUG buildsEric Sandeen1-8/+8
Builds with EXT4FS_DEBUG defined (to enable ext4_debug()) fail without these changes. Clean up some format warnings too. Signed-off-by: Eric Sandeen <[email protected]> Signed-off-by: Mingming Cao <[email protected]>
2008-01-28ext4: add ext4_group_t, and change all group variables to this type.Avantika Mathur1-6/+6
In many places variables for block group are of type int, which limits the maximum number of block groups to 2^31. Each block group can have up to 2^15 blocks, with a 4K block size, and the max filesystem size is limited to 2^31 * (2^15 * 2^12) = 2^58 -- or 256 PB This patch introduces a new type ext4_group_t, of type unsigned long, to represent block group numbers in ext4. All occurrences of block group variables are converted to type ext4_group_t. Signed-off-by: Avantika Mathur <[email protected]>
2007-10-17ext4: lighten up resize transaction requirementsEric Sandeen1-3/+43
When resizing online, setup_new_group_blocks attempts to reserve a potentially very large transaction, depending on the current filesystem geometry. For some journal sizes, there may not be enough room for this transaction, and the online resize will fail. The patch below resizes & restarts the transaction as necessary while setting up the new group, and should work with even the smallest journal. Tested with something like: [root@newbox ~]# dd if=/dev/zero of=fsfile bs=1024 count=32768 [root@newbox ~]# mkfs.ext3 -b 1024 fsfile 16384 [root@newbox ~]# mount -o loop fsfile mnt/ [root@newbox ~]# resize2fs /dev/loop0 resize2fs 1.40.2 (12-Jul-2007) Filesystem at /dev/loop0 is mounted on /root/mnt; on-line resizing required old desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/loop0 to 32768 (1k) blocks. resize2fs: No space left on device While trying to add group #2 [root@newbox ~]# dmesg | tail -n 1 JBD: resize2fs wants too many credits (258 > 256) [root@newbox ~]# With the below change, it works. Signed-off-by: Eric Sandeen <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Acked-by: Andreas Dilger <[email protected]>
2007-10-17ext4: fix setup_new_group_blocks lockingEric Sandeen1-3/+3
setup_new_group_blocks() manipulates the group descriptor block bh under the block_bitmap bh's lock. It shouldn't matter since nobody but resize should be touching these blocks, but it's worth fixing up. Signed-off-by: Eric Sandeen <[email protected]> Signed-off-by: Mingming Cao <[email protected]>
2007-10-17Ext4: Uninitialized Block GroupsAndreas Dilger1-19/+2
In pass1 of e2fsck, every inode table in the fileystem is scanned and checked, regardless of whether it is in use. This is this the most time consuming part of the filesystem check. The unintialized block group feature can greatly reduce e2fsck time by eliminating checking of uninitialized inodes. With this feature, there is a a high water mark of used inodes for each block group. Block and inode bitmaps can be uninitialized on disk via a flag in the group descriptor to avoid reading or scanning them at e2fsck time. A checksum of each group descriptor is used to ensure that corruption in the group descriptor's bit flags does not cause incorrect operation. The feature is enabled through a mkfs option mke2fs /dev/ -O uninit_groups A patch adding support for uninitialized block groups to e2fsprogs tools has been posted to the linux-ext4 mailing list. The patches have been stress tested with fsstress and fsx. In performance tests testing e2fsck time, we have seen that e2fsck time on ext3 grows linearly with the total number of inodes in the filesytem. In ext4 with the uninitialized block groups feature, the e2fsck time is constant, based solely on the number of used inodes rather than the total inode count. Since typical ext4 filesystems only use 1-10% of their inodes, this feature can greatly reduce e2fsck time for users. With performance improvement of 2-20 times, depending on how full the filesystem is. The attached graph shows the major improvements in e2fsck times in filesystems with a large total inode count, but few inodes in use. In each group descriptor if we have EXT4_BG_INODE_UNINIT set in bg_flags: Inode table is not initialized/used in this group. So we can skip the consistency check during fsck. EXT4_BG_BLOCK_UNINIT set in bg_flags: No block in the group is used. So we can skip the block bitmap verification for this group. We also add two new fields to group descriptor as a part of uninitialized group patch. __le16 bg_itable_unused; /* Unused inodes count */ __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */ bg_itable_unused: If we have EXT4_BG_INODE_UNINIT not set in bg_flags then bg_itable_unused will give the offset within the inode table till the inodes are used. This can be used by fsck to skip list of inodes that are marked unused. bg_checksum: Now that we depend on bg_flags and bg_itable_unused to determine the block and inode usage, we need to make sure group descriptor is not corrupt. We add checksum to group descriptor to detect corruption. If the descriptor is found to be corrupt, we mark all the blocks and inodes in the group used. Signed-off-by: Avantika Mathur <[email protected]> Signed-off-by: Andreas Dilger <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Aneesh Kumar K.V <[email protected]>
2007-10-17lib: percpu_counter_addPeter Zijlstra1-2/+2
s/percpu_counter_mod/percpu_counter_add/ Because its a better name, _mod implies modulo. Signed-off-by: Peter Zijlstra <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-05-08header cleaning: don't include smp_lock.h when not usedRandy Dunlap1-1/+0
Remove includes of <linux/smp_lock.h> where it is not used/needed. Suggested by Al Viro. Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc, sparc64, and arm (all 59 defconfigs). Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-02-14[PATCH] remove many unneeded #includes of sched.hTim Schmielau1-1/+0
After Al Viro (finally) succeeded in removing the sched.h #include in module.h recently, it makes sense again to remove other superfluous sched.h includes. There are quite a lot of files which include it but don't actually need anything defined in there. Presumably these includes were once needed for macros that used to live in sched.h, but moved to other header files in the course of cleaning it up. To ease the pain, this time I did not fiddle with any header files and only removed #includes from .c-files, which tend to cause less trouble. Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha, arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig, allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all configs in arch/arm/configs on arm. I also checked that no new warnings were introduced by the patch (actually, some warnings are removed that were emitted by unnecessarily included header files). Signed-off-by: Tim Schmielau <[email protected]> Acked-by: Russell King <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-28[PATCH] ext4: fix printk format warningsRandy Dunlap1-9/+14
fs/ext4/resize.c:72: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:76: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:81: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:85: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:89: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:89: warning: long long unsigned int format, __u64 arg (arg 5) fs/ext4/resize.c:93: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:93: warning: long long unsigned int format, __u64 arg (arg 5) fs/ext4/resize.c:98: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:103: warning: long long unsigned int format, __u64 arg (arg 4) fs/ext4/resize.c:109: warning: long long unsigned int format, __u64 arg (arg 4) Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-11[PATCH] ext4: move block number hi bitsAlexandre Ratchov1-3/+3
move '_hi' bits of block numbers in the larger part of the block group descriptor structure Signed-off-by: Alexandre Ratchov <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-11[PATCH] ext4: blk_type from sector_t to unsigned long longMingming Cao1-14/+14
Change ext4 in-kernel block type (ext4_fsblk_t) from sector_t to unsigned long long. Remove ext4 block type string micro E3FSBLK, replaced with "%llu" [[email protected]: build fix] Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-11[PATCH] ext4: 64bit metadataLaurent Vivier1-24/+28
In-kernel super block changes to support >32 bit free blocks numbers. Signed-off-by: Laurent Vivier <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: Alexandre Ratchov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-11[PATCH] ext4: switch fsblk to sector_tMingming Cao1-7/+6
Redefine ext3 in-kernel filesystem block type (ext3_fsblk_t) from unsigned long to sector_t, to allow kernel to handle >32 bit ext3 blocks. Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-11[PATCH] jbd2: enable building of jbd2 and have ext4 use it rather than jbdMingming Cao1-1/+1
Reworked from a patch by Mingming Cao and Randy Dunlap Signed-off-By: Randy Dunlap <[email protected]> Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-11[PATCH] ext4: rename ext4 symbols to avoid duplication of ext3 symbolsMingming Cao1-206/+206
Mingming Cao originally did this work, and Shaggy reproduced it using some scripts from her. Signed-off-by: Mingming Cao <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-11[PATCH] ext4: initial copy of files from ext3Dave Kleikamp1-0/+1042
Start of the ext4 patch series. See Documentation/filesystems/ext4.txt for details. This is a simple copy of the files in fs/ext3 to fs/ext4 and /usr/incude/linux/ext3* to /usr/include/ex4* Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>