Whamcloud - gitweb
LU-4406 osd-zfs: Correct number of integers for zap key 57/8857/4
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Tue, 14 Jan 2014 21:42:35 +0000 (16:42 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 3 Feb 2014 02:30:20 +0000 (02:30 +0000)
All zap_*_uint64 functions take a key size that is the number of
uint64s.  This corrects the osd_prepare_key to account for that, and
changes the name to make it more consistant with zap functions.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I8ee5ee6e955016fc4340025cede21aaf5bd034b7
Reviewed-on: http://review.whamcloud.com/8857
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/osd-zfs/osd_index.c

index a6f0dd3..40167bb 100644 (file)
@@ -1043,8 +1043,9 @@ static struct dt_index_operations osd_dir_ops = {
  * Primitives for index files using binary keys.
  */
 
-static int osd_prepare_key(struct osd_object *o, __u64 *dst,
-                          const struct dt_key *src)
+/* key integer_size is 8 */
+static int osd_prepare_key_uint64(struct osd_object *o, __u64 *dst,
+                                 const struct dt_key *src)
 {
        int size;
 
@@ -1061,7 +1062,7 @@ static int osd_prepare_key(struct osd_object *o, __u64 *dst,
                memset(dst + o->oo_keysize, 0, size - o->oo_keysize);
        memcpy(dst, (const char *)src, o->oo_keysize);
 
-       return size;
+       return (size/sizeof(__u64));
 }
 
 static int osd_index_lookup(const struct lu_env *env, struct dt_object *dt,
@@ -1074,7 +1075,7 @@ static int osd_index_lookup(const struct lu_env *env, struct dt_object *dt,
        int                rc;
        ENTRY;
 
-       rc = osd_prepare_key(obj, k, key);
+       rc = osd_prepare_key_uint64(obj, k, key);
 
        rc = -zap_lookup_uint64(osd->od_objset.os, obj->oo_db->db_object,
                                k, rc, obj->oo_recusize, obj->oo_recsize,
@@ -1126,7 +1127,7 @@ static int osd_index_insert(const struct lu_env *env, struct dt_object *dt,
 
        oh = container_of0(th, struct osd_thandle, ot_super);
 
-       rc = osd_prepare_key(obj, k, key);
+       rc = osd_prepare_key_uint64(obj, k, key);
 
        /* Insert (key,oid) into ZAP */
        rc = -zap_add_uint64(osd->od_objset.os, obj->oo_db->db_object,
@@ -1170,7 +1171,7 @@ static int osd_index_delete(const struct lu_env *env, struct dt_object *dt,
        LASSERT(th != NULL);
        oh = container_of0(th, struct osd_thandle, ot_super);
 
-       rc = osd_prepare_key(obj, k, key);
+       rc = osd_prepare_key_uint64(obj, k, key);
 
        /* Remove binary key from the ZAP */
        rc = -zap_remove_uint64(osd->od_objset.os, obj->oo_db->db_object,
@@ -1271,7 +1272,7 @@ static int osd_index_it_rec(const struct lu_env *env, const struct dt_it *di,
        if (rc)
                RETURN(rc);
 
-       rc = osd_prepare_key(obj, k, (const struct dt_key *)za->za_name);
+       rc = osd_prepare_key_uint64(obj, k, (const struct dt_key *)za->za_name);
 
        rc = -zap_lookup_uint64(osd->od_objset.os, obj->oo_db->db_object,
                                k, rc, obj->oo_recusize, obj->oo_recsize,