Commit 3c97c9f7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R
Browse files

xfs: tidy up xfs_rtallocate_extent_exact



Use common code for both xfs_rtallocate_range calls by moving
the !isfree logic into the non-default branch.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent d9498fa8
Loading
Loading
Loading
Loading
+13 −21
Original line number Diff line number Diff line
@@ -350,17 +350,7 @@ xfs_rtallocate_extent_exact(
	if (error)
		return error;

	if (isfree) {
		/*
		 * If it is, allocate it and return success.
		 */
		error = xfs_rtallocate_range(args, start, maxlen);
		if (error)
			return error;
		*len = maxlen;
		*rtx = start;
		return 0;
	}
	if (!isfree) {
		/*
		 * If not, allocate what there is, if it's at least minlen.
		 */
@@ -376,6 +366,8 @@ xfs_rtallocate_extent_exact(
			if (maxlen < minlen)
				return -ENOSPC;
		}
	}

	/*
	 * Allocate what we can and return it.
	 */