Lines Matching defs:bits

143 	 * drop the unsupported bits
178 static int add_extent_changeset(struct extent_state *state, u32 bits,
186 if (set && (state->state & bits) == bits)
188 if (!set && (state->state & bits) == 0)
370 u32 bits, struct extent_changeset *changeset)
372 u32 bits_to_set = bits & ~EXTENT_CTLBITS;
376 btrfs_set_delalloc_extent(tree->inode, state, bits);
384 * Insert an extent_state struct into the tree. 'bits' are set on the
395 u32 bits, struct extent_changeset *changeset)
401 set_state_bits(tree, state, bits, changeset);
434 struct rb_node *parent, unsigned bits,
437 set_state_bits(tree, state, bits, changeset);
496 * Utility function to clear some bits in an extent state struct. It will
499 * If no bits are set on the state struct after clearing things, the
504 u32 bits, int wake,
508 u32 bits_to_clear = bits & ~EXTENT_CTLBITS;
512 btrfs_clear_delalloc_extent(tree->inode, state, bits);
536 * Detect if extent bits request NOWAIT semantics and set the gfp mask accordingly,
539 static void set_gfp_mask_from_bits(u32 *bits, gfp_t *mask)
541 *mask = (*bits & EXTENT_NOWAIT ? GFP_NOWAIT : GFP_NOFS);
542 *bits &= EXTENT_NOWAIT - 1;
546 * Clear some bits on a range in the tree. This may require splitting or
558 u32 bits, struct extent_state **cached_state,
568 int delete = (bits & EXTENT_CLEAR_ALL_BITS);
571 set_gfp_mask_from_bits(&bits, &mask);
573 trace_btrfs_clear_extent_bit(tree, start, end - start + 1, bits);
576 bits |= ~EXTENT_CTLBITS;
578 if (bits & EXTENT_DELALLOC)
579 bits |= EXTENT_NORESERVE;
581 wake = (bits & EXTENT_LOCKED) ? 1 : 0;
582 if (bits & (EXTENT_LOCKED | EXTENT_BOUNDARY))
626 /* The state doesn't have the wanted bits, go ahead. */
627 if (!(state->state & bits)) {
637 * We need to split the extent we found, and may flip bits on second
659 state = clear_state_bit(tree, state, bits, wake, changeset);
680 clear_state_bit(tree, prealloc, bits, wake, changeset);
686 state = clear_state_bit(tree, state, bits, wake, changeset);
725 * Wait for one or more bits to clear on a range in the state tree.
729 void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, u32 bits,
740 * are more bits than the bits we're waiting on set on this state.
760 if (state->state & bits) {
807 * Find the first state struct with 'bits' set after 'start', and return it.
812 u64 start, u32 bits)
822 if (state->end >= start && (state->state & bits))
830 * Find the first offset in the io tree with one or more @bits set.
832 * Note: If there are multiple bits set in @bits, any of them will match.
838 u64 *start_ret, u64 *end_ret, u32 bits,
849 if (state->state & bits)
860 state = find_first_extent_bit_state(tree, start, bits);
874 * Find a contiguous area of bits
878 * @start_ret: the first offset we found with the bits set
879 * @end_ret: the final contiguous range of the bits that were set
880 * @bits: bits to look for
883 * to set bits appropriately, and then merge them again. During this time it
885 * contiguous area for given bits. We will search to the first bit we find, and
887 * returned will be the full contiguous area with the bits set.
890 u64 *start_ret, u64 *end_ret, u32 bits)
896 state = find_first_extent_bit_state(tree, start, bits);
967 * Set some bits on a range in the tree. This may require allocations or
971 * If any of the exclusive bits are set, this will fail with -EEXIST if some
972 * part of the range already has the desired bits set. The extent_state of the
981 u32 bits, u64 *failed_start,
993 u32 exclusive_bits = (bits & EXTENT_LOCKED);
996 set_gfp_mask_from_bits(&bits, &mask);
998 trace_btrfs_set_extent_bit(tree, start, end - start + 1, bits);
1034 insert_state_fast(tree, prealloc, p, parent, bits, changeset);
1057 set_state_bits(tree, state, bits, changeset);
1076 * We need to split the extent we found, and may flip bits on second
1094 * If this extent already has all the bits we want set, then
1097 if ((state->state & bits) == bits) {
1114 set_state_bits(tree, state, bits, changeset);
1151 err = insert_state(tree, prealloc, bits, changeset);
1181 set_state_bits(tree, prealloc, bits, changeset);
1206 u32 bits, struct extent_state **cached_state)
1208 return __set_extent_bit(tree, start, end, bits, NULL, NULL,
1213 * Convert all bits in a given range from one bit to another
1218 * @bits: the bits to set in this range
1219 * @clear_bits: the bits to clear in this range
1222 * This will go through and set bits for the given range. If any states exist
1226 * boundary bits like LOCK.
1231 u32 bits, u32 clear_bits,
1244 trace_btrfs_convert_extent_bit(tree, start, end - start + 1, bits,
1282 insert_state_fast(tree, prealloc, p, parent, bits, NULL);
1298 set_state_bits(tree, state, bits, NULL);
1316 * We need to split the extent we found, and may flip bits on second
1338 set_state_bits(tree, state, bits, NULL);
1376 err = insert_state(tree, prealloc, bits, NULL);
1401 set_state_bits(tree, prealloc, bits, NULL);
1425 * Find the first range that has @bits not set. This range could start before
1432 * @bits: the set of bits which must be unset
1434 * Since unallocated range is also considered one which doesn't have the bits
1440 u64 *start_ret, u64 *end_ret, u32 bits)
1447 /* Find first extent with bits cleared */
1475 if (state->state & bits) {
1477 * |--range with bits sets--|
1485 * have the bits set, so take its start as the
1488 * |--range with bits cleared----|
1517 * bits set
1520 if (state->end >= start && !(state->state & bits)) {
1543 * @bits: The bits the range must have in order to be accounted for.
1544 * If multiple bits are set, then only subranges that have all
1545 * the bits set are accounted for.
1554 * all given bits set. If the returned number of bytes is greater than zero
1555 * then @start is updated with the offset of the first byte with the bits set.
1559 u32 bits, int contig,
1614 if (state->end >= cur_start && (state->state & bits) == bits) {
1644 * returns 1 only if every extent in the tree has the bits set. Otherwise, 1
1648 u32 bits, int filled, struct extent_state *cached)
1668 if (state->state & bits) {
1695 u32 bits, struct extent_changeset *changeset)
1699 * record any bits changed, so for EXTENT_LOCKED case, it will
1703 ASSERT(!(bits & EXTENT_LOCKED));
1705 return __set_extent_bit(tree, start, end, bits, NULL, NULL, NULL, changeset);
1709 u32 bits, struct extent_changeset *changeset)
1715 ASSERT(!(bits & EXTENT_LOCKED));
1717 return __clear_extent_bit(tree, start, end, bits, NULL, changeset);