If the page is empty, we need to check the array->last_cookie instead of
the first entry. Add a helper for the cases where we care.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
        }
 }
 
+static u64 nfs_readdir_array_index_cookie(struct nfs_cache_array *array)
+{
+       return array->size == 0 ? array->last_cookie : array->array[0].cookie;
+}
+
 static void nfs_readdir_array_set_eof(struct nfs_cache_array *array)
 {
        array->page_is_eof = 1;
 
        if (array->change_attr != change_attr)
                ret = false;
-       if (array->size > 0 && array->array[0].cookie != last_cookie)
+       if (nfs_readdir_array_index_cookie(array) != last_cookie)
                ret = false;
        kunmap_atomic(array);
        return ret;
                desc->cache_entry_index = 0;
                desc->page_index++;
        } else
-               desc->last_cookie = array->array[0].cookie;
+               desc->last_cookie = nfs_readdir_array_index_cookie(array);
 }
 
 static void nfs_readdir_rewind_search(struct nfs_readdir_descriptor *desc)