[PATCH 3/9] XArray: handle a NULL head by itself

Wei Yang
2020-03-30T12:37:49Z

For a NULL head, xas_expand() return the proper shift directly without
other handling.

Let's take this out to emphasize it is handled specially.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
lib/xarray.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/xarray.c b/lib/xarray.c
index 6454cf3f5b4c..1a092c87fca5 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -559,9 +559,10 @@ static int xas_expand(struct xa_state *xas, void *head)
unsigned int shift = 0;
unsigned long max = xas_max(xas);

- if (!head) {
+ if (!head)
return roundup(fls_long(max), XA_CHUNK_SHIFT);
- } else if (xa_is_node(head)) {
+
+ if (xa_is_node(head)) {
node = xa_to_node(head);
shift = node->shift + XA_CHUNK_SHIFT;
}
--
2.23.0