int (*test_export)(struct obd_export *));
static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
{
- return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
- (obd->obd_force ? OBD_OPT_FORCE : 0) |
+ return ((obd->obd_force ? OBD_OPT_FORCE : 0) |
(obd->obd_abort_recovery ? OBD_OPT_ABORT_RECOV : 0) |
0);
}
static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat* tmp)
{
- /* Always add in ldlm_stats */
- tmp->nid_ldlm_stats = lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC
- ,LPROCFS_STATS_FLAG_NOPERCPU);
- if (tmp->nid_ldlm_stats == NULL)
- return -ENOMEM;
-
- lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
-
- return lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
- tmp->nid_ldlm_stats);
-}
-
-#define EXP_CHECK_MD_OP(exp, op) \
-do { \
- if ((exp) == NULL) { \
- CERROR("obd_" #op ": NULL export\n"); \
- RETURN(-ENODEV); \
- } \
- if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
- CERROR("obd_" #op ": cleaned up obd\n"); \
- RETURN(-EOPNOTSUPP); \
- } \
- if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \
- CERROR("obd_" #op ": dev %s/%d no operation\n", \
- (exp)->exp_obd->obd_name, \
- (exp)->exp_obd->obd_minor); \
- RETURN(-EOPNOTSUPP); \
- } \
+ /* Always add in ldlm_stats */
+ tmp->nid_ldlm_stats =
+ lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC,
+ LPROCFS_STATS_FLAG_NOPERCPU);
+ if (tmp->nid_ldlm_stats == NULL)
+ return -ENOMEM;
+
+ lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
+
+ return lprocfs_register_stats(tmp->nid_proc, "ldlm_stats",
+ tmp->nid_ldlm_stats);
+}
+
+#define EXP_CHECK_MD_OP(exp, op) \
+do { \
+ if ((exp) == NULL) { \
+ CERROR("obd_" #op ": NULL export\n"); \
+ RETURN(-ENODEV); \
+ } \
+ if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
+ CERROR("obd_" #op ": cleaned up obd\n"); \
+ RETURN(-EOPNOTSUPP); \
+ } \
+ if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \
+ CERROR("%s: obd_" #op ": dev %d no operation\n", \
+ (exp)->exp_obd->obd_name, \
+ (exp)->exp_obd->obd_minor); \
+ RETURN(-EOPNOTSUPP); \
+ } \
} while (0)
-#define OBD_CHECK_DT_OP(obd, op, err) \
-do { \
- if (!OBT(obd) || !OBP((obd), op)) { \
- if (err) \
- CERROR("obd_" #op ": dev %d no operation\n", \
- obd->obd_minor); \
- RETURN(err); \
- } \
+#define OBD_CHECK_DT_OP(obd, op, err) \
+do { \
+ if (!OBT(obd) || !OBP((obd), op)) { \
+ if (err) \
+ CERROR("%s: no obd_" #op " operation\n", \
+ obd->obd_name); \
+ RETURN(err); \
+ } \
} while (0)
-#define EXP_CHECK_DT_OP(exp, op) \
-do { \
- if ((exp) == NULL) { \
- CERROR("obd_" #op ": NULL export\n"); \
- RETURN(-ENODEV); \
- } \
- if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
- CERROR("obd_" #op ": cleaned up obd\n"); \
- RETURN(-EOPNOTSUPP); \
- } \
- if (!OBT((exp)->exp_obd) || !OBP((exp)->exp_obd, op)) { \
- CERROR("obd_" #op ": dev %d no operation\n", \
- (exp)->exp_obd->obd_minor); \
- RETURN(-EOPNOTSUPP); \
- } \
+#define EXP_CHECK_DT_OP(exp, op) \
+do { \
+ if ((exp) == NULL) { \
+ CERROR("obd_" #op ": NULL export\n"); \
+ RETURN(-ENODEV); \
+ } \
+ if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
+ CERROR("obd_" #op ": cleaned up obd\n"); \
+ RETURN(-EOPNOTSUPP); \
+ } \
+ OBD_CHECK_DT_OP((exp)->exp_obd, op, -EOPNOTSUPP); \
} while (0)
-#define CTXT_CHECK_OP(ctxt, op, err) \
-do { \
- if (!OBT(ctxt->loc_obd) || !CTXTP((ctxt), op)) { \
- if (err) \
- CERROR("lop_" #op ": dev %d no operation\n", \
- ctxt->loc_obd->obd_minor); \
- RETURN(err); \
- } \
+#define CTXT_CHECK_OP(ctxt, op, err) \
+do { \
+ if (!OBT(ctxt->loc_obd) || !CTXTP((ctxt), op)) { \
+ if (err) \
+ CERROR("%s: no lop_" #op "operation\n", \
+ ctxt->loc_obd->obd_name); \
+ RETURN(err); \
+ } \
} while (0)
static inline int class_devno_max(void)
{
- return MAX_OBD_DEVICES;
+ return MAX_OBD_DEVICES;
}
static inline int obd_get_info(const struct lu_env *env, struct obd_export *exp,
}
static inline int obd_notify(struct obd_device *obd,
- struct obd_device *watched,
- enum obd_notify_event ev,
- void *data)
+ struct obd_device *watched,
+ enum obd_notify_event ev)
{
- int rc;
- ENTRY;
- OBD_CHECK_DEV(obd);
+ int rc;
+ ENTRY;
+ OBD_CHECK_DEV(obd);
if (!obd->obd_set_up) {
- CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
- RETURN(-EINVAL);
- }
+ CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
+ RETURN(-EINVAL);
+ }
- if (!OBP(obd, notify)) {
- CDEBUG(D_HA, "obd %s has no notify handler\n", obd->obd_name);
- RETURN(-ENOSYS);
- }
+ if (!OBP(obd, notify)) {
+ CDEBUG(D_HA, "obd %s has no notify handler\n", obd->obd_name);
+ RETURN(-ENOSYS);
+ }
- OBD_COUNTER_INCREMENT(obd, notify);
- rc = OBP(obd, notify)(obd, watched, ev, data);
- RETURN(rc);
+ OBD_COUNTER_INCREMENT(obd, notify);
+ rc = OBP(obd, notify)(obd, watched, ev);
+
+ RETURN(rc);
}
static inline int obd_notify_observer(struct obd_device *observer,
- struct obd_device *observed,
- enum obd_notify_event ev,
- void *data)
+ struct obd_device *observed,
+ enum obd_notify_event ev)
{
- int rc1;
- int rc2;
+ int rc = 0;
+ int rc2 = 0;
+ struct obd_notify_upcall *onu;
- struct obd_notify_upcall *onu;
+ if (observer->obd_observer)
+ rc = obd_notify(observer->obd_observer, observed, ev);
- if (observer->obd_observer)
- rc1 = obd_notify(observer->obd_observer, observed, ev, data);
- else
- rc1 = 0;
- /*
- * Also, call non-obd listener, if any
- */
- onu = &observer->obd_upcall;
- if (onu->onu_upcall != NULL)
- rc2 = onu->onu_upcall(observer, observed, ev,
- onu->onu_owner, NULL);
- else
- rc2 = 0;
+ /*
+ * Also, call non-obd listener, if any
+ */
+ onu = &observer->obd_upcall;
+ if (onu->onu_upcall != NULL)
+ rc2 = onu->onu_upcall(observer, observed, ev, onu->onu_owner);
- return rc1 ? rc1 : rc2;
+ return rc ? rc : rc2;
}
static inline int obd_quotactl(struct obd_export *exp,
/* linux-module.c */
extern struct miscdevice obd_psdev;
+int obd_ioctl_getdata(char **buf, int *len, void __user *arg);
int class_procfs_init(void);
int class_procfs_clean(void);