From b8d04564d54fbff0836f3783fd70dcbc8771c008 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Tue, 14 Jan 2014 16:42:35 -0500 Subject: [PATCH] LU-4406 osd-zfs: Correct number of integers for zap key 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 Change-Id: I8ee5ee6e955016fc4340025cede21aaf5bd034b7 Reviewed-on: http://review.whamcloud.com/8857 Reviewed-by: Fan Yong Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/osd-zfs/osd_index.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index a6f0dd3..40167bb 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -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, -- 1.8.3.1