#include <linux/lustre_lib.h>
#include <linux/lustre_idl.h>
#include <linux/lprocfs_status.h>
-#include <linux/lustre_mds.h>
+#include <linux/lustre_log.h>
/* OBD Device Declarations */
#define MAX_OBD_DEVICES 256
void oig_release(struct obd_io_group *oig);
int oig_wait(struct obd_io_group *oig);
-/* config.c */
+/* obd_config.c */
int class_process_config(struct lustre_cfg *lcfg);
-int class_attach(struct lustre_cfg *lcfg);
-int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
-int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg);
-int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg);
-/* Passed as data param to class_config_parse_llog */
+/* Passed as data param to class_config_parse_handler() */
struct config_llog_instance {
char * cfg_instance;
struct obd_uuid cfg_uuid;
- ptl_nid_t cfg_local_nid;
+ ptl_nid_t cfg_local_nid;
};
-int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
- struct config_llog_instance *cfg);
+
+int class_config_process_llog(struct llog_ctxt *ctxt, char *name,
+ struct config_llog_instance *cfg);
int class_config_dump_llog(struct llog_ctxt *ctxt, char *name,
struct config_llog_instance *cfg);
struct lustre_profile *class_get_profile(char * prof);
void class_del_profile(char *prof);
+#define class_export_rpc_get(exp) \
+({ \
+ atomic_inc(&(exp)->exp_rpc_count); \
+ CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", \
+ (exp), atomic_read(&(exp)->exp_rpc_count)); \
+ class_export_get(exp); \
+})
+
+#define class_export_rpc_put(exp) \
+({ \
+ atomic_dec(&(exp)->exp_rpc_count); \
+ CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", \
+ (exp), atomic_read(&(exp)->exp_rpc_count)); \
+ class_export_put(exp); \
+})
+
#define class_export_get(exp) \
({ \
struct obd_export *exp_ = exp; \
RETURN(rc);
}
+static inline int
+obd_process_config(struct obd_device *obd, int datalen, void *data)
+{
+ int rc;
+ ENTRY;
+
+ OBD_CHECK_OP(obd, process_config, -EOPNOTSUPP);
+ OBD_COUNTER_INCREMENT(obd, process_config);
+
+ rc = OBP(obd, process_config)(obd, datalen, data);
+ RETURN(rc);
+}
+
/* Pack an in-memory MD struct for storage on disk.
* Returns +ve size of packed MD (0 for free), or -ve error.
*
return obd_unpackmd(exp, mem_tgt, NULL, 0);
}
+static inline int obd_revalidate_md(struct obd_export *exp, struct obdo *obdo,
+ struct lov_stripe_md *ea,
+ struct obd_trans_info *oti)
+{
+ int rc;
+ ENTRY;
+
+ EXP_CHECK_OP(exp, revalidate_md);
+ OBD_COUNTER_INCREMENT(exp->exp_obd, revalidate_md);
+
+ rc = OBP(exp->exp_obd, revalidate_md)(exp, obdo, ea, oti);
+ RETURN(rc);
+}
+
static inline int obd_create(struct obd_export *exp, struct obdo *obdo,
struct lov_stripe_md **ea,
struct obd_trans_info *oti)
RETURN(rc);
}
-static inline int obd_write_extents(struct obd_export *exp, struct obd_ioobj *obj,
- int niocount, struct niobuf_local *local, int rc)
+static inline int obd_do_cow(struct obd_export *exp, struct obd_ioobj *obj,
+ int objcount,struct niobuf_remote *rnb)
+{
+ int rc;
+ ENTRY;
+
+ /* there are cases when write_extents is not implemented. */
+ if (!OBP(exp->exp_obd, do_cow))
+ RETURN(0);
+
+ OBD_COUNTER_INCREMENT(exp->exp_obd, do_cow);
+
+ rc = OBP(exp->exp_obd, do_cow)(exp, obj, objcount, rnb);
+
+ RETURN(rc);
+}
+
+static inline int obd_write_extents(struct obd_export *exp,
+ struct obd_ioobj *obj,
+ int objcount, int niocount,
+ struct niobuf_local *local,
+ int rc)
{
ENTRY;
OBD_COUNTER_INCREMENT(exp->exp_obd, write_extents);
- rc = OBP(exp->exp_obd, write_extents)(exp, obj, niocount, local, rc);
+ rc = OBP(exp->exp_obd, write_extents)(exp, obj, objcount, niocount,
+ local, rc);
RETURN(rc);
}
RETURN(rc);
}
+/* this function notifies MDC, that inode described by @fid gets removed from
+ * memory.*/
+static inline int md_delete_object(struct obd_export *exp,
+ struct ll_fid *fid)
+{
+ int rc;
+ ENTRY;
+
+ /* as this method only notifies MDC that inode gets deleted, we can
+ * return zero if method is not implemented, this means, that OBD does
+ * not need such a notification. */
+ if (MDP(exp->exp_obd, delete_object) == NULL)
+ RETURN(0);
+
+ MD_COUNTER_INCREMENT(exp->exp_obd, delete_object);
+ rc = MDP(exp->exp_obd, delete_object)(exp, fid);
+ RETURN(rc);
+}
+
static inline int md_getattr(struct obd_export *exp, struct ll_fid *fid,
unsigned long valid, unsigned int ea_size,
struct ptlrpc_request **request)
{
int rc;
+ ENTRY;
EXP_CHECK_MD_OP(exp, getattr);
MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
rc = MDP(exp->exp_obd, getattr)(exp, fid, valid, ea_size, request);
RETURN(rc);
}
-static inline struct obd_device * md_get_real_obd(struct obd_export *exp,
- char *name, int len)
+static inline struct obd_device *md_get_real_obd(struct obd_export *exp,
+ char *name, int len)
{
ENTRY;
if (MDP(exp->exp_obd, get_real_obd) == NULL)