[PATCH 8/9] XArray: take xas_error() handling for clearer logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If xas is already in error state, return NULL directly.

Take this logic out instead of burying in the middle to make the logic
more straight forward.

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

diff --git a/lib/xarray.c b/lib/xarray.c
index 82570bbbf2a5..01f64a000e14 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -636,6 +636,9 @@ static void *xas_create(struct xa_state *xas, bool allow_root)
 	int shift;
 	unsigned int order = xas->xa_shift;
 
+	if (xas_error(xas))
+		return NULL;
+
 	if (xas_top(node)) {
 		entry = xa_head_locked(xa);
 		xas->xa_node = NULL;
@@ -648,8 +651,6 @@ static void *xas_create(struct xa_state *xas, bool allow_root)
 			shift = XA_CHUNK_SHIFT;
 		entry = xa_head_locked(xa);
 		slot = &xa->xa_head;
-	} else if (xas_error(xas)) {
-		return NULL;
 	} else {
 		unsigned int offset = xas->xa_offset;
 
-- 
2.23.0




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux