Whamcloud - gitweb
LU-3573 osd-zfs: Only advance zap cursor as needed
[fs/lustre-release.git] / lustre / osd-zfs / osd_index.c
index 210a00e..8765df1 100644 (file)
@@ -842,6 +842,8 @@ static int osd_dir_it_next(const struct lu_env *env, struct dt_it *di)
        zap_attribute_t   *za = &osd_oti_get(env)->oti_za;
        int                rc;
 
+       ENTRY;
+
        /* temp. storage should be enough for any key supported by ZFS */
        CLASSERT(sizeof(za->za_name) <= sizeof(it->ozi_name));
 
@@ -854,9 +856,10 @@ static int osd_dir_it_next(const struct lu_env *env, struct dt_it *di)
                it->ozi_pos++;
                if (it->ozi_pos <=2)
                        RETURN(0);
-       }
 
-       zap_cursor_advance(it->ozi_zc);
+       } else {
+               zap_cursor_advance(it->ozi_zc);
+       }
 
        /*
         * According to current API we need to return error if its last entry.