}
cobd->cache_exp = class_conn2export(&conn);
- /* default set cache on, but nothins is realy connected yet, will be
+ /* default set cache on, but nothing is realy connected yet, will be
* done in cobd_connect() time. */
cobd->cache_on = 1;
RETURN(rc);
}
+static int cobd_notify(struct obd_device *obd, struct obd_device *watched,
+ int active, void *data)
+{
+ struct obd_export *cobd_exp;
+ int rc = 0;
+ ENTRY;
+
+ cobd_exp = cobd_get_exp(obd);
+ rc = obd_notify(class_exp2obd(cobd_exp), watched, active, data);
+ RETURN(rc);
+}
+
+static int cobd_pin(struct obd_export *exp, obd_id ino, __u32 gen,
+ int type, struct obd_client_handle *handle,
+ int flag)
+{
+ struct obd_device *obd = class_exp2obd(exp);
+ struct obd_export *cobd_exp;
+ int rc = 0;
+ ENTRY;
+
+ if (obd == NULL) {
+ CERROR("invalid client cookie "LPX64"\n",
+ exp->exp_handle.h_cookie);
+ RETURN(-EINVAL);
+ }
+ cobd_exp = cobd_get_exp(obd);
+ rc = obd_pin(cobd_exp, ino, gen, type, handle, flag);
+ RETURN(rc);
+}
+
+static int cobd_unpin(struct obd_export *exp,
+ struct obd_client_handle *handle,
+ int flag)
+{
+ struct obd_device *obd = class_exp2obd(exp);
+ struct obd_export *cobd_exp;
+ int rc = 0;
+ ENTRY;
+
+ if (obd == NULL) {
+ CERROR("invalid client cookie "LPX64"\n",
+ exp->exp_handle.h_cookie);
+ RETURN(-EINVAL);
+ }
+ cobd_exp = cobd_get_exp(obd);
+ rc = obd_unpin(cobd_exp, handle, flag);
+ RETURN(rc);
+}
+
+/* data related stuff */
static int cobd_dt_packmd(struct obd_export *exp,
struct lov_mds_md **disk_tgt,
struct lov_stripe_md *mem_src)
RETURN(rc);
}
-static int cobd_dt_notify(struct obd_device *obd, struct obd_device *watched,
- int active, void *data)
-{
- struct obd_export *cobd_exp;
- int rc = 0;
- ENTRY;
-
- cobd_exp = cobd_get_exp(obd);
- rc = obd_notify(class_exp2obd(cobd_exp), watched, active, data);
- RETURN(rc);
-}
-
-static int cobd_dt_pin(struct obd_export *exp, obd_id ino, __u32 gen,
- int type, struct obd_client_handle *handle,
- int flag)
-{
- struct obd_device *obd = class_exp2obd(exp);
- struct obd_export *cobd_exp;
- int rc = 0;
- ENTRY;
-
- if (obd == NULL) {
- CERROR("invalid client cookie "LPX64"\n",
- exp->exp_handle.h_cookie);
- RETURN(-EINVAL);
- }
- cobd_exp = cobd_get_exp(obd);
- rc = obd_pin(cobd_exp, ino, gen, type, handle, flag);
- RETURN(rc);
-}
-
-static int cobd_dt_unpin(struct obd_export *exp,
- struct obd_client_handle *handle,
- int flag)
-{
- struct obd_device *obd = class_exp2obd(exp);
- struct obd_export *cobd_exp;
- int rc = 0;
- ENTRY;
-
- if (obd == NULL) {
- CERROR("invalid client cookie "LPX64"\n",
- exp->exp_handle.h_cookie);
- RETURN(-EINVAL);
- }
- cobd_exp = cobd_get_exp(obd);
- rc = obd_unpin(cobd_exp, handle, flag);
- RETURN(rc);
-}
-
static int cobd_dt_init_ea_size(struct obd_export *exp, int easize,
int cookiesize)
{
RETURN(0);
}
+/* metadata related stuff */
static int cobd_md_getstatus(struct obd_export *exp,
struct lustre_id *rootid)
{
.o_get_info = cobd_get_info,
.o_statfs = cobd_statfs,
.o_iocontrol = cobd_iocontrol,
+ .o_notify = cobd_notify,
+ .o_pin = cobd_pin,
+ .o_unpin = cobd_unpin,
.o_packmd = cobd_dt_packmd,
.o_unpackmd = cobd_dt_unpackmd,
.o_commitrw = cobd_dt_commitrw,
.o_llog_init = cobd_dt_llog_init,
.o_llog_finish = cobd_dt_llog_finish,
- .o_notify = cobd_dt_notify,
- .o_pin = cobd_dt_pin,
- .o_unpin = cobd_dt_unpin,
.o_import_event = cobd_dt_import_event,
.o_init_ea_size = cobd_dt_init_ea_size,
.o_adjust_kms = cobd_dt_adjust_kms,
spin_lock_init(&cli->cl_read_page_hist.oh_lock);
spin_lock_init(&cli->cl_write_page_hist.oh_lock);
+ memset(&cli->cl_last_write_time, 0,
+ sizeof(cli->cl_last_write_time));
+ cli->cl_write_gap_sum = 0;
+ cli->cl_write_gaps = 0;
+
if (num_physpages >> (20 - PAGE_SHIFT) <= 128) { /* <= 128 MB */
cli->cl_max_pages_per_rpc = PTLRPC_MAX_BRW_PAGES / 4;
cli->cl_max_rpcs_in_flight = OSC_MAX_RIF_DEFAULT / 4;
class_import_put(cli->cl_import);
cli->cl_import = NULL;
- ldlm_put_ref(flags & OBD_OPT_FORCE);
+ if (cli->cl_write_gap_sum) {
+ CWARN("%s: %lu write gaps: %lu av. (usec), %lu total "
+ "(usec)\n", obddev->obd_name, cli->cl_write_gaps,
+ cli->cl_write_gap_sum / cli->cl_write_gaps,
+ cli->cl_write_gap_sum);
+ }
+ ldlm_put_ref(flags & OBD_OPT_FORCE);
RETURN(0);
}
osc_ap_completion(cli, aa->aa_oa, oap, 1, rc);
}
+ /* no write RPCs in flight, reset the time */
+ if (request->rq_reqmsg->opc == OST_WRITE && cli->cl_w_in_flight == 0)
+ do_gettimeofday(&cli->cl_last_write_time);
+
osc_wake_cache_waiters(cli);
osc_check_rpcs(cli);
spin_unlock(&cli->cl_loi_list_lock);
RETURN(req);
}
+/* strange write gap too long (15s) */
+#define CLI_ODD_WRITE_GAP 15000000
+
static void lop_update_pending(struct client_obd *cli,
struct loi_oap_pages *lop, int cmd, int delta)
{
cli->cl_pending_r_pages += delta;
}
+static long timeval_sub(struct timeval *large, struct timeval *small)
+{
+ return (large->tv_sec - small->tv_sec) * 1000000 +
+ (large->tv_usec - small->tv_usec);
+}
+
/* the loi lock is held across this function but it's allowed to release
* and reacquire it during its work */
static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi,
spin_lock(&cli->cl_loi_list_lock);
+ /* collect write gaps and sum of them */
+ if (cmd == OBD_BRW_WRITE && cli->cl_w_in_flight == 0) {
+ struct timeval now;
+ long diff;
+
+ do_gettimeofday(&now);
+
+ if (cli->cl_last_write_time.tv_sec) {
+ diff = timeval_sub(&now, &cli->cl_last_write_time);
+ if (diff < CLI_ODD_WRITE_GAP) {
+ cli->cl_write_gap_sum += diff;
+ cli->cl_write_gaps++;
+ }
+ }
+ }
+
if (cmd == OBD_BRW_READ)
cli->cl_r_in_flight++;
else
cli->cl_w_in_flight++;
+
/* queued sync pages can be torn down while the pages
* were between the pending list and the rpc */
list_for_each(pos, &aa->aa_oaps) {
}
CDEBUG(D_INODE, "req %p: %d pages, aa %p. now %dr/%dw in flight\n",
- request, page_count, aa, cli->cl_r_in_flight,
- cli->cl_w_in_flight);
+ request, page_count, aa, cli->cl_r_in_flight, cli->cl_w_in_flight);
oap->oap_request = ptlrpc_request_addref(request);
request->rq_interpret_reply = brw_interpret_oap;
+
ptlrpcd_add_req(request);
RETURN(1);
}