/*
* handling device state, mostly for tests
*/
- void (*dt_sync)(const struct lu_context *ctx,
- struct dt_device *dev);
- void (*dt_ro)(const struct lu_context *ctx,
- struct dt_device *dev, int sync);
+ int (*dt_sync)(const struct lu_context *ctx, struct dt_device *dev);
+ void (*dt_ro)(const struct lu_context *ctx, struct dt_device *dev);
};
struct lu_context ctxt;
struct mdt_device *mdt = mdt_dev(exp->exp_obd->obd_lu_dev);
struct dt_device *dt = mdt->mdt_bottom;
- int rc = 0;
+ int rc;
ENTRY;
CDEBUG(D_IOCTL, "handling ioctl cmd %#x\n", cmd);
if (rc)
RETURN(rc);
lu_context_enter(&ctxt);
- switch (cmd) {
- case OBD_IOC_SYNC:
- dt->dd_ops->dt_sync(&ctxt, dt);
- break;
- case OBD_IOC_SET_READONLY:
- dt->dd_ops->dt_ro(&ctxt, dt, 1);
- break;
- default:
- CDEBUG(D_INFO, "Trying old MDS iocontrol %x\n", cmd);
+ if (cmd == OBD_IOC_SYNC || cmd == OBD_IOC_SET_READONLY) {
+ if (cmd == OBD_IOC_SYNC)
+ rc = dt->dd_ops->dt_sync(&ctxt, dt);
+ dt->dd_ops->dt_ro(&ctxt, dt);
+ } else
rc = -EOPNOTSUPP;
- break;
- }
lu_context_exit(&ctxt);
lu_context_fini(&ctxt);
RETURN(rc);
static inline __u64 mcd_last_transno(struct mdt_client_data *mcd)
{
- return (le64_to_cpu(mcd->mcd_last_transno) >
+ return (le64_to_cpu(mcd->mcd_last_transno) >
le64_to_cpu(mcd->mcd_last_close_transno) ?
le64_to_cpu(mcd->mcd_last_transno) :
le64_to_cpu(mcd->mcd_last_close_transno));
static inline __u64 mcd_last_xid(struct mdt_client_data *mcd)
{
- return (le64_to_cpu(mcd->mcd_last_xid) >
+ return (le64_to_cpu(mcd->mcd_last_xid) >
le64_to_cpu(mcd->mcd_last_close_xid) ?
le64_to_cpu(mcd->mcd_last_xid) :
le64_to_cpu(mcd->mcd_last_close_xid));
/* opdata for mdt_open(), has the same as ldlm_reply:lock_policy_res1.
* mdt_update_last_rcvd() stores this value onto disk for recovery
- * when mdt_trans_stop_cb() is called.
+ * when mdt_trans_stop_cb() is called.
*/
__u64 mti_opdata;
- /* temporary stuff used by thread to save stack consumption.
- * if something is in a union, make sure they do not conflict */
+ /* temporary stuff used by thread to save stack consumption.
+ * if something is in a union, make sure they do not conflict */
struct lu_fid mti_tmp_fid1;
struct lu_fid mti_tmp_fid2;
struct kstatfs ksfs; /* for mdt_statfs() */
struct {
/* for mdt_readpage() */
- struct lu_rdpg mti_rdpg;
+ struct lu_rdpg mti_rdpg;
/* for mdt_sendpage() */
- struct l_wait_info mti_wait_info;
+ struct l_wait_info mti_wait_info;
} rdpg;
} mti_u;
};
if (OBD_FAIL_CHECK(id)) {
CERROR(LUSTRE_MDT_NAME": obd_fail_loc=%x, fail write ops\n",
id);
- dd->dd_ops->dt_ro(ctx, dd, 0);
+ dd->dd_ops->dt_ro(ctx, dd);
/* We set FAIL_ONCE because we never "un-fail" a device */
obd_fail_loc |= OBD_FAILED | OBD_FAIL_ONCE;
}
EXIT;
}
-static void osd_sync(const struct lu_context *ctx,
+static int osd_sync(const struct lu_context *ctx,
struct dt_device *d)
{
- struct osd_device *osd = osd_dt_dev(d);
- ENTRY;
-
CDEBUG(D_HA, "syncing OSD %s\n", LUSTRE_OSD_NAME);
- ldiskfs_force_commit(osd_sb(osd));
- EXIT;
+ return ldiskfs_force_commit(osd_sb(osd_dt_dev(d)));
}
enum {
SYNC_DEVICE_CREDITS = 3
};
-static void osd_ro(const struct lu_context *ctx, struct dt_device *d, int sync)
+static void osd_ro(const struct lu_context *ctx, struct dt_device *d)
{
- struct thandle *th;
- struct osd_thread_info *oti = lu_context_key_get(ctx, &osd_key);
- struct txn_param *param = &oti->oti_txn;
ENTRY;
CERROR("*** setting device %s read-only ***\n", LUSTRE_OSD_NAME);
- param->tp_credits = SYNC_DEVICE_CREDITS;
-
- th = osd_trans_start(ctx, d, param);
- if (!IS_ERR(th))
- osd_trans_stop(ctx, th);
-
- if (sync)
- osd_sync(ctx, d);
-
lvfs_set_rdonly(lvfs_sbdev(osd_sb(osd_dt_dev(d))));
EXIT;
}