summaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.h
Commit message (Collapse)AuthorAgeFilesLines
* ext4: remove unused ac_ex_scannedEric Sandeen2014-02-201-2/+0
| | | | | | | | | | | | | | | | | | | When looking at a bug report with: > kernel: EXT4-fs: 0 scanned, 0 found I thought wow, 0 scanned, that's odd? But it's not odd; it's printing a variable that is initialized to 0 and never touched again. It's never been used since the original merge, so I don't really even know what the original intent was, either. If anyone knows how to hook it up, speak now via patch, otherwise just yank it so it's not making a confusing situation more confusing in kernel logs. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: address a benign compiler warningPatrick Palka2014-02-171-1/+1
| | | | | | | | | | | | | When !defined(CONFIG_EXT4_DEBUG), mb_debug() should be defined as a no_printk() statement instead of an empty statement in order to suppress the following compiler warning: fs/ext4/mballoc.c: In function ‘ext4_mb_cleanup_pa’: fs/ext4/mballoc.c:2659:47: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] mb_debug(1, "mballoc: %u PAs left\n", count); Signed-off-by: Patrick Palka <patrick@parcs.ath.cx> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: use module parameters instead of debugfs for mballoc_debugTheodore Ts'o2013-02-091-2/+2
| | | | | | | | | | | | | | | | | | There are multiple reasons to move away from debugfs. First of all, we are only using it for a single parameter, and it is much more complicated to set up (some 30 lines of code compared to 3), and one more thing that might fail while loading the ext4 module. Secondly, as a module paramter it can be specified as a boot option if ext4 is built into the kernel, or as a parameter when the module is loaded, and it can also be manipulated dynamically under /sys/module/ext4/parameters/mballoc_debug. So it is more flexible. Ultimately we want to move away from using mb_debug() towards tracepoints, but for now this is still a useful simplification of the code base. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: remove unused macro MB_DEFAULT_MAX_GROUPS_TO_SCANRobin Dong2012-08-171-5/+0
| | | | | Signed-off-by: Robin Dong <sanbai@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: remove EXT4_MB_{BITMAP,BUDDY} macrosTheodore Ts'o2012-02-201-2/+0
| | | | | | | The EXT4_MB_BITMAP and EXT4_MB_BUDDY macros obfuscate more than they provide any abstraction. So remove them. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: expand commit callback andBobi Jam2012-02-201-8/+10
| | | | | | | | | | | The per-commit callback was used by mballoc code to manage free space bitmaps after deleted blocks have been released. This patch expands it to support multiple different callbacks, to allow other things to be done after the commit has been completed. Signed-off-by: Bobi Jam <bobijam@whamcloud.com> Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: fix a typo in struct ext4_allocation_contextRobin Dong2011-10-311-1/+1
| | | | | | | This patch changes "bext" to "best". Signed-off-by: Robin Dong <sanbai@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: teach ext4_free_blocks() about bigalloc and clustersTheodore Ts'o2011-09-091-1/+1
| | | | | | | | | | | | | | The ext4_free_blocks() function now has two new flags that indicate whether a partial cluster at the beginning or the end of the block extents should be freed or not. That will be up the caller (i.e., truncate), who can figure out whether partial clusters at the beginning or the end of a block range can be freed. We also have to update the ext4_mb_free_metadata() and release_blocks_on_commit() machinery to be cluster-based, since it is used by ext4_free_blocks(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: teach mballoc preallocation code about bigalloc clustersTheodore Ts'o2011-09-091-2/+2
| | | | | | | | | | | | | | | In most of mballoc.c, we do everything in units of clusters, since the block allocation bitmaps and buddy bitmaps are all denominated in clusters. The one place where we do deal with absolute block numbers is in the code that handles the preallocation regions, since in the case of inode-based preallocation regions, the start of the preallocation region can't be relative to the beginning of the group. So this adds a bit of complexity, where pa_pstart and pa_lstart are block numbers, while pa_free, pa_len, and fe_len are denominated in units of clusters. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: convert block group-relative offsets to use clustersTheodore Ts'o2011-09-091-1/+2
| | | | | | | | | Certain parts of the ext4 code base, primarily in mballoc.c, use a block group number and offset from the beginning of the block group. This offset is invariably used to index into the allocation bitmap, so change the offset to be denominated in units of clusters. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: remove ac_repeats from ext4_allocation_contextTao Ma2011-07-231-1/+0
| | | | | | | ac_repeats isn't referenced in the mballoc code. So remove it. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: remove alloc_sempAmir Goldstein2011-05-091-6/+0
| | | | | | | | After taking care of all group init races, all that remains is to remove alloc_semp from ext4_allocation_context and ext4_buddy structs. Signed-off-by: Amir Goldstein <amir73il@users.sf.net> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: clarify description of ac_g_ex in struct ext4_allocation_contextColy Li2011-02-241-1/+1
| | | | | | Signed-off-by: Coly Li <bosong.ly@taobao.com> Cc: Alex Tomas <alex@clusterfs.com> Cc: Theodore Tso <tytso@google.com>
* ext4: consolidate in_range() definitionsAkinobu Mita2010-03-031-2/+0
| | | | | | | | | | There are duplicate macro definitions of in_range() in mballoc.h and balloc.c. This consolidates these two definitions into ext4.h, and changes extents.c to use in_range() as well. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Andreas Dilger <adilger@sun.com>
* ext4: cleanup to use ext4_group_first_block_no()Akinobu Mita2010-03-031-6/+1
| | | | | | | | | | | This is a cleanup and simplification patch which takes some open-coded calculations to calculate the first block number of a group and converts them to use the (already defined) ext4_group_first_block_no() function. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Andreas Dilger <adilger@sun.com>
* ext4: remove unused #include <linux/version.h>Huang Weiyi2009-12-141-1/+0
| | | | | | | | | Remove unused #include <linux/version.h>('s) in fs/ext4/block_validity.c fs/ext4/mballoc.h Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Use tracepoints for mb_history trace fileTheodore Ts'o2009-09-301-33/+0
| | | | | | | | | | | | | | The /proc/fs/ext4/<dev>/mb_history was maintained manually, and had a number of problems: it required a largish amount of memory to be allocated for each ext4 filesystem, and the s_mb_history_lock introduced a CPU contention problem. By ripping out the mb_history code and replacing it with ftrace tracepoints, and we get more functionality: timestamps, event filtering, the ability to correlate mballoc history with other ext4 tracepoints, etc. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4, jbd2: Drop unneeded printks at mount and unmount timeTheodore Ts'o2009-09-291-1/+1
| | | | | | | | | | | There are a number of kernel printk's which are printed when an ext4 filesystem is mounted and unmounted. Disable them to economize space in the system logs. In addition, disabling the mballoc stats by default saves a number of unneeded atomic operations for every block allocation or deallocation. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: use ext4_grpblk_t more extensivelyEric Sandeen2009-08-251-3/+3
| | | | | | | | | | | | | | | | | unsigned short is potentially too small to track blocks within a group; today it is safe due to restrictions in e2fsprogs but we have _lo / _hi bits for group blocks with the intent to go up to 32 bits, so clean this up now. There are many more places where we use unsigned/int/unsigned int to contain a group block but this should at least fix all the short types. I added a few comments to the struct ext4_group_info definition as well. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Add configurable run-time mballoc debuggingTheodore Ts'o2009-09-181-4/+12
| | | | | | | Allow mballoc debugging to be enabled at run-time instead of just at compile time. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: convert instrumentation from markers to tracepointsTheodore Ts'o2009-06-171-1/+0
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Move fs/ext4/group.h into ext4.hTheodore Ts'o2009-05-011-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" <tytso@mit.edu>
* ext4: Rename pa_linear to pa_typeAneesh Kumar K.V2009-03-271-2/+5
| | | | | | | | | | | Impact: code cleanup This patch rename pa_linear to pa_type and add MB_INODE_PA and MB_GROUP_PA to indicate inode and group prealloc space. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Remove stale block allocator references from ext4.hMike Snitzer2009-02-061-1/+0
| | | | | | | | | Remove some leftovers from when the old block allocator was removed (c2ea3fde). ext4_sb_info is now a bit lighter. Also remove a dangling read_block_bitmap() prototype. Signed-off-by: Mike Snitzer <snitzer@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Don't allow new groups to be added during block allocationAneesh Kumar K.V2009-01-051-0/+5
| | | | | | | | | | | After we mark the blocks in the buddy cache as allocated, we need to ensure that we don't reinit the buddy cache until the block bitmap is updated. This commit achieves this by holding the group_info alloc_semaphore till ext4_mb_release_context Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@kernel.org
* ext4: fix BUG when calling ext4_error with locked block groupAneesh Kumar K.V2009-01-051-47/+0
| | | | | | | | | | | The mballoc code likes to call ext4_error while it is holding locked block groups. This can causes a scheduling in atomic context BUG. We can't just unlock the block group and relock it after/if ext4_error returns since that might result in race conditions in the case where the filesystem is set to continue after finding errors. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: cleanup mballoc header filesAneesh Kumar K.V2008-11-251-17/+1
| | | | | | | | | | Move some of the forward declaration of the static functions to mballoc.c where they are used. This enables us to include mballoc.h in other .c files. Also correct the buddy cache documentation. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Use EXT4_GROUP_INFO_NEED_INIT_BIT during resizeAneesh Kumar K.V2009-01-051-0/+3
| | | | | | | | | | | | | | | 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 <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> cc: stable@kernel.org
* ext4: Replace hackish ext4_mb_poll_new_transaction with commit callbackTheodore Ts'o2008-10-161-2/+1
| | | | | | | | | | | The multiblock allocator needs to be able to release blocks (and issue a blkdev discard request) when the transaction which freed those blocks is committed. Previously this was done via a polling mechanism when blocks are allocated or freed. A much better way of doing things is to create a jbd2 callback function and attaching the list of blocks to be freed directly to the transaction structure. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: let the block device know when unused blocks can be discardedTheodore Ts'o2008-10-161-0/+2
| | | | | | | Let the block device know when unused blocks can be discarded, using the new sb_issue_discard() interface. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Use an rbtree for tracking blocks freed during transaction.Aneesh Kumar K.V2008-10-161-10/+16
| | | | | | | | | With this patch we track the block freed during a transaction using red-black tree. We also make sure contiguous blocks freed are collected in one node in the tree. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* ext4: move /proc setup and teardown out of mballoc.cTheodore Ts'o2008-09-231-1/+0
| | | | | | | ...and into the core setup/teardown code in fs/ext4/super.c so that other parts of ext4 can define tuning parameters. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* ext4: Don't allow lg prealloc list to be grow large.Aneesh Kumar K.V2008-07-231-2/+8
| | | | | | | | | | | | | | | | | | Currently, the locality group prealloc list is freed only when there is a block allocation failure. This can result in large number of entries in the preallocation list making ext4_mb_use_preallocated() expensive. To fix this, we convert the locality group prealloc list to a hash list. The hash index is the order of number of blocks in the prealloc space with a max order of 9. When adding prealloc space to the list we make sure total entries for each order does not exceed 8. If it is more than 8 we discard few entries and make sure the we have only <= 5 entries. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* ext4: Move mballoc headers/structures to a seperate header file mballoc.hMingming Cao2008-04-291-0/+304
Move function and structure definiations out of mballoc.c and put it under a new header file mballoc.h Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>