From: alex Date: Wed, 30 Sep 2009 08:26:19 +0000 (+0000) Subject: - dmu osd's ->get() and ->load() methods to reinitialize zap's cursor properly X-Git-Tag: GIT_EPOCH_B_HD_KDMU~2^4~42 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=881e6c327fcb876f73481aa8e4c765acc1e69b5b;p=fs%2Flustre-release.git - dmu osd's ->get() and ->load() methods to reinitialize zap's cursor properly (with preceeding release) --- diff --git a/lustre/dmu-osd/osd_handler.c b/lustre/dmu-osd/osd_handler.c index b548d1c..8a684d2 100644 --- a/lustre/dmu-osd/osd_handler.c +++ b/lustre/dmu-osd/osd_handler.c @@ -813,7 +813,6 @@ static struct thandle *osd_trans_create(const struct lu_env *env, static int osd_trans_start(const struct lu_env *env, struct dt_device *d, struct thandle *th) { - struct osd_device *osd = osd_dt_dev(th->th_dev); struct osd_thandle *oh; int rc; ENTRY; @@ -1450,7 +1449,7 @@ static struct dt_it *osd_zap_it_init(const struct lu_env *env, OBD_ALLOC_PTR(it); if (it != NULL) { if (udmu_zap_cursor_init(&it->ozi_zc, &osd->od_objset, - udmu_object_get_id(obj->oo_db))) + udmu_object_get_id(obj->oo_db), 0)) RETURN(ERR_PTR(-ENOMEM)); it->ozi_obj = obj; @@ -1496,6 +1495,7 @@ static int osd_zap_it_get(const struct lu_env *env, { struct osd_zap_it *it = (struct osd_zap_it *)di; struct osd_object *obj = it->ozi_obj; + struct osd_device *osd = osd_obj2dev(obj); ENTRY; LASSERT(it); @@ -1504,8 +1504,11 @@ static int osd_zap_it_get(const struct lu_env *env, /* XXX: API is broken at the moment */ LASSERT(((const char *)key)[0] == '\0'); - udmu_zap_cursor_init_serialized(it->ozi_zc, &osd_obj2dev(obj)->od_objset, - udmu_object_get_id(obj->oo_db), 0ULL); + udmu_zap_cursor_fini(it->ozi_zc); + if (udmu_zap_cursor_init(&it->ozi_zc, &osd->od_objset, + udmu_object_get_id(obj->oo_db), 0)) + RETURN(-ENOMEM); + it->ozi_reset = 1; RETURN(+1); @@ -1632,12 +1635,15 @@ static int osd_zap_it_load(const struct lu_env *env, { struct osd_zap_it *it = (struct osd_zap_it *)di; struct osd_object *obj = it->ozi_obj; + struct osd_device *osd = osd_obj2dev(obj); int rc; ENTRY; + udmu_zap_cursor_fini(it->ozi_zc); + if (udmu_zap_cursor_init(&it->ozi_zc, &osd->od_objset, + udmu_object_get_id(obj->oo_db), hash)) + RETURN(-ENOMEM); it->ozi_reset = 0; - udmu_zap_cursor_init_serialized(it->ozi_zc, &osd_obj2dev(obj)->od_objset, - udmu_object_get_id(obj->oo_db), hash); /* same as osd_zap_it_next()*/ rc = udmu_zap_cursor_retrieve_key(it->ozi_zc, NULL, NAME_MAX + 1); @@ -1922,7 +1928,7 @@ int osd_xattr_get(const struct lu_env *env, struct dt_object *dt, rc = -ENODATA; if (rc == 0) rc = size; -out: + RETURN(rc); } diff --git a/lustre/dmu-osd/udmu.c b/lustre/dmu-osd/udmu.c index 6509db8..413fe0d 100644 --- a/lustre/dmu-osd/udmu.c +++ b/lustre/dmu-osd/udmu.c @@ -550,7 +550,6 @@ static int udmu_zap_insert_impl(objset_t *os, dmu_buf_t *zap_db, dmu_tx_t *tx, num_int = len; } - /* Assert that the transaction has been assigned to a transaction group. */ ASSERT(tx->tx_txg != 0); @@ -585,13 +584,14 @@ int udmu_zap_delete(udmu_objset_t *uos, dmu_buf_t *zap_db, dmu_tx_t *tx, /* * Zap cursor APIs */ -int udmu_zap_cursor_init(zap_cursor_t **zc, udmu_objset_t *uos, uint64_t zapobj) +int udmu_zap_cursor_init(zap_cursor_t **zc, udmu_objset_t *uos, + uint64_t zapobj, uint64_t hash) { zap_cursor_t * t; t = kmem_alloc(sizeof(*t), KM_NOSLEEP); if (t) { - zap_cursor_init(t, uos->os, zapobj); + zap_cursor_init_serialized(t, uos->os, zapobj, hash); *zc = t; return 0; } @@ -672,13 +672,6 @@ int udmu_zap_cursor_move_to_key(zap_cursor_t *zc, const char *name) return zap_cursor_move_to_key(zc, name, MT_BEST); } -void udmu_zap_cursor_init_serialized(zap_cursor_t *zc, udmu_objset_t *uos, - uint64_t zapobj, uint64_t serialized) -{ - zap_cursor_init_serialized(zc, uos->os, zapobj, serialized); -} - - /* * Read data from a DMU object */ diff --git a/lustre/dmu-osd/udmu.h b/lustre/dmu-osd/udmu.h index 999a4c2..c20b7f1 100644 --- a/lustre/dmu-osd/udmu.h +++ b/lustre/dmu-osd/udmu.h @@ -205,7 +205,8 @@ int udmu_zap_delete(udmu_objset_t *uos, dmu_buf_t *zap_db, dmu_tx_t *tx, const char *name); /* zap cursor apis */ -int udmu_zap_cursor_init(zap_cursor_t **zc, udmu_objset_t *uos, uint64_t zapobj); +int udmu_zap_cursor_init(zap_cursor_t **zc, udmu_objset_t *uos, + uint64_t zapobj, uint64_t hash); void udmu_zap_cursor_fini(zap_cursor_t *zc); @@ -220,8 +221,6 @@ uint64_t udmu_zap_cursor_serialize(zap_cursor_t *zc); int udmu_zap_cursor_move_to_key(zap_cursor_t *zc, const char *name); -void udmu_zap_cursor_init_serialized(zap_cursor_t *zc, udmu_objset_t *uos, - uint64_t zapobj, uint64_t serialized); /* udmu object API */