ENTRY;
if (!ea) {
- CERROR("lov_create needs EA for striping information\n");
+ CERROR("lov_create needs ea\n");
RETURN(-EINVAL);
}
+
if (!export)
RETURN(-EINVAL);
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
- if (oa->o_valid && OBD_MD_FLSIZE)
+ if (oa->o_valid & OBD_MD_FLSIZE)
CERROR("setting size on an LOV object is totally broken\n");
lov = &export->exp_obd->u.lov;
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
RETURN(-EINVAL);
}
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
if (!export || !export->exp_obd)
RETURN(-ENODEV);
else
stripe_off -= stripeno * ssize;
- return lov_off + stripe_off;
+ return lov_off * ssize + stripe_off;
}
/* compute which stripe offset "lov_off" will be written into */
ENTRY;
if (!lsm) {
- CERROR("LOV requires striping ea for desctruction\n");
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
RETURN(-EINVAL);
}
int *where;
ENTRY;
+ if (!lsm) {
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
+ RETURN(-EINVAL);
+ }
+
lov = &export->exp_obd->u.lov;
our_cb = ll_init_cb();
atomic_inc(&our_cb->refcount);
}
- for (i = 0, loi = lsm->lsm_oinfo, si = si_last = stripeinfo;
- i < stripe_count;
- i++, loi++, si_last = si, si++) {
+ for (i = 0, loi = lsm->lsm_oinfo, si_last = si = stripeinfo;
+ i < stripe_count; i++, loi++, si_last = si, si++) {
if (i > 0)
si->index = si_last->index + si_last->bufct;
si->lsm.lsm_object_id = loi->loi_id;
stripeinfo[which].subcount++;
}
- for (i = 0, si = stripeinfo; i < stripe_count; i++) {
+ for (i = 0, si = stripeinfo; i < stripe_count; i++, si++) {
int shift = si->index;
if (si->bufct) {
ENTRY;
if (!lsm) {
- CERROR("LOV requires striping ea for desctruction\n");
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
RETURN(-EINVAL);
}
ENTRY;
if (!lsm) {
- CERROR("LOV requires striping ea for lock cancellation\n");
+ CERROR("LOV requires striping ea\n");
+ RETURN(-EINVAL);
+ }
+
+ if (lsm->lsm_magic != LOV_MAGIC) {
+ CERROR("LOV striping magic bad %#lx != %#lx\n",
+ lsm->lsm_magic, LOV_MAGIC);
RETURN(-EINVAL);
}
RETURN(rc);
}
+static int lov_cancel_unused(struct lustre_handle *conn,
+ struct lov_stripe_md *lsm)
+{
+ struct obd_export *export = class_conn2export(conn);
+ struct lov_obd *lov;
+ struct lov_oinfo *loi;
+ int rc = 0, i;
+ ENTRY;
+
+ if (!lsm) {
+ CERROR("LOV requires striping ea for lock cancellation\n");
+ RETURN(-EINVAL);
+ }
+
+ if (!export || !export->exp_obd)
+ RETURN(-ENODEV);
+
+ lov = &export->exp_obd->u.lov;
+ for (i = 0,loi = lsm->lsm_oinfo; i < lsm->lsm_stripe_count; i++,loi++) {
+ struct lov_stripe_md submd;
+
+ submd.lsm_object_id = loi->loi_id;
+ submd.lsm_mds_easize = lov_mds_md_size(lsm->lsm_ost_count);
+ submd.lsm_stripe_count = 0;
+ rc = obd_cancel_unused(&lov->tgts[loi->loi_ost_idx].conn,
+ &submd);
+ if (rc)
+ CERROR("Error cancel unused objid "LPX64" subobj "LPX64
+ " on OST idx %d: rc = %d\n", lsm->lsm_object_id,
+ loi->loi_id, loi->loi_ost_idx, rc);
+ }
+ RETURN(rc);
+}
+
static int lov_statfs(struct lustre_handle *conn, struct obd_statfs *osfs)
{
struct obd_export *export = class_conn2export(conn);
o_brw: lov_brw,
o_punch: lov_punch,
o_enqueue: lov_enqueue,
- o_cancel: lov_cancel
+ o_cancel: lov_cancel,
+ o_cancel_unused: lov_cancel_unused
};