#include <linux/lustre_lib.h>
#include <linux/lustre_net.h>
#include <linux/lustre_idl.h>
+#include <linux/lustre_dlm.h>
#include <linux/obd_class.h>
#include <linux/lustre_log.h>
#include <linux/lustre_cmobd.h>
/* reintegration functions */
static int cmobd_setattr_reint(struct obd_device *obd, void *rec)
{
+ int rc = 0;
+ struct lov_stripe_md *lsm;
struct cm_obd *cmobd = &obd->u.cm;
- struct lov_obd *lov = &cmobd->master_obd->u.lov;
struct obd_export *exp = cmobd->master_exp;
- struct lov_stripe_md *lsm;
- struct obdo *oa = (struct obdo*)rec;
- int rc;
+ struct obdo *oa = (struct obdo *)rec;
ENTRY;
- rc = cmobd_dummy_lsm(&lsm, lov->desc.ld_tgt_count, oa,
- (__u32)lov->desc.ld_default_stripe_size);
+ rc = cmobd_dummy_lsm(&lsm, cmobd->master_desc.ld_tgt_count, oa,
+ (__u32)cmobd->master_desc.ld_default_stripe_size);
if (rc)
GOTO(out, rc);
static int cmobd_create_reint(struct obd_device *obd, void *rec)
{
+ struct obdo *oa = (struct obdo *)rec;
struct cm_obd *cmobd = &obd->u.cm;
- struct lov_obd *lov = &cmobd->master_obd->u.lov;
struct obd_export *exp = cmobd->master_exp;
struct lov_stripe_md *lsm;
struct obd_trans_info oti = { 0 };
- struct obdo *oa=(struct obdo*)rec;
int rc;
ENTRY;
- rc = cmobd_dummy_lsm(&lsm, lov->desc.ld_tgt_count, oa,
- (__u32)lov->desc.ld_default_stripe_size);
+ rc = cmobd_dummy_lsm(&lsm, cmobd->master_desc.ld_tgt_count, oa,
+ (__u32)cmobd->master_desc.ld_default_stripe_size);
if (rc)
GOTO(out, rc);
if (cmobd->master_group != oa->o_gr) {
GOTO(out, rc = -EINVAL);
cmobd->master_group = oa->o_gr;
}
- rc = obd_create(exp, oa, &lsm, &oti);
+ rc = obd_create(exp, oa, NULL, 0, &lsm, &oti);
cmobd_free_lsm(&lsm);
out:
}
/* XXX layering violation! -phil */
- l_lock(&lock->l_resource->lr_namespace->ns_lock);
+ lock_res_and_lock(lock);
+
/* Get this: if filter_blocking_ast is racing with ldlm_intent_policy,
* such that filter_blocking_ast is called just before l_i_p takes the
* ns_lock, then by the time we get the lock, we might not be the
* correct blocking function anymore. So check, and return early, if
* so. */
if (lock->l_blocking_ast != cache_blocking_ast) {
- l_unlock(&lock->l_resource->lr_namespace->ns_lock);
+ unlock_res_and_lock(lock);
RETURN(0);
}
lock->l_flags |= LDLM_FL_CBPENDING;
do_ast = (!lock->l_readers && !lock->l_writers);
- l_unlock(&lock->l_resource->lr_namespace->ns_lock);
+ unlock_res_and_lock(lock);
if (do_ast) {
struct lustre_handle lockh;
struct ldlm_extent *extent)
{
struct cm_obd *cmobd = &obd->u.cm;
- struct obd_device *cache = cmobd->cache_obd;
- struct lov_obd *lov = &cmobd->master_obd->u.lov;
- struct ldlm_res_id res_id;
- ldlm_policy_data_t policy;
+ struct obd_device *cache = cmobd->cache_exp->exp_obd;
struct lustre_handle lockh_src = { 0 };
struct lustre_handle lockh_dst = { 0 };
+ struct ldlm_res_id res_id;
+ ldlm_policy_data_t policy;
struct lov_stripe_md *lsm;
int flags = 0, err, rc = 0;
ENTRY;
RETURN(rc);
/* construct the pseudo lsm */
- rc = cmobd_dummy_lsm(&lsm, lov->desc.ld_tgt_count, oa,
- (__u32)lov->desc.ld_default_stripe_size);
+
+ /*
+ * it is not good to access lov fields like @desc directly. This is
+ * layering violation. It should be accessed via some interface method,
+ * like llite does. --umka
+ */
+ rc = cmobd_dummy_lsm(&lsm, cmobd->master_desc.ld_tgt_count, oa,
+ (__u32)cmobd->master_desc.ld_default_stripe_size);
if (rc)
GOTO(out_lock, rc);
static int cmobd_write_reint(struct obd_device *obd, void *rec)
{
struct cm_obd *cmobd = &obd->u.cm;
- struct obd_device *cache = cmobd->cache_obd;
struct obdo *oa = (struct obdo *)rec;
struct ldlm_extent *extent = NULL;
+ char *extents_buf = NULL;
+ struct obd_device *cache;
+ int rc = 0, ext_num = 0;
unsigned long csb, ino;
- char *extents_buf = NULL;
- int size = 0, rc = 0, ext_num = 0;
+ __u32 size = 0;
ENTRY;
size = sizeof(csb);
-
obd_get_info(cmobd->cache_exp, strlen("cache_sb") + 1,
"cache_sb", &size, &csb);
ino = *(int*)(&oa->o_inline[0]);
- rc = fsfilt_get_ino_write_extents(cache, (struct super_block *)csb, ino,
- &extents_buf, &ext_num);
+
+ cache = cmobd->cache_exp->exp_obd;
+ rc = fsfilt_get_ino_write_extents(cache, (struct super_block *)csb,
+ ino, &extents_buf, &ext_num);
if (rc)
GOTO(out, rc);
extent = (struct ldlm_extent *)extents_buf;