static int lmv_notify(struct obd_device *obd, struct obd_device *watched,
enum obd_notify_event ev)
{
- struct obd_connect_data *conn_data;
- struct lmv_obd *lmv = &obd->u.lmv;
- struct obd_uuid *uuid;
- int rc = 0;
- ENTRY;
-
- if (strcmp(watched->obd_type->typ_name, LUSTRE_MDC_NAME)) {
- CERROR("unexpected notification of %s %s!\n",
- watched->obd_type->typ_name,
- watched->obd_name);
- RETURN(-EINVAL);
- }
-
- uuid = &watched->u.cli.cl_target_uuid;
- if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE) {
- /*
- * Set MDC as active before notifying the observer, so the
- * observer can use the MDC normally.
- */
- rc = lmv_set_mdc_active(lmv, uuid,
- ev == OBD_NOTIFY_ACTIVE);
- if (rc) {
- CERROR("%sactivation of %s failed: %d\n",
- ev == OBD_NOTIFY_ACTIVE ? "" : "de",
- uuid->uuid, rc);
- RETURN(rc);
- }
+ struct obd_connect_data *conn_data;
+ struct lmv_obd *lmv = &obd->u.lmv;
+ struct obd_uuid *uuid;
+ int rc = 0;
+
+ ENTRY;
+
+ if (strcmp(watched->obd_type->typ_name, LUSTRE_MDC_NAME)) {
+ CERROR("unexpected notification of %s %s!\n",
+ watched->obd_type->typ_name,
+ watched->obd_name);
+ RETURN(-EINVAL);
+ }
+
+ uuid = &watched->u.cli.cl_target_uuid;
+ if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE) {
+ /*
+ * Set MDC as active before notifying the observer, so the
+ * observer can use the MDC normally.
+ */
+ rc = lmv_set_mdc_active(lmv, uuid,
+ ev == OBD_NOTIFY_ACTIVE);
+ if (rc) {
+ CERROR("%sactivation of %s failed: %d\n",
+ ev == OBD_NOTIFY_ACTIVE ? "" : "de",
+ uuid->uuid, rc);
+ RETURN(rc);
+ }
} else if (ev == OBD_NOTIFY_OCD) {
conn_data = &watched->u.cli.cl_import->imp_connect_data;
/*
obd->obd_self_export->exp_connect_data = *conn_data;
}
- /*
- * Pass the notification up the chain.
- */
+ /* Pass the notification up the chain. */
if (obd->obd_observer)
rc = obd_notify(obd->obd_observer, watched, ev);
struct lustre_handle conn = { 0 };
struct obd_export *exp;
int rc;
+
ENTRY;
rc = class_connect(&conn, obd, cluuid);
rc = md_init_ea_size(tgt->ltd_exp, easize, def_easize);
if (rc) {
- CERROR("%s: obd_init_ea_size() failed on MDT target %d:"
- " rc = %d\n", obd->obd_name, tgt->ltd_index, rc);
+ CERROR("%s: obd_init_ea_size() failed on MDT target %d: rc = %d\n",
+ obd->obd_name, tgt->ltd_index, rc);
break;
}
}
struct obd_export *mdc_exp;
struct lu_fld_target target;
int rc;
+
ENTRY;
mdc_obd = class_find_client_obd(&tgt->ltd_uuid, LUSTRE_MDC_NAME,
RETURN(rc);
}
- /*
- * Init fid sequence client for this mdc and add new fld target.
- */
+ /* Init fid sequence client for this mdc and add new fld target. */
rc = obd_fid_init(mdc_obd, mdc_exp, LUSTRE_SEQ_METADATA);
if (rc)
RETURN(rc);
}
if (obd->obd_observer) {
- /*
- * Tell the observer about the new target.
- */
+ /* Tell the observer about the new target. */
rc = obd_notify(obd->obd_observer, mdc_exp->exp_obd,
OBD_NOTIFY_ACTIVE);
if (rc) {
struct lmv_obd *lmv = &obd->u.lmv;
struct obd_device *mdc_obd;
int rc;
+
ENTRY;
LASSERT(tgt != NULL);
/* unregister request (call from llapi_hsm_copytool_fini) */
lmv_foreach_connected_tgt(lmv, tgt)
- /* best effort: try to clean as much as possible
- * (continue on error) */
+ /* try to clean as much as possible (continue on error) */
obd_iocontrol(cmd, tgt->ltd_exp, len, lk, uarg);
/* Whatever the result, remove copytool from kuc groups.
/* All or nothing: try to register to all MDS.
* In case of failure, unregister from previous MDS,
- * except if it because of inactive target. */
+ * except if it because of inactive target.
+ */
lmv_foreach_connected_tgt(lmv, tgt) {
err = obd_iocontrol(cmd, tgt->ltd_exp, len, lk, uarg);
if (err) {
if (tgt->ltd_active) {
/* permanent error */
- CERROR("%s: iocontrol MDC %s on MDT"
- " idx %d cmd %x: err = %d\n",
+ CERROR("%s: iocontrol MDC %s on MDT idx %d cmd %x: err = %d\n",
lmv2obd_dev(lmv)->obd_name,
tgt->ltd_uuid.uuid, tgt->ltd_index, cmd,
err);
GOTO(err_kkuc_rem, rc);
}
/* else: transient error.
- * kuc will register to the missing MDT
- * when it is back */
+ * kuc will register to the missing MDT when it is back
+ */
} else {
any_set = true;
}
RETURN(rc);
/* Note: this is from llite(see ll_dir_ioctl()), @uarg does not
- * point to user space memory for FID2MDTIDX. */
+ * point to user space memory for FID2MDTIDX.
+ */
*(__u32 *)uarg = mdt_index;
break;
}
if (reqcount == 0)
RETURN(0);
- /* if the request is about a single fid
- * or if there is a single MDS, no need to split
- * the request. */
+ /* if the request is about a single fid or if there is a single
+ * MDS, no need to split the request.
+ */
if (reqcount == 1 || count == 1) {
tgt = lmv_fid2tgt(lmv, &hur->hur_user_item[0].hui_fid);
if (IS_ERR(tgt))
int err;
/* ll_umount_begin() sets force flag but for lmv, not
- * mdc. Let's pass it through */
+ * mdc. Let's pass it through
+ */
mdc_obd = class_exp2obd(tgt->ltd_exp);
mdc_obd->obd_force = obd->obd_force;
err = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg);
int gen;
__u32 index;
int rc;
+
ENTRY;
switch (lcfg->lcfg_command) {
case LCFG_ADD_MDC:
/* modify_mdc_tgts add 0:lustre-clilmv 1:lustre-MDT0000_UUID
- * 2:0 3:1 4:lustre-MDT0000-mdc_UUID */
+ * 2:0 3:1 4:lustre-MDT0000-mdc_UUID
+ */
if (LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(obd_uuid.uuid))
GOTO(out, rc = -EINVAL);
if (temp->os_state & OS_STATFS_SUM ||
flags == OBD_STATFS_FOR_MDT0) {
- /* reset to the last aggregated values
- * and don't sum with non-aggrated data */
- /* If the statfs is from mount, it needs to retrieve
- * necessary information from MDT0. i.e. mount does
- * not need the merged osfs from all of MDT. Also
- * clients can be mounted as long as MDT0 is in
- * service */
+ /* reset to the last aggregated values and don't sum
+ * with non-aggrated data
+ *
+ * If the statfs is from mount, it needs to retrieve
+ * necessary info from MDT0. i.e. mount does not need
+ * the merged osfs from all of MDT. Also clients can be
+ * mounted as long as MDT0 is in service
+ */
*osfs = *temp;
GOTO(out_free_temp, rc);
}
/* During creating VOLATILE file, it should honor the mdt
* index if the file under striped dir is being restored, see
- * ct_restore(). */
+ * ct_restore().
+ */
if (op_data->op_bias & MDS_CREATE_VOLATILE &&
op_data->op_mds != LMV_OFFSET_DEFAULT) {
tgt = lmv_tgt(lmv, op_data->op_mds);
}
int
-lmv_getattr_name(struct obd_export *exp,struct md_op_data *op_data,
+lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
struct ptlrpc_request **preq)
{
struct obd_device *obd = exp->exp_obd;
}
#define md_op_data_fid(op_data, fl) \
- (fl == MF_MDC_CANCEL_FID1 ? &op_data->op_fid1 : \
- fl == MF_MDC_CANCEL_FID2 ? &op_data->op_fid2 : \
- fl == MF_MDC_CANCEL_FID3 ? &op_data->op_fid3 : \
- fl == MF_MDC_CANCEL_FID4 ? &op_data->op_fid4 : \
- NULL)
+ (fl == MF_MDC_CANCEL_FID1 ? &op_data->op_fid1 : \
+ fl == MF_MDC_CANCEL_FID2 ? &op_data->op_fid2 : \
+ fl == MF_MDC_CANCEL_FID3 ? &op_data->op_fid3 : \
+ fl == MF_MDC_CANCEL_FID4 ? &op_data->op_fid4 : \
+ NULL)
static int lmv_early_cancel(struct obd_export *exp, struct lmv_tgt_desc *tgt,
struct md_op_data *op_data, __u32 op_tgt,
struct lmv_obd *lmv = &exp->exp_obd->u.lmv;
union ldlm_policy_data policy = { { 0 } };
int rc = 0;
+
ENTRY;
if (!fid_is_sane(fid))
}
/*
- * llite passes fid of an target inode in op_data->op_fid1 and id of directory in
- * op_data->op_fid2
+ * llite passes fid of an target inode in op_data->op_fid1 and id of directory
+ * in op_data->op_fid2
*/
static int lmv_link(struct obd_export *exp, struct md_op_data *op_data,
- struct ptlrpc_request **request)
+ struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
struct lmv_tgt_desc *tgt;
int rc;
+
ENTRY;
LASSERT(op_data->op_namelen != 0);
if (IS_ERR(tgt))
RETURN(PTR_ERR(tgt));
- /*
- * Cancel UPDATE lock on child (fid1).
- */
+ /* Cancel UPDATE lock on child (fid1). */
op_data->op_flags |= MF_MDC_CANCEL_FID2;
rc = lmv_early_cancel(exp, NULL, op_data, tgt->ltd_index, LCK_EX,
MDS_INODELOCK_UPDATE, MF_MDC_CANCEL_FID1);
* orphan, and we can only check orphan on the local MDT right now, so
* we send rename request to the MDT where target child is located. If
* target child does not exist, then it will send the request to the
- * target parent */
+ * target parent
+ */
if (fid_is_sane(&op_data->op_fid4)) {
tgt = lmv_fid2tgt(lmv, &op_data->op_fid4);
if (IS_ERR(tgt))
/* treat error as eof, so dir can be partially accessed */
stripe->sd_eof = true;
ctxt->ldc_mrinfo->mr_partial_readdir_rc = rc;
- LCONSOLE_WARN("dir "DFID" stripe %d readdir failed: %d, "
- "directory is partially accessed!\n",
+ LCONSOLE_WARN("dir "DFID" stripe %d readdir failed: %d, directory is partially accessed!\n",
PFID(&ctxt->ldc_op_data->op_fid1), stripe_index,
rc);
}
__u16 ent_size;
size_t left_bytes;
int rc = 0;
+
ENTRY;
/* Allocate a page and read entries from all of stripes and fill
- * the page by hash order */
+ * the page by hash order
+ */
page = alloc_page(GFP_KERNEL);
if (!page)
RETURN(-ENOMEM);
ent_size = le16_to_cpu(next->lde_reclen);
/* the last entry lde_reclen is 0, but it might not be the last
- * one of this temporay dir page */
+ * one of this temporay dir page
+ */
if (!ent_size)
ent_size = lu_dirent_calc_size(
le16_to_cpu(next->lde_namelen),
memcpy(ent, next, ent_size);
/* Replace . with master FID and Replace .. with the parent FID
- * of master object */
+ * of master object
+ */
if (strncmp(ent->lde_name, ".",
le16_to_cpu(ent->lde_namelen)) == 0 &&
le16_to_cpu(ent->lde_namelen) == 1)
rc = ptlrpc_set_wait(NULL, set);
if (rc == 0) {
int j = 0;
+
for (i = 0; i < tgt_count; i++) {
fat = fas[i];
if (!fat || fat->fa_nr == 0)
struct obd_device *obd;
struct lmv_obd *lmv;
int rc = 0;
+
ENTRY;
obd = class_exp2obd(exp);
int cplen;
int i;
int rc = 0;
+
ENTRY;
lsm->lsm_md_magic = le32_to_cpu(lmm1->lmv_magic);
if (cplen >= sizeof(lsm->lsm_md_pool_name))
RETURN(-E2BIG);
- CDEBUG(D_INFO, "unpack lsm count %d/%d, master %d hash_type %#x/%#x "
- "layout_version %d\n", lsm->lsm_md_stripe_count,
+ CDEBUG(D_INFO, "unpack lsm count %d/%d, master %d hash_type %#x/%#x layout_version %d\n",
+ lsm->lsm_md_stripe_count,
lsm->lsm_md_migrate_offset, lsm->lsm_md_master_mdt_index,
lsm->lsm_md_hash_type, lsm->lsm_md_migrate_hash,
lsm->lsm_md_layout_version);
struct lmv_stripe_object *lsm_obj;
__u32 magic;
int rc;
+
ENTRY;
LASSERT(lsop != NULL && *lsop == NULL);
struct obd_device *obd = exp->exp_obd;
struct lmv_obd *lmv = &obd->u.lmv;
struct lmv_tgt_desc *tgt = lmv_tgt(lmv, 0);
+
ENTRY;
lmv_stripe_object_put(&md->def_lsm_obj);
}
static const struct obd_ops lmv_obd_ops = {
- .o_owner = THIS_MODULE,
- .o_setup = lmv_setup,
- .o_cleanup = lmv_cleanup,
- .o_precleanup = lmv_precleanup,
- .o_process_config = lmv_process_config,
- .o_connect = lmv_connect,
- .o_disconnect = lmv_disconnect,
- .o_statfs = lmv_statfs,
- .o_get_info = lmv_get_info,
- .o_set_info_async = lmv_set_info_async,
- .o_notify = lmv_notify,
- .o_get_uuid = lmv_get_uuid,
+ .o_owner = THIS_MODULE,
+ .o_setup = lmv_setup,
+ .o_cleanup = lmv_cleanup,
+ .o_precleanup = lmv_precleanup,
+ .o_process_config = lmv_process_config,
+ .o_connect = lmv_connect,
+ .o_disconnect = lmv_disconnect,
+ .o_statfs = lmv_statfs,
+ .o_get_info = lmv_get_info,
+ .o_set_info_async = lmv_set_info_async,
+ .o_notify = lmv_notify,
+ .o_get_uuid = lmv_get_uuid,
.o_fid_alloc = lmv_fid_alloc,
- .o_iocontrol = lmv_iocontrol,
- .o_quotactl = lmv_quotactl
+ .o_iocontrol = lmv_iocontrol,
+ .o_quotactl = lmv_quotactl
};
static const struct md_ops lmv_md_ops = {
.m_get_root = lmv_get_root,
- .m_null_inode = lmv_null_inode,
- .m_close = lmv_close,
- .m_create = lmv_create,
- .m_enqueue = lmv_enqueue,
- .m_getattr = lmv_getattr,
- .m_getxattr = lmv_getxattr,
- .m_getattr_name = lmv_getattr_name,
- .m_intent_lock = lmv_intent_lock,
- .m_link = lmv_link,
- .m_rename = lmv_rename,
- .m_setattr = lmv_setattr,
- .m_setxattr = lmv_setxattr,
+ .m_null_inode = lmv_null_inode,
+ .m_close = lmv_close,
+ .m_create = lmv_create,
+ .m_enqueue = lmv_enqueue,
+ .m_getattr = lmv_getattr,
+ .m_getxattr = lmv_getxattr,
+ .m_getattr_name = lmv_getattr_name,
+ .m_intent_lock = lmv_intent_lock,
+ .m_link = lmv_link,
+ .m_rename = lmv_rename,
+ .m_setattr = lmv_setattr,
+ .m_setxattr = lmv_setxattr,
.m_fsync = lmv_fsync,
.m_file_resync = lmv_file_resync,
.m_read_page = lmv_read_page,
- .m_unlink = lmv_unlink,
- .m_init_ea_size = lmv_init_ea_size,
- .m_cancel_unused = lmv_cancel_unused,
- .m_set_lock_data = lmv_set_lock_data,
- .m_lock_match = lmv_lock_match,
+ .m_unlink = lmv_unlink,
+ .m_init_ea_size = lmv_init_ea_size,
+ .m_cancel_unused = lmv_cancel_unused,
+ .m_set_lock_data = lmv_set_lock_data,
+ .m_lock_match = lmv_lock_match,
.m_get_lustre_md = lmv_get_lustre_md,
.m_put_lustre_md = lmv_put_lustre_md,
.m_merge_attr = lmv_merge_attr,
- .m_set_open_replay_data = lmv_set_open_replay_data,
- .m_clear_open_replay_data = lmv_clear_open_replay_data,
- .m_intent_getattr_async = lmv_intent_getattr_async,
+ .m_set_open_replay_data = lmv_set_open_replay_data,
+ .m_clear_open_replay_data = lmv_clear_open_replay_data,
+ .m_intent_getattr_async = lmv_intent_getattr_async,
.m_revalidate_lock = lmv_revalidate_lock,
.m_get_fid_from_lsm = lmv_get_fid_from_lsm,
.m_stripe_object_create = lmv_stripe_object_create,