struct cl_site ed_site_myself;
struct cl_site *ed_site;
struct lu_device *ed_next;
- int ed_next_islov;
int ed_next_ismd;
struct lu_client_seq *ed_cl_seq;
};
}
next = tgt->obd_lu_dev;
- if (!strcmp(tgt->obd_type->typ_name, LUSTRE_MDT_NAME)) {
- ed->ed_next_ismd = 1;
- } else {
- ed->ed_next_ismd = 0;
- rc = echo_site_init(env, ed);
- if (rc)
- GOTO(out, rc);
- }
+
+ if (strcmp(tgt->obd_type->typ_name, LUSTRE_MDT_NAME) == 0) {
+ ed->ed_next_ismd = 1;
+ } else if (strcmp(tgt->obd_type->typ_name, LUSTRE_OST_NAME) == 0 ||
+ strcmp(tgt->obd_type->typ_name, LUSTRE_OSC_NAME) == 0) {
+ ed->ed_next_ismd = 0;
+ rc = echo_site_init(env, ed);
+ if (rc)
+ GOTO(out, rc);
+ } else {
+ GOTO(out, rc = -EINVAL);
+ }
+
cleanup = 3;
rc = echo_client_setup(env, obd, cfg);
"Only remote operations are supported. Metadata client "
"must be run on server side.\n");
GOTO(out, rc = -EOPNOTSUPP);
-#endif
+#endif /* HAVE_SERVER_SUPPORT */
} else {
/* if echo client is to be stacked upon ost device, the next is
* NULL since ost is not a clio device so far */
NULL);
if (rc)
GOTO(out, rc);
-
- /* Tricky case, I have to determine the obd type since
- * CLIO uses the different parameters to initialize
- * objects for lov & osc. */
- if (strcmp(tgt_type_name, LUSTRE_LOV_NAME) == 0)
- ed->ed_next_islov = 1;
- else
- LASSERT(strcmp(tgt_type_name,
- LUSTRE_OSC_NAME) == 0);
} else
LASSERT(strcmp(tgt_type_name, LUSTRE_OST_NAME) == 0);
}
info = echo_env_info(env);
conf = &info->eti_conf;
if (d->ed_next) {
- if (!d->ed_next_islov) {
- struct lov_oinfo *oinfo = lsm->lsm_oinfo[0];
- LASSERT(oinfo != NULL);
- oinfo->loi_oi = lsm->lsm_oi;
- conf->eoc_cl.u.coc_oinfo = oinfo;
- } else {
- struct lustre_md *md;
- md = &info->eti_md;
- memset(md, 0, sizeof *md);
- md->lsm = lsm;
- conf->eoc_cl.u.coc_md = md;
- }
+ struct lov_oinfo *oinfo = lsm->lsm_oinfo[0];
+
+ LASSERT(oinfo != NULL);
+ oinfo->loi_oi = lsm->lsm_oi;
+ conf->eoc_cl.u.coc_oinfo = oinfo;
}
conf->eoc_md = lsmp;
static obd_id last_object_id;
-static int
-echo_copyin_lsm (struct echo_device *ed, struct lov_stripe_md *lsm,
- void __user *ulsm, int ulsm_nob)
-{
- struct echo_client_obd *ec = ed->ed_ec;
- int i;
-
- if (ulsm_nob < sizeof (*lsm))
- return (-EINVAL);
-
- if (copy_from_user (lsm, ulsm, sizeof (*lsm)))
- return (-EFAULT);
-
- if (lsm->lsm_stripe_count > ec->ec_nstripes ||
- lsm->lsm_magic != LOV_MAGIC ||
- (lsm->lsm_stripe_size & (~CFS_PAGE_MASK)) != 0 ||
- ((__u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count > ~0UL))
- return (-EINVAL);
-
-
- for (i = 0; i < lsm->lsm_stripe_count; i++) {
- if (copy_from_user(lsm->lsm_oinfo[i],
- ((struct lov_stripe_md *)ulsm)-> \
- lsm_oinfo[i],
- sizeof(lsm->lsm_oinfo[0])))
- return (-EFAULT);
- }
- return (0);
-}
-
#ifdef HAVE_SERVER_SUPPORT
static inline void echo_md_build_name(struct lu_name *lname, char *name,
__u64 id)
#endif /* HAVE_SERVER_SUPPORT */
static int echo_create_object(const struct lu_env *env, struct echo_device *ed,
- int on_target, struct obdo *oa, void __user *ulsm,
- int ulsm_nob, struct obd_trans_info *oti)
+ struct obdo *oa, struct obd_trans_info *oti)
{
struct echo_object *eco;
struct echo_client_obd *ec = ed->ed_ec;
int created = 0;
ENTRY;
- if ((oa->o_valid & OBD_MD_FLID) == 0 && /* no obj id */
- (on_target || /* set_stripe */
- ec->ec_nstripes != 0)) { /* LOV */
+ if ((oa->o_valid & OBD_MD_FLID) == 0) { /* no obj id */
CERROR ("No valid oid\n");
RETURN(-EINVAL);
}
GOTO(failed, rc);
}
- if (ulsm != NULL) {
- int i, idx;
-
- rc = echo_copyin_lsm (ed, lsm, ulsm, ulsm_nob);
- if (rc != 0)
- GOTO(failed, rc);
-
- if (lsm->lsm_stripe_count == 0)
- lsm->lsm_stripe_count = ec->ec_nstripes;
-
- if (lsm->lsm_stripe_size == 0)
- lsm->lsm_stripe_size = PAGE_CACHE_SIZE;
-
- idx = cfs_rand();
-
- /* setup stripes: indices + default ids if required */
- for (i = 0; i < lsm->lsm_stripe_count; i++) {
- if (ostid_id(&lsm->lsm_oinfo[i]->loi_oi) == 0)
- lsm->lsm_oinfo[i]->loi_oi = lsm->lsm_oi;
-
- lsm->lsm_oinfo[i]->loi_ost_idx =
- (idx + i) % ec->ec_nstripes;
- }
- }
-
- /* setup object ID here for !on_target and LOV hint */
+ /* setup object ID here */
if (oa->o_valid & OBD_MD_FLID) {
LASSERT(oa->o_valid & OBD_MD_FLGROUP);
lsm->lsm_oi = oa->o_oi;
if (ostid_id(&lsm->lsm_oi) == 0)
ostid_set_id(&lsm->lsm_oi, ++last_object_id);
- rc = 0;
- if (on_target) {
- /* Only echo objects are allowed to be created */
- LASSERT((oa->o_valid & OBD_MD_FLGROUP) &&
- (ostid_seq(&oa->o_oi) == FID_SEQ_ECHO));
- rc = obd_create(env, ec->ec_exp, oa, &lsm, oti);
- if (rc != 0) {
- CERROR("Cannot create objects: rc = %d\n", rc);
- GOTO(failed, rc);
- }
- created = 1;
+ /* Only echo objects are allowed to be created */
+ LASSERT((oa->o_valid & OBD_MD_FLGROUP) &&
+ (ostid_seq(&oa->o_oi) == FID_SEQ_ECHO));
+
+ rc = obd_create(env, ec->ec_exp, oa, &lsm, oti);
+ if (rc != 0) {
+ CERROR("Cannot create objects: rc = %d\n", rc);
+ GOTO(failed, rc);
}
+ created = 1;
+
/* See what object ID we were given */
oa->o_oi = lsm->lsm_oi;
oa->o_valid |= OBD_MD_FLID;
}
static void
-echo_get_stripe_off_id (struct lov_stripe_md *lsm, obd_off *offp, obd_id *idp)
-{
- unsigned long stripe_count;
- unsigned long stripe_size;
- unsigned long width;
- unsigned long woffset;
- int stripe_index;
- obd_off offset;
-
- if (lsm->lsm_stripe_count <= 1)
- return;
-
- offset = *offp;
- stripe_size = lsm->lsm_stripe_size;
- stripe_count = lsm->lsm_stripe_count;
-
- /* width = # bytes in all stripes */
- width = stripe_size * stripe_count;
-
- /* woffset = offset within a width; offset = whole number of widths */
- woffset = do_div (offset, width);
-
- stripe_index = woffset / stripe_size;
-
- *idp = ostid_id(&lsm->lsm_oinfo[stripe_index]->loi_oi);
- *offp = offset * stripe_size + woffset % stripe_size;
-}
-
-static void
-echo_client_page_debug_setup(struct lov_stripe_md *lsm,
- struct page *page, int rw, obd_id id,
- obd_off offset, obd_off count)
+echo_client_page_debug_setup(struct page *page, int rw, obd_id id,
+ obd_off offset, obd_off count)
{
char *addr;
obd_off stripe_off;
if (rw == OBD_BRW_WRITE) {
stripe_off = offset + delta;
stripe_id = id;
- echo_get_stripe_off_id(lsm, &stripe_off, &stripe_id);
} else {
stripe_off = 0xdeadbeef00c0ffeeULL;
stripe_id = 0xdeadbeef00c0ffeeULL;
kunmap(page);
}
-static int echo_client_page_debug_check(struct lov_stripe_md *lsm,
- struct page *page, obd_id id,
- obd_off offset, obd_off count)
+static int
+echo_client_page_debug_check(struct page *page, obd_id id, obd_off offset,
+ obd_off count)
{
obd_off stripe_off;
obd_id stripe_id;
for (rc = delta = 0; delta < PAGE_CACHE_SIZE; delta += OBD_ECHO_BLOCK_SIZE) {
stripe_off = offset + delta;
stripe_id = id;
- echo_get_stripe_off_id (lsm, &stripe_off, &stripe_id);
rc2 = block_debug_check("test_brw",
addr + delta, OBD_ECHO_BLOCK_SIZE,
obd_size count, int async,
struct obd_trans_info *oti)
{
- struct lov_stripe_md *lsm = eco->eo_lsm;
obd_count npages;
struct brw_page *pga;
struct brw_page *pgp;
gfp_mask = ((ostid_id(&oa->o_oi) & 2) == 0) ? GFP_IOFS : GFP_HIGHUSER;
LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ);
- LASSERT(lsm != NULL);
- LASSERT(ostid_id(&lsm->lsm_oi) == ostid_id(&oa->o_oi));
if (count <= 0 ||
(count & (~CFS_PAGE_MASK)) != 0)
pgp->flag = brw_flags;
if (verify)
- echo_client_page_debug_setup(lsm, pgp->pg, rw,
+ echo_client_page_debug_setup(pgp->pg, rw,
ostid_id(&oa->o_oi), off,
pgp->count);
}
if (verify) {
int vrc;
- vrc = echo_client_page_debug_check(lsm, pgp->pg,
+ vrc = echo_client_page_debug_check(pgp->pg,
ostid_id(&oa->o_oi),
pgp->off, pgp->count);
if (vrc != 0 && rc == 0)
obd_size batch, struct obd_trans_info *oti,
int async)
{
- struct lov_stripe_md *lsm = eco->eo_lsm;
struct obd_ioobj ioo;
struct niobuf_local *lnb;
struct niobuf_remote *rnb;
ENTRY;
- if (count <= 0 || (count & (~CFS_PAGE_MASK)) != 0 ||
- (lsm != NULL && ostid_id(&lsm->lsm_oi) != ostid_id(&oa->o_oi)))
+ if (count <= 0 || (count & ~PAGE_CACHE_MASK) != 0)
RETURN(-EINVAL);
npages = batch >> PAGE_CACHE_SHIFT;
continue;
if (rw == OBD_BRW_WRITE)
- echo_client_page_debug_setup(lsm, page, rw,
+ echo_client_page_debug_setup(page, rw,
ostid_id(&oa->o_oi),
rnb[i].rnb_offset,
rnb[i].rnb_len);
else
- echo_client_page_debug_check(lsm, page,
+ echo_client_page_debug_check(page,
ostid_id(&oa->o_oi),
rnb[i].rnb_offset,
rnb[i].rnb_len);
if (!cfs_capable(CFS_CAP_SYS_ADMIN))
GOTO (out, rc = -EPERM);
- rc = echo_create_object(env, ed, 1, oa, data->ioc_pbuf1,
- data->ioc_plen1, &dummy_oti);
+ rc = echo_create_object(env, ed, oa, &dummy_oti);
GOTO(out, rc);
#ifdef HAVE_SERVER_SUPPORT
rc = echo_get_object(&eco, ed, oa);
if (rc == 0) {
- rc = obd_destroy(env, ec->ec_exp, oa, eco->eo_lsm,
- &dummy_oti, NULL, NULL);
+ rc = obd_destroy(env, ec->ec_exp, oa, NULL,
+ &dummy_oti, NULL, NULL);
if (rc == 0)
eco->eo_deleted = 1;
echo_put_object(eco);
case OBD_IOC_GETATTR:
rc = echo_get_object(&eco, ed, oa);
if (rc == 0) {
- struct obd_info oinfo = { { { 0 } } };
- oinfo.oi_md = eco->eo_lsm;
- oinfo.oi_oa = oa;
+ struct obd_info oinfo = {
+ .oi_oa = oa,
+ };
+
rc = obd_getattr(env, ec->ec_exp, &oinfo);
echo_put_object(eco);
}
rc = echo_get_object(&eco, ed, oa);
if (rc == 0) {
- struct obd_info oinfo = { { { 0 } } };
- oinfo.oi_oa = oa;
- oinfo.oi_md = eco->eo_lsm;
+ struct obd_info oinfo = {
+ .oi_oa = oa,
+ };
rc = obd_setattr(env, ec->ec_exp, &oinfo, NULL);
echo_put_object(eco);
INIT_LIST_HEAD(&ec->ec_objects);
INIT_LIST_HEAD(&ec->ec_locks);
ec->ec_unique = 0;
- ec->ec_nstripes = 0;
if (!strcmp(tgt->obd_type->typ_name, LUSTRE_MDT_NAME)) {
#ifdef HAVE_SERVER_SUPPORT