Lines Matching full:space

7 #include "space-info.h"
10 #include "free-space-cache.h"
20 * HOW DOES SPACE RESERVATION WORK
28 * 1) space_info. This is the ultimate arbiter of how much space we can use.
32 * determining if there is space to make an allocation. There is a space_info
38 * much space is accounted for in space_info->bytes_may_use.
68 * enough space
79 * Flushes various things attempting to free up space.
82 * This is called by anything that either subtracts space from
86 * completed. If it can the space is added to space_info->bytes_may_use and
108 * reclaim space so we can make new reservations.
116 * metadata space.
119 * Look at the delalloc comment to get an idea of how much space is reserved
120 * for delayed allocation. We can reclaim some of this space simply by
122 * reclaim the bulk of this space.
125 * We have a block reserve for the outstanding delayed refs space, and every
127 * to reclaim space, but we want to hold this until the end because COW can
135 * zones of an unused block group and let us reuse the space. The reusing
140 * We will skip this the first time through space reservation, because of
141 * overcommit and we don't want to have a lot of useless metadata space when
146 * items, and extent tree items. Loads of space could be freed up by these
161 * reserve more space than is currently free in the currently allocate
162 * metadata space. This only happens with metadata, data does not allow
166 * btrfs_can_overcommit(), but it only applies to unallocated space. If there
167 * is no unallocated space to be had, all reservations are kept within the
168 * free space in the allocated metadata chunks.
172 * thing with or without extra unallocated space.
186 * after adding space to the filesystem, we need to clear the full flags
187 * on all the space infos.
199 * Block groups with more than this value (percents) of unusable space will be
397 * space is actually usable. For raid56, the space info used in calc_available_free_space()
412 * available space used by a data allocation, which could put us in a in calc_available_free_space()
416 * space. If we are relatively empty this won't affect our ability to in calc_available_free_space()
427 * 1/2th of the space. If we can flush, don't let us overcommit in calc_available_free_space()
428 * too much, let it overcommit up to 1/8 of the space. in calc_available_free_space()
478 * This is for space we already have accounted in space_info->bytes_may_use, so
479 * basically when we're returning space from block_rsv's.
558 /* The free space could be negative in case of overcommit */ in __btrfs_dump_space_info()
644 /* Calc the number of the pages we need flush for space reservation */ in shrink_delalloc()
669 * that likely won't give us the space back we need. in shrink_delalloc()
827 * bunch of pinned space, so make sure we run the iputs before in flush_space()
871 * We may be flushing because suddenly we have less space than we had in btrfs_calc_reclaim_metadata_size()
873 * space. If that's the case add in our overage so we make sure to put in btrfs_calc_reclaim_metadata_size()
921 * If we have over half of the free space occupied by reservations or in need_preemptive_reclaim()
932 * if our reclaimable space exceeds our clamped free space. in need_preemptive_reclaim()
963 * space before tickets need to wait for things to finish. In the case in need_preemptive_reclaim()
1029 * @space_info - the space info we were flushing
1051 btrfs_info(fs_info, "cannot satisfy tickets, dumping space info"); in maybe_fail_all_tickets()
1148 * pretty hard to reclaim space. Think of the case where we in btrfs_async_reclaim_metadata_space()
1149 * freed up a bunch of space and so have a lot of pinned space in btrfs_async_reclaim_metadata_space()
1177 * This handles pre-flushing of metadata space before we get to the point that
1181 * watermark of space by flushing whichever reservation pool is currently the
1214 * out the block rsv's space from the bytes_may_use. If that in btrfs_preempt_reclaim_metadata_space()
1227 * because that's space we can't touch. Subtract it from the in btrfs_preempt_reclaim_metadata_space()
1278 * Space is freed from flushing delalloc in one of two ways.
1280 * 1) compression is on and we allocate less space than we reserved
1281 * 2) we are overwriting existing space
1283 * For #1 that extra space is reclaimed as soon as the delalloc pages are
1285 * length to ->bytes_reserved, and subtracts the reserved space from
1296 * thus have been truncated and freed up space. But again this space is not
1301 * This is where we reclaim all of the pinned space generated by running the
1311 * so if we now have space to allocate do the force chunk allocation.
1462 * turned into error mode due to a transaction abort when flushing space in priority_reclaim_metadata_space()
1479 * the available space. in priority_reclaim_metadata_space()
1525 * Delete us from the list. After we unlock the space in wait_reserve_ticket()
1527 * space for this ticket. If that would happen, then the in wait_reserve_ticket()
1528 * ticket's task would not known that space was reserved in wait_reserve_ticket()
1529 * despite getting an error, resulting in a space leak in wait_reserve_ticket()
1550 * @space_info: space info for the reservation
1596 * releasing reserved space (if an error happens the expectation is that in handle_reserve_ticket()
1597 * space wasn't reserved at all). in handle_reserve_ticket()
1625 * and freeing space, like there is with flushing delayed refs or in maybe_clamp_preempt()
1650 * Try to reserve bytes from the block_rsv's space.
1653 * @space_info: space info we want to allocate from
1657 * This will reserve orig_bytes number of bytes from the space info associated
1658 * with the block_rsv. If there is not enough space it will make an attempt to
1659 * flush out space to make room. It will do this by flushing delalloc if
1662 * space already.
1709 * Carry on if we have enough space (short-circuit) OR call in __reserve_bytes()
1721 * will let this reservation go through as long as we have actual space in __reserve_bytes()
1775 * We will do the space reservation dance during log replay, in __reserve_bytes()
1797 * Try to reserve metadata bytes from the block_rsv's space.
1804 * This will reserve orig_bytes number of bytes from the space info associated
1805 * with the block_rsv. If there is not enough space it will make an attempt to
1806 * flush out space to make room. It will do this by flushing delalloc if
1809 * space already.
1836 * This will reserve bytes from the data space info. If there is not enough
1837 * space then we will attempt to flush space as specified by flush.
1860 /* Dump all the space infos when we abort a transaction due to ENOSPC. */
1865 btrfs_info(fs_info, "dumping space info:"); in btrfs_dump_space_info_for_trans_abort()
1875 * Account the unused space of all the readonly block group in the space_info.
1928 * A reasonable buffer for unallocated space is 10 data block_groups.
1932 * allocate and pressure the unallocated space.
1943 * unallocated space and thus minimize the probability of the filesystem going
1946 * However, relocations happen into the space_info's unused space, therefore
1947 * automatic reclaim must also back off as that space runs low. There is no
1954 * safe from running out of unallocated space but not be wasteful about it.
1975 /* If we have no unused space, don't bother, it won't work anyway. */ in calc_dynamic_reclaim_threshold()
2113 /* Prioritize the global reservation to receive the freed space. */ in btrfs_return_free_space()