Whamcloud - gitweb
LU-6101 osd: zfs-osd should convert hash
[fs/lustre-release.git] / lustre / osd-zfs / osd_index.c
index dbc8f30..b498b23 100644 (file)
 /*
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
- */
-/*
- * Copyright (c) 2012, 2013, Intel Corporation.
- * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -140,7 +138,8 @@ static inline void osd_obj_cursor_init_serialized(zap_cursor_t *zc,
                                                 uint64_t dirhash)
 {
        struct osd_device *d = osd_obj2dev(o);
-       zap_cursor_init_serialized(zc, d->od_os, o->oo_db->db_object, dirhash);
+       osd_zap_cursor_init_serialized(zc, d->od_os,
+                                      o->oo_db->db_object, dirhash);
 }
 
 static inline int osd_obj_cursor_init(zap_cursor_t **zc, struct osd_object *o,
@@ -527,7 +526,7 @@ static inline void osd_object_put(const struct lu_env *env,
 }
 
 static int osd_seq_exists(const struct lu_env *env, struct osd_device *osd,
-                         obd_seq seq)
+                         u64 seq)
 {
        struct lu_seq_range     *range = &osd_oti_get(env)->oti_seq_range;
        struct seq_server_site  *ss = osd_seq_site(osd);
@@ -865,6 +864,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));
 
@@ -877,9 +878,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.
@@ -969,14 +971,11 @@ static int osd_dir_it_rec(const struct lu_env *env, const struct dt_it *di,
                osd_it_append_attrs(lde, attr, 2, IFTODT(S_IFDIR));
                lde->lde_reclen = cpu_to_le16(lu_dirent_calc_size(2, attr));
                rc = osd_find_parent_fid(env, &it->ozi_obj->oo_dt, &lde->lde_fid);
-               /*
-                * early Orion code was not setting LinkEA, so it's possible
-                * some setups still have objects with no LinkEA set.
-                * but at that time .. was a real record in the directory
-                * so we should try to lookup .. in ZAP
-                */
-               if (rc != -ENOENT)
-                       GOTO(out, rc);
+
+               /* ENOENT happens at the root of filesystem so ignore it */
+               if (rc == -ENOENT)
+                       rc = 0;
+               GOTO(out, rc);
        }
 
        LASSERT(lde);