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

Commit b09d10df authored by Martin Brandenburg's avatar Martin Brandenburg Committed by Mike Marshall
Browse files

orangefs: Do not unref if there is no bufmap.

parent 765a75b3
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -82,21 +82,32 @@ static void orangefs_bufmap_unref(struct orangefs_bufmap *bufmap)
	}
}

/*
 * XXX: Can the size and shift change while the caller gives up the 
 * XXX: lock between calling this and doing something useful?
 */

int orangefs_bufmap_size_query(void)
{
	struct orangefs_bufmap *bufmap = orangefs_bufmap_ref();
	int size = bufmap ? bufmap->desc_size : 0;

	struct orangefs_bufmap *bufmap;
	int size = 0;
	bufmap = orangefs_bufmap_ref();
	if (bufmap) {
		size = bufmap->desc_size;
		orangefs_bufmap_unref(bufmap);
	}
	return size;
}

int orangefs_bufmap_shift_query(void)
{
	struct orangefs_bufmap *bufmap = orangefs_bufmap_ref();
	int shift = bufmap ? bufmap->desc_shift : 0;

	struct orangefs_bufmap *bufmap;
	int shift = 0;
	bufmap = orangefs_bufmap_ref();
	if (bufmap) {
		shift = bufmap->desc_shift;
		orangefs_bufmap_unref(bufmap);
	}
	return shift;
}