#include <cl_object.h>
#include <lustre_fid.h>
#include <lustre_acl.h>
+#include <lustre_net.h>
#include "echo_internal.h"
obd_size count, int async,
struct obd_trans_info *oti)
{
- struct echo_client_obd *ec = ed->ed_ec;
struct lov_stripe_md *lsm = eco->eo_lsm;
obd_count npages;
struct brw_page *pga;
oa->o_id, off, pgp->count);
}
- if (ed->ed_next == NULL) {
- struct obd_info oinfo = { { { 0 } } };
- oinfo.oi_oa = oa;
- oinfo.oi_md = lsm;
- rc = obd_brw(rw, ec->ec_exp, &oinfo, npages, pga, oti);
- } else
- rc = cl_echo_object_brw(eco, rw, offset, pages, npages, async);
+ /* brw mode can only be used at client */
+ LASSERT(ed->ed_next != NULL);
+ rc = cl_echo_object_brw(eco, rw, offset, pages, npages, async);
out:
if (rc != 0 || rw != OBD_BRW_READ)
static int echo_client_prep_commit(struct obd_export *exp, int rw,
struct obdo *oa, struct echo_object *eco,
obd_off offset, obd_size count,
- obd_size batch, struct obd_trans_info *oti)
+ obd_size batch, struct obd_trans_info *oti,
+ int async)
{
struct lov_stripe_md *lsm = eco->eo_lsm;
struct obd_ioobj ioo;
if (page == NULL && lnb[i].rc == 0)
continue;
+ if (async)
+ lnb[i].flags |= OBD_BRW_ASYNC;
+
if (oa->o_id == ECHO_PERSISTENT_OBJID ||
(oa->o_valid & OBD_MD_FLFLAGS) == 0 ||
(oa->o_flags & OBD_FL_DEBUG_CHECK) == 0)
struct echo_object *eco;
int rc;
int async = 1;
+ long test_mode;
ENTRY;
LASSERT(oa->o_valid & OBD_MD_FLGROUP);
oa->o_valid &= ~OBD_MD_FLHANDLE;
- switch((long)data->ioc_pbuf1) {
- case 1:
+ /* obdfilter doesn't support obd_brw now, simulate via prep + commit */
+ test_mode = (long)data->ioc_pbuf1;
+ if (test_mode == 1)
async = 0;
+
+ if (ed->ed_next == NULL && test_mode != 3) {
+ test_mode = 3;
+ data->ioc_plen1 = data->ioc_count;
+ }
+
+ /* Truncate batch size to maximum */
+ if (data->ioc_plen1 > PTLRPC_MAX_BRW_SIZE)
+ data->ioc_plen1 = PTLRPC_MAX_BRW_SIZE;
+
+ switch (test_mode) {
+ case 1:
/* fall through */
case 2:
rc = echo_client_kbrw(ed, rw, oa,
rc = echo_client_prep_commit(ec->ec_exp, rw, oa,
eco, data->ioc_offset,
data->ioc_count, data->ioc_plen1,
- &dummy_oti);
+ &dummy_oti, async);
break;
default:
rc = -EINVAL;