#include <lustre_lib.h>
#include <lustre_fsfilt.h>
#include <lustre_ver.h>
-#include <dt_object.h>
#include "mds_internal.h"
-void md_lov_info_update_objids(struct md_lov_info *mli, obd_id *ids)
+void mds_lov_update_objids(struct obd_device *obd, obd_id *ids)
{
+ struct mds_obd *mds = &obd->u.mds;
int i;
+ ENTRY;
+
lock_kernel();
- for (i = 0; i < mli->md_lov_desc.ld_tgt_count; i++)
- if (ids[i] > (mli->md_lov_objids)[i]) {
- (mli->md_lov_objids)[i] = ids[i];
- mli->md_lov_objids_dirty = 1;
+ for (i = 0; i < mds->mds_lov_desc.ld_tgt_count; i++)
+ if (ids[i] > (mds->mds_lov_objids)[i]) {
+ (mds->mds_lov_objids)[i] = ids[i];
+ mds->mds_lov_objids_dirty = 1;
}
unlock_kernel();
+ EXIT;
}
-void mds_lov_update_objids(struct obd_device *obd, obd_id *ids)
+static int mds_lov_read_objids(struct obd_device *obd)
{
struct mds_obd *mds = &obd->u.mds;
-
- md_lov_info_update_objids(&mds->mds_lov_info, ids);
-}
-
-static int mds_lov_read_objids(struct obd_device *obd, struct md_lov_info *mli,
- const void *ctxt)
-{
- struct file *filp = (struct file *)mli->md_lov_objid_obj;
obd_id *ids;
loff_t off = 0;
int i, rc, size;
ENTRY;
- LASSERT(!mli->md_lov_objids_size);
- LASSERT(!mli->md_lov_objids_dirty);
+ LASSERT(!mds->mds_lov_objids_size);
+ LASSERT(!mds->mds_lov_objids_dirty);
- /* Read everything in the file, even if our current lov desc
- has fewer targets. Old targets not in the lov descriptor
+ /* Read everything in the file, even if our current lov desc
+ has fewer targets. Old targets not in the lov descriptor
during mds setup may still have valid objids. */
- size = filp->f_dentry->d_inode->i_size;
+ size = mds->mds_lov_objid_filp->f_dentry->d_inode->i_size;
if (size == 0)
RETURN(0);
OBD_ALLOC(ids, size);
if (ids == NULL)
RETURN(-ENOMEM);
- mli->md_lov_objids = ids;
- mli->md_lov_objids_size = size;
+ mds->mds_lov_objids = ids;
+ mds->mds_lov_objids_size = size;
- rc = fsfilt_read_record(obd, filp, ids, size, &off);
+ rc = fsfilt_read_record(obd, mds->mds_lov_objid_filp, ids, size, &off);
if (rc < 0) {
CERROR("Error reading objids %d\n", rc);
RETURN(rc);
}
-
- mli->md_lov_objids_in_file = size / sizeof(*ids);
-
- for (i = 0; i < mli->md_lov_objids_in_file; i++) {
+
+ mds->mds_lov_objids_in_file = size / sizeof(*ids);
+
+ for (i = 0; i < mds->mds_lov_objids_in_file; i++) {
CDEBUG(D_INFO, "read last object "LPU64" for idx %d\n",
- mli->md_lov_objids[i], i);
+ mds->mds_lov_objids[i], i);
}
RETURN(0);
}
-int mds_lov_write_objids(struct obd_device *obd, struct md_lov_info *mli,
- const void *ctxt)
+int mds_lov_write_objids(struct obd_device *obd)
{
- struct file *filp = (struct file *)mli->md_lov_objid_obj;
+ struct mds_obd *mds = &obd->u.mds;
loff_t off = 0;
- int i, rc, tgts;
+ int i, rc, tgts;
ENTRY;
- if (!mli->md_lov_objids_dirty)
+ if (!mds->mds_lov_objids_dirty)
RETURN(0);
- tgts = max(mli->md_lov_desc.ld_tgt_count, mli->md_lov_objids_in_file);
+ tgts = max(mds->mds_lov_desc.ld_tgt_count, mds->mds_lov_objids_in_file);
if (!tgts)
RETURN(0);
for (i = 0; i < tgts; i++)
CDEBUG(D_INFO, "writing last object "LPU64" for idx %d\n",
- mli->md_lov_objids[i], i);
+ mds->mds_lov_objids[i], i);
- rc = fsfilt_write_record(obd, filp, mli->md_lov_objids,
- tgts * sizeof(obd_id),
+ rc = fsfilt_write_record(obd, mds->mds_lov_objid_filp,
+ mds->mds_lov_objids, tgts * sizeof(obd_id),
&off, 0);
if (rc >= 0) {
- mli->md_lov_objids_dirty = 0;
+ mds->mds_lov_objids_dirty = 0;
rc = 0;
}
RETURN(rc);
}
-struct md_lov_ops mli_ops = {
- .ml_read_objids = mds_lov_read_objids,
- .ml_write_objids = mds_lov_write_objids,
-};
-
-int md_lov_clear_orphans(struct md_lov_info *mli, struct obd_uuid *ost_uuid)
+int mds_lov_clear_orphans(struct mds_obd *mds, struct obd_uuid *ost_uuid)
{
int rc;
struct obdo oa;
struct lov_stripe_md *empty_ea = NULL;
ENTRY;
- LASSERT(mli->md_lov_objids != NULL);
+ LASSERT(mds->mds_lov_objids != NULL);
/* This create will in fact either create or destroy: If the OST is
* missing objects below this ID, they will be created. If it finds
memcpy(&oa.o_inline, ost_uuid, sizeof(*ost_uuid));
oa.o_valid |= OBD_MD_FLINLINE;
}
- rc = obd_create(mli->md_lov_exp, &oa, &empty_ea, &oti);
+ rc = obd_create(mds->mds_osc_exp, &oa, &empty_ea, &oti);
RETURN(rc);
}
-int mds_lov_clear_orphans(struct mds_obd *mds, struct obd_uuid *ost_uuid)
-{
- return md_lov_clear_orphans(&mds->mds_lov_info, ost_uuid);
-}
-
/* update the LOV-OSC knowledge of the last used object id's */
-static int md_lov_info_set_nextid(struct obd_device *obd,
- struct md_lov_info *mli)
+int mds_lov_set_nextid(struct obd_device *obd)
{
+ struct mds_obd *mds = &obd->u.mds;
int rc;
ENTRY;
LASSERT(!obd->obd_recovering);
- LASSERT(mli->md_lov_objids != NULL);
- rc = obd_set_info_async(mli->md_lov_exp, strlen(KEY_NEXT_ID),
+ LASSERT(mds->mds_lov_objids != NULL);
+
+ rc = obd_set_info_async(mds->mds_osc_exp, strlen(KEY_NEXT_ID),
KEY_NEXT_ID,
- mli->md_lov_desc.ld_tgt_count,
- mli->md_lov_objids, NULL);
+ mds->mds_lov_desc.ld_tgt_count,
+ mds->mds_lov_objids, NULL);
+
+ if (rc)
+ CERROR ("%s: mds_lov_set_nextid failed (%d)\n",
+ obd->obd_name, rc);
RETURN(rc);
}
-int mds_lov_set_nextid(struct obd_device *obd)
+/* Update the lov desc for a new size lov. */
+static int mds_lov_update_desc(struct obd_device *obd, struct obd_export *lov)
{
- struct md_lov_info *mli = &obd->u.mds.mds_lov_info;
- return md_lov_info_set_nextid(obd, mli);
-}
-
-int md_lov_info_update_desc(struct md_lov_info *mli, struct obd_export *lov)
-{
- struct lov_desc *ld;
- __u32 size, stripes, valsize = sizeof(mli->md_lov_desc);
+ struct mds_obd *mds = &obd->u.mds;
+ struct lov_desc *ld;
+ __u32 size, stripes, valsize = sizeof(mds->mds_lov_desc);
int rc = 0;
ENTRY;
/* The size of the LOV target table may have increased. */
size = ld->ld_tgt_count * sizeof(obd_id);
- if ((mli->md_lov_objids_size == 0) ||
- (size > mli->md_lov_objids_size)) {
+ if ((mds->mds_lov_objids_size == 0) ||
+ (size > mds->mds_lov_objids_size)) {
obd_id *ids;
-
+
/* add room by powers of 2 */
size = 1;
- while (size < ld->ld_tgt_count)
+ while (size < ld->ld_tgt_count)
size = size << 1;
size = size * sizeof(obd_id);
if (ids == NULL)
GOTO(out, rc = -ENOMEM);
memset(ids, 0, size);
- if (mli->md_lov_objids_size) {
- obd_id *old_ids = mli->md_lov_objids;
- memcpy(ids, mli->md_lov_objids,
- mli->md_lov_objids_size);
- mli->md_lov_objids = ids;
- OBD_FREE(old_ids, mli->md_lov_objids_size);
+ if (mds->mds_lov_objids_size) {
+ obd_id *old_ids = mds->mds_lov_objids;
+ memcpy(ids, mds->mds_lov_objids,
+ mds->mds_lov_objids_size);
+ mds->mds_lov_objids = ids;
+ OBD_FREE(old_ids, mds->mds_lov_objids_size);
}
- mli->md_lov_objids = ids;
- mli->md_lov_objids_size = size;
+ mds->mds_lov_objids = ids;
+ mds->mds_lov_objids_size = size;
}
/* Don't change the mds_lov_desc until the objids size matches the
count (paranoia) */
- mli->md_lov_desc = *ld;
+ mds->mds_lov_desc = *ld;
CDEBUG(D_CONFIG, "updated lov_desc, tgt_count: %d\n",
- mli->md_lov_desc.ld_tgt_count);
+ mds->mds_lov_desc.ld_tgt_count);
- stripes = min((__u32)LOV_MAX_STRIPE_COUNT,
- max(mli->md_lov_desc.ld_tgt_count,
- mli->md_lov_objids_in_file));
-
- mli->md_lov_max_mdsize = lov_mds_md_size(stripes);
- mli->md_lov_max_cookiesize = stripes * sizeof(struct llog_cookie);
+ stripes = min((__u32)LOV_MAX_STRIPE_COUNT,
+ max(mds->mds_lov_desc.ld_tgt_count,
+ mds->mds_lov_objids_in_file));
+ mds->mds_max_mdsize = lov_mds_md_size(stripes);
+ mds->mds_max_cookiesize = stripes * sizeof(struct llog_cookie);
CDEBUG(D_CONFIG, "updated max_mdsize/max_cookiesize: %d/%d\n",
- mli->md_lov_max_mdsize, mli->md_lov_max_cookiesize);
+ mds->mds_max_mdsize, mds->mds_max_cookiesize);
out:
OBD_FREE(ld, sizeof(*ld));
RETURN(rc);
}
+
#define MDSLOV_NO_INDEX -1
+
/* Inform MDS about new/updated target */
-static int mds_lov_update_mds(struct obd_device *obd,
- struct md_lov_info *mli,
- struct obd_device *watched,
- __u32 idx, const void *ctxt)
+static int mds_lov_update_mds(struct obd_device *obd,
+ struct obd_device *watched,
+ __u32 idx)
{
+ struct mds_obd *mds = &obd->u.mds;
int old_count;
- int rc;
+ int rc = 0;
ENTRY;
- old_count = mli->md_lov_desc.ld_tgt_count;
- rc = md_lov_info_update_desc(mli, mli->md_lov_exp);
+ old_count = mds->mds_lov_desc.ld_tgt_count;
+ rc = mds_lov_update_desc(obd, mds->mds_osc_exp);
if (rc)
RETURN(rc);
CDEBUG(D_CONFIG, "idx=%d, recov=%d/%d, cnt=%d/%d\n",
- idx, obd->obd_recovering, obd->obd_async_recov, old_count,
- mli->md_lov_desc.ld_tgt_count);
+ idx, obd->obd_recovering, obd->obd_async_recov, old_count,
+ mds->mds_lov_desc.ld_tgt_count);
/* idx is set as data from lov_notify. */
if (idx != MDSLOV_NO_INDEX && !obd->obd_recovering) {
- if (idx >= mli->md_lov_desc.ld_tgt_count) {
- CERROR("index %d > count %d!\n", idx,
- mli->md_lov_desc.ld_tgt_count);
+ if (idx >= mds->mds_lov_desc.ld_tgt_count) {
+ CERROR("index %d > count %d!\n", idx,
+ mds->mds_lov_desc.ld_tgt_count);
RETURN(-EINVAL);
}
-
- if (idx >= mli->md_lov_objids_in_file) {
+
+ if (idx >= mds->mds_lov_objids_in_file) {
/* We never read this lastid; ask the osc */
obd_id lastid;
__u32 size = sizeof(lastid);
rc = obd_get_info(watched->obd_self_export,
- strlen("last_id"),
+ strlen("last_id"),
"last_id", &size, &lastid);
if (rc)
RETURN(rc);
- mli->md_lov_objids[idx] = lastid;
- mli->md_lov_objids_dirty = 1;
- mli->md_lov_ops->ml_write_objids(obd, mli, ctxt);
+ mds->mds_lov_objids[idx] = lastid;
+ mds->mds_lov_objids_dirty = 1;
+ mds_lov_write_objids(obd);
} else {
/* We have read this lastid from disk; tell the osc.
- Don't call this during recovery. */
- rc = md_lov_info_set_nextid(obd, mli);
+ Don't call this during recovery. */
+ rc = mds_lov_set_nextid(obd);
}
-
+
CDEBUG(D_CONFIG, "last object "LPU64" from OST %d\n",
- mli->md_lov_objids[idx], idx);
+ mds->mds_lov_objids[idx], idx);
}
-#if 0
- /*FIXME: Do not support llog in mdd, so disable this temporarily*/
+
/* If we added a target we have to reconnect the llogs */
- /* Only do this at first add (idx), or the first time after recovery */
- if (idx != MDSLOV_NO_INDEX || 1/*FIXME*/) {
- CDEBUG(D_CONFIG, "reset llogs idx=%d\n", idx);
- /* These two must be atomic */
- down(&mli->md_lov_orphan_recovery_sem);
- obd_llog_finish(obd, old_count);
- llog_cat_initialize(obd, mli->md_lov_desc.ld_tgt_count);
- up(&mli->md_lov_orphan_recovery_sem);
- }
-#else
+ /* We only _need_ to do this at first add (idx), or the first time
+ after recovery. However, it should now be safe to call anytime. */
CDEBUG(D_CONFIG, "reset llogs idx=%d\n", idx);
- llog_cat_initialize(obd, mli->md_lov_desc.ld_tgt_count);
-#endif
+ llog_cat_initialize(obd, mds->mds_lov_desc.ld_tgt_count);
+
RETURN(rc);
}
-int md_lov_connect(struct obd_device *obd, struct md_lov_info *mli,
- char *lov_name, struct obd_uuid *uuid,
- struct md_lov_ops *mlo, const void *ctxt)
+/* update the LOV-OSC knowledge of the last used object id's */
+int mds_lov_connect(struct obd_device *obd, char * lov_name)
{
+ struct mds_obd *mds = &obd->u.mds;
struct lustre_handle conn = {0,};
struct obd_connect_data *data;
- int rc;
+ int rc, i;
+ ENTRY;
- if (IS_ERR(mli->md_lov_obd))
- RETURN(PTR_ERR(mli->md_lov_obd));
+ if (IS_ERR(mds->mds_osc_obd))
+ RETURN(PTR_ERR(mds->mds_osc_obd));
- if (mli->md_lov_obd)
+ if (mds->mds_osc_obd)
RETURN(0);
- mli->md_lov_obd = class_name2obd(lov_name);
- if (!mli->md_lov_obd) {
+ mds->mds_osc_obd = class_name2obd(lov_name);
+ if (!mds->mds_osc_obd) {
CERROR("MDS cannot locate LOV %s\n", lov_name);
- mli->md_lov_obd = ERR_PTR(-ENOTCONN);
+ mds->mds_osc_obd = ERR_PTR(-ENOTCONN);
RETURN(-ENOTCONN);
}
data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_INDEX |
OBD_CONNECT_REQPORTAL;
data->ocd_version = LUSTRE_VERSION_CODE;
-
/* NB: lov_connect() needs to fill in .ocd_index for each OST */
- rc = obd_connect(NULL, &conn, mli->md_lov_obd, uuid, data);
+ rc = obd_connect(NULL, &conn, mds->mds_osc_obd, &obd->obd_uuid, data);
OBD_FREE(data, sizeof(*data));
if (rc) {
CERROR("MDS cannot connect to LOV %s (%d)\n", lov_name, rc);
- GOTO(out, rc);
+ mds->mds_osc_obd = ERR_PTR(rc);
+ RETURN(rc);
}
- mli->md_lov_exp = class_conn2export(&conn);
+ mds->mds_osc_exp = class_conn2export(&conn);
- rc = obd_register_observer(mli->md_lov_obd, obd);
+ rc = obd_register_observer(mds->mds_osc_obd, obd);
if (rc) {
CERROR("MDS cannot register as observer of LOV %s (%d)\n",
lov_name, rc);
- GOTO(out, rc);
+ GOTO(err_discon, rc);
}
- CDEBUG(D_INFO, "regist observer %s to lov %s \n",
- obd->obd_name, mli->md_lov_obd->obd_name);
- rc = mli->md_lov_ops->ml_read_objids(obd, mli, ctxt);
+ rc = mds_lov_read_objids(obd);
if (rc) {
CERROR("cannot read %s: rc = %d\n", "lov_objids", rc);
- GOTO(out, rc);
- }
-
- rc = md_lov_info_update_desc(mli, mli->md_lov_exp);
- if (rc)
- GOTO(out, rc);
-out:
- RETURN(rc);
-}
-EXPORT_SYMBOL(md_lov_connect);
-
-int md_lov_update_objids(struct obd_device *obd, struct md_lov_info *mli,
- const void *ctxt)
-{
- int rc = 0, i;
-
- /* If we're mounting this code for the first time on an existing FS,
- * we need to populate the objids array from the real OST values */
- if (mli->md_lov_desc.ld_tgt_count > mli->md_lov_objids_in_file) {
- int size = sizeof(obd_id) * mli->md_lov_desc.ld_tgt_count;
- rc = obd_get_info(mli->md_lov_exp, strlen("last_id"),
- "last_id", &size, mli->md_lov_objids);
- if (!rc) {
- for (i = 0; i < mli->md_lov_desc.ld_tgt_count; i++)
- CWARN("got last object "LPU64" from OST %d\n",
- mli->md_lov_objids[i], i);
- mli->md_lov_objids_dirty = 1;
- rc = mli->md_lov_ops->ml_write_objids(obd, mli, ctxt);
- if (rc)
- CERROR("got last objids from OSTs, but error "
- "writing objids file: %d\n", rc);
- }
+ GOTO(err_reg, rc);
}
- return rc;
-}
-
-/* update the LOV-OSC knowledge of the last used object id's */
-int mds_lov_connect(struct obd_device *obd, char * lov_name)
-{
- struct mds_obd *mds = &obd->u.mds;
- struct md_lov_info *mli = &mds->mds_lov_info;
- int rc;
- ENTRY;
- rc = md_lov_connect(obd, mli, lov_name, &obd->obd_uuid, &mli_ops,
- NULL);
+ rc = mds_lov_update_desc(obd, mds->mds_osc_exp);
if (rc)
GOTO(err_reg, rc);
/* If we're mounting this code for the first time on an existing FS,
* we need to populate the objids array from the real OST values */
- rc = md_lov_update_objids(obd, mli, NULL);
+ if (mds->mds_lov_desc.ld_tgt_count > mds->mds_lov_objids_in_file) {
+ int size = sizeof(obd_id) * mds->mds_lov_desc.ld_tgt_count;
+ rc = obd_get_info(mds->mds_osc_exp, strlen("last_id"),
+ "last_id", &size, mds->mds_lov_objids);
+ if (!rc) {
+ for (i = 0; i < mds->mds_lov_desc.ld_tgt_count; i++)
+ CWARN("got last object "LPU64" from OST %d\n",
+ mds->mds_lov_objids[i], i);
+ mds->mds_lov_objids_dirty = 1;
+ rc = mds_lov_write_objids(obd);
+ if (rc)
+ CERROR("got last objids from OSTs, but error "
+ "writing objids file: %d\n", rc);
+ }
+ }
/* I want to see a callback happen when the OBD moves to a
* "For General Use" state, and that's when we'll call
err_reg:
obd_register_observer(mds->mds_osc_obd, NULL);
- if (mli->md_lov_exp) {
- obd_disconnect(mli->md_lov_exp);
- mli->md_lov_exp = NULL;
- }
- mli->md_lov_obd = ERR_PTR(rc);
+err_discon:
+ obd_disconnect(mds->mds_osc_exp);
+ mds->mds_osc_exp = NULL;
+ mds->mds_osc_obd = ERR_PTR(rc);
RETURN(rc);
}
}
struct mds_lov_sync_info {
- struct obd_device *mlsi_obd; /* the lov device to sync */
- struct md_lov_info *mlsi_mli;
- struct obd_device *mlsi_watched; /* target osc */
- __u32 mlsi_index; /* index of target */
- const void *mlsi_ctxt;
+ struct obd_device *mlsi_obd; /* the lov device to sync */
+ struct obd_device *mlsi_watched; /* target osc */
+ __u32 mlsi_index; /* index of target */
};
-
/* We only sync one osc at a time, so that we don't have to hold
- any kind of lock on the whole mds_lov_desc, which may change
+ any kind of lock on the whole mds_lov_desc, which may change
(grow) as a result of mds_lov_add_ost. This also avoids any
- kind of mismatch between the lov_desc and the mds_lov_desc,
+ kind of mismatch between the lov_desc and the mds_lov_desc,
which are not in lock-step during lov_add_obd */
static int __mds_lov_synchronize(void *data)
{
struct mds_lov_sync_info *mlsi = data;
struct obd_device *obd = mlsi->mlsi_obd;
- struct mds_obd *mds = &obd->u.mds;
struct obd_device *watched = mlsi->mlsi_watched;
- struct md_lov_info *mli = mlsi->mlsi_mli;
- const void *ctxt = mlsi->mlsi_ctxt;
+ struct mds_obd *mds = &obd->u.mds;
struct obd_uuid *uuid;
__u32 idx = mlsi->mlsi_index;
int rc = 0;
uuid = &watched->u.cli.cl_target_uuid;
LASSERT(uuid);
- rc = mds_lov_update_mds(obd, mli, watched, idx, ctxt);
+ rc = mds_lov_update_mds(obd, watched, idx);
if (rc != 0)
GOTO(out, rc);
-
- rc = obd_set_info_async(mli->md_lov_exp, strlen(KEY_MDS_CONN),
+
+ rc = obd_set_info_async(mds->mds_osc_exp, strlen(KEY_MDS_CONN),
KEY_MDS_CONN, 0, uuid, NULL);
if (rc != 0)
GOTO(out, rc);
rc = llog_connect(llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT),
mds->mds_lov_desc.ld_tgt_count,
NULL, NULL, uuid);
-
+
if (rc != 0) {
CERROR("%s: failed at llog_origin_connect: %d\n",
obd->obd_name, rc);
GOTO(out, rc);
}
+
LCONSOLE_INFO("MDS %s: %s now active, resetting orphans\n",
obd->obd_name, obd_uuid2str(uuid));
if (obd->obd_stopping)
GOTO(out, rc = -ENODEV);
- rc = md_lov_clear_orphans(mli, uuid);
+ rc = mds_lov_clear_orphans(mds, uuid);
if (rc != 0) {
- CERROR("%s: failed at md_lov_clear_orphans: %d\n",
+ CERROR("%s: failed at mds_lov_clear_orphans: %d\n",
obd->obd_name, rc);
GOTO(out, rc);
}
if (obd->obd_upcall.onu_owner) {
/*This is an hack for mds_notify->mdd_notify,
- *When the mds obd in mdd is removed,
+ *When the mds obd in mdd is removed,
*This hack should be removed*/
- LASSERT(obd->obd_upcall.onu_upcall != NULL);
- obd->obd_upcall.onu_upcall(NULL, NULL, 0,
- obd->obd_upcall.onu_owner);
+ LASSERT(obd->obd_upcall.onu_upcall != NULL);
+ rc = obd->obd_upcall.onu_upcall(NULL, NULL, 0,
+ obd->obd_upcall.onu_owner);
}
+ EXIT;
out:
class_decref(obd);
- RETURN(rc);
+ return rc;
}
int mds_lov_synchronize(void *data)
struct mds_lov_sync_info *mlsi = data;
char name[20];
- sprintf(name, "ll_mlov_sync_%02u", mlsi->mlsi_index);
+ if (mlsi->mlsi_index == MDSLOV_NO_INDEX)
+ /* There is still a watched target,
+ but we don't know its index */
+ sprintf(name, "ll_sync_tgt");
+ else
+ snprintf(name, sizeof(name), "ll_sync_%02u", mlsi->mlsi_index);
ptlrpc_daemonize(name);
RETURN(__mds_lov_synchronize(data));
}
-int md_lov_start_synchronize(struct obd_device *obd, struct md_lov_info *mli,
- struct obd_device *watched,
- void *data, int nonblock, const void *ctxt)
+int mds_lov_start_synchronize(struct obd_device *obd,
+ struct obd_device *watched,
+ void *data, int nonblock)
{
struct mds_lov_sync_info *mlsi;
int rc;
mlsi->mlsi_obd = obd;
mlsi->mlsi_watched = watched;
- mlsi->mlsi_mli = mli;
- mlsi->mlsi_ctxt = ctxt;
- if (data)
+ if (data)
mlsi->mlsi_index = *(__u32 *)data;
else
mlsi->mlsi_index = MDSLOV_NO_INDEX;
disconnect the LOV. This of course means a cleanup won't
finish for as long as the sync is blocking. */
class_incref(obd);
+
if (nonblock) {
/* Synchronize in the background */
rc = cfs_kernel_thread(mds_lov_synchronize, mlsi,
} else {
rc = __mds_lov_synchronize((void *)mlsi);
}
- RETURN(rc);
-}
-EXPORT_SYMBOL(md_lov_start_synchronize);
-int mds_lov_start_synchronize(struct obd_device *obd,
- struct obd_device *watched,
- void *data, int nonblock)
-{
- return md_lov_start_synchronize(obd, &obd->u.mds.mds_lov_info,
- watched, data, nonblock, NULL);
+ RETURN(rc);
}
-int md_lov_notity_pre(struct obd_device *obd, struct md_lov_info *mli,
- struct obd_device *watched, enum obd_notify_event ev,
- void *data)
+int mds_notify(struct obd_device *obd, struct obd_device *watched,
+ enum obd_notify_event ev, void *data)
{
int rc = 0;
+ ENTRY;
switch (ev) {
/* We only handle these: */
case OBD_NOTIFY_SYNC_NONBLOCK:
break;
default:
- RETURN(-ENOENT);
+ RETURN(0);
}
CDEBUG(D_CONFIG, "notify %s ev=%d\n", watched->obd_name, ev);
if (obd->obd_recovering) {
CWARN("MDS %s: in recovery, not resetting orphans on %s\n",
- obd->obd_name,
+ obd->obd_name,
obd_uuid2str(&watched->u.cli.cl_target_uuid));
- /* We still have to fix the lov descriptor for ost's added
+ /* We still have to fix the lov descriptor for ost's added
after the mdt in the config log. They didn't make it into
mds_lov_connect. */
- rc = md_lov_info_update_desc(mli, mli->md_lov_exp);
- RETURN(-EBUSY);
- }
- RETURN(rc);
-}
-EXPORT_SYMBOL(md_lov_notity_pre);
-
-int mds_notify(struct obd_device *obd, struct obd_device *watched,
- enum obd_notify_event ev, void *data)
-{
- int rc = 0;
- struct md_lov_info *mli = &obd->u.mds.mds_lov_info;
- ENTRY;
-
- rc = md_lov_notity_pre(obd, mli, watched, ev, data);
- if (rc) {
- if (rc == -ENOENT || rc == -EBUSY)
- rc = 0;
+ rc = mds_lov_update_desc(obd, obd->u.mds.mds_osc_exp);
RETURN(rc);
}
LASSERT(llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT) != NULL);
- rc = mds_lov_start_synchronize(obd, watched, data,
+ rc = mds_lov_start_synchronize(obd, watched, data,
!(ev == OBD_NOTIFY_SYNC));
-
+
lquota_recovery(quota_interface, obd);
-
+
RETURN(rc);
}
int rc, err;
ENTRY;
- if (le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC ||
+ if (le32_to_cpu(lmm->lmm_magic) == LOV_MAGIC ||
le32_to_cpu(lmm->lmm_magic == LOV_MAGIC_JOIN))
RETURN(0);
CDEBUG(D_INODE, "converting LOV EA on %lu/%u from %#08x to %#08x\n",
inode->i_ino, inode->i_generation, le32_to_cpu(lmm->lmm_magic),
LOV_MAGIC);
-
+
rc = obd_unpackmd(obd->u.mds.mds_osc_exp, &lsm, lmm, lmm_size);
if (rc < 0)
GOTO(conv_end, rc);