Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b22bad7 authored by Alexandre Oliva's avatar Alexandre Oliva Committed by Chris Mason
Browse files

Btrfs: start search for new cluster at the beginning



Instead of starting at zero (offset is always zero), request a cluster
starting at search_start, that denotes the beginning of the current
block group.

Signed-off-by: default avatarAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent b78d09bc
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -5301,10 +5301,8 @@ alloc:
			spin_lock(&last_ptr->refill_lock);
			if (last_ptr->block_group &&
			    (last_ptr->block_group->ro ||
			    !block_group_bits(last_ptr->block_group, data))) {
				offset = 0;
			    !block_group_bits(last_ptr->block_group, data)))
				goto refill_cluster;
			}

			offset = btrfs_alloc_from_cluster(block_group, last_ptr,
						 num_bytes, search_start);
@@ -5355,7 +5353,7 @@ refill_cluster:
			/* allocate a cluster in this block group */
			ret = btrfs_find_space_cluster(trans, root,
					       block_group, last_ptr,
					       offset, num_bytes,
					       search_start, num_bytes,
					       empty_cluster + empty_size);
			if (ret == 0) {
				/*