#include <linux/iobuf.h>
#endif
#include <asm/div64.h>
+#include <linux/smp_lock.h>
#else
#include <liblustre.h>
#endif
oa->o_id = ++last_object_id;
if (on_target) {
- oa->o_gr = FILTER_GROUP_ECHO;
+ /* XXX get some filter group constants */
+ oa->o_gr = 2;
oa->o_valid |= OBD_MD_FLGROUP;
rc = obd_create(ec->ec_exp, oa, &lsm, oti);
if (rc != 0)
rc2 = block_debug_check("test_brw",
addr + delta, OBD_ECHO_BLOCK_SIZE,
stripe_off, stripe_id);
- if (rc2 != 0) {
- CERROR ("Error in echo object "LPX64"\n", id);
+ if (rc2 != 0)
rc = rc2;
- }
}
kunmap(page);
obd_off off;
int i;
int rc;
- int verify = 0;
+ int verify;
int gfp_mask;
verify = ((oa->o_id) != ECHO_PERSISTENT_OBJID &&
goto out;
pgp->count = PAGE_SIZE;
- pgp->disk_offset = pgp->page_offset = off;
+ pgp->off = off;
pgp->flag = 0;
if (verify)
if (verify) {
int vrc;
vrc = echo_client_page_debug_check(lsm, pgp->pg, oa->o_id,
- pgp->page_offset,
- pgp->count);
+ pgp->off, pgp->count);
if (vrc != 0 && rc == 0)
rc = vrc;
}
for (i = 0, off = offset, pgp = pga;
i < npages;
i++, off += PAGE_SIZE, pgp++) {
- pgp->disk_offset = pgp->page_offset = off;
+ pgp->off = off;
pgp->pg = kiobuf->maplist[i];
pgp->count = PAGE_SIZE;
pgp->flag = 0;
struct list_head eap_item;
};
+#define EAP_FROM_COOKIE(c) \
+ (LASSERT(((struct echo_async_page *)(c))->eap_magic == EAP_MAGIC), \
+ (struct echo_async_page *)(c))
+
struct echo_async_state {
spinlock_t eas_lock;
obd_off eas_next_offset;
return rc;
};
-struct echo_async_page *eap_from_cookie(void *cookie)
-{
- struct echo_async_page *eap = cookie;
- if (eap->eap_magic != EAP_MAGIC)
- return ERR_PTR(-EINVAL);
- return eap;
-};
-
static int ec_ap_make_ready(void *data, int cmd)
{
/* our pages are issued ready */
}
static void ec_ap_fill_obdo(void *data, int cmd, struct obdo *oa)
{
- struct echo_async_page *eap;
- eap = eap_from_cookie(data);
- if (IS_ERR(eap))
- return;
+ struct echo_async_page *eap = EAP_FROM_COOKIE(data);
memcpy(oa, &eap->eap_eas->eas_oa, sizeof(*oa));
}
static void ec_ap_completion(void *data, int cmd, struct obdo *oa, int rc)
{
- struct echo_async_page *eap = eap_from_cookie(data);
+ struct echo_async_page *eap = EAP_FROM_COOKIE(data);
struct echo_async_state *eas;
unsigned long flags;
- if (IS_ERR(eap))
- return;
eas = eap->eap_eas;
if (cmd == OBD_BRW_READ &&
#if 0
int verify;
int gfp_mask;
- /* oa_id == 0 => speed test (no verification) else...
- * oa & 1 => use HIGHMEM
- */
- verify = (oa->o_id != 0);
- gfp_mask = ((oa->o_id & 1) == 0) ? GFP_KERNEL : GFP_HIGHUSER;
+
+ verify = ((oa->o_id) != ECHO_PERSISTENT_OBJID &&
+ (oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
+ (oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
+
+ gfp_mask = ((oa->o_id & 2) == 0) ? GFP_KERNEL : GFP_HIGHUSER;
#endif
LASSERT(rw == OBD_BRW_WRITE || rw == OBD_BRW_READ);
(oa->o_flags & OBD_FL_DEBUG_CHECK) == 0)
continue;
-
if (rw == OBD_BRW_WRITE)
echo_client_page_debug_setup(lsm, page, rw,
oa->o_id,
data->ioc_obdo1.o_valid &= ~OBD_MD_FLHANDLE;
data->ioc_obdo1.o_valid |= OBD_MD_FLGROUP;
- data->ioc_obdo1.o_gr = FILTER_GROUP_ECHO;
+ data->ioc_obdo1.o_gr = 2;
switch((long)data->ioc_pbuf1) {
case 1:
int i;
ENTRY;
+ unlock_kernel();
+
memset(&dummy_oti, 0, sizeof(dummy_oti));
obd = exp->exp_obd;
rc = echo_get_object (&eco, obd, &data->ioc_obdo1);
if (rc == 0) {
oa = &data->ioc_obdo1;
- oa->o_gr = FILTER_GROUP_ECHO;
+ oa->o_gr = 2;
oa->o_valid |= OBD_MD_FLGROUP;
rc = obd_destroy(ec->ec_exp, oa, eco->eco_lsm,
&dummy_oti);
ldlm_lock_decref(&ack_lock->lock, ack_lock->mode);
}
+ lock_kernel();
+
return rc;
}
int rc;
ENTRY;
- if (lcfg->lcfg_inllen1 < 1) {
+ if (lcfg->lcfg_bufcount < 2 || LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
CERROR("requires a TARGET OBD name\n");
RETURN(-EINVAL);
}
- tgt = class_name2obd(lcfg->lcfg_inlbuf1);
+ tgt = class_name2obd(lustre_cfg_string(lcfg, 1));
if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
CERROR("device not attached or not set up (%s)\n",
- lcfg->lcfg_inlbuf1);
+ lustre_cfg_string(lcfg, 1));
RETURN(-EINVAL);
}
INIT_LIST_HEAD (&ec->ec_objects);
ec->ec_unique = 0;
- rc = obd_connect(&conn, tgt, &echo_uuid, 0);
+ rc = obd_connect(&conn, tgt, &echo_uuid, NULL /* obd_connect_data */);
if (rc) {
- CERROR("fail to connect to device %s\n", lcfg->lcfg_inlbuf1);
+ CERROR("fail to connect to device %s\n",
+ lustre_cfg_string(lcfg, 1));
return (rc);
}
ec->ec_exp = class_conn2export(&conn);
RETURN(rc);
}
-static int echo_client_cleanup(struct obd_device *obddev, int flags)
+static int echo_client_cleanup(struct obd_device *obddev)
{
struct list_head *el;
struct ec_object *eco;
echo_put_object(eco);
}
- rc = obd_disconnect(ec->ec_exp, 0);
+ rc = obd_disconnect(ec->ec_exp);
if (rc != 0)
CERROR("fail to disconnect device: %d\n", rc);
}
static int echo_client_connect(struct lustre_handle *conn,
- struct obd_device *src,
- struct obd_uuid *cluuid,
- unsigned long flags)
+ struct obd_device *src, struct obd_uuid *cluuid,
+ struct obd_connect_data *data)
{
struct obd_export *exp;
int rc;
RETURN (rc);
}
-static int echo_client_disconnect(struct obd_export *exp,
- unsigned long flags)
+static int echo_client_disconnect(struct obd_export *exp)
{
struct obd_device *obd;
struct echo_client_obd *ec;
OBD_FREE (ecl, sizeof (*ecl));
}
- rc = class_disconnect(exp, 0);
+ rc = class_disconnect(exp);
GOTO(out, rc);
out:
return rc;
struct lprocfs_static_vars lvars;
lprocfs_init_vars(echo, &lvars);
- return class_register_type(&echo_obd_ops, NULL, lvars.module_vars,
+ return class_register_type(&echo_obd_ops, lvars.module_vars,
OBD_ECHO_CLIENT_DEVICENAME);
}