X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Flov%2Flov_object.c;h=7d5c32500d0373233d9ce7462b0ad73138ca804b;hb=446eb3dda264c24acdeeea3158bba55a16c8c5e1;hp=a33848b525ca353b9004f72194607897cc5b80f2;hpb=18834a5554f2a5a8615f259be48bb2df9101b5a2;p=fs%2Flustre-release.git diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index a33848b..7d5c325 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -42,7 +42,6 @@ #define DEBUG_SUBSYSTEM S_LOV #include "lov_cl_internal.h" -#include /** \addtogroup lov * @{ @@ -233,6 +232,8 @@ static int lov_init_raid0(const struct lu_env *env, r0->lo_nr = lsm->lsm_stripe_count; LASSERT(r0->lo_nr <= lov_targets_nr(dev)); + lov->lo_layout_invalid = true; + OBD_ALLOC_LARGE(r0->lo_sub, r0->lo_nr * sizeof r0->lo_sub[0]); if (r0->lo_sub != NULL) { int psz = 0; @@ -248,6 +249,9 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_oinfo *oinfo = lsm->lsm_oinfo[i]; int ost_idx = oinfo->loi_ost_idx; + if (lov_oinfo_is_dummy(oinfo)) + continue; + result = ostid_to_fid(ofid, &oinfo->loi_oi, oinfo->loi_ost_idx); if (result != 0) @@ -437,7 +441,7 @@ static int lov_print_raid0(const struct lu_env *env, void *cookie, (*p)(env, cookie, "stripes: %d, %s, lsm{%p 0x%08X %d %u %u}:\n", r0->lo_nr, lov->lo_layout_invalid ? "invalid" : "valid", lsm, - lsm->lsm_magic, cfs_atomic_read(&lsm->lsm_refc), + lsm->lsm_magic, atomic_read(&lsm->lsm_refc), lsm->lsm_stripe_count, lsm->lsm_layout_gen); for (i = 0; i < r0->lo_nr; ++i) { struct lu_object *sub; @@ -461,7 +465,7 @@ static int lov_print_released(const struct lu_env *env, void *cookie, (*p)(env, cookie, "released: %s, lsm{%p 0x%08X %d %u %u}:\n", lov->lo_layout_invalid ? "invalid" : "valid", lsm, - lsm->lsm_magic, cfs_atomic_read(&lsm->lsm_refc), + lsm->lsm_magic, atomic_read(&lsm->lsm_refc), lsm->lsm_stripe_count, lsm->lsm_layout_gen); return 0; } @@ -498,7 +502,7 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct cl_object *obj, * hit this assertion. * Anyway, it's still okay to call attr_get w/o type guard as layout * can't go if locks exist. */ - /* LASSERT(cfs_atomic_read(&lsm->lsm_refc) > 1); */ + /* LASSERT(atomic_read(&lsm->lsm_refc) > 1); */ if (!r0->lo_attr_valid) { struct lov_stripe_md *lsm = lov->lo_lsm; @@ -671,13 +675,13 @@ static int lov_layout_wait(const struct lu_env *env, struct lov_object *lov) struct l_wait_info lwi = { 0 }; ENTRY; - while (cfs_atomic_read(&lov->lo_active_ios) > 0) { + while (atomic_read(&lov->lo_active_ios) > 0) { CDEBUG(D_INODE, "file:"DFID" wait for active IO, now: %d.\n", PFID(lu_object_fid(lov2lu(lov))), - cfs_atomic_read(&lov->lo_active_ios)); + atomic_read(&lov->lo_active_ios)); l_wait_event(lov->lo_waitq, - cfs_atomic_read(&lov->lo_active_ios) == 0, &lwi); + atomic_read(&lov->lo_active_ios) == 0, &lwi); } RETURN(0); } @@ -723,7 +727,7 @@ static int lov_layout_change(const struct lu_env *unused, if (result == 0) { old_ops->llo_fini(env, lov, &lov->u); - LASSERT(cfs_atomic_read(&lov->lo_active_ios) == 0); + LASSERT(atomic_read(&lov->lo_active_ios) == 0); lov->lo_type = LLT_EMPTY; result = new_ops->llo_init(env, @@ -761,7 +765,7 @@ int lov_object_init(const struct lu_env *env, struct lu_object *obj, ENTRY; init_rwsem(&lov->lo_type_guard); - cfs_atomic_set(&lov->lo_active_ios, 0); + atomic_set(&lov->lo_active_ios, 0); init_waitqueue_head(&lov->lo_waitq); cl_object_page_init(lu2cl(obj), sizeof(struct lov_page)); @@ -791,7 +795,7 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj, if (conf->coc_opc == OBJECT_CONF_WAIT) { if (lov->lo_layout_invalid && - cfs_atomic_read(&lov->lo_active_ios) > 0) { + atomic_read(&lov->lo_active_ios) > 0) { lov_conf_unlock(lov); result = lov_layout_wait(env, lov); lov_conf_lock(lov); @@ -813,7 +817,7 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj, } /* will change layout - check if there still exists active IO. */ - if (cfs_atomic_read(&lov->lo_active_ios) > 0) { + if (atomic_read(&lov->lo_active_ios) > 0) { lov->lo_layout_invalid = true; GOTO(out, result = -EBUSY); } @@ -922,28 +926,28 @@ static const struct lu_object_operations lov_lu_obj_ops = { }; struct lu_object *lov_object_alloc(const struct lu_env *env, - const struct lu_object_header *unused, - struct lu_device *dev) + const struct lu_object_header *unused, + struct lu_device *dev) { - struct lov_object *lov; - struct lu_object *obj; + struct lov_object *lov; + struct lu_object *obj; - ENTRY; - OBD_SLAB_ALLOC_PTR_GFP(lov, lov_object_kmem, __GFP_IO); - if (lov != NULL) { - obj = lov2lu(lov); - lu_object_init(obj, NULL, dev); - lov->lo_cl.co_ops = &lov_ops; - lov->lo_type = -1; /* invalid, to catch uninitialized type */ - /* - * object io operation vector (cl_object::co_iop) is installed - * later in lov_object_init(), as different vectors are used - * for object with different layouts. - */ - obj->lo_ops = &lov_lu_obj_ops; - } else - obj = NULL; - RETURN(obj); + ENTRY; + OBD_SLAB_ALLOC_PTR_GFP(lov, lov_object_kmem, GFP_NOFS); + if (lov != NULL) { + obj = lov2lu(lov); + lu_object_init(obj, NULL, dev); + lov->lo_cl.co_ops = &lov_ops; + lov->lo_type = -1; /* invalid, to catch uninitialized type */ + /* + * object io operation vector (cl_object::co_iop) is installed + * later in lov_object_init(), as different vectors are used + * for object with different layouts. + */ + obj->lo_ops = &lov_lu_obj_ops; + } else + obj = NULL; + RETURN(obj); } struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov) @@ -954,24 +958,13 @@ struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov) if (lov->lo_lsm != NULL) { lsm = lsm_addref(lov->lo_lsm); CDEBUG(D_INODE, "lsm %p addref %d/%d by %p.\n", - lsm, cfs_atomic_read(&lsm->lsm_refc), + lsm, atomic_read(&lsm->lsm_refc), lov->lo_layout_invalid, current); } lov_conf_thaw(lov); return lsm; } -void lov_lsm_decref(struct lov_object *lov, struct lov_stripe_md *lsm) -{ - if (lsm == NULL) - return; - - CDEBUG(D_INODE, "lsm %p decref %d by %p.\n", - lsm, cfs_atomic_read(&lsm->lsm_refc), current); - - lov_free_memmd(&lsm); -} - struct lov_stripe_md *lov_lsm_get(struct cl_object *clobj) { struct lu_object *luobj; @@ -1016,6 +1009,10 @@ int lov_read_and_clear_async_rc(struct cl_object *clob) LASSERT(lsm != NULL); for (i = 0; i < lsm->lsm_stripe_count; i++) { struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + + if (lov_oinfo_is_dummy(loi)) + continue; + if (loi->loi_ar.ar_rc && !rc) rc = loi->loi_ar.ar_rc; loi->loi_ar.ar_rc = 0;