Whamcloud - gitweb
LU-11796 lov: Remove unnecessary assert
[fs/lustre-release.git] / lustre / lov / lov_object.c
index 9b56d84..200f943 100644 (file)
@@ -213,9 +213,8 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev,
 
        spin_lock_init(&r0->lo_sub_lock);
        r0->lo_nr = lse->lsme_stripe_count;
-       LASSERT(r0->lo_nr <= lov_targets_nr(dev));
 
-       OBD_ALLOC_LARGE(r0->lo_sub, r0->lo_nr * sizeof r0->lo_sub[0]);
+       OBD_ALLOC_LARGE(r0->lo_sub, r0->lo_nr * sizeof(r0->lo_sub[0]));
        if (r0->lo_sub == NULL)
                GOTO(out, result = -ENOMEM);
 
@@ -282,14 +281,14 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
 {
        struct cl_object        *sub;
        struct lu_site          *site;
-       struct lu_site_bkt_data *bkt;
-       wait_queue_t          *waiter;
+       wait_queue_head_t *wq;
+       wait_queue_entry_t *waiter;
 
         LASSERT(r0->lo_sub[idx] == los);
 
-        sub  = lovsub2cl(los);
-        site = sub->co_lu.lo_dev->ld_site;
-        bkt  = lu_site_bkt_from_fid(site, &sub->co_lu.lo_header->loh_fid);
+       sub = lovsub2cl(los);
+       site = sub->co_lu.lo_dev->ld_site;
+       wq = lu_site_wq_from_fid(site, &sub->co_lu.lo_header->loh_fid);
 
         cl_object_kill(env, sub);
         /* release a reference to the sub-object and ... */
@@ -301,7 +300,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
        if (r0->lo_sub[idx] == los) {
                waiter = &lov_env_info(env)->lti_waiter;
                init_waitqueue_entry(waiter, current);
-               add_wait_queue(&bkt->lsb_marche_funebre, waiter);
+               add_wait_queue(wq, waiter);
                set_current_state(TASK_UNINTERRUPTIBLE);
                while (1) {
                        /* this wait-queue is signaled at the end of
@@ -317,7 +316,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov,
                                break;
                        }
                }
-               remove_wait_queue(&bkt->lsb_marche_funebre, waiter);
+               remove_wait_queue(wq, waiter);
        }
        LASSERT(r0->lo_sub[idx] == NULL);
 }
@@ -657,7 +656,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
        comp->lo_entry_count = lsm->lsm_entry_count;
        comp->lo_preferred_mirror = -1;
 
-       if (equi(flr_state == LCM_FL_NOT_FLR, comp->lo_mirror_count > 1))
+       if (equi(flr_state == LCM_FL_NONE, comp->lo_mirror_count > 1))
                RETURN(-EINVAL);
 
        OBD_ALLOC(comp->lo_mirrors,
@@ -695,7 +694,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
                lle->lle_extent = &lle->lle_lsme->lsme_extent;
                lle->lle_valid = !(lle->lle_lsme->lsme_flags & LCME_FL_STALE);
 
-               if (flr_state != LCM_FL_NOT_FLR)
+               if (flr_state != LCM_FL_NONE)
                        mirror_id = mirror_id_of(lle->lle_lsme->lsme_id);
 
                lre = &comp->lo_mirrors[j];
@@ -1805,8 +1804,11 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj,
        ENTRY;
 
        lsm = lov_lsm_addref(cl2lov(obj));
-       if (lsm == NULL)
-               RETURN(-ENODATA);
+       if (lsm == NULL) {
+               /* no extent: there is no object for mapping */
+               fiemap->fm_mapped_extents = 0;
+               return 0;
+       }
 
        if (!(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) {
                /**