-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
- */
-/*
- * Copyright (c) 2011 Whamcloud, Inc.
+ *
+ * Copyright (c) 2011, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#error Unsupported operating system.
#endif
+#define OBD_STATFS_NODELAY 0x0001 /* requests should be send without delay
+ * and resends for avoid deadlocks */
+#define OBD_STATFS_FROM_CACHE 0x0002 /* the statfs callback should not update
+ * obd_osfs_age */
+#define OBD_STATFS_PTLRPCD 0x0004 /* requests will be sent via ptlrpcd
+ * instead of a specific set. This
+ * means that we cannot rely on the set
+ * interpret routine to be called.
+ * lov_statfs_fini() must thus be called
+ * by the request interpret routine */
+#define OBD_STATFS_FOR_MDT0 0x0008 /* The statfs is only for retrieving
+ * information from MDT0. */
+#define OBD_FL_PUNCH 0x00000001 /* To indicate it is punch operation */
+
/* OBD Device Declarations */
extern struct obd_device *obd_devs[MAX_OBD_DEVICES];
-extern cfs_rwlock_t obd_dev_lock;
+extern rwlock_t obd_dev_lock;
/* OBD Operations Declarations */
extern struct obd_device *class_conn2obd(struct lustre_handle *);
extern struct obd_device *class_exp2obd(struct obd_export *);
extern int class_handle_ioctl(unsigned int cmd, unsigned long arg);
+extern int lustre_get_jobid(char *jobid);
struct lu_device_type;
struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid,
int *next);
struct obd_device * class_num2obd(int num);
+int get_devices_count(void);
int class_notify_sptlrpc_conf(const char *fsname, int namelen);
void *kuc_alloc(int payload_len, int transport, int type);
void kuc_free(void *p, int payload_len);
+struct llog_handle;
+struct llog_rec_hdr;
+typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *,
+ struct llog_rec_hdr *, void *);
/* obd_config.c */
+struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg,
+ const char *new_name);
int class_process_config(struct lustre_cfg *lcfg);
int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
struct lustre_cfg *lcfg, void *data);
void class_decref(struct obd_device *obd,
const char *scope, const void *source);
void dump_exports(struct obd_device *obd, int locks);
+int class_config_llog_handler(const struct lu_env *env,
+ struct llog_handle *handle,
+ struct llog_rec_hdr *rec, void *data);
+int class_add_conn(struct obd_device *obd, struct lustre_cfg *lcfg);
+int class_add_uuid(const char *uuid, __u64 nid);
/*obdecho*/
#ifdef LPROCFS
void *cfg_instance;
struct super_block *cfg_sb;
struct obd_uuid cfg_uuid;
+ llog_cb_t cfg_callback;
int cfg_last_idx; /* for partial llog processing */
int cfg_flags;
};
-int class_config_parse_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);
+int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
+ char *name, struct config_llog_instance *cfg);
+int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
+ char *name, struct config_llog_instance *cfg);
enum {
CONFIG_T_CONFIG = 0,
struct config_llog_data *cld_sptlrpc;/* depended sptlrpc log */
struct config_llog_data *cld_recover; /* imperative recover log */
struct obd_export *cld_mgcexp;
- cfs_mutex_t cld_lock;
+ struct mutex cld_lock;
int cld_type;
unsigned int cld_stopping:1, /* we were told to stop
* watching */
#endif
-#define class_export_rpc_get(exp) \
+#define class_export_rpc_inc(exp) \
({ \
cfs_atomic_inc(&(exp)->exp_rpc_count); \
CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", \
(exp), cfs_atomic_read(&(exp)->exp_rpc_count)); \
- class_export_get(exp); \
})
-#define class_export_rpc_put(exp) \
+#define class_export_rpc_dec(exp) \
({ \
LASSERT_ATOMIC_POS(&exp->exp_rpc_count); \
cfs_atomic_dec(&(exp)->exp_rpc_count); \
CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", \
(exp), cfs_atomic_read(&(exp)->exp_rpc_count)); \
- class_export_put(exp); \
})
#define class_export_lock_get(exp, lock) \
0);
}
+#ifdef HAVE_SERVER_SUPPORT
static inline struct lu_target *class_exp2tgt(struct obd_export *exp)
{
LASSERT(exp->exp_obd);
LASSERT(obd->u.obt.obt_lut);
return &obd->u.obt.obt_lut->lut_lsd;
}
+#endif
void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid);
void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
unsigned int valid);
+void obdo_cpu_to_le(struct obdo *dobdo, struct obdo *sobdo);
+void obdo_le_to_cpu(struct obdo *dobdo, struct obdo *sobdo);
+
#define OBT(dev) (dev)->obd_type
#define OBP(dev, op) (dev)->obd_type->typ_dt_ops->o_ ## op
#define MDP(dev, op) (dev)->obd_type->typ_md_ops->m_ ## op
return MAX_OBD_DEVICES;
}
-static inline int obd_get_info(struct obd_export *exp, __u32 keylen,
+static inline int obd_get_info(const struct lu_env *env,
+ struct obd_export *exp, __u32 keylen,
void *key, __u32 *vallen, void *val,
struct lov_stripe_md *lsm)
{
EXP_CHECK_DT_OP(exp, get_info);
EXP_COUNTER_INCREMENT(exp, get_info);
- rc = OBP(exp->exp_obd, get_info)(exp, keylen, key, vallen, val, lsm);
+ rc = OBP(exp->exp_obd, get_info)(env, exp, keylen, key, vallen, val,
+ lsm);
RETURN(rc);
}
-static inline int obd_set_info_async(struct obd_export *exp, obd_count keylen,
+static inline int obd_set_info_async(const struct lu_env *env,
+ struct obd_export *exp, obd_count keylen,
void *key, obd_count vallen, void *val,
struct ptlrpc_request_set *set)
{
EXP_CHECK_DT_OP(exp, set_info_async);
EXP_COUNTER_INCREMENT(exp, set_info_async);
- rc = OBP(exp->exp_obd, set_info_async)(exp, keylen, key, vallen, val,
- set);
+ rc = OBP(exp->exp_obd, set_info_async)(env, exp, keylen, key, vallen,
+ val, set);
RETURN(rc);
}
/* If we set up but never connected, the
client import will not have been cleaned. */
- cfs_down_write(&obd->u.cli.cl_sem);
+ down_write(&obd->u.cli.cl_sem);
if (obd->u.cli.cl_import) {
struct obd_import *imp;
imp = obd->u.cli.cl_import;
ptlrpc_free_rq_pool(imp->imp_rq_pool);
imp->imp_rq_pool = NULL;
}
- class_destroy_import(imp);
+ client_destroy_import(imp);
obd->u.cli.cl_import = NULL;
}
- cfs_up_write(&obd->u.cli.cl_sem);
+ up_write(&obd->u.cli.cl_sem);
EXIT;
}
}
static inline int obd_free_diskmd(struct obd_export *exp,
- struct lov_mds_md **disk_tgt)
-{
- LASSERT(disk_tgt);
- LASSERT(*disk_tgt);
- return obd_packmd(exp, disk_tgt, NULL);
+ struct lov_mds_md **disk_tgt)
+{
+ LASSERT(disk_tgt);
+ LASSERT(*disk_tgt);
+ /*
+ * LU-2590, for caller's convenience, *disk_tgt could be host
+ * endianness, it needs swab to LE if necessary, while just
+ * lov_mds_md header needs it for figuring out how much memory
+ * needs to be freed.
+ */
+ if ((cpu_to_le32(LOV_MAGIC) != LOV_MAGIC) &&
+ (((*disk_tgt)->lmm_magic == LOV_MAGIC_V1) ||
+ ((*disk_tgt)->lmm_magic == LOV_MAGIC_V3)))
+ lustre_swab_lov_mds_md(*disk_tgt);
+ return obd_packmd(exp, disk_tgt, NULL);
}
/* Unpack an MD struct from disk to in-memory format.
RETURN(rc);
}
-static inline int obd_create(struct obd_export *exp, struct obdo *obdo,
- struct lov_stripe_md **ea,
+static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
+ struct obdo *obdo, struct lov_stripe_md **ea,
struct obd_trans_info *oti)
{
int rc;
EXP_CHECK_DT_OP(exp, create);
EXP_COUNTER_INCREMENT(exp, create);
- rc = OBP(exp->exp_obd, create)(exp, obdo, ea, oti);
+ rc = OBP(exp->exp_obd, create)(env, exp, obdo, ea, oti);
RETURN(rc);
}
-static inline int obd_destroy(struct obd_export *exp, struct obdo *obdo,
- struct lov_stripe_md *ea,
+static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp,
+ struct obdo *obdo, struct lov_stripe_md *ea,
struct obd_trans_info *oti,
struct obd_export *md_exp, void *capa)
{
EXP_CHECK_DT_OP(exp, destroy);
EXP_COUNTER_INCREMENT(exp, destroy);
- rc = OBP(exp->exp_obd, destroy)(exp, obdo, ea, oti, md_exp, capa);
+ rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, ea, oti, md_exp, capa);
RETURN(rc);
}
-static inline int obd_getattr(struct obd_export *exp, struct obd_info *oinfo)
+static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp,
+ struct obd_info *oinfo)
{
int rc;
ENTRY;
EXP_CHECK_DT_OP(exp, getattr);
EXP_COUNTER_INCREMENT(exp, getattr);
- rc = OBP(exp->exp_obd, getattr)(exp, oinfo);
+ rc = OBP(exp->exp_obd, getattr)(env, exp, oinfo);
RETURN(rc);
}
RETURN(rc);
}
-static inline int obd_setattr(struct obd_export *exp, struct obd_info *oinfo,
+static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp,
+ struct obd_info *oinfo,
struct obd_trans_info *oti)
{
int rc;
EXP_CHECK_DT_OP(exp, setattr);
EXP_COUNTER_INCREMENT(exp, setattr);
- rc = OBP(exp->exp_obd, setattr)(exp, oinfo, oti);
+ rc = OBP(exp->exp_obd, setattr)(env, exp, oinfo, oti);
RETURN(rc);
}
RETURN(rc);
}
-static inline int obd_fid_init(struct obd_export *exp)
+static inline int obd_fid_init(struct obd_device *obd, struct obd_export *exp,
+ enum lu_cli_type type)
{
- int rc;
- ENTRY;
+ int rc;
+ ENTRY;
- OBD_CHECK_DT_OP(exp->exp_obd, fid_init, 0);
- EXP_COUNTER_INCREMENT(exp, fid_init);
+ OBD_CHECK_DT_OP(obd, fid_init, 0);
+ OBD_COUNTER_INCREMENT(obd, fid_init);
- rc = OBP(exp->exp_obd, fid_init)(exp);
- RETURN(rc);
+ rc = OBP(obd, fid_init)(obd, exp, type);
+ RETURN(rc);
}
-static inline int obd_fid_fini(struct obd_export *exp)
+static inline int obd_fid_fini(struct obd_device *obd)
{
- int rc;
- ENTRY;
+ int rc;
+ ENTRY;
- OBD_CHECK_DT_OP(exp->exp_obd, fid_fini, 0);
- EXP_COUNTER_INCREMENT(exp, fid_fini);
+ OBD_CHECK_DT_OP(obd, fid_fini, 0);
+ OBD_COUNTER_INCREMENT(obd, fid_fini);
- rc = OBP(exp->exp_obd, fid_fini)(exp);
- RETURN(rc);
+ rc = OBP(obd, fid_fini)(obd);
+ RETURN(rc);
}
static inline int obd_fid_alloc(struct obd_export *exp,
RETURN(rc);
}
-static inline int obd_fid_delete(struct obd_export *exp,
- const struct lu_fid *fid)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, fid_delete);
- EXP_COUNTER_INCREMENT(exp, fid_delete);
-
- rc = OBP(exp->exp_obd, fid_delete)(exp, fid);
- RETURN(rc);
-}
-
-static inline int obd_ping(struct obd_export *exp)
+static inline int obd_ping(const struct lu_env *env, struct obd_export *exp)
{
int rc;
ENTRY;
OBD_CHECK_DT_OP(exp->exp_obd, ping, 0);
EXP_COUNTER_INCREMENT(exp, ping);
- rc = OBP(exp->exp_obd, ping)(exp);
+ rc = OBP(exp->exp_obd, ping)(env, exp);
RETURN(rc);
}
}
static inline struct dentry *
-obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr)
+obd_lvfs_fid2dentry(struct obd_export *exp, struct ost_id *oi, __u32 gen)
{
- LASSERT(exp->exp_obd);
+ struct lvfs_run_ctxt *ctxt = &exp->exp_obd->obd_lvfs_ctxt;
+ LASSERT(exp->exp_obd);
- return lvfs_fid2dentry(&exp->exp_obd->obd_lvfs_ctxt, id_ino, gen, gr,
- exp->exp_obd);
-}
-
-static inline int
-obd_lvfs_open_llog(struct obd_export *exp, __u64 id_ino, struct dentry *dentry)
-{
- LASSERT(exp->exp_obd);
- CERROR("FIXME what's the story here? This needs to be an obd fn?\n");
-#if 0
- return lvfs_open_llog(&exp->exp_obd->obd_lvfs_ctxt, id_ino,
- dentry, exp->exp_obd);
-#endif
- return 0;
+ return ctxt->cb_ops.l_fid2dentry(ostid_id(oi), gen, ostid_seq(oi),
+ exp->exp_obd);
}
/* @max_age is the oldest time in jiffies that we accept using a cached data.
* If the cache is older than @max_age we will get a new value from the
* target. Use a value of "cfs_time_current() + HZ" to guarantee freshness. */
-static inline int obd_statfs_async(struct obd_device *obd,
+static inline int obd_statfs_async(struct obd_export *exp,
struct obd_info *oinfo,
__u64 max_age,
struct ptlrpc_request_set *rqset)
{
int rc = 0;
+ struct obd_device *obd;
ENTRY;
- if (obd == NULL)
+ if (exp == NULL || exp->exp_obd == NULL)
RETURN(-EINVAL);
+ obd = exp->exp_obd;
OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(obd, statfs);
CDEBUG(D_SUPER, "%s: osfs %p age "LPU64", max_age "LPU64"\n",
obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age);
if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
- rc = OBP(obd, statfs_async)(obd, oinfo, max_age, rqset);
+ rc = OBP(obd, statfs_async)(exp, oinfo, max_age, rqset);
} else {
CDEBUG(D_SUPER,"%s: use %p cache blocks "LPU64"/"LPU64
" objects "LPU64"/"LPU64"\n",
obd->obd_name, &obd->obd_osfs,
obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
- cfs_spin_lock(&obd->obd_osfs_lock);
- memcpy(oinfo->oi_osfs, &obd->obd_osfs, sizeof(*oinfo->oi_osfs));
- cfs_spin_unlock(&obd->obd_osfs_lock);
+ spin_lock(&obd->obd_osfs_lock);
+ memcpy(oinfo->oi_osfs, &obd->obd_osfs, sizeof(*oinfo->oi_osfs));
+ spin_unlock(&obd->obd_osfs_lock);
oinfo->oi_flags |= OBD_STATFS_FROM_CACHE;
if (oinfo->oi_cb_up)
oinfo->oi_cb_up(oinfo, 0);
RETURN(rc);
}
-static inline int obd_statfs_rqset(struct obd_device *obd,
+static inline int obd_statfs_rqset(struct obd_export *exp,
struct obd_statfs *osfs, __u64 max_age,
__u32 flags)
{
oinfo.oi_osfs = osfs;
oinfo.oi_flags = flags;
- rc = obd_statfs_async(obd, &oinfo, max_age, set);
+ rc = obd_statfs_async(exp, &oinfo, max_age, set);
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
/* @max_age is the oldest time in jiffies that we accept using a cached data.
* If the cache is older than @max_age we will get a new value from the
* target. Use a value of "cfs_time_current() + HZ" to guarantee freshness. */
-static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
- __u64 max_age, __u32 flags)
+static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
+ struct obd_statfs *osfs, __u64 max_age,
+ __u32 flags)
{
int rc = 0;
+ struct obd_device *obd = exp->exp_obd;
ENTRY;
if (obd == NULL)
CDEBUG(D_SUPER, "osfs "LPU64", max_age "LPU64"\n",
obd->obd_osfs_age, max_age);
if (cfs_time_before_64(obd->obd_osfs_age, max_age)) {
- rc = OBP(obd, statfs)(obd, osfs, max_age, flags);
+ rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags);
if (rc == 0) {
- cfs_spin_lock(&obd->obd_osfs_lock);
- memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
- obd->obd_osfs_age = cfs_time_current_64();
- cfs_spin_unlock(&obd->obd_osfs_lock);
- }
- } else {
- CDEBUG(D_SUPER,"%s: use %p cache blocks "LPU64"/"LPU64
- " objects "LPU64"/"LPU64"\n",
- obd->obd_name, &obd->obd_osfs,
- obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
- obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
- cfs_spin_lock(&obd->obd_osfs_lock);
- memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
- cfs_spin_unlock(&obd->obd_osfs_lock);
- }
- RETURN(rc);
+ spin_lock(&obd->obd_osfs_lock);
+ memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs));
+ obd->obd_osfs_age = cfs_time_current_64();
+ spin_unlock(&obd->obd_osfs_lock);
+ }
+ } else {
+ CDEBUG(D_SUPER, "%s: use %p cache blocks "LPU64"/"LPU64
+ " objects "LPU64"/"LPU64"\n",
+ obd->obd_name, &obd->obd_osfs,
+ obd->obd_osfs.os_bavail, obd->obd_osfs.os_blocks,
+ obd->obd_osfs.os_ffree, obd->obd_osfs.os_files);
+ spin_lock(&obd->obd_osfs_lock);
+ memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
+ spin_unlock(&obd->obd_osfs_lock);
+ }
+ RETURN(rc);
}
static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo,
if (set == NULL)
RETURN(-ENOMEM);
- rc = OBP(exp->exp_obd, sync)(exp, oinfo, start, end, set);
+ rc = OBP(exp->exp_obd, sync)(NULL, exp, oinfo, start, end, set);
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
RETURN(rc);
}
-static inline int obd_sync(struct obd_export *exp, struct obd_info *oinfo,
- obd_size start, obd_size end,
+static inline int obd_sync(const struct lu_env *env, struct obd_export *exp,
+ struct obd_info *oinfo, obd_size start, obd_size end,
struct ptlrpc_request_set *set)
{
int rc;
OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP);
EXP_COUNTER_INCREMENT(exp, sync);
- rc = OBP(exp->exp_obd, sync)(exp, oinfo, start, end, set);
+ rc = OBP(exp->exp_obd, sync)(env, exp, oinfo, start, end, set);
RETURN(rc);
}
if (set == NULL)
RETURN(-ENOMEM);
- rc = OBP(exp->exp_obd, punch)(exp, oinfo, oti, set);
+ rc = OBP(exp->exp_obd, punch)(NULL, exp, oinfo, oti, set);
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
RETURN(rc);
}
-static inline int obd_punch(struct obd_export *exp, struct obd_info *oinfo,
- struct obd_trans_info *oti,
+static inline int obd_punch(const struct lu_env *env, struct obd_export *exp,
+ struct obd_info *oinfo, struct obd_trans_info *oti,
struct ptlrpc_request_set *rqset)
{
int rc;
EXP_CHECK_DT_OP(exp, punch);
EXP_COUNTER_INCREMENT(exp, punch);
- rc = OBP(exp->exp_obd, punch)(exp, oinfo, oti, rqset);
+ rc = OBP(exp->exp_obd, punch)(env, exp, oinfo, oti, rqset);
RETURN(rc);
}
RETURN(rc);
}
-static inline int obd_preprw(int cmd, struct obd_export *exp, struct obdo *oa,
+static inline int obd_preprw(const struct lu_env *env, int cmd,
+ struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj,
struct niobuf_remote *remote, int *pages,
struct niobuf_local *local,
EXP_CHECK_DT_OP(exp, preprw);
EXP_COUNTER_INCREMENT(exp, preprw);
- rc = OBP(exp->exp_obd, preprw)(cmd, exp, oa, objcount, obj, remote,
+ rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote,
pages, local, oti, capa);
RETURN(rc);
}
-static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa,
+static inline int obd_commitrw(const struct lu_env *env, int cmd,
+ struct obd_export *exp, struct obdo *oa,
int objcount, struct obd_ioobj *obj,
struct niobuf_remote *rnb, int pages,
struct niobuf_local *local,
EXP_CHECK_DT_OP(exp, commitrw);
EXP_COUNTER_INCREMENT(exp, commitrw);
- rc = OBP(exp->exp_obd, commitrw)(cmd, exp, oa, objcount, obj,
+ rc = OBP(exp->exp_obd, commitrw)(env, cmd, exp, oa, objcount, obj,
rnb, pages, local, oti, rc);
RETURN(rc);
}
}
if (!OBP(obd, notify)) {
- CERROR("obd %s has no notify handler\n", obd->obd_name);
+ CDEBUG(D_HA, "obd %s has no notify handler\n", obd->obd_name);
RETURN(-ENOSYS);
}
RETURN(rc);
}
-static inline int obd_quota_adjust_qunit(struct obd_export *exp,
- struct quota_adjust_qunit *oqaq,
- struct lustre_quota_ctxt *qctxt,
- struct ptlrpc_request_set *set)
-{
-#if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
- struct timeval work_start;
- struct timeval work_end;
- long timediff;
-#endif
- int rc;
- ENTRY;
-
-#if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
- if (qctxt)
- cfs_gettimeofday(&work_start);
-#endif
- EXP_CHECK_DT_OP(exp, quota_adjust_qunit);
- EXP_COUNTER_INCREMENT(exp, quota_adjust_qunit);
-
- rc = OBP(exp->exp_obd, quota_adjust_qunit)(exp, oqaq, qctxt, set);
-
-#if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
- if (qctxt) {
- cfs_gettimeofday(&work_end);
- timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
- lprocfs_counter_add(qctxt->lqc_stats, LQUOTA_ADJUST_QUNIT,
- timediff);
- }
-#endif
- RETURN(rc);
-}
-
-static inline int obd_health_check(struct obd_device *obd)
+static inline int obd_health_check(const struct lu_env *env,
+ struct obd_device *obd)
{
/* returns: 0 on healthy
* >0 on unhealthy + reason code/flag
if (!OBP(obd, health_check))
RETURN(0);
- rc = OBP(obd, health_check)(obd);
+ rc = OBP(obd, health_check)(env, obd);
RETURN(rc);
}
{
ENTRY;
OBD_CHECK_DEV(obd);
- cfs_down_write(&obd->obd_observer_link_sem);
+ down_write(&obd->obd_observer_link_sem);
if (obd->obd_observer && observer) {
- cfs_up_write(&obd->obd_observer_link_sem);
+ up_write(&obd->obd_observer_link_sem);
RETURN(-EALREADY);
}
obd->obd_observer = observer;
- cfs_up_write(&obd->obd_observer_link_sem);
+ up_write(&obd->obd_observer_link_sem);
RETURN(0);
}
struct obd_device **observer)
{
ENTRY;
- cfs_down_read(&obd->obd_observer_link_sem);
+ down_read(&obd->obd_observer_link_sem);
if (!obd->obd_observer) {
*observer = NULL;
- cfs_up_read(&obd->obd_observer_link_sem);
+ up_read(&obd->obd_observer_link_sem);
RETURN(-ENOENT);
}
*observer = obd->obd_observer;
static inline int obd_unpin_observer(struct obd_device *obd)
{
ENTRY;
- cfs_up_read(&obd->obd_observer_link_sem);
+ up_read(&obd->obd_observer_link_sem);
RETURN(0);
}
RETURN(rc);
}
-static inline int md_change_cbdata(struct obd_export *exp,
- const struct lu_fid *fid,
- ldlm_iterator_t it, void *data)
+static inline int md_null_inode(struct obd_export *exp,
+ const struct lu_fid *fid)
{
int rc;
ENTRY;
- EXP_CHECK_MD_OP(exp, change_cbdata);
- EXP_MD_COUNTER_INCREMENT(exp, change_cbdata);
- rc = MDP(exp->exp_obd, change_cbdata)(exp, fid, it, data);
+ EXP_CHECK_MD_OP(exp, null_inode);
+ EXP_MD_COUNTER_INCREMENT(exp, null_inode);
+ rc = MDP(exp->exp_obd, null_inode)(exp, fid);
RETURN(rc);
}
}
static inline int md_intent_lock(struct obd_export *exp,
- struct md_op_data *op_data, void *lmm,
- int lmmsize, struct lookup_intent *it,
- int flags, struct ptlrpc_request **reqp,
- ldlm_blocking_callback cb_blocking,
- int extra_lock_flags)
+ struct md_op_data *op_data, void *lmm,
+ int lmmsize, struct lookup_intent *it,
+ int lookup_flags, struct ptlrpc_request **reqp,
+ ldlm_blocking_callback cb_blocking,
+ __u64 extra_lock_flags)
{
int rc;
ENTRY;
EXP_CHECK_MD_OP(exp, intent_lock);
EXP_MD_COUNTER_INCREMENT(exp, intent_lock);
rc = MDP(exp->exp_obd, intent_lock)(exp, op_data, lmm, lmmsize,
- it, flags, reqp, cb_blocking,
+ it, lookup_flags, reqp, cb_blocking,
extra_lock_flags);
RETURN(rc);
}
RETURN(rc);
}
-static inline int md_readpage(struct obd_export *exp, const struct lu_fid *fid,
- struct obd_capa *oc, __u64 offset,
- struct page **pages, unsigned npages,
+static inline int md_readpage(struct obd_export *exp, struct md_op_data *opdata,
+ struct page **pages,
struct ptlrpc_request **request)
{
int rc;
ENTRY;
EXP_CHECK_MD_OP(exp, readpage);
EXP_MD_COUNTER_INCREMENT(exp, readpage);
- rc = MDP(exp->exp_obd, readpage)(exp, fid, oc, offset, pages, npages,
- request);
+ rc = MDP(exp->exp_obd, readpage)(exp, opdata, pages, request);
RETURN(rc);
}
RETURN(rc);
}
-static inline ldlm_mode_t md_lock_match(struct obd_export *exp, int flags,
+static inline ldlm_mode_t md_lock_match(struct obd_export *exp, __u64 flags,
const struct lu_fid *fid,
ldlm_type_t type,
ldlm_policy_data_t *policy,
static inline int md_revalidate_lock(struct obd_export *exp,
struct lookup_intent *it,
- struct lu_fid *fid)
+ struct lu_fid *fid, __u64 *bits)
{
int rc;
ENTRY;
EXP_CHECK_MD_OP(exp, revalidate_lock);
EXP_MD_COUNTER_INCREMENT(exp, revalidate_lock);
- rc = MDP(exp->exp_obd, revalidate_lock)(exp, it, fid);
+ rc = MDP(exp->exp_obd, revalidate_lock)(exp, it, fid, bits);
RETURN(rc);
}
extern void obd_cleanup_caches(void);
/* support routines */
-extern cfs_mem_cache_t *obdo_cachep;
+extern struct kmem_cache *obdo_cachep;
#define OBDO_ALLOC(ptr) \
do { \
- OBD_SLAB_ALLOC_PTR_GFP((ptr), obdo_cachep, CFS_ALLOC_IO); \
+ OBD_SLAB_ALLOC_PTR_GFP((ptr), obdo_cachep, __GFP_IO); \
} while(0)
#define OBDO_FREE(ptr) \
/* something here */
}
+typedef int (*register_lwp_cb)(void *data);
+
+struct lwp_register_item {
+ struct obd_export **lri_exp;
+ register_lwp_cb lri_cb_func;
+ void *lri_cb_data;
+ cfs_list_t lri_list;
+ char lri_name[MTI_NAME_MAXLEN];
+};
+
/* I'm as embarrassed about this as you are.
*
* <shaver> // XXX do not look into _superhack with remaining eye
* <shaver> // XXX if this were any uglier, I'd get my own show on MTV */
extern int (*ptlrpc_put_connection_superhack)(struct ptlrpc_connection *c);
+/* obd_mount.c */
+#ifdef HAVE_SERVER_SUPPORT
+int lustre_register_lwp_item(const char *lwpname, struct obd_export **exp,
+ register_lwp_cb cb_func, void *cb_data);
+void lustre_deregister_lwp_item(struct obd_export **exp);
+int tgt_name2lwpname(const char *tgt_name, char *lwp_name);
+#endif /* HAVE_SERVER_SUPPORT */
+
/* sysctl.c */
extern void obd_sysctl_init (void);
extern void obd_sysctl_clean (void);