/* client.c */
-int client_sanobd_setup(struct obd_device *obddev, obd_count len, void *buf);
+int client_sanobd_setup(struct obd_device *obddev, struct lustre_cfg* lcfg);
struct client_obd *client_conn2cli(struct lustre_handle *conn);
struct mdc_open_data;
#define LDLM_MAXREQSIZE (5 * 1024)
#define LDLM_MAXREPSIZE (1024)
+#define MDT_MIN_THREADS 2UL
#define MDT_MAX_THREADS 32UL
#define MDT_NUM_THREADS max(min_t(unsigned long, MDT_MAX_THREADS, \
num_physpages >> (25 - PAGE_SHIFT)), 2UL)
}
/* ldlm/ldlm_lib.c */
-int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf);
+int client_obd_setup(struct obd_device *obddev, struct lustre_cfg* lcfg);
int client_obd_cleanup(struct obd_device * obddev);
int client_connect_import(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid, struct obd_connect_data *);
static int quotfmt_test_5(struct lustre_quota_info *lqi)
{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
int i, rc = 0;
for (i = USRQUOTA; i < MAXQUOTAS && !rc; i++) {
RETURN(0);
}
-static int quotfmt_test_setup(struct obd_device *obd, obd_count len, void *buf)
+static int quotfmt_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg *lcfg = buf;
struct obd_device *tgt;
int rc;
ENTRY;
* 2 - server UUID
* 3 - inactive-on-startup
*/
-int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf)
+int client_obd_setup(struct obd_device *obddev, struct lustre_cfg* lcfg)
{
- struct lustre_cfg* lcfg = buf;
struct client_obd *cli = &obddev->u.cli;
struct obd_import *imp;
struct obd_uuid server_uuid;
tgt_obd = class_find_client_obd(tgt_uuid, LUSTRE_OSC_NAME,
&obd->obd_uuid);
-
+
if (!tgt_obd) {
CERROR("Target %s not attached\n", obd_uuid2str(tgt_uuid));
RETURN(-EINVAL);
}
-
+
CDEBUG(D_CONFIG, "Connect tgt %s (%s)\n", obd_uuid2str(tgt_uuid),
tgt_obd->obd_name);
if (activate) {
tgt_obd->obd_no_recov = 0;
- /* FIXME this is probably supposed to be
+ /* FIXME this is probably supposed to be
ptlrpc_set_import_active. Horrible naming. */
ptlrpc_activate_import(tgt_obd->u.cli.cl_import);
}
int rc;
ENTRY;
- lov->ocd.ocd_connect_flags = OBD_CONNECT_EMPTY;
- if (data)
+ lov->ocd.ocd_connect_flags = OBD_CONNECT_EMPTY;
+ if (data)
lov->ocd = *data;
rc = class_connect(conn, obd, cluuid);
- if (!rc)
+ if (!rc)
lov->connects++;
CDEBUG(D_CONFIG, "connect #%d\n", lov->connects);
int rc;
ENTRY;
- CDEBUG(D_CONFIG, "%s: disconnecting target %s\n",
+ CDEBUG(D_CONFIG, "%s: disconnecting target %s\n",
obd->obd_name, osc_obd->obd_name);
lov_proc_dir = lprocfs_srch(obd->obd_proc_entry, "target_obds");
struct obd_uuid *uuid;
LASSERT(watched);
-
+
if (strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) {
CERROR("unexpected notification of %s %s!\n",
watched->obd_type->typ_name,
struct lov_tgt_desc *tgt;
struct obd_device *tgt_obd;
int i;
- for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count;
+ for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count;
i++, tgt++) {
if (obd_uuid_empty(&tgt->uuid))
continue;
rc = obd_notify_observer(obd, tgt_obd, ev, data);
if (rc) {
CERROR("%s: notify %s of %s failed %d\n",
- obd->obd_name,
+ obd->obd_name,
obd->obd_observer->obd_name,
tgt_obd->obd_name, rc);
break;
osc_obd->obd_no_recov = 0;
}
- if (lov->ocd.ocd_connect_flags != OBD_CONNECT_EMPTY) {
+ if (lov->ocd.ocd_connect_flags != OBD_CONNECT_EMPTY) {
/* Keep the original connect flags pristine */
OBD_ALLOC(ocd, sizeof(*ocd));
- if (!ocd)
+ if (!ocd)
RETURN(-ENOMEM);
*ocd = lov->ocd;
}
GOTO(out, rc);
idx = index;
- rc = lov_notify(obd, tgt->ltd_exp->exp_obd,
+ rc = lov_notify(obd, tgt->ltd_exp->exp_obd,
active ? OBD_NOTIFY_ACTIVE : OBD_NOTIFY_INACTIVE,
(void *)&idx);
out:
if (rc) {
- CERROR("add failed (%d), deleting %s\n", rc,
+ CERROR("add failed (%d), deleting %s\n", rc,
(char *)tgt->uuid.uuid);
lov_del_target(obd, &tgt->uuid, index, 0);
}
}
/* Schedule a target for deletion */
-static int lov_del_target(struct obd_device *obd, struct obd_uuid *uuidp,
+static int lov_del_target(struct obd_device *obd, struct obd_uuid *uuidp,
int index, int gen)
{
struct lov_obd *lov = &obd->u.lov;
LASSERT(tgt->reap);
osc_obd = class_exp2obd(tgt->ltd_exp);
- CDEBUG(D_CONFIG, "Removing tgt %s : %s\n", tgt->uuid.uuid,
+ CDEBUG(D_CONFIG, "Removing tgt %s : %s\n", tgt->uuid.uuid,
osc_obd ? osc_obd->obd_name : "<no obd>");
if (tgt->ltd_exp)
desc->ld_default_stripe_count = 1;
/* from lov_setstripe */
- if ((desc->ld_pattern != 0) &&
+ if ((desc->ld_pattern != 0) &&
(desc->ld_pattern != LOV_PATTERN_RAID0)) {
CDEBUG(D_IOCTL, "bad userland stripe pattern: %#x\n",
desc->ld_pattern);
}
}
-static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
+static int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg *lcfg = buf;
struct lov_desc *desc;
struct lov_obd *lov = &obd->u.lov;
int count;
}
static
-int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size,
+int mdc_getattr_common(struct obd_export *exp, unsigned int ea_size,
unsigned int acl_size, struct ptlrpc_request *req)
{
struct mds_body *body;
RETURN (-EPROTO);
}
}
-
+
if (body->valid & OBD_MD_FLMODEASIZE) {
- if (exp->exp_obd->u.cli.cl_max_mds_easize < body->max_mdsize)
- exp->exp_obd->u.cli.cl_max_mds_easize =
+ if (exp->exp_obd->u.cli.cl_max_mds_easize < body->max_mdsize)
+ exp->exp_obd->u.cli.cl_max_mds_easize =
body->max_mdsize;
- if (exp->exp_obd->u.cli.cl_max_mds_cookiesize <
+ if (exp->exp_obd->u.cli.cl_max_mds_cookiesize <
body->max_cookiesize)
- exp->exp_obd->u.cli.cl_max_mds_cookiesize =
+ exp->exp_obd->u.cli.cl_max_mds_cookiesize =
body->max_cookiesize;
}
GOTO(out, rc = -ENOMEM);
mdc_pack_req_body(req, MDS_REQ_REC_OFF, valid, fid, ea_len);
-
+
LASSERT (strnlen (filename, namelen) == namelen - 1);
memcpy(lustre_msg_buf(req->rq_reqmsg, 1, namelen), filename, namelen);
if (keylen == strlen("max_easize") &&
memcmp(key, "max_easize", strlen("max_easize")) == 0) {
int mdsize, *max_easize;
-
+
if (*vallen != sizeof(int))
RETURN(-EINVAL);
mdsize = *(int*)val;
RETURN(rc);
}
-static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
+static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
{
struct client_obd *cli = &obd->u.cli;
struct lprocfs_static_vars lvars;
GOTO(err_rpc_lock, rc = -ENOMEM);
mdc_init_rpc_lock(cli->cl_setattr_lock);
- rc = client_obd_setup(obd, len, buf);
+ rc = client_obd_setup(obd, cfg);
if (rc)
GOTO(err_setattr_lock, rc);
lprocfs_init_vars(mdc, &lvars);
stripes = min(desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT);
lsm.lsm_stripe_count = stripes;
size = obd_size_diskmd(lov_exp, &lsm);
-
+
if (cli->cl_max_mds_easize < size)
cli->cl_max_mds_easize = size;
CDEBUG(D_HA, "updating max_mdsize/max_cookiesize: %d/%d\n",
cli->cl_max_mds_easize, cli->cl_max_mds_cookiesize);
-
+
RETURN(0);
}
struct dentry *de = mds_fid2dentry(mds, fid, mnt), *retval = de;
struct ldlm_res_id res_id = { .name = {0} };
int flags = 0, rc;
- ldlm_policy_data_t policy = { .l_inodebits = { lockpart} };
+ ldlm_policy_data_t policy = { .l_inodebits = { lockpart} };
ENTRY;
if (IS_ERR(de))
RETURN(result);
}
-static int mds_connect_internal(struct obd_export *exp,
+static int mds_connect_internal(struct obd_export *exp,
struct obd_connect_data *data)
{
struct obd_device *obd = exp->exp_obd;
/* Swap to the old mds_server_data format, in case
someone wants to revert to a pre-1.6 lustre */
CDEBUG(D_CONFIG, "writing old last_rcvd format\n");
- /* malloc new struct instead of swap in-place because
+ /* malloc new struct instead of swap in-place because
we don't have a lock on the last_trasno or mount count -
someone may modify it while we're here, and we don't want
them to inc the wrong thing. */
OBD_ALLOC(lsd_copy, sizeof(*lsd_copy));
- if (!lsd_copy)
+ if (!lsd_copy)
RETURN(-ENOMEM);
*lsd_copy = *lsd;
lsd_copy->lsd_unused = lsd->lsd_last_transno;
if (rc)
CERROR("error writing MDS server data: rc = %d\n", rc);
- if (lsd_copy)
+ if (lsd_copy)
OBD_FREE(lsd_copy, sizeof(*lsd_copy));
RETURN(rc);
* 3 = config name
* 4 = mount options
*/
-static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
+static int mds_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg* lcfg = buf;
struct mds_obd *mds = &obd->u.mds;
struct lustre_mount_info *lmi;
struct vfsmount *mnt;
lustre_cfg_string(lcfg, 4));
fsoptions_to_mds_flags(mds, options);
}
-
+
mnt = do_kern_mount(lustre_cfg_string(lcfg, 2), 0,
- lustre_cfg_string(lcfg, 1),
+ lustre_cfg_string(lcfg, 1),
(void *)options);
free_page(page);
if (IS_ERR(mnt)) {
unlock_kernel();
mntput(mds->mds_vfsmnt);
lock_kernel();
- }
+ }
obd->u.obt.obt_sb = NULL;
return rc;
}
if (mds->mds_profile) {
struct lustre_profile *lprof;
- /* The profile defines which osc and mdc to connect to, for a
+ /* The profile defines which osc and mdc to connect to, for a
client. We reuse that here to figure out the name of the
lov to use (and ignore lprof->lp_mdc).
- The profile was set in the config log with
+ The profile was set in the config log with
LCFG_MOUNTOPT profilenm oscnm mdcnm */
lprof = class_get_profile(mds->mds_profile);
if (lprof == NULL) {
/* Notify the LOV, which will in turn call mds_notify for each tgt */
/* This means that we have to hack obd_notify to think we're obd_set_up
during mds_lov_connect. */
- obd_notify(obd->u.mds.mds_osc_obd, NULL,
+ obd_notify(obd->u.mds.mds_osc_obd, NULL,
obd->obd_async_recov ? OBD_NOTIFY_SYNC_NONBLOCK :
OBD_NOTIFY_SYNC, NULL);
lquota_cleanup(quota_interface, obd);
mds_update_server_data(obd, 1);
- if (mds->mds_lov_objids != NULL)
+ if (mds->mds_lov_objids != NULL)
OBD_FREE(mds->mds_lov_objids, mds->mds_lov_objids_size);
mds_fs_cleanup(obd);
unlock_kernel();
must_relock++;
}
-
- if (must_put)
+
+ if (must_put)
/* In case we didn't mount with lustre_get_mount -- old method*/
mntput(mds->mds_vfsmnt);
obd->u.obt.obt_sb = NULL;
RETURN(ELDLM_LOCK_REPLACED);
}
-static int mdt_setup(struct obd_device *obd, obd_count len, void *buf)
+static int mdt_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct mds_obd *mds = &obd->u.mds;
struct lprocfs_static_vars lvars;
return rc;
}
init_obd_quota_ops(quota_interface, &mds_obd_ops);
-
+
lprocfs_init_vars(mds, &lvars);
class_register_type(&mds_obd_ops, lvars.module_vars, LUSTRE_MDS_NAME);
lprocfs_init_vars(mdt, &lvars);
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
-
+
#ifndef EXPORT_SYMTAB
# define EXPORT_SYMTAB
#endif
char *name_end;
int len;
__u64 resname = 0;
-
+
/* fsname is at most 8 chars long at the beginning of the logname
e.g. "lustre-MDT0001" or "lustre" */
name_end = strrchr(logname, '-');
CDEBUG(D_MGC, "dropping config log %s\n", cld->cld_logname);
OBD_FREE(cld->cld_logname, strlen(cld->cld_logname) + 1);
if (cld->cld_cfg.cfg_instance != NULL)
- OBD_FREE(cld->cld_cfg.cfg_instance,
+ OBD_FREE(cld->cld_cfg.cfg_instance,
strlen(cld->cld_cfg.cfg_instance) + 1);
OBD_FREE(cld, sizeof(*cld));
}
EXIT;
}
-static struct config_llog_data *config_log_find(char *logname,
+static struct config_llog_data *config_log_find(char *logname,
struct config_llog_instance *cfg)
{
struct list_head *tmp;
spin_lock(&config_list_lock);
list_for_each(tmp, &config_llog_list) {
cld = list_entry(tmp, struct config_llog_data, cld_list_chain);
- if (match_instance && cld->cld_cfg.cfg_instance &&
+ if (match_instance && cld->cld_cfg.cfg_instance &&
strcmp(logid, cld->cld_cfg.cfg_instance) == 0)
goto out_found;
- if (!match_instance &&
+ if (!match_instance &&
strcmp(logid, cld->cld_logname) == 0)
goto out_found;
}
RETURN(cld);
}
-/* Add this log to our list of active logs.
+/* Add this log to our list of active logs.
We have one active log per "mount" - client instance or servername.
Each instance may be at a different point in the log. */
static int config_log_add(char *logname, struct config_llog_instance *cfg,
ENTRY;
CDEBUG(D_MGC, "adding config log %s:%s\n", logname, cfg->cfg_instance);
-
+
OBD_ALLOC(cld, sizeof(*cld));
- if (!cld)
+ if (!cld)
RETURN(-ENOMEM);
OBD_ALLOC(cld->cld_logname, strlen(logname) + 1);
- if (!cld->cld_logname) {
+ if (!cld->cld_logname) {
OBD_FREE(cld, sizeof(*cld));
RETURN(-ENOMEM);
}
cld->cld_cfg.cfg_sb = sb;
atomic_set(&cld->cld_refcount, 1);
if (cfg->cfg_instance != NULL) {
- OBD_ALLOC(cld->cld_cfg.cfg_instance,
+ OBD_ALLOC(cld->cld_cfg.cfg_instance,
strlen(cfg->cfg_instance) + 1);
strcpy(cld->cld_cfg.cfg_instance, cfg->cfg_instance);
}
spin_lock(&config_list_lock);
list_add(&cld->cld_list_chain, &config_llog_list);
spin_unlock(&config_list_lock);
-
+
RETURN(rc);
}
/* Stop watching for updates on this log. */
static int config_log_end(char *logname, struct config_llog_instance *cfg)
-{
+{
struct config_llog_data *cld;
int rc = 0;
ENTRY;
-
+
cld = config_log_find(logname, cfg);
- if (IS_ERR(cld))
+ if (IS_ERR(cld))
RETURN(PTR_ERR(cld));
/* drop the ref from the find */
config_log_put(cld);
struct list_head *tmp, *n;
struct config_llog_data *cld;
ENTRY;
-
+
spin_lock(&config_list_lock);
list_for_each_safe(tmp, n, &config_llog_list) {
cld = list_entry(tmp, struct config_llog_data, cld_list_chain);
/********************** class fns **********************/
-static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb,
+static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb,
struct vfsmount *mnt)
{
struct lvfs_run_ctxt saved;
obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
if (IS_ERR(obd->obd_fsops)) {
up(&cli->cl_mgc_sem);
- CERROR("No fstype %s rc=%ld\n", MT_STR(lsi->lsi_ldd),
+ CERROR("No fstype %s rc=%ld\n", MT_STR(lsi->lsi_ldd),
PTR_ERR(obd->obd_fsops));
RETURN(PTR_ERR(obd->obd_fsops));
}
cli->cl_mgc_vfsmnt = mnt;
- // FIXME which is the right SB? - filter_common_setup also
+ // FIXME which is the right SB? - filter_common_setup also
CDEBUG(D_MGC, "SB's: fill=%p mnt=%p root=%p\n", sb, mnt->mnt_sb,
mnt->mnt_root->d_inode->i_sb);
fsfilt_setup(obd, mnt->mnt_sb);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
if (IS_ERR(dentry)) {
err = PTR_ERR(dentry);
- CERROR("cannot lookup %s directory: rc = %d\n",
+ CERROR("cannot lookup %s directory: rc = %d\n",
MOUNT_CONFIGS_DIR, err);
GOTO(err_ops, err);
}
/* We keep the cl_mgc_sem until mgc_fs_cleanup */
RETURN(0);
-err_ops:
+err_ops:
fsfilt_put_ops(obd->obd_fsops);
obd->obd_fsops = NULL;
cli->cl_mgc_vfsmnt = NULL;
struct lvfs_run_ctxt saved;
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
l_dput(cli->cl_mgc_configs_dir);
- cli->cl_mgc_configs_dir = NULL;
+ cli->cl_mgc_configs_dir = NULL;
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
}
cli->cl_mgc_vfsmnt = NULL;
- if (obd->obd_fsops)
+ if (obd->obd_fsops)
fsfilt_put_ops(obd->obd_fsops);
-
+
up(&cli->cl_mgc_sem);
RETURN(rc);
}
/* FIXME calls to mgc_fs_setup must take an obd ref to insure there's
no fs by the time we get here. */
LASSERT(cli->cl_mgc_vfsmnt == NULL);
-
+
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
static struct obd_device *the_mgc;
-static int mgc_setup(struct obd_device *obd, obd_count len, void *buf)
+static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
int rc;
ENTRY;
ptlrpcd_addref();
- rc = client_obd_setup(obd, len, buf);
+ rc = client_obd_setup(obd, lcfg);
if (rc)
GOTO(err_decref, rc);
RETURN(rc);
}
-static int mgc_process_log(struct obd_device *mgc,
+static int mgc_process_log(struct obd_device *mgc,
struct config_llog_data *cld);
/* FIXME I don't want a thread for every cld; make a list of cld's to requeue
int rc = 0;
ENTRY;
- if (!data)
+ if (!data)
RETURN(-EINVAL);
- if (cld->cld_stopping)
+ if (cld->cld_stopping)
GOTO(out, rc = 0);
lock_kernel();
sigfillset(¤t->blocked);
RECALC_SIGPENDING;
SIGNAL_MASK_UNLOCK(current, flags);
- THREAD_NAME(current->comm, sizeof(current->comm) - 1, "reQ %s",
+ THREAD_NAME(current->comm, sizeof(current->comm) - 1, "reQ %s",
cld->cld_logname);
unlock_kernel();
- CDEBUG(D_MGC, "requeue "LPX64" %s:%s\n",
- cld->cld_resid.name[0], cld->cld_logname,
+ CDEBUG(D_MGC, "requeue "LPX64" %s:%s\n",
+ cld->cld_resid.name[0], cld->cld_logname,
cld->cld_cfg.cfg_instance);
-
+
/* Sleep a few seconds to allow the server who caused
the lock revocation to finish its setup, plus some random
so everyone doesn't try to reconnect at once. */
every server at every update. Turning it off until I'm sure
it's needed. */
server_register_target(cld->cld_cfg.cfg_sb);
-#endif
+#endif
rc = mgc_process_log(the_mgc, cld);
class_export_put(the_mgc->obd_self_export);
out:
- /* Whether we enqueued again or not in mgc_process_log,
- we're done with the ref from the old mgc_blocking_ast */
- config_log_put(cld);
+ /* Whether we enqueued again or not in mgc_process_log,
+ we're done with the ref from the old mgc_blocking_ast */
+ config_log_put(cld);
RETURN(rc);
}
case LDLM_CB_CANCELING: {
/* We've given up the lock, prepare ourselves to update. */
LDLM_DEBUG(lock, "MGC cancel CB");
-
+
CDEBUG(D_MGC, "Lock res "LPX64" (%.8s)\n",
- lock->l_resource->lr_name.name[0],
+ lock->l_resource->lr_name.name[0],
(char *)&lock->l_resource->lr_name.name[0]);
/* Make sure not to re-enqueue when the mgc is stopping
/* Drop this here or in mgc_async_requeue,
in either case, we're done with the reference
after this. */
- config_log_put(cld);
+ config_log_put(cld);
break;
}
default:
if (rc) {
- CERROR("%s CB failed %d:\n", flag == LDLM_CB_BLOCKING ?
+ CERROR("%s CB failed %d:\n", flag == LDLM_CB_BLOCKING ?
"blocking" : "cancel", rc);
LDLM_ERROR(lock, "MGC ast");
}
int *flags, void *bl_cb, void *cp_cb, void *gl_cb,
void *data, __u32 lvb_len, void *lvb_swabber,
struct lustre_handle *lockh)
-{
+{
struct config_llog_data *cld = (struct config_llog_data *)data;
struct obd_device *obd = class_exp2obd(exp);
int rc;
CDEBUG(D_MGC, "Enqueue for %s (res "LPX64")\n", cld->cld_logname,
cld->cld_resid.name[0]);
-
+
/* We can only drop this config log ref when we drop the lock */
if (config_log_get(cld))
RETURN(ELDLM_LOCK_ABORTED);
ldlm_lock_match (see rev 1.1.2.11.2.47) */
rc = ldlm_cli_enqueue(exp, NULL, obd->obd_namespace, cld->cld_resid,
- type, NULL, mode, flags,
+ type, NULL, mode, flags,
mgc_blocking_ast, ldlm_completion_ast, NULL,
data, NULL, 0, NULL, lockh);
RETURN(-ENOMEM);
req_mti = lustre_msg_buf(req->rq_reqmsg, 0, sizeof(*req_mti));
- if (!req_mti)
+ if (!req_mti)
RETURN(-ENOMEM);
memcpy(req_mti, mti, sizeof(*req_mti));
req->rq_replen = lustre_msg_size(1, &rep_size);
CDEBUG(D_MGC, "register %s\n", mti->mti_svname);
-
+
rc = ptlrpc_queue_wait(req);
if (!rc) {
rep_mti = lustre_swab_repbuf(req, 0, sizeof(*rep_mti),
exp->exp_obd->obd_name, imp->imp_initial_recov_bk);
if (imp->imp_invalid) {
/* Resurrect if we previously died */
- CDEBUG(D_MGC, "Reactivate %s %d:%d:%d\n",
+ CDEBUG(D_MGC, "Reactivate %s %d:%d:%d\n",
imp->imp_obd->obd_name,
- imp->imp_deactive, imp->imp_invalid,
+ imp->imp_deactive, imp->imp_invalid,
imp->imp_state);
/* can't put this in obdclass, module loop with ptlrpc*/
- /* This seems to be necessary when restarting a
+ /* This seems to be necessary when restarting a
combo mgs/mdt while the mgc is alive */
ptlrpc_invalidate_import(imp);
/* Remove 'invalid' flag */
}
RETURN(rc);
-}
+}
static int mgc_import_event(struct obd_device *obd,
struct obd_import *imp,
break;
}
- case IMP_EVENT_DISCON:
- case IMP_EVENT_INACTIVE:
- case IMP_EVENT_ACTIVE:
+ case IMP_EVENT_DISCON:
+ case IMP_EVENT_INACTIVE:
+ case IMP_EVENT_ACTIVE:
case IMP_EVENT_OCD:
break;
default:
return(rc <= 1);
}
-static int mgc_copy_handler(struct llog_handle *llh, struct llog_rec_hdr *rec,
+static int mgc_copy_handler(struct llog_handle *llh, struct llog_rec_hdr *rec,
void *data)
{
struct llog_rec_hdr local_rec = *rec;
/* FIXME we should always write to an empty log, so remove this check.*/
/* append new records */
- if (rec->lrh_index >= llog_get_size(local_llh)) {
- rc = llog_write_rec(local_llh, &local_rec, NULL, 0,
+ if (rec->lrh_index >= llog_get_size(local_llh)) {
+ rc = llog_write_rec(local_llh, &local_rec, NULL, 0,
(void *)cfg_buf, -1);
- CDEBUG(D_INFO, "idx=%d, rc=%d, len=%d, cmd %x %s %s\n",
- rec->lrh_index, rc, rec->lrh_len, lcfg->lcfg_command,
+ CDEBUG(D_INFO, "idx=%d, rc=%d, len=%d, cmd %x %s %s\n",
+ rec->lrh_index, rc, rec->lrh_len, lcfg->lcfg_command,
lustre_cfg_string(lcfg, 0), lustre_cfg_string(lcfg, 1));
} else {
CDEBUG(D_INFO, "skip idx=%d\n", rec->lrh_index);
/* Get a config log from the MGS and process it.
This func is called for both clients and servers. */
-static int mgc_process_log(struct obd_device *mgc,
+static int mgc_process_log(struct obd_device *mgc,
struct config_llog_data *cld)
{
struct llog_ctxt *ctxt, *lctxt;
CERROR("Missing cld, aborting log update\n");
RETURN(-EINVAL);
}
- if (cld->cld_stopping)
+ if (cld->cld_stopping)
RETURN(0);
lsi = s2lsi(cld->cld_cfg.cfg_sb);
- CDEBUG(D_MGC, "Process log %s:%s from %d\n", cld->cld_logname,
+ CDEBUG(D_MGC, "Process log %s:%s from %d\n", cld->cld_logname,
cld->cld_cfg.cfg_instance, cld->cld_cfg.cfg_last_idx + 1);
ctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT);
RETURN(-EINVAL);
}
- /* I don't want mutliple processes running process_log at once --
- sounds like badness. It actually might be fine, as long as
+ /* I don't want mutliple processes running process_log at once --
+ sounds like badness. It actually might be fine, as long as
we're not trying to update from the same log
simultaneously (in which case we should use a per-log sem.) */
down(&llog_process_lock);
/* Get the cfg lock on the llog */
- rcl = mgc_enqueue(mgc->u.cli.cl_mgc_mgsexp, NULL, LDLM_PLAIN, NULL,
- LCK_CR, &flags, NULL, NULL, NULL,
+ rcl = mgc_enqueue(mgc->u.cli.cl_mgc_mgsexp, NULL, LDLM_PLAIN, NULL,
+ LCK_CR, &flags, NULL, NULL, NULL,
cld, 0, NULL, &lockh);
- if (rcl)
+ if (rcl)
CERROR("Can't get cfg lock: %d\n", rcl);
-
+
lctxt = llog_get_context(mgc, LLOG_CONFIG_ORIG_CTXT);
- /* Copy the setup log locally if we can. Don't mess around if we're
+ /* Copy the setup log locally if we can. Don't mess around if we're
running an MGS though (logs are already local). */
- if (lctxt && lsi && (lsi->lsi_flags & LSI_SERVER) &&
+ if (lctxt && lsi && (lsi->lsi_flags & LSI_SERVER) &&
(lsi->lsi_srv_mnt == cli->cl_mgc_vfsmnt) &&
!IS_MGS(lsi->lsi_ldd)) {
push_ctxt(&saved, &mgc->obd_lvfs_ctxt, NULL);
must_pop++;
- if (rcl == 0)
+ if (rcl == 0)
/* Only try to copy log if we have the lock. */
rc = mgc_copy_llog(mgc, ctxt, lctxt, cld->cld_logname);
if (rcl || rc) {
"local copy.\n", cld->cld_logname);
}
/* Now, whether we copied or not, start using the local llog.
- If we failed to copy, we'll start using whatever the old
+ If we failed to copy, we'll start using whatever the old
log has. */
ctxt = lctxt;
}
- /* logname and instance info should be the same, so use our
+ /* logname and instance info should be the same, so use our
copy of the instance for the update. The cfg_last_idx will
be updated here. */
rc = class_config_parse_llog(ctxt, cld->cld_logname, &cld->cld_cfg);
-
+
out_pop:
- if (must_pop)
+ if (must_pop)
pop_ctxt(&saved, &mgc->obd_lvfs_ctxt, NULL);
- /* Now drop the lock so MGS can revoke it */
+ /* Now drop the lock so MGS can revoke it */
if (!rcl) {
- rcl = mgc_cancel(mgc->u.cli.cl_mgc_mgsexp, NULL,
+ rcl = mgc_cancel(mgc->u.cli.cl_mgc_mgsexp, NULL,
LCK_CR, &lockh);
- if (rcl)
+ if (rcl)
CERROR("Can't drop cfg lock: %d\n", rcl);
}
-
+
if (rc) {
CERROR("%s: the configuration '%s' could not be read "
"(%d) from the MGS.\n",
}
up(&llog_process_lock);
-
+
RETURN(rc);
}
case LCFG_LOV_ADD_OBD: {
struct mgs_target_info *mti;
- if (LUSTRE_CFG_BUFLEN(lcfg, 1) !=
+ if (LUSTRE_CFG_BUFLEN(lcfg, 1) !=
sizeof(struct mgs_target_info))
GOTO(out, rc = -EINVAL);
mti = (struct mgs_target_info *)lustre_cfg_buf(lcfg, 1);
- CDEBUG(D_MGC, "add_target %s %#x\n",
+ CDEBUG(D_MGC, "add_target %s %#x\n",
mti->mti_svname, mti->mti_flags);
rc = mgc_target_register(obd->u.cli.cl_mgc_mgsexp, mti);
break;
}
- case LCFG_LOV_DEL_OBD:
+ case LCFG_LOV_DEL_OBD:
/* FIXME */
CERROR("lov_del_obd unimplemented\n");
rc = -ENOSYS;
char *logname = lustre_cfg_string(lcfg, 1);
cfg = (struct config_llog_instance *)lustre_cfg_buf(lcfg, 2);
sb = *(struct super_block **)lustre_cfg_buf(lcfg, 3);
-
- CDEBUG(D_MGC, "parse_log %s from %d\n", logname,
+
+ CDEBUG(D_MGC, "parse_log %s from %d\n", logname,
cfg->cfg_last_idx);
/* We're only called through here on the initial mount */
rc = config_log_add(logname, cfg, sb);
- if (rc)
+ if (rc)
break;
cld = config_log_find(logname, cfg);
if (IS_ERR(cld)) {
rc = PTR_ERR(cld);
break;
}
-
+
/* COMPAT_146 */
/* For old logs, there was no start marker. */
/* FIXME only set this for old logs! */
cld->cld_cfg.cfg_flags |= CFG_F_MARKER;
-
+
rc = mgc_process_log(obd, cld);
config_log_put(cld);
-
- break;
+
+ break;
}
case LCFG_LOG_END: {
struct config_llog_instance *cfg = NULL;
static int mgs_handle(struct ptlrpc_request *req);
/* Start the MGS obd */
-static int mgs_setup(struct obd_device *obd, obd_count len, void *buf)
+static int mgs_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct lprocfs_static_vars lvars;
struct mgs_obd *mgs = &obd->u.mgs;
/* Find our disk */
lmi = server_get_mount(obd->obd_name);
- if (!lmi)
+ if (!lmi)
RETURN(rc = -EINVAL);
mnt = lmi->lmi_mnt;
/* Start the service threads */
mgs->mgs_service =
ptlrpc_init_svc(MGS_NBUFS, MGS_BUFSIZE, MGS_MAXREQSIZE,
- MGS_MAXREPSIZE, MGS_REQUEST_PORTAL,
+ MGS_MAXREPSIZE, MGS_REQUEST_PORTAL,
MGC_REPLY_PORTAL, MGS_SERVICE_WATCHDOG_TIMEOUT,
- mgs_handle, LUSTRE_MGS_NAME,
+ mgs_handle, LUSTRE_MGS_NAME,
obd->obd_proc_entry, NULL, MGS_NUM_THREADS);
if (!mgs->mgs_service) {
RETURN(0);
save_dev = lvfs_sbdev(mgs->mgs_sb);
-
+
lprocfs_obd_cleanup(obd);
ptlrpc_unregister_service(mgs->mgs_service);
ENTRY;
rc = mgc_logname2resid(fsname, &res_id);
- if (!rc)
+ if (!rc)
rc = ldlm_cli_enqueue(NULL, NULL, obd->obd_namespace, res_id,
LDLM_PLAIN, NULL, LCK_EX, &flags,
- ldlm_blocking_ast, ldlm_completion_ast,
+ ldlm_blocking_ast, ldlm_completion_ast,
NULL, fsname, NULL, 0, NULL, lockh);
- if (rc)
+ if (rc)
CERROR("can't take cfg lock for %s (%d)\n", fsname, rc);
-
+
RETURN(rc);
}
} else {
/* Index is correctly marked as used */
- /* If the logs don't contain the mti_nids then add
+ /* If the logs don't contain the mti_nids then add
them as failover nids */
rc = mgs_check_failnid(obd, mti);
}
/* Called whenever a target starts up. Flags indicate first connect, etc. */
static int mgs_handle_target_reg(struct ptlrpc_request *req)
-{
+{
struct obd_device *obd = req->rq_export->exp_obd;
struct lustre_handle lockh;
struct mgs_target_info *mti, *rep_mti;
mti = lustre_swab_reqbuf(req, 0, sizeof(*mti),
lustre_swab_mgs_target_info);
-
+
if (!(mti->mti_flags & (LDD_F_WRITECONF | LDD_F_UPGRADE14 |
LDD_F_UPDATE))) {
/* We're just here as a startup ping. */
mti->mti_svname, obd_export_nid2str(req->rq_export));
rc = mgs_check_target(obd, mti);
/* above will set appropriate mti flags */
- if (!rc)
+ if (!rc)
/* Nothing wrong, don't revoke lock */
GOTO(out_nolock, rc);
}
/* Revoke the config lock to make sure nobody is reading. */
/* Although actually I think it should be alright if
- someone was reading while we were updating the logs - if we
+ someone was reading while we were updating the logs - if we
revoke at the end they will just update from where they left off. */
lockrc = mgs_get_cfg_lock(obd, mti->mti_fsname, &lockh);
if (lockrc != ELDLM_OK) {
CERROR("Can't upgrade from 1.4 (%d)\n", rc);
GOTO(out, rc);
}
-
+
mti->mti_flags &= ~LDD_F_UPGRADE14;
/* Turn off the upgrade flag permanently */
mti->mti_flags |= LDD_F_REWRITE_LDD;
/* end COMPAT_146 */
if (mti->mti_flags & LDD_F_UPDATE) {
- CDEBUG(D_MGS, "adding %s, index=%d\n", mti->mti_svname,
+ CDEBUG(D_MGS, "adding %s, index=%d\n", mti->mti_svname,
mti->mti_stripe_index);
-
- /* create the log for the new target
+
+ /* create the log for the new target
and update the client/mdt logs */
rc = mgs_write_log_target(obd, mti);
if (rc) {
- CERROR("Failed to write %s log (%d)\n",
+ CERROR("Failed to write %s log (%d)\n",
mti->mti_svname, rc);
GOTO(out, rc);
}
- mti->mti_flags &= ~(LDD_F_VIRGIN | LDD_F_UPDATE |
+ mti->mti_flags &= ~(LDD_F_VIRGIN | LDD_F_UPDATE |
LDD_F_NEED_INDEX);
mti->mti_flags |= LDD_F_REWRITE_LDD;
}
if (lockrc == ELDLM_OK)
mgs_put_cfg_lock(&lockh);
out_nolock:
- CDEBUG(D_MGS, "replying with %s, index=%d, rc=%d\n", mti->mti_svname,
+ CDEBUG(D_MGS, "replying with %s, index=%d, rc=%d\n", mti->mti_svname,
mti->mti_stripe_index, rc);
- lustre_pack_reply(req, 1, &rep_size, NULL);
+ lustre_pack_reply(req, 1, &rep_size, NULL);
/* send back the whole mti in the reply */
rep_mti = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep_mti));
memcpy(rep_mti, mti, sizeof(*rep_mti));
}
LASSERT(current->journal_info == NULL);
-
+
CDEBUG(D_CONFIG | (rc?D_ERROR:0), "MGS handle cmd=%d rc=%d\n",
req->rq_reqmsg->opc, rc);
if (lcfg == NULL)
RETURN(-ENOMEM);
rc = copy_from_user(lcfg, data->ioc_pbuf1, data->ioc_plen1);
- if (rc)
+ if (rc)
GOTO(out_free, rc);
if (lcfg->lcfg_bufcount < 1)
if (!ptr) {
/* assume devname is the fsname */
strncpy(fsname, devname, sizeof(fsname));
- } else {
+ } else {
strncpy(fsname, devname, ptr - devname);
}
- CDEBUG(D_MGS, "set param on fs %s device %s\n",
+ CDEBUG(D_MGS, "set param on fs %s device %s\n",
fsname, devname);
} else {
CDEBUG(D_MGS, "set global param\n");
writing (above). */
if (fsname) {
lockrc = mgs_get_cfg_lock(obd, fsname, &lockh);
- if (lockrc != ELDLM_OK)
- CERROR("lock error %d for fs %s\n", lockrc,
+ if (lockrc != ELDLM_OK)
+ CERROR("lock error %d for fs %s\n", lockrc,
fsname);
else
mgs_put_cfg_lock(&lockh);
}
rc = llog_destroy(llh);
- if (rc)
+ if (rc)
CERROR("7: llog_destroy failed: %d\n", rc);
else
- llog_free_handle(llh);
+ llog_free_handle(llh);
RETURN(rc);
}
return rc;
}
-static int llog_test_setup(struct obd_device *obd, obd_count len, void *buf)
+static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg *lcfg = buf;
struct obd_device *tgt;
int rc;
ENTRY;
CDEBUG(D_IOCTL, "attach type %s name: %s uuid: %s\n",
MKSTR(typename), MKSTR(name), MKSTR(uuid));
-
+
/* Mountconf transitional hack, should go away after 1.6.
- 1.4.7 uses the old names, so translate back if the
- mountconf flag is set.
+ 1.4.7 uses the old names, so translate back if the
+ mountconf flag is set.
1.6 should set this flag, and translate the other way here
if not set. */
if (lcfg->lcfg_flags & LCFG_FLG_MOUNTCONF){
list_del_init(&exp->exp_obd_chain_timed);
class_export_put(exp);
- err = obd_setup(obd, sizeof(*lcfg), lcfg);
+ err = obd_setup(obd, lcfg);
if (err)
GOTO(err_exp, err);
obd->obd_force = 1;
break;
case 'A':
- LCONSOLE_WARN("Failing over %s\n",
+ LCONSOLE_WARN("Failing over %s\n",
obd->obd_name);
obd->obd_fail = 1;
obd->obd_no_transno = 1;
RETURN(-EINVAL);
}
if (strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) &&
- strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) &&
+ strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) &&
strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME)) {
CERROR("can't add connection on non-client dev\n");
RETURN(-EINVAL);
OBD_FREE(lprof->lp_osc, osclen);
if (lprof->lp_profile)
OBD_FREE(lprof->lp_profile, proflen);
- OBD_FREE(lprof, sizeof(*lprof));
- RETURN(err);
+ OBD_FREE(lprof, sizeof(*lprof));
+ RETURN(err);
}
void class_del_profile(char *prof)
}
}
out:
- if ((err == -ENOSYS || err == -EINVAL) &&
+ if ((err == -ENOSYS || err == -EINVAL) &&
!(lcfg->lcfg_command & LCFG_REQUIRED)) {
CWARN("Skipping optional command %#x\n", lcfg->lcfg_command);
err = 0;
char *cfg_buf = (char*) (rec + 1);
int rc = 0;
ENTRY;
-
+
//class_config_dump_handler(handle, rec, data);
switch (rec->lrh_type) {
if (marker->cm_flags & CM_START) {
/* all previous flags off */
cfg->cfg_flags = CFG_F_MARKER;
- if (marker->cm_flags & CM_SKIP) {
+ if (marker->cm_flags & CM_SKIP) {
cfg->cfg_flags |= CFG_F_SKIP;
CDEBUG(D_CONFIG, "SKIP #%d\n",
marker->cm_step);
- } else if (lustre_check_exclusion(cfg->cfg_sb,
+ } else if (lustre_check_exclusion(cfg->cfg_sb,
marker->cm_svname)) {
cfg->cfg_flags |= CFG_F_EXCLUDE;
CDEBUG(D_CONFIG, "EXCLUDE %d\n",
cfg->cfg_flags = 0;
}
}
- /* A config command without a start marker before it is
+ /* A config command without a start marker before it is
illegal (1.4.6. compat must set it artificially) */
- if (!(cfg->cfg_flags & CFG_F_MARKER) &&
+ if (!(cfg->cfg_flags & CFG_F_MARKER) &&
(lcfg->lcfg_command != LCFG_MARKER)) {
- CWARN("Config not inside markers, ignoring! (%#x)\n",
+ CWARN("Config not inside markers, ignoring! (%#x)\n",
cfg->cfg_flags);
cfg->cfg_flags |= CFG_F_SKIP;
}
-
+
if (cfg->cfg_flags & CFG_F_SKIP) {
// FIXME warning
CDEBUG(D_CONFIG|D_WARNING, "skipping %#x\n",
break;
}
- if ((cfg->cfg_flags & CFG_F_EXCLUDE) &&
+ if ((cfg->cfg_flags & CFG_F_EXCLUDE) &&
(lcfg->lcfg_command == LCFG_LOV_ADD_OBD))
/* Add inactive instead */
lcfg->lcfg_command = LCFG_LOV_ADD_INA;
lustre_cfg_string(lcfg, 0),
cfg->cfg_instance);
lustre_cfg_bufs_set_string(&bufs, 0, inst_name);
- CDEBUG(D_CONFIG, "cmd %x, instance name: %s\n",
+ CDEBUG(D_CONFIG, "cmd %x, instance name: %s\n",
lcfg->lcfg_command, inst_name);
}
/* we override the llog's uuid for clients, to insure they
are unique */
- if (cfg && cfg->cfg_instance &&
+ if (cfg && cfg->cfg_instance &&
lcfg->lcfg_command == LCFG_ATTACH) {
lustre_cfg_bufs_set_string(&bufs, 2,
cfg->cfg_uuid.uuid);
}
lcfg_new->lcfg_nal = 0; /* illegal value for obsolete field */
-
+
rc = class_process_config(lcfg_new);
lustre_cfg_free(lcfg_new);
rc = llog_process(llh, class_config_llog_handler, cfg, &cd);
// FIXME remove warning
- CDEBUG(D_CONFIG|D_WARNING, "Processed log %s gen %d-%d (%d)\n", name,
+ CDEBUG(D_CONFIG|D_WARNING, "Processed log %s gen %d-%d (%d)\n", name,
cd.first_idx + 1, cd.last_idx, rc);
if (cfg)
cfg->cfg_last_idx = cd.last_idx;
if (lcfg->lcfg_command == LCFG_MARKER) {
struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
ptr += snprintf(ptr, end-ptr, "marker=%d(%#x)%s '%s'",
- marker->cm_step, marker->cm_flags,
+ marker->cm_step, marker->cm_flags,
marker->cm_svname, marker->cm_comment);
} else {
for (i = 0; i < lcfg->lcfg_bufcount; i++) {
}
int echo_destroy(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, struct obd_trans_info *oti,
+ struct lov_stripe_md *ea, struct obd_trans_info *oti,
struct obd_export *md_exp)
{
struct obd_device *obd = class_exp2obd(exp);
return rc;
}
-static int echo_setup(struct obd_device *obd, obd_count len, void *buf)
+static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct lprocfs_static_vars lvars;
int rc;
*offp = offset * stripe_size + woffset % stripe_size;
}
-static void
-echo_client_page_debug_setup(struct lov_stripe_md *lsm,
- struct page *page, int rw, obd_id id,
+static void
+echo_client_page_debug_setup(struct lov_stripe_md *lsm,
+ struct page *page, int rw, obd_id id,
obd_off offset, obd_off count)
{
char *addr;
stripe_off = 0xdeadbeef00c0ffeeULL;
stripe_id = 0xdeadbeef00c0ffeeULL;
}
- block_debug_setup(addr + delta, OBD_ECHO_BLOCK_SIZE,
+ block_debug_setup(addr + delta, OBD_ECHO_BLOCK_SIZE,
stripe_off, stripe_id);
}
}
static int
-echo_client_page_debug_check(struct lov_stripe_md *lsm,
- struct page *page, obd_id id,
+echo_client_page_debug_check(struct lov_stripe_md *lsm,
+ struct page *page, obd_id id,
obd_off offset, obd_off count)
{
obd_off stripe_off;
stripe_id = id;
echo_get_stripe_off_id (lsm, &stripe_off, &stripe_id);
- rc2 = block_debug_check("test_brw",
- addr + delta, OBD_ECHO_BLOCK_SIZE,
+ rc2 = block_debug_check("test_brw",
+ addr + delta, OBD_ECHO_BLOCK_SIZE,
stripe_off, stripe_id);
if (rc2 != 0) {
CERROR ("Error in echo object "LPX64"\n", id);
pgp->flag = 0;
if (verify)
- echo_client_page_debug_setup(lsm, pgp->pg, rw,
+ echo_client_page_debug_setup(lsm, pgp->pg, rw,
oa->o_id, off, pgp->count);
}
eas->eas_oa.o_id != ECHO_PERSISTENT_OBJID &&
(eas->eas_oa.o_valid & OBD_MD_FLFLAGS) != 0 &&
(eas->eas_oa.o_flags & OBD_FL_DEBUG_CHECK) != 0)
- echo_client_page_debug_check(eas->eas_lsm, eap->eap_page,
+ echo_client_page_debug_check(eas->eas_lsm, eap->eap_page,
eas->eas_oa.o_id, eap->eap_off,
PAGE_SIZE);
/* sleep until we have a page to send */
spin_unlock_irqrestore(&eas.eas_lock, flags);
- rc = wait_event_interruptible(eas.eas_waitq,
+ rc = wait_event_interruptible(eas.eas_waitq,
eas_should_wake(&eas));
spin_lock_irqsave(&eas.eas_lock, flags);
if (rc && !eas.eas_rc)
/* unbind the eap from its old page offset */
if (eap->eap_cookie != NULL) {
- obd_teardown_async_page(exp, lsm, NULL,
+ obd_teardown_async_page(exp, lsm, NULL,
eap->eap_cookie);
eap->eap_cookie = NULL;
}
if (oa->o_id != ECHO_PERSISTENT_OBJID &&
(oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
(oa->o_flags & OBD_FL_DEBUG_CHECK) != 0)
- echo_client_page_debug_setup(lsm, eap->eap_page, rw,
- oa->o_id,
+ echo_client_page_debug_setup(lsm, eap->eap_page, rw,
+ oa->o_id,
eap->eap_off, PAGE_SIZE);
/* always asserts urgent, which isn't quite right */
eas.eas_in_flight++;
if (eas.eas_next_offset == eas.eas_end_offset)
break;
- }
+ }
/* still hold the eas_lock here.. */
/* now we just spin waiting for all the rpcs to complete */
while(eas.eas_in_flight) {
spin_unlock_irqrestore(&eas.eas_lock, flags);
- wait_event_interruptible(eas.eas_waitq,
+ wait_event_interruptible(eas.eas_waitq,
eas.eas_in_flight == 0);
spin_lock_irqsave(&eas.eas_lock, flags);
}
out:
list_for_each_safe(pos, n, &pages) {
- struct page *page = list_entry(pos, struct page,
+ struct page *page = list_entry(pos, struct page,
PAGE_LIST_ENTRY);
list_del(&PAGE_LIST(page));
if (page->private != 0) {
eap = (struct echo_async_page *)page->private;
if (eap->eap_cookie != NULL)
- obd_teardown_async_page(exp, lsm, NULL,
+ obd_teardown_async_page(exp, lsm, NULL,
eap->eap_cookie);
OBD_FREE(eap, sizeof(*eap));
}
static int echo_client_prep_commit(struct obd_export *exp, int rw,
struct obdo *oa, struct lov_stripe_md *lsm,
- obd_off offset, obd_size count,
+ obd_off offset, obd_size count,
obd_size batch, struct obd_trans_info *oti)
{
struct obd_ioobj ioo;
oa = &data->ioc_obdo1;
oa->o_gr = FILTER_GROUP_ECHO;
oa->o_valid |= OBD_MD_FLGROUP;
- rc = obd_destroy(ec->ec_exp, oa, eco->eco_lsm,
+ rc = obd_destroy(ec->ec_exp, oa, eco->eco_lsm,
&dummy_oti, NULL);
if (rc == 0)
eco->eco_deleted = 1;
out:
/* XXX this should be in a helper also called by target_send_reply */
- for (ack_lock = dummy_oti.oti_ack_locks, i = 0; i < 4;
+ for (ack_lock = dummy_oti.oti_ack_locks, i = 0; i < 4;
i++, ack_lock++) {
if (!ack_lock->mode)
break;
return rc;
}
-static int
-echo_client_setup(struct obd_device *obddev, obd_count len, void *buf)
+static int echo_client_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
{
- struct lustre_cfg* lcfg = buf;
struct echo_client_obd *ec = &obddev->u.echo_client;
struct obd_device *tgt;
struct lustre_handle conn = {0, };
lustre_cfg_string(lcfg, 1));
return -ENOMEM;
}
-
+
ocd->ocd_version = LUSTRE_VERSION_CODE;
rc = obd_connect(&conn, tgt, &echo_uuid, ocd);
* 3 = flags: failover=f, failout=n
* 4 = mount options
*/
-int filter_common_setup(struct obd_device *obd, obd_count len, void *buf,
+int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg,
void *option)
{
- struct lustre_cfg* lcfg = buf;
struct filter_obd *filter = &obd->u.filter;
struct vfsmount *mnt;
struct lustre_mount_info *lmi;
CERROR("Using old MDS mount method\n");
mnt = do_kern_mount(lustre_cfg_string(lcfg, 2),
MS_NOATIME|MS_NODIRATIME,
- lustre_cfg_string(lcfg, 1), option);
+ lustre_cfg_string(lcfg, 1), option);
if (IS_ERR(mnt)) {
rc = PTR_ERR(mnt);
LCONSOLE_ERROR("Can't mount disk %s (%d)\n",
return rc;
}
-static int filter_setup(struct obd_device *obd, obd_count len, void *buf)
+static int filter_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg* lcfg = buf;
unsigned long page;
int rc;
memcpy((void *)page, lustre_cfg_buf(lcfg, 4),
LUSTRE_CFG_BUFLEN(lcfg, 4));
- rc = filter_common_setup(obd, len, buf, (void *)page);
+ rc = filter_common_setup(obd, lcfg, (void *)page);
free_page(page);
lprocfs_init_vars(filter, &lvars);
unlock_kernel();
must_relock++;
}
-
- if (must_put)
+
+ if (must_put)
/* In case we didn't mount with lustre_get_mount -- old method*/
mntput(filter->fo_vfsmnt);
obd->u.obt.obt_sb = NULL;
static int filter_connect_internal(struct obd_export *exp,
struct obd_connect_data *data)
{
- if (!data)
+ if (!data)
RETURN(0);
-
+
CDEBUG(D_RPCTRACE, "%s: cli %s/%p ocd_connect_flags: "LPX64
" ocd_version: %x ocd_grant: %d\n",
exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp,
struct filter_obd *filter = &exp->exp_obd->u.filter;
struct lr_server_data *lsd = filter->fo_fsd;
int index = le32_to_cpu(lsd->lsd_ost_index);
-
+
if (!(lsd->lsd_feature_compat &
cpu_to_le32(OBD_COMPAT_OST))) {
/* this will only happen on the first connect */
lsd->lsd_ost_index = le32_to_cpu(data->ocd_index);
lsd->lsd_feature_compat |= cpu_to_le32(OBD_COMPAT_OST);
- filter_update_server_data(exp->exp_obd,
+ filter_update_server_data(exp->exp_obd,
filter->fo_rcvd_filp, lsd, 1);
} else if (index != data->ocd_index) {
LCONSOLE_ERROR("Connection from %s to index "
"%u doesn't match actual OST "
"index %u, bad configuration?\n",
- obd_export_nid2str(exp), index,
+ obd_export_nid2str(exp), index,
data->ocd_index);
RETURN(-EBADF);
}
unsigned int cur_ids[MAXQUOTAS] = {oa->o_uid, oa->o_gid};
int rc2 = lquota_adjust(quota_interface, exp->exp_obd, cur_ids,
orig_ids, rc, FSFILT_OP_SETATTR);
- CDEBUG(rc2 ? D_ERROR : D_QUOTA,
+ CDEBUG(rc2 ? D_ERROR : D_QUOTA,
"filter adjust qunit. (rc:%d)\n", rc2);
}
return rc;
/* set EROFS to state field if FS is mounted as RDONLY. The goal is to
* stop creating files on MDS if OST is not good shape to create
* objects.*/
- osfs->os_state = (filter->fo_obt.obt_sb->s_flags & MS_RDONLY) ?
+ osfs->os_state = (filter->fo_obt.obt_sb->s_flags & MS_RDONLY) ?
EROFS : 0;
RETURN(rc);
}
qcids[USRQUOTA] = oa->o_uid;
qcids[GRPQUOTA] = oa->o_gid;
rc2 = lquota_adjust(quota_interface, obd, qcids, NULL, rc,
- FSFILT_OP_UNLINK);
- CDEBUG(rc2 ? D_ERROR : D_QUOTA,
+ FSFILT_OP_UNLINK);
+ CDEBUG(rc2 ? D_ERROR : D_QUOTA,
"filter adjust qunit! (rc:%d)\n", rc2);
return rc;
}
CDEBUG(D_INODE, "calling truncate for object "LPU64", valid = "LPX64
", o_size = "LPD64"\n", oa->o_id, oa->o_valid, start);
-
+
oa->o_size = start;
rc = filter_setattr(exp, oa, NULL, oti);
RETURN(rc);
/* setup llog imports */
ctxt = llog_get_context(obd, LLOG_MDS_OST_REPL_CTXT);
rc = llog_receptor_accept(ctxt, exp->exp_imp_reverse);
-
+
lquota_setinfo(quota_interface, exp, obd);
RETURN(rc);
out:
if (quota_interface)
PORTAL_SYMBOL_PUT(filter_quota_interface);
-
+
OBD_FREE(obdfilter_created_scratchpad,
OBDFILTER_CREATED_SCRATCHPAD_ENTRIES *
sizeof(*obdfilter_created_scratchpad));
- }
+ }
return rc;
}
class_unregister_type(LUSTRE_OSTSAN_NAME);
class_unregister_type(LUSTRE_OST_NAME);
-
+
OBD_FREE(obdfilter_created_scratchpad,
OBDFILTER_CREATED_SCRATCHPAD_ENTRIES *
sizeof(*obdfilter_created_scratchpad));
int filter_update_server_data(struct obd_device *, struct file *,
struct lr_server_data *, int force_sync);
int filter_update_last_objid(struct obd_device *, obd_gr, int force_sync);
-int filter_common_setup(struct obd_device *, obd_count len, void *buf,
+int filter_common_setup(struct obd_device *, struct lustre_cfg *lcfg,
void *option);
int filter_destroy(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md *md, struct obd_trans_info *,
struct llog_rec_hdr *rec, void *data);
/* filter_san.c */
-int filter_san_setup(struct obd_device *obd, obd_count len, void *buf);
+int filter_san_setup(struct obd_device *obd, struct lustre_cfg *cfg);
int filter_san_preprw(int cmd, struct obd_export *, struct obdo *, int objcount,
struct obd_ioobj *, int niocount, struct niobuf_remote *);
#include "filter_internal.h"
/* sanobd setup methods - use a specific mount option */
-int filter_san_setup(struct obd_device *obd, obd_count len, void *buf)
+int filter_san_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
{
- struct lustre_cfg* lcfg = buf;
unsigned long page;
int rc;
else
LBUG(); /* just a reminder */
- rc = filter_common_setup(obd, len, buf, (void *)page);
+ rc = filter_common_setup(obd, lcfg, (void *)page);
free_page(page);
return rc;
return dev;
}
-int client_sanobd_setup(struct obd_device *obddev, obd_count len, void *buf)
+int client_sanobd_setup(struct obd_device *obddev, struct lustre_cfg* lcfg)
{
- struct lustre_cfg* lcfg = buf;
struct client_obd *cli = &obddev->u.cli;
ENTRY;
RETURN(-EINVAL);
}
- client_obd_setup(obddev, len, buf);
+ client_obd_setup(obddev, lcfg);
cli->cl_sandev = path2dev(lustre_cfg_string(lcfg, 3));
if (!kdev_t_to_nr(cli->cl_sandev)) {
}
*saved_oa = *oa;
}
-
+
rc = osc_brw_internal(cmd, exp, oa, md, pages_per_brw, pga);
if (rc != 0)
RETURN(0);
}
-
+
if (KEY_IS("unlinked")) {
struct osc_creator *oscc = &obd->u.cli.cl_oscc;
spin_lock(&oscc->oscc_lock);
RETURN(rc);
}
-int osc_setup(struct obd_device *obd, obd_count len, void *buf)
+int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
int rc;
if (rc)
return rc;
- rc = client_obd_setup(obd, len, buf);
+ rc = client_obd_setup(obd, lcfg);
if (rc) {
ptlrpcd_decref();
} else {
RETURN(0);
}
#endif
-
+
static int ost_brw_lock_get(int mode, struct obd_export *exp,
struct obd_ioobj *obj, struct niobuf_remote *nb,
struct lustre_handle *lh)
oqctl = lustre_swab_reqbuf(req, 0, sizeof(*oqctl),
lustre_swab_obd_quotactl);
- if (oqctl == NULL)
+ if (oqctl == NULL)
RETURN(-EPROTO);
rc = lustre_pack_reply(req, 0, NULL, NULL);
RETURN(result);
}
-static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
+static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
{
struct ost_obd *ost = &obd->u.ost;
struct lprocfs_static_vars lvars;
return 0;
}
-static int quotacheck_test_setup(struct obd_device *obd, obd_count len, void *buf)
+static int quotacheck_test_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg *lcfg = buf;
struct obd_device *tgt;
int rc;
ENTRY;
RETURN(0);
}
#endif
-
+
/* Test set/getquota */
static int quotactl_test_3(struct obd_device *obd, struct super_block *sb)
{
return 0;
}
-static int quotactl_test_setup(struct obd_device *obd, obd_count len, void *buf)
+static int quotactl_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
struct lprocfs_static_vars lvars;
- struct lustre_cfg *lcfg = buf;
struct obd_device *tgt;
int rc;
ENTRY;