struct mds_idmap_table;
struct mdt_idmap_table;
-struct lu_export_data {
+struct tg_export_data {
/** Protects led_lcd below */
- cfs_semaphore_t led_lcd_lock;
+ cfs_semaphore_t ted_lcd_lock;
/** Per-client data for each export */
- struct lsd_client_data *led_lcd;
+ struct lsd_client_data *ted_lcd;
/** Offset of record in last_rcvd file */
- loff_t led_lr_off;
+ loff_t ted_lr_off;
/** Client index in last_rcvd file */
- int led_lr_idx;
+ int ted_lr_idx;
};
struct mdt_export_data {
- struct lu_export_data med_led;
+ struct tg_export_data med_ted;
cfs_list_t med_open_head;
cfs_spinlock_t med_open_lock; /* lock med_open_head, mfd_list*/
__u64 med_ibits_known;
struct lustre_idmap_table *med_idmap;
};
-#define med_lcd_lock med_led.led_lcd_lock
-#define med_lcd med_led.led_lcd
-#define med_lr_off med_led.led_lr_off
-#define med_lr_idx med_led.led_lr_idx
-
struct osc_creator {
cfs_spinlock_t oscc_lock;
cfs_list_t oscc_wait_create_list;
/* In-memory access to client data from OST struct */
struct filter_export_data {
- struct lu_export_data fed_led;
+ struct tg_export_data fed_ted;
cfs_spinlock_t fed_lock; /**< protects fed_mod_list */
long fed_dirty; /* in bytes */
long fed_grant; /* in bytes */
__u32 fed_group;
};
-#define fed_lcd_lock fed_led.led_lcd_lock
-#define fed_lcd fed_led.led_lcd
-#define fed_lr_off fed_led.led_lr_off
-#define fed_lr_idx fed_led.led_lr_idx
-
typedef struct nid_stat {
lnet_nid_t nid;
cfs_hlist_node_t nid_hash;
cfs_time_t exp_flvr_expire[2]; /* seconds */
union {
- struct lu_export_data eu_target_data;
+ struct tg_export_data eu_target_data;
struct mdt_export_data eu_mdt_data;
struct filter_export_data eu_filter_data;
struct ec_export_data eu_ec_data;
{
struct obd_device *obd = ctxt->loc_exp->exp_obd;
- if (!strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME))
- ctxt->loc_gen.mnt_cnt = obd->u.mds.mds_mount_count;
- else if (!strstr(obd->obd_type->typ_name, LUSTRE_OST_NAME))
- ctxt->loc_gen.mnt_cnt = obd->u.filter.fo_mount_count;
- else
- ctxt->loc_gen.mnt_cnt = 0;
+ ctxt->loc_gen.mnt_cnt = obd->u.obt.obt_mount_count;
ctxt->loc_gen.conn_cnt++;
}
int fo_sec_level;
};
-#define fo_translock fo_obt.obt_lut->lut_translock
-#define fo_last_rcvd_slots fo_obt.obt_lut->lut_client_bitmap
-#define fo_mount_count fo_obt.obt_lut->lut_mount_count
-#define fo_rcvd_filp fo_obt.obt_rcvd_filp
-#define fo_vfsmnt fo_obt.obt_vfsmnt
-
struct timeout_item {
enum timeout_event ti_event;
cfs_time_t ti_timeout;
cfs_rw_semaphore_t mds_notify_lock;
};
-#define mds_transno_lock mds_obt.obt_translock
-#define mds_rcvd_filp mds_obt.obt_rcvd_filp
-#define mds_server_data mds_obt.obt_lsd
-#define mds_client_bitmap mds_obt.obt_client_bitmap
-#define mds_mount_count mds_obt.obt_mount_count
-#define mds_last_transno mds_obt.obt_last_transno
-#define mds_vfsmnt mds_obt.obt_vfsmnt
-
/* lov objid */
extern __u32 mds_max_ost_index;
}
if (mnt) {
- *mnt = mds->mds_vfsmnt;
+ *mnt = mds->mds_obt.obt_vfsmnt;
mntget(*mnt);
}
{
struct mds_obd *mds = &obd->u.mds;
- mds->mds_vfsmnt = mnt;
+ mds->mds_obt.obt_vfsmnt = mnt;
/* why not mnt->mnt_sb instead of mnt->mnt_root->d_inode->i_sb? */
obd->u.obt.obt_sb = mnt->mnt_root->d_inode->i_sb;
struct obd_device* obd = (struct obd_device *)data;
LASSERT(obd != NULL);
- LASSERT(obd->u.mds.mds_vfsmnt->mnt_devname);
+ LASSERT(obd->u.obt.obt_vfsmnt->mnt_devname);
*eof = 1;
- return snprintf(page, count, "%s\n",obd->u.mds.mds_vfsmnt->mnt_devname);
+ return snprintf(page, count, "%s\n",obd->u.obt.obt_vfsmnt->mnt_devname);
}
static int lprocfs_mds_rd_evictostnids(char *page, char **start, off_t off,
LASSERT(obd->obd_upcall.onu_upcall != NULL);
rc = obd->obd_upcall.onu_upcall(obd, NULL, ev,
obd->obd_upcall.onu_owner,
- &mds->mds_mount_count);
+ &mds->mds_obt.obt_mount_count);
}
out:
OBD_FREE(ld, sizeof(*ld));
LASSERT(mti != NULL);
mti->mti_exp = lexp;
memcpy(lcd->lcd_uuid, cluuid, sizeof lcd->lcd_uuid);
- lexp->exp_mdt_data.med_lcd = lcd;
+ lexp->exp_target_data.ted_lcd = lcd;
rc = mdt_client_new(env, mdt);
if (rc == 0)
mdt_export_stats_init(obd, lexp, localdata);
m->mdt_max_mdsize, m->mdt_max_cookiesize);
mdt_allow_cli(m, CONFIG_SYNC);
if (data)
- (*(__u64 *)data) = m->mdt_mount_count;
+ (*(__u64 *)data) = m->mdt_lut.lut_mount_count;
break;
case MD_NO_TRANS:
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
/* check if request's xid is equal to last one or not*/
static inline int req_xid_is_last(struct ptlrpc_request *req)
{
- struct lsd_client_data *lcd = req->rq_export->exp_mdt_data.med_lcd;
+ struct lsd_client_data *lcd = req->rq_export->exp_target_data.ted_lcd;
return (req->rq_xid == lcd->lcd_last_xid ||
req->rq_xid == lcd->lcd_last_close_xid);
}
int mdt_sec_level;
};
-#define mdt_transno_lock mdt_lut.lut_translock
-#define mdt_last_transno mdt_lut.lut_last_transno
-#define mdt_last_rcvd mdt_lut.lut_last_rcvd
-#define mdt_mount_count mdt_lut.lut_mount_count
-#define mdt_lsd mdt_lut.lut_lsd
-#define mdt_client_bitmap_lock mdt_lut.lut_client_bitmap_lock
-#define mdt_client_bitmap mdt_lut.lut_client_bitmap
-
#define MDT_SERVICE_WATCHDOG_FACTOR (2)
#define MDT_ROCOMPAT_SUPP (OBD_ROCOMPAT_LOVOBJID)
#define MDT_INCOMPAT_SUPP (OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR | \
RETURN(1);
}
DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")",
- req->rq_export->exp_mdt_data.med_lcd->lcd_last_xid);
+ req->rq_export->exp_target_data.ted_lcd->lcd_last_xid);
}
RETURN(0);
}
ma->ma_som->msd_size = la->la_valid & LA_SIZE ? la->la_size : 0;
ma->ma_som->msd_blocks = la->la_valid & LA_BLOCKS ?
la->la_blocks : 0;
- ma->ma_som->msd_mountid = mdt->mdt_mount_count;
+ ma->ma_som->msd_mountid = mdt->mdt_lut.lut_mount_count;
ma->ma_attr.la_valid &= LA_ATIME | LA_MTIME | LA_CTIME;
} else {
ma->ma_som->msd_ioepoch = IOEPOCH_INVAL;
return;
}
- cfs_spin_lock(&mdt->mdt_transno_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_translock);
if (info->mti_transno == 0) {
- info->mti_transno = ++ mdt->mdt_last_transno;
+ info->mti_transno = ++ mdt->mdt_lut.lut_last_transno;
} else {
/* should be replay */
- if (info->mti_transno > mdt->mdt_last_transno)
- mdt->mdt_last_transno = info->mti_transno;
+ if (info->mti_transno > mdt->mdt_lut.lut_last_transno)
+ mdt->mdt_lut.lut_last_transno = info->mti_transno;
}
- cfs_spin_unlock(&mdt->mdt_transno_lock);
+ cfs_spin_unlock(&mdt->mdt_lut.lut_translock);
CDEBUG(D_INODE, "transno = "LPU64", last_committed = "LPU64"\n",
info->mti_transno,
struct mdt_device *mdt = info->mti_mdt;
struct req_capsule *pill = info->mti_pill;
struct ptlrpc_request *req = mdt_info_req(info);
- struct mdt_export_data *med = &req->rq_export->exp_mdt_data;
- struct lsd_client_data *lcd = med->med_lcd;
+ struct tg_export_data *ted = &req->rq_export->exp_target_data;
+ struct lsd_client_data *lcd = ted->ted_lcd;
struct md_attr *ma = &info->mti_attr;
struct mdt_reint_record *rr = &info->mti_rr;
__u32 flags = info->mti_spec.sp_cr_flags;
ma->ma_valid = 0;
- mdt_req_from_lcd(req, med->med_lcd);
+ mdt_req_from_lcd(req, lcd);
mdt_set_disposition(info, ldlm_rep, lcd->lcd_last_data);
CERROR("This is reconstruct open: disp="LPX64", result=%d\n",
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
mti->mti_off = 0;
- rc = dt_record_read(env, mdt->mdt_last_rcvd,
+ rc = dt_record_read(env, mdt->mdt_lut.lut_last_rcvd,
mdt_buf(env, &mti->mti_lsd, sizeof(mti->mti_lsd)),
&mti->mti_off);
if (rc == 0)
- lsd_le_to_cpu(&mti->mti_lsd, &mdt->mdt_lsd);
+ lsd_le_to_cpu(&mti->mti_lsd, &mdt->mdt_lut.lut_lsd);
CDEBUG(D_INFO, "read last_rcvd header rc = %d, uuid = %s, "
- "last_transno = "LPU64"\n", rc, mdt->mdt_lsd.lsd_uuid,
- mdt->mdt_lsd.lsd_last_transno);
+ "last_transno = "LPU64"\n", rc, mdt->mdt_lut.lut_lsd.lsd_uuid,
+ mdt->mdt_lut.lut_lsd.lsd_last_transno);
return rc;
}
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
mti->mti_off = 0;
- lsd_cpu_to_le(&mdt->mdt_lsd, &mti->mti_lsd);
+ lsd_cpu_to_le(&mdt->mdt_lut.lut_lsd, &mti->mti_lsd);
- rc = dt_record_write(env, mdt->mdt_last_rcvd,
+ rc = dt_record_write(env, mdt->mdt_lut.lut_last_rcvd,
mdt_buf_const(env, &mti->mti_lsd,
sizeof(mti->mti_lsd)),
&mti->mti_off, th);
CDEBUG(D_INFO, "write last_rcvd header rc = %d, uuid = %s, "
- "last_transno = "LPU64"\n", rc, mdt->mdt_lsd.lsd_uuid,
- mdt->mdt_lsd.lsd_last_transno);
+ "last_transno = "LPU64"\n", rc, mdt->mdt_lut.lut_lsd.lsd_uuid,
+ mdt->mdt_lut.lut_lsd.lsd_last_transno);
RETURN(rc);
}
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
tmp = &mti->mti_lcd;
- rc = dt_record_read(env, mdt->mdt_last_rcvd,
+ rc = dt_record_read(env, mdt->mdt_lut.lut_last_rcvd,
mdt_buf(env, tmp, sizeof(*tmp)), off);
if (rc == 0) {
check_lcd(mdt2obd_dev(mdt)->obd_name, index, tmp);
lcd_cpu_to_le(lcd, tmp);
- rc = dt_record_write(env, mdt->mdt_last_rcvd,
+ rc = dt_record_write(env, mdt->mdt_lut.lut_last_rcvd,
mdt_buf_const(env, tmp, sizeof(*tmp)), off, th);
CDEBUG(D_INFO, "write lcd @%d rc = %d, uuid = %s, last_transno = "LPU64
struct mdt_device *mdt,
unsigned long last_size)
{
- struct lr_server_data *lsd = &mdt->mdt_lsd;
+ struct lr_server_data *lsd = &mdt->mdt_lut.lut_lsd;
struct lsd_client_data *lcd = NULL;
struct obd_device *obd = mdt2obd_dev(mdt);
loff_t off;
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
LASSERT(mti != NULL);
mti->mti_exp = exp;
- exp->exp_mdt_data.med_lcd = lcd;
+ exp->exp_target_data.ted_lcd = lcd;
rc = mdt_client_add(env, mdt, cl_idx);
/* can't fail existing */
LASSERTF(rc == 0, "rc = %d\n", rc);
CDEBUG(D_OTHER, "client at idx %d has last_transno="LPU64"\n",
cl_idx, last_transno);
/* protect __u64 value update */
- cfs_spin_lock(&mdt->mdt_transno_lock);
- mdt->mdt_last_transno = max(last_transno,
- mdt->mdt_last_transno);
- cfs_spin_unlock(&mdt->mdt_transno_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_translock);
+ mdt->mdt_lut.lut_last_transno = max(last_transno,
+ mdt->mdt_lut.lut_last_transno);
+ cfs_spin_unlock(&mdt->mdt_lut.lut_translock);
}
err_client:
struct mdt_device *mdt,
struct lustre_sb_info *lsi)
{
- struct lr_server_data *lsd = &mdt->mdt_lsd;
+ struct lr_server_data *lsd = &mdt->mdt_lut.lut_lsd;
struct lsd_client_data *lcd = NULL;
struct obd_device *obd = mdt2obd_dev(mdt);
struct mdt_thread_info *mti;
LASSERT(mti != NULL);
la = &mti->mti_attr.ma_attr;
- obj = mdt->mdt_last_rcvd;
- rc = obj->do_ops->do_attr_get(env, mdt->mdt_last_rcvd, la, BYPASS_CAPA);
+ obj = mdt->mdt_lut.lut_last_rcvd;
+ rc = obj->do_ops->do_attr_get(env, obj, la, BYPASS_CAPA);
if (rc)
RETURN(rc);
lsd->lsd_feature_incompat |= OBD_INCOMPAT_FID;
- cfs_spin_lock(&mdt->mdt_transno_lock);
- mdt->mdt_last_transno = lsd->lsd_last_transno;
- cfs_spin_unlock(&mdt->mdt_transno_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_translock);
+ mdt->mdt_lut.lut_last_transno = lsd->lsd_last_transno;
+ cfs_spin_unlock(&mdt->mdt_lut.lut_translock);
CDEBUG(D_INODE, "========BEGIN DUMPING LAST_RCVD========\n");
CDEBUG(D_INODE, "%s: server last_transno: "LPU64"\n",
- obd->obd_name, mdt->mdt_last_transno);
+ obd->obd_name, mdt->mdt_lut.lut_last_transno);
CDEBUG(D_INODE, "%s: server mount_count: "LPU64"\n",
obd->obd_name, mount_count + 1);
CDEBUG(D_INODE, "%s: server data size: %u\n",
if (rc)
GOTO(err_client, rc);
- cfs_spin_lock(&mdt->mdt_transno_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_translock);
/* obd_last_committed is used for compatibility
* with other lustre recovery code */
- obd->obd_last_committed = mdt->mdt_last_transno;
- cfs_spin_unlock(&mdt->mdt_transno_lock);
+ obd->obd_last_committed = mdt->mdt_lut.lut_last_transno;
+ cfs_spin_unlock(&mdt->mdt_lut.lut_translock);
- mdt->mdt_mount_count = mount_count + 1;
- lsd->lsd_mount_count = mdt->mdt_mount_count;
+ mdt->mdt_lut.lut_mount_count = mount_count + 1;
+ lsd->lsd_mount_count = mdt->mdt_lut.lut_mount_count;
/* save it, so mount count and last_transno is current */
rc = mdt_server_data_update(env, mdt);
RETURN(PTR_ERR(th));
CDEBUG(D_SUPER, "MDS mount_count is "LPU64", last_transno is "LPU64"\n",
- mdt->mdt_mount_count, mdt->mdt_last_transno);
+ mdt->mdt_lut.lut_mount_count, mdt->mdt_lut.lut_last_transno);
- cfs_spin_lock(&mdt->mdt_transno_lock);
- mdt->mdt_lsd.lsd_last_transno = mdt->mdt_last_transno;
- cfs_spin_unlock(&mdt->mdt_transno_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_translock);
+ mdt->mdt_lut.lut_lsd.lsd_last_transno = mdt->mdt_lut.lut_last_transno;
+ cfs_spin_unlock(&mdt->mdt_lut.lut_translock);
rc = mdt_last_rcvd_header_write(env, mdt, th);
mdt_trans_stop(env, mdt, th);
int mdt_client_new(const struct lu_env *env, struct mdt_device *mdt)
{
- unsigned long *bitmap = mdt->mdt_client_bitmap;
+ unsigned long *bitmap = mdt->mdt_lut.lut_client_bitmap;
struct mdt_thread_info *mti;
- struct mdt_export_data *med;
- struct lsd_client_data *lcd;
- struct lr_server_data *lsd = &mdt->mdt_lsd;
+ struct tg_export_data *ted;
+ struct lr_server_data *lsd = &mdt->mdt_lut.lut_lsd;
struct obd_device *obd = mdt2obd_dev(mdt);
struct thandle *th;
loff_t off;
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
LASSERT(mti != NULL);
- med = &mti->mti_exp->exp_mdt_data;
- lcd = med->med_lcd;
+ ted = &mti->mti_exp->exp_target_data;
LASSERT(bitmap != NULL);
- if (!strcmp(med->med_lcd->lcd_uuid, obd->obd_uuid.uuid))
+ if (!strcmp(ted->ted_lcd->lcd_uuid, obd->obd_uuid.uuid))
RETURN(0);
/* the bitmap operations can handle cl_idx > sizeof(long) * 8, so
* there's no need for extra complication here
*/
- cfs_spin_lock(&mdt->mdt_client_bitmap_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_client_bitmap_lock);
cl_idx = cfs_find_first_zero_bit(bitmap, LR_MAX_CLIENTS);
if (cl_idx >= LR_MAX_CLIENTS ||
OBD_FAIL_CHECK(OBD_FAIL_MDS_CLIENT_ADD)) {
CERROR("no room for %u clients - fix LR_MAX_CLIENTS\n",
cl_idx);
- cfs_spin_unlock(&mdt->mdt_client_bitmap_lock);
+ cfs_spin_unlock(&mdt->mdt_lut.lut_client_bitmap_lock);
RETURN(-EOVERFLOW);
}
cfs_set_bit(cl_idx, bitmap);
- cfs_spin_unlock(&mdt->mdt_client_bitmap_lock);
+ cfs_spin_unlock(&mdt->mdt_lut.lut_client_bitmap_lock);
CDEBUG(D_INFO, "client at idx %d with UUID '%s' added\n",
- cl_idx, med->med_lcd->lcd_uuid);
+ cl_idx, ted->ted_lcd->lcd_uuid);
- med->med_lr_idx = cl_idx;
- med->med_lr_off = lsd->lsd_client_start +
+ ted->ted_lr_idx = cl_idx;
+ ted->ted_lr_off = lsd->lsd_client_start +
(cl_idx * lsd->lsd_client_size);
- cfs_init_mutex(&med->med_lcd_lock);
+ cfs_init_mutex(&ted->ted_lcd_lock);
- LASSERTF(med->med_lr_off > 0, "med_lr_off = %llu\n", med->med_lr_off);
+ LASSERTF(ted->ted_lr_off > 0, "ted_lr_off = %llu\n", ted->ted_lr_off);
/* Write new client data. */
- off = med->med_lr_off;
+ off = ted->ted_lr_off;
if (OBD_FAIL_CHECK(OBD_FAIL_TGT_CLIENT_ADD))
RETURN(-ENOSPC);
mti->mti_exp->exp_need_sync = 1;
cfs_spin_unlock(&mti->mti_exp->exp_lock);
- rc = mdt_last_rcvd_write(env, mdt, lcd, &off, th);
+ rc = mdt_last_rcvd_write(env, mdt, ted->ted_lcd, &off, th);
CDEBUG(D_INFO, "wrote client lcd at idx %u off %llu (len %u)\n",
- cl_idx, med->med_lr_off, (int)sizeof(*lcd));
+ cl_idx, ted->ted_lr_off, (int)sizeof(*(ted->ted_lcd)));
mdt_trans_stop(env, mdt, th);
RETURN(rc);
struct mdt_device *mdt, int cl_idx)
{
struct mdt_thread_info *mti;
- struct mdt_export_data *med;
- unsigned long *bitmap = mdt->mdt_client_bitmap;
+ struct tg_export_data *ted;
+ unsigned long *bitmap = mdt->mdt_lut.lut_client_bitmap;
struct obd_device *obd = mdt2obd_dev(mdt);
- struct lr_server_data *lsd = &mdt->mdt_lsd;
+ struct lr_server_data *lsd = &mdt->mdt_lut.lut_lsd;
int rc = 0;
ENTRY;
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
LASSERT(mti != NULL);
- med = &mti->mti_exp->exp_mdt_data;
+ ted = &mti->mti_exp->exp_target_data;
LASSERT(bitmap != NULL);
LASSERTF(cl_idx >= 0, "%d\n", cl_idx);
- if (!strcmp(med->med_lcd->lcd_uuid, obd->obd_uuid.uuid))
+ if (!strcmp(ted->ted_lcd->lcd_uuid, obd->obd_uuid.uuid))
RETURN(0);
- cfs_spin_lock(&mdt->mdt_client_bitmap_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_client_bitmap_lock);
if (cfs_test_and_set_bit(cl_idx, bitmap)) {
CERROR("MDS client %d: bit already set in bitmap!!\n",
cl_idx);
LBUG();
}
- cfs_spin_unlock(&mdt->mdt_client_bitmap_lock);
+ cfs_spin_unlock(&mdt->mdt_lut.lut_client_bitmap_lock);
CDEBUG(D_INFO, "client at idx %d with UUID '%s' added\n",
- cl_idx, med->med_lcd->lcd_uuid);
+ cl_idx, ted->ted_lcd->lcd_uuid);
- med->med_lr_idx = cl_idx;
- med->med_lr_off = lsd->lsd_client_start +
+ ted->ted_lr_idx = cl_idx;
+ ted->ted_lr_off = lsd->lsd_client_start +
(cl_idx * lsd->lsd_client_size);
- cfs_init_mutex(&med->med_lcd_lock);
+ cfs_init_mutex(&ted->ted_lcd_lock);
- LASSERTF(med->med_lr_off > 0, "med_lr_off = %llu\n", med->med_lr_off);
+ LASSERTF(ted->ted_lr_off > 0, "ted_lr_off = %llu\n", ted->ted_lr_off);
RETURN(rc);
}
int mdt_client_del(const struct lu_env *env, struct mdt_device *mdt)
{
struct mdt_thread_info *mti;
- struct mdt_export_data *med;
- struct lsd_client_data *lcd;
+ struct tg_export_data *ted;
struct obd_device *obd = mdt2obd_dev(mdt);
struct obd_export *exp;
struct thandle *th;
LASSERT(mti != NULL);
exp = mti->mti_exp;
- med = &exp->exp_mdt_data;
- lcd = med->med_lcd;
- if (!lcd)
+ ted = &exp->exp_target_data;
+ if (!ted->ted_lcd)
RETURN(0);
/* XXX: If lcd_uuid were a real obd_uuid, I could use obd_uuid_equals */
- if (!strcmp(lcd->lcd_uuid, obd->obd_uuid.uuid))
+ if (!strcmp(ted->ted_lcd->lcd_uuid, obd->obd_uuid.uuid))
GOTO(free, 0);
CDEBUG(D_INFO, "freeing client at idx %u, offset %lld\n",
- med->med_lr_idx, med->med_lr_off);
+ ted->ted_lr_idx, ted->ted_lr_off);
- off = med->med_lr_off;
+ off = ted->ted_lr_off;
/*
- * Don't clear med_lr_idx here as it is likely also unset. At worst we
+ * Don't clear ted_lr_idx here as it is likely also unset. At worst we
* leak a client slot that will be cleaned on the next recovery.
*/
if (off <= 0) {
CERROR("client idx %d has offset %lld\n",
- med->med_lr_idx, off);
+ ted->ted_lr_idx, off);
GOTO(free, rc = -EINVAL);
}
* Clear the bit _after_ zeroing out the client so we don't race with
* mdt_client_add and zero out new clients.
*/
- if (!cfs_test_bit(med->med_lr_idx, mdt->mdt_client_bitmap)) {
+ if (!cfs_test_bit(ted->ted_lr_idx, mdt->mdt_lut.lut_client_bitmap)) {
CERROR("MDT client %u: bit already clear in bitmap!!\n",
- med->med_lr_idx);
+ ted->ted_lr_idx);
LBUG();
}
if (IS_ERR(th))
GOTO(free, rc = PTR_ERR(th));
- cfs_mutex_down(&med->med_lcd_lock);
- memset(lcd->lcd_uuid, 0, sizeof lcd->lcd_uuid);
- rc = mdt_last_rcvd_write(env, mdt, lcd, &off, th);
- cfs_mutex_up(&med->med_lcd_lock);
+ cfs_mutex_down(&ted->ted_lcd_lock);
+ memset(ted->ted_lcd->lcd_uuid, 0, sizeof ted->ted_lcd->lcd_uuid);
+ rc = mdt_last_rcvd_write(env, mdt, ted->ted_lcd, &off, th);
+ cfs_mutex_up(&ted->ted_lcd_lock);
mdt_trans_stop(env, mdt, th);
CDEBUG(rc == 0 ? D_INFO : D_ERROR, "Zeroing out client idx %u in "
- "%s, rc %d\n", med->med_lr_idx, LAST_RCVD, rc);
+ "%s, rc %d\n", ted->ted_lr_idx, LAST_RCVD, rc);
RETURN(0);
free:
return 0;
{
struct mdt_device *mdt = mti->mti_mdt;
struct ptlrpc_request *req = mdt_info_req(mti);
- struct mdt_export_data *med;
+ struct tg_export_data *ted;
struct lsd_client_data *lcd;
loff_t off;
int err;
LASSERT(req);
LASSERT(req->rq_export);
LASSERT(mdt);
- med = &req->rq_export->exp_mdt_data;
- LASSERT(med);
+ ted = &req->rq_export->exp_target_data;
+ LASSERT(ted);
- cfs_mutex_down(&med->med_lcd_lock);
- lcd = med->med_lcd;
+ cfs_mutex_down(&ted->ted_lcd_lock);
+ lcd = ted->ted_lcd;
/* if the export has already been disconnected, we have no last_rcvd slot,
* update server data with latest transno then */
if (lcd == NULL) {
- cfs_mutex_up(&med->med_lcd_lock);
+ cfs_mutex_up(&ted->ted_lcd_lock);
CWARN("commit transaction for disconnected client %s: rc %d\n",
req->rq_export->exp_client_uuid.uuid, rc);
err = mdt_last_rcvd_header_write(mti->mti_env, mdt, th);
RETURN(err);
}
- off = med->med_lr_off;
+ off = ted->ted_lr_off;
LASSERT(ergo(mti->mti_transno == 0, rc != 0));
if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE ||
lustre_msg_get_opc(req->rq_reqmsg) == MDS_DONE_WRITING) {
}
if (off <= 0) {
- CERROR("client idx %d has offset %lld\n", med->med_lr_idx, off);
+ CERROR("client idx %d has offset %lld\n", ted->ted_lr_idx, off);
err = -EINVAL;
} else {
err = mdt_last_rcvd_write(mti->mti_env, mdt, lcd, &off, th);
}
- cfs_mutex_up(&med->med_lcd_lock);
+ cfs_mutex_up(&ted->ted_lcd_lock);
RETURN(err);
}
}
mti->mti_has_trans = 1;
- cfs_spin_lock(&mdt->mdt_transno_lock);
+ cfs_spin_lock(&mdt->mdt_lut.lut_translock);
if (txn->th_result != 0) {
if (mti->mti_transno != 0) {
CERROR("Replay transno "LPU64" failed: rc %i\n",
mti->mti_transno, txn->th_result);
}
} else if (mti->mti_transno == 0) {
- mti->mti_transno = ++ mdt->mdt_last_transno;
+ mti->mti_transno = ++ mdt->mdt_lut.lut_last_transno;
} else {
/* should be replay */
- if (mti->mti_transno > mdt->mdt_last_transno)
- mdt->mdt_last_transno = mti->mti_transno;
+ if (mti->mti_transno > mdt->mdt_lut.lut_last_transno)
+ mdt->mdt_lut.lut_last_transno = mti->mti_transno;
}
- cfs_spin_unlock(&mdt->mdt_transno_lock);
+ cfs_spin_unlock(&mdt->mdt_lut.lut_translock);
/* sometimes the reply message has not been successfully packed */
LASSERT(req != NULL && req->rq_repmsg != NULL);
struct mdt_lock_handle *lhc)
{
struct ptlrpc_request *req = mdt_info_req(mti);
- struct mdt_export_data *med = &req->rq_export->exp_mdt_data;
+ struct tg_export_data *ted = &req->rq_export->exp_target_data;
- return mdt_req_from_lcd(req, med->med_lcd);
+ return mdt_req_from_lcd(req, ted->ted_lcd);
}
static void mdt_reconstruct_create(struct mdt_thread_info *mti,
{
struct ptlrpc_request *req = mdt_info_req(mti);
struct obd_export *exp = req->rq_export;
- struct mdt_export_data *med = &exp->exp_mdt_data;
+ struct tg_export_data *ted = &exp->exp_target_data;
struct mdt_device *mdt = mti->mti_mdt;
struct mdt_object *child;
struct mdt_body *body;
int rc;
- mdt_req_from_lcd(req, med->med_lcd);
+ mdt_req_from_lcd(req, ted->ted_lcd);
if (req->rq_status)
return;
struct mdt_object *obj;
struct mdt_body *body;
- mdt_req_from_lcd(req, med->med_lcd);
+ mdt_req_from_lcd(req, med->med_ted.ted_lcd);
if (req->rq_status)
return;
int filter_finish_transno(struct obd_export *exp, struct inode *inode,
struct obd_trans_info *oti, int rc, int force_sync)
{
- struct filter_obd *filter = &exp->exp_obd->u.filter;
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct lr_server_data *fsd = class_server_data(exp->exp_obd);
+ struct obd_device_target *obt = &exp->exp_obd->u.obt;
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct lr_server_data *lsd = class_server_data(exp->exp_obd);
struct lsd_client_data *lcd;
__u64 last_rcvd;
loff_t off;
if (!exp->exp_obd->obd_replayable || oti == NULL)
RETURN(rc);
- cfs_mutex_down(&fed->fed_lcd_lock);
- lcd = fed->fed_lcd;
+ cfs_mutex_down(&ted->ted_lcd_lock);
+ lcd = ted->ted_lcd;
/* if the export has already been disconnected, we have no last_rcvd slot,
* update server data with latest transno then */
if (lcd == NULL) {
- cfs_mutex_up(&fed->fed_lcd_lock);
+ cfs_mutex_up(&ted->ted_lcd_lock);
CWARN("commit transaction for disconnected client %s: rc %d\n",
exp->exp_client_uuid.uuid, rc);
err = filter_update_server_data(exp->exp_obd);
}
/* we don't allocate new transnos for replayed requests */
- cfs_spin_lock(&filter->fo_translock);
+ cfs_spin_lock(&obt->obt_lut->lut_translock);
if (oti->oti_transno == 0) {
- last_rcvd = le64_to_cpu(fsd->lsd_last_transno) + 1;
- fsd->lsd_last_transno = cpu_to_le64(last_rcvd);
+ last_rcvd = le64_to_cpu(lsd->lsd_last_transno) + 1;
+ lsd->lsd_last_transno = cpu_to_le64(last_rcvd);
} else {
last_rcvd = oti->oti_transno;
- if (last_rcvd > le64_to_cpu(fsd->lsd_last_transno))
- fsd->lsd_last_transno = cpu_to_le64(last_rcvd);
+ if (last_rcvd > le64_to_cpu(lsd->lsd_last_transno))
+ lsd->lsd_last_transno = cpu_to_le64(last_rcvd);
}
oti->oti_transno = last_rcvd;
lcd->lcd_last_transno = cpu_to_le64(last_rcvd);
lcd->lcd_pre_versions[0] = cpu_to_le64(oti->oti_pre_version);
lcd->lcd_last_xid = cpu_to_le64(oti->oti_xid);
- cfs_spin_unlock(&filter->fo_translock);
+ cfs_spin_unlock(&obt->obt_lut->lut_translock);
if (inode)
fsfilt_set_version(exp->exp_obd, inode, last_rcvd);
- off = fed->fed_lr_off;
+ off = ted->ted_lr_off;
if (off <= 0) {
CERROR("%s: client idx %d is %lld\n", exp->exp_obd->obd_name,
- fed->fed_lr_idx, fed->fed_lr_off);
+ ted->ted_lr_idx, ted->ted_lr_off);
err = -EINVAL;
} else {
class_export_cb_get(exp); /* released when the cb is called */
filter_commit_cb,
exp);
- err = fsfilt_write_record(exp->exp_obd, filter->fo_rcvd_filp,
+ err = fsfilt_write_record(exp->exp_obd, obt->obt_rcvd_filp,
lcd, sizeof(*lcd), &off,
force_sync | exp->exp_need_sync);
if (force_sync)
}
CDEBUG(log_pri, "wrote trans "LPU64" for client %s at #%d: err = %d\n",
- last_rcvd, lcd->lcd_uuid, fed->fed_lr_idx, err);
- cfs_mutex_up(&fed->fed_lcd_lock);
+ last_rcvd, lcd->lcd_uuid, ted->ted_lr_idx, err);
+ cfs_mutex_up(&ted->ted_lcd_lock);
RETURN(rc);
}
static int filter_client_add(struct obd_device *obd, struct obd_export *exp,
int cl_idx)
{
- struct filter_obd *filter = &obd->u.filter;
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct lr_server_data *fsd = class_server_data(obd);
- unsigned long *bitmap = filter->fo_last_rcvd_slots;
+ struct obd_device_target *obt = &obd->u.obt;
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct lr_server_data *lsd = class_server_data(obd);
+ unsigned long *bitmap = obt->obt_lut->lut_client_bitmap;
int new_client = (cl_idx == -1);
ENTRY;
LASSERTF(cl_idx > -2, "%d\n", cl_idx);
/* Self-export */
- if (strcmp(fed->fed_lcd->lcd_uuid, obd->obd_uuid.uuid) == 0)
+ if (strcmp(ted->ted_lcd->lcd_uuid, obd->obd_uuid.uuid) == 0)
RETURN(0);
/* the bitmap operations can handle cl_idx > sizeof(long) * 8, so
}
}
- fed->fed_lr_idx = cl_idx;
- fed->fed_lr_off = le32_to_cpu(fsd->lsd_client_start) +
- cl_idx * le16_to_cpu(fsd->lsd_client_size);
- cfs_init_mutex(&fed->fed_lcd_lock);
- LASSERTF(fed->fed_lr_off > 0, "fed_lr_off = %llu\n", fed->fed_lr_off);
+ ted->ted_lr_idx = cl_idx;
+ ted->ted_lr_off = le32_to_cpu(lsd->lsd_client_start) +
+ cl_idx * le16_to_cpu(lsd->lsd_client_size);
+ cfs_init_mutex(&ted->ted_lcd_lock);
+ LASSERTF(ted->ted_lr_off > 0, "ted_lr_off = %llu\n", ted->ted_lr_off);
CDEBUG(D_INFO, "client at index %d (%llu) with UUID '%s' added\n",
- fed->fed_lr_idx, fed->fed_lr_off, fed->fed_lcd->lcd_uuid);
+ ted->ted_lr_idx, ted->ted_lr_off, ted->ted_lcd->lcd_uuid);
if (new_client) {
struct lvfs_run_ctxt saved;
- loff_t off = fed->fed_lr_off;
+ loff_t off = ted->ted_lr_off;
int rc;
void *handle;
CDEBUG(D_INFO, "writing client lcd at idx %u (%llu) (len %u)\n",
- fed->fed_lr_idx,off,(unsigned int)sizeof(*fed->fed_lcd));
+ ted->ted_lr_idx,off,(unsigned int)sizeof(*ted->ted_lcd));
if (OBD_FAIL_CHECK(OBD_FAIL_TGT_CLIENT_ADD))
RETURN(-ENOSPC);
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
/* Transaction needed to fix bug 1403 */
handle = fsfilt_start(obd,
- filter->fo_rcvd_filp->f_dentry->d_inode,
+ obt->obt_rcvd_filp->f_dentry->d_inode,
FSFILT_OP_SETATTR, NULL);
if (IS_ERR(handle)) {
rc = PTR_ERR(handle);
CERROR("unable to start transaction: rc %d\n", rc);
} else {
- fed->fed_lcd->lcd_last_epoch = fsd->lsd_start_epoch;
+ ted->ted_lcd->lcd_last_epoch = lsd->lsd_start_epoch;
exp->exp_last_request_time = cfs_time_current_sec();
rc = fsfilt_add_journal_cb(obd, 0, handle,
target_client_add_cb,
exp->exp_need_sync = 1;
cfs_spin_unlock(&exp->exp_lock);
}
- rc = fsfilt_write_record(obd, filter->fo_rcvd_filp,
- fed->fed_lcd,
- sizeof(*fed->fed_lcd),
+ rc = fsfilt_write_record(obd, obt->obt_rcvd_filp,
+ ted->ted_lcd,
+ sizeof(*ted->ted_lcd),
&off, rc /* sync if no cb */);
fsfilt_commit(obd,
- filter->fo_rcvd_filp->f_dentry->d_inode,
+ obt->obt_rcvd_filp->f_dentry->d_inode,
handle, 0);
}
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
if (rc) {
CERROR("error writing %s client idx %u: rc %d\n",
- LAST_RCVD, fed->fed_lr_idx, rc);
+ LAST_RCVD, ted->ted_lr_idx, rc);
RETURN(rc);
}
}
static int filter_client_del(struct obd_export *exp)
{
- struct filter_export_data *fed = &exp->exp_filter_data;
- struct filter_obd *filter = &exp->exp_obd->u.filter;
- struct obd_device *obd = exp->exp_obd;
+ struct tg_export_data *ted = &exp->exp_target_data;
+ struct obd_device_target *obt = &exp->exp_obd->u.obt;
struct lvfs_run_ctxt saved;
- struct lsd_client_data *lcd = fed->fed_lcd;
int rc;
loff_t off;
ENTRY;
- if (lcd == NULL)
+ if (ted->ted_lcd == NULL)
RETURN(0);
/* XXX if lcd_uuid were a real obd_uuid, I could use obd_uuid_equals */
- if (strcmp(lcd->lcd_uuid, obd->obd_uuid.uuid ) == 0)
+ if (strcmp(ted->ted_lcd->lcd_uuid, exp->exp_obd->obd_uuid.uuid ) == 0)
GOTO(free, 0);
- LASSERT(filter->fo_last_rcvd_slots != NULL);
+ LASSERT(obt->obt_lut->lut_client_bitmap != NULL);
- off = fed->fed_lr_off;
+ off = ted->ted_lr_off;
CDEBUG(D_INFO, "freeing client at idx %u, offset %lld with UUID '%s'\n",
- fed->fed_lr_idx, fed->fed_lr_off, lcd->lcd_uuid);
+ ted->ted_lr_idx, ted->ted_lr_off, ted->ted_lcd->lcd_uuid);
- /* Don't clear fed_lr_idx here as it is likely also unset. At worst
+ /* Don't clear ted_lr_idx here as it is likely also unset. At worst
* we leak a client slot that will be cleaned on the next recovery. */
if (off <= 0) {
CERROR("%s: client idx %d has med_off %lld\n",
- obd->obd_name, fed->fed_lr_idx, off);
+ exp->exp_obd->obd_name, ted->ted_lr_idx, off);
GOTO(free, rc = -EINVAL);
}
/* Clear the bit _after_ zeroing out the client so we don't
race with filter_client_add and zero out new clients.*/
- if (!cfs_test_bit(fed->fed_lr_idx, filter->fo_last_rcvd_slots)) {
+ if (!cfs_test_bit(ted->ted_lr_idx, obt->obt_lut->lut_client_bitmap)) {
CERROR("FILTER client %u: bit already clear in bitmap!!\n",
- fed->fed_lr_idx);
+ ted->ted_lr_idx);
LBUG();
}
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
/* Make sure the server's last_transno is up to date.
* This should be done before zeroing client slot so last_transno will
* be in server data or in client data in case of failure */
- filter_update_server_data(obd);
-
- cfs_mutex_down(&fed->fed_lcd_lock);
- memset(fed->fed_lcd->lcd_uuid, 0, sizeof fed->fed_lcd->lcd_uuid);
- rc = fsfilt_write_record(obd, filter->fo_rcvd_filp,
- fed->fed_lcd,
- sizeof(*fed->fed_lcd), &off, 0);
- cfs_mutex_up(&fed->fed_lcd_lock);
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ filter_update_server_data(exp->exp_obd);
+
+ cfs_mutex_down(&ted->ted_lcd_lock);
+ memset(ted->ted_lcd->lcd_uuid, 0, sizeof ted->ted_lcd->lcd_uuid);
+ rc = fsfilt_write_record(exp->exp_obd, obt->obt_rcvd_filp,
+ ted->ted_lcd,
+ sizeof(*ted->ted_lcd), &off, 0);
+ cfs_mutex_up(&ted->ted_lcd_lock);
+ pop_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
CDEBUG(rc == 0 ? D_INFO : D_ERROR,
"zero out client %s at idx %u/%llu in %s, rc %d\n",
- lcd->lcd_uuid, fed->fed_lr_idx, fed->fed_lr_off,
+ ted->ted_lcd->lcd_uuid, ted->ted_lr_idx, ted->ted_lr_off,
LAST_RCVD, rc);
EXIT;
free:
return ldlm_init_export(exp);
}
-static int filter_free_server_data(struct filter_obd *filter)
+static int filter_free_server_data(struct obd_device_target *obt)
{
- lut_fini(NULL, filter->fo_obt.obt_lut);
- OBD_FREE_PTR(filter->fo_obt.obt_lut);
+ lut_fini(NULL, obt->obt_lut);
+ OBD_FREE_PTR(obt->obt_lut);
return 0;
}
int filter_update_server_data(struct obd_device *obd)
{
struct file *filp = obd->u.obt.obt_rcvd_filp;
- struct lr_server_data *fsd = class_server_data(obd);
+ struct lr_server_data *lsd = class_server_data(obd);
loff_t off = 0;
int rc;
ENTRY;
- CDEBUG(D_INODE, "server uuid : %s\n", fsd->lsd_uuid);
+ CDEBUG(D_INODE, "server uuid : %s\n", lsd->lsd_uuid);
CDEBUG(D_INODE, "server last_rcvd : "LPU64"\n",
- le64_to_cpu(fsd->lsd_last_transno));
+ le64_to_cpu(lsd->lsd_last_transno));
CDEBUG(D_INODE, "server last_mount: "LPU64"\n",
- le64_to_cpu(fsd->lsd_mount_count));
+ le64_to_cpu(lsd->lsd_mount_count));
- rc = fsfilt_write_record(obd, filp, fsd, sizeof(*fsd), &off, 0);
+ rc = fsfilt_write_record(obd, filp, lsd, sizeof(*lsd), &off, 0);
if (rc)
CERROR("error writing lr_server_data: rc = %d\n", rc);
static int filter_init_server_data(struct obd_device *obd, struct file * filp)
{
struct filter_obd *filter = &obd->u.filter;
- struct lr_server_data *fsd;
+ struct lr_server_data *lsd;
struct lsd_client_data *lcd = NULL;
struct inode *inode = filp->f_dentry->d_inode;
unsigned long last_rcvd_size = i_size_read(inode);
/* ensure padding in the struct is the correct size */
CLASSERT (offsetof(struct lr_server_data, lsd_padding) +
- sizeof(fsd->lsd_padding) == LR_SERVER_SIZE);
+ sizeof(lsd->lsd_padding) == LR_SERVER_SIZE);
CLASSERT (offsetof(struct lsd_client_data, lcd_padding) +
sizeof(lcd->lcd_padding) == LR_CLIENT_SIZE);
RETURN(-ENOMEM);
rc = lut_init(NULL, lut, obd, NULL);
if (rc)
- GOTO(err_fsd, rc);
- fsd = class_server_data(obd);
+ GOTO(err_lut, rc);
+ lsd = class_server_data(obd);
if (last_rcvd_size == 0) {
LCONSOLE_WARN("%s: new disk, initializing\n", obd->obd_name);
- memcpy(fsd->lsd_uuid, obd->obd_uuid.uuid,sizeof(fsd->lsd_uuid));
- fsd->lsd_last_transno = 0;
- mount_count = fsd->lsd_mount_count = 0;
- fsd->lsd_server_size = cpu_to_le32(LR_SERVER_SIZE);
- fsd->lsd_client_start = cpu_to_le32(LR_CLIENT_START);
- fsd->lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE);
- fsd->lsd_subdir_count = cpu_to_le16(FILTER_SUBDIR_COUNT);
+ memcpy(lsd->lsd_uuid, obd->obd_uuid.uuid,sizeof(lsd->lsd_uuid));
+ lsd->lsd_last_transno = 0;
+ mount_count = lsd->lsd_mount_count = 0;
+ lsd->lsd_server_size = cpu_to_le32(LR_SERVER_SIZE);
+ lsd->lsd_client_start = cpu_to_le32(LR_CLIENT_START);
+ lsd->lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE);
+ lsd->lsd_subdir_count = cpu_to_le16(FILTER_SUBDIR_COUNT);
filter->fo_subdir_count = FILTER_SUBDIR_COUNT;
/* OBD_COMPAT_OST is set in filter_connect_internal when the
* MDS first connects and assigns the OST index number. */
- fsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_COMMON_LR|
+ lsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_COMMON_LR|
OBD_INCOMPAT_OST);
} else {
- rc = fsfilt_read_record(obd, filp, fsd, sizeof(*fsd), &off);
+ rc = fsfilt_read_record(obd, filp, lsd, sizeof(*lsd), &off);
if (rc) {
CDEBUG(D_INODE,"OBD filter: error reading %s: rc %d\n",
LAST_RCVD, rc);
- GOTO(err_fsd, rc);
+ GOTO(err_lut, rc);
}
- if (strcmp(fsd->lsd_uuid, obd->obd_uuid.uuid) != 0) {
+ if (strcmp(lsd->lsd_uuid, obd->obd_uuid.uuid) != 0) {
LCONSOLE_ERROR_MSG(0x134, "Trying to start OBD %s "
"using the wrong disk %s. Were the "
"/dev/ assignments rearranged?\n",
- obd->obd_uuid.uuid, fsd->lsd_uuid);
- GOTO(err_fsd, rc = -EINVAL);
+ obd->obd_uuid.uuid, lsd->lsd_uuid);
+ GOTO(err_lut, rc = -EINVAL);
}
- mount_count = le64_to_cpu(fsd->lsd_mount_count);
- filter->fo_subdir_count = le16_to_cpu(fsd->lsd_subdir_count);
+ mount_count = le64_to_cpu(lsd->lsd_mount_count);
+ filter->fo_subdir_count = le16_to_cpu(lsd->lsd_subdir_count);
/* COMPAT_146 */
/* Assume old last_rcvd format unless I_C_LR is set */
- if (!(fsd->lsd_feature_incompat &
+ if (!(lsd->lsd_feature_incompat &
cpu_to_le32(OBD_INCOMPAT_COMMON_LR)))
- fsd->lsd_last_transno = fsd->lsd_compat14;
+ lsd->lsd_last_transno = lsd->lsd_compat14;
/* end COMPAT_146 */
/* OBD_COMPAT_OST is set in filter_connect_internal when the
* MDS first connects and assigns the OST index number. */
- fsd->lsd_feature_incompat |= cpu_to_le32(OBD_INCOMPAT_COMMON_LR|
+ lsd->lsd_feature_incompat |= cpu_to_le32(OBD_INCOMPAT_COMMON_LR|
OBD_INCOMPAT_OST);
}
- if (fsd->lsd_feature_incompat & ~cpu_to_le32(FILTER_INCOMPAT_SUPP)) {
+ if (lsd->lsd_feature_incompat & ~cpu_to_le32(FILTER_INCOMPAT_SUPP)) {
CERROR("%s: unsupported incompat filesystem feature(s) %x\n",
- obd->obd_name, le32_to_cpu(fsd->lsd_feature_incompat) &
+ obd->obd_name, le32_to_cpu(lsd->lsd_feature_incompat) &
~FILTER_INCOMPAT_SUPP);
- GOTO(err_fsd, rc = -EINVAL);
+ GOTO(err_lut, rc = -EINVAL);
}
- if (fsd->lsd_feature_rocompat & ~cpu_to_le32(FILTER_ROCOMPAT_SUPP)) {
+ if (lsd->lsd_feature_rocompat & ~cpu_to_le32(FILTER_ROCOMPAT_SUPP)) {
CERROR("%s: unsupported read-only filesystem feature(s) %x\n",
- obd->obd_name, le32_to_cpu(fsd->lsd_feature_rocompat) &
+ obd->obd_name, le32_to_cpu(lsd->lsd_feature_rocompat) &
~FILTER_ROCOMPAT_SUPP);
/* Do something like remount filesystem read-only */
- GOTO(err_fsd, rc = -EINVAL);
+ GOTO(err_lut, rc = -EINVAL);
}
- start_epoch = le32_to_cpu(fsd->lsd_start_epoch);
+ start_epoch = le32_to_cpu(lsd->lsd_start_epoch);
CDEBUG(D_INODE, "%s: server start_epoch : %#x\n",
obd->obd_name, start_epoch);
CDEBUG(D_INODE, "%s: server last_transno : "LPX64"\n",
- obd->obd_name, le64_to_cpu(fsd->lsd_last_transno));
+ obd->obd_name, le64_to_cpu(lsd->lsd_last_transno));
CDEBUG(D_INODE, "%s: server mount_count: "LPU64"\n",
obd->obd_name, mount_count + 1);
CDEBUG(D_INODE, "%s: server data size: %u\n",
- obd->obd_name, le32_to_cpu(fsd->lsd_server_size));
+ obd->obd_name, le32_to_cpu(lsd->lsd_server_size));
CDEBUG(D_INODE, "%s: per-client data start: %u\n",
- obd->obd_name, le32_to_cpu(fsd->lsd_client_start));
+ obd->obd_name, le32_to_cpu(lsd->lsd_client_start));
CDEBUG(D_INODE, "%s: per-client data size: %u\n",
- obd->obd_name, le32_to_cpu(fsd->lsd_client_size));
+ obd->obd_name, le32_to_cpu(lsd->lsd_client_size));
CDEBUG(D_INODE, "%s: server subdir_count: %u\n",
- obd->obd_name, le16_to_cpu(fsd->lsd_subdir_count));
+ obd->obd_name, le16_to_cpu(lsd->lsd_subdir_count));
CDEBUG(D_INODE, "%s: last_rcvd clients: %lu\n", obd->obd_name,
- last_rcvd_size <= le32_to_cpu(fsd->lsd_client_start) ? 0 :
- (last_rcvd_size - le32_to_cpu(fsd->lsd_client_start)) /
- le16_to_cpu(fsd->lsd_client_size));
+ last_rcvd_size <= le32_to_cpu(lsd->lsd_client_start) ? 0 :
+ (last_rcvd_size - le32_to_cpu(lsd->lsd_client_start)) /
+ le16_to_cpu(lsd->lsd_client_size));
if (!obd->obd_replayable) {
CWARN("%s: recovery support OFF\n", obd->obd_name);
GOTO(out, rc = 0);
}
- for (cl_idx = 0, off = le32_to_cpu(fsd->lsd_client_start);
+ for (cl_idx = 0, off = le32_to_cpu(lsd->lsd_client_start);
off < last_rcvd_size; cl_idx++) {
__u64 last_rcvd;
struct obd_export *exp;
/* Don't assume off is incremented properly by
* fsfilt_read_record(), in case sizeof(*lcd)
- * isn't the same as fsd->lsd_client_size. */
- off = le32_to_cpu(fsd->lsd_client_start) +
- cl_idx * le16_to_cpu(fsd->lsd_client_size);
+ * isn't the same as lsd->lsd_client_size. */
+ off = le32_to_cpu(lsd->lsd_client_start) +
+ cl_idx * le16_to_cpu(lsd->lsd_client_size);
rc = fsfilt_read_record(obd, filp, lcd, sizeof(*lcd), &off);
if (rc) {
CERROR("error reading FILT %s idx %d off %llu: rc %d\n",
CDEBUG(D_HA, "RCVRNG CLIENT uuid: %s idx: %d lr: "LPU64
" srv lr: "LPU64"\n", lcd->lcd_uuid, cl_idx,
- last_rcvd, le64_to_cpu(fsd->lsd_last_transno));
+ last_rcvd, le64_to_cpu(lsd->lsd_last_transno));
if (IS_ERR(exp)) {
if (PTR_ERR(exp) == -EALREADY) {
/* export already exists, zero out this one */
}
} else {
fed = &exp->exp_filter_data;
- fed->fed_lcd = lcd;
+ fed->fed_ted.ted_lcd = lcd;
fed->fed_group = 0; /* will be assigned at connect */
filter_export_stats_init(obd, exp, NULL);
rc = filter_client_add(obd, exp, cl_idx);
CDEBUG(D_OTHER, "client at idx %d has last_rcvd = "LPU64"\n",
cl_idx, last_rcvd);
- if (last_rcvd > le64_to_cpu(fsd->lsd_last_transno))
- fsd->lsd_last_transno = cpu_to_le64(last_rcvd);
+ if (last_rcvd > le64_to_cpu(lsd->lsd_last_transno))
+ lsd->lsd_last_transno = cpu_to_le64(last_rcvd);
}
if (lcd)
OBD_FREE_PTR(lcd);
- obd->obd_last_committed = le64_to_cpu(fsd->lsd_last_transno);
+ obd->obd_last_committed = le64_to_cpu(lsd->lsd_last_transno);
out:
- filter->fo_mount_count = mount_count + 1;
- fsd->lsd_mount_count = cpu_to_le64(filter->fo_mount_count);
+ lut->lut_mount_count = mount_count + 1;
+ lsd->lsd_mount_count = cpu_to_le64(lut->lut_mount_count);
/* save it, so mount count and last_transno is current */
rc = filter_update_server_data(obd);
err_client:
class_disconnect_exports(obd);
-err_fsd:
- filter_free_server_data(filter);
+err_lut:
+ filter_free_server_data(&obd->u.obt);
RETURN(rc);
}
RETURN(PTR_ERR(dentry));
}
} else {
- dentry = simple_mkdir(filter->fo_dentry_O, filter->fo_vfsmnt,
- name, 0700, 1);
+ dentry = simple_mkdir(filter->fo_dentry_O,
+ obd->u.obt.obt_vfsmnt, name, 0700, 1);
if (IS_ERR(dentry)) {
CERROR("cannot lookup/create O/%s: rc = %ld\n", name,
PTR_ERR(dentry));
snprintf(dir, sizeof(dir), "d%u", i);
tmp_subdirs->dentry[i] = simple_mkdir(dentry,
- filter->fo_vfsmnt,
+ obd->u.obt.obt_vfsmnt,
dir, 0700, 1);
if (IS_ERR(tmp_subdirs->dentry[i])) {
rc = PTR_ERR(tmp_subdirs->dentry[i]);
loff_t off = 0;
ENTRY;
- O_dentry = simple_mkdir(current->fs->pwd, filter->fo_vfsmnt,
+ O_dentry = simple_mkdir(current->fs->pwd, obd->u.obt.obt_vfsmnt,
"O", 0700, 1);
CDEBUG(D_INODE, "got/created O: %p\n", O_dentry);
if (IS_ERR(O_dentry)) {
LAST_RCVD, rc);
GOTO(out, rc);
}
- filter->fo_rcvd_filp = file;
+ obd->u.obt.obt_rcvd_filp = file;
if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
CERROR("%s is not a regular file!: mode = %o\n", LAST_RCVD,
file->f_dentry->d_inode->i_mode);
filter->fo_obt.obt_health_check_filp = NULL;
err_server_data:
target_recovery_fini(obd);
- filter_free_server_data(filter);
+ filter_free_server_data(&obd->u.obt);
err_filp:
- if (filp_close(filter->fo_rcvd_filp, 0))
+ if (filp_close(obd->u.obt.obt_rcvd_filp, 0))
CERROR("can't close %s after error\n", LAST_RCVD);
- filter->fo_rcvd_filp = NULL;
+ obd->u.obt.obt_rcvd_filp = NULL;
goto out;
}
i, rc);
}
- rc = filp_close(filter->fo_rcvd_filp, 0);
- filter->fo_rcvd_filp = NULL;
+ rc = filp_close(obd->u.obt.obt_rcvd_filp, 0);
+ obd->u.obt.obt_rcvd_filp = NULL;
if (rc)
CERROR("error closing %s: rc = %d\n", LAST_RCVD, rc);
CERROR("error closing %s: rc = %d\n", HEALTH_CHECK, rc);
filter_cleanup_groups(obd);
- filter_free_server_data(filter);
+ filter_free_server_data(&obd->u.obt);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
filter_free_capa_keys(filter);
struct dentry *dchild)
{
struct inode *inode = dchild->d_inode;
- struct filter_obd *filter = &obd->u.filter;
int rc;
if (inode->i_nlink != 1 || atomic_read(&inode->i_count) != 1) {
atomic_read(&inode->i_count));
}
- rc = filter_vfs_unlink(dparent->d_inode, dchild, filter->fo_vfsmnt);
+ rc = filter_vfs_unlink(dparent->d_inode, dchild, obd->u.obt.obt_vfsmnt);
if (rc)
CERROR("error unlinking objid %.*s: rc %d\n",
dchild->d_name.len, dchild->d_name.name, rc);
}
}
- filter->fo_vfsmnt = mnt;
+ obd->u.obt.obt_vfsmnt = mnt;
obd->u.obt.obt_sb = mnt->mnt_sb;
filter->fo_fstype = mnt->mnt_sb->s_type->name;
CDEBUG(D_SUPER, "%s: mnt = %p\n", filter->fo_fstype, mnt);
LL_DQUOT_OFF(obd->u.obt.obt_sb);
shrink_dcache_sb(obd->u.obt.obt_sb);
- server_put_mount(obd->obd_name, filter->fo_vfsmnt);
+ server_put_mount(obd->obd_name, obd->u.obt.obt_vfsmnt);
obd->u.obt.obt_sb = NULL;
fsfilt_put_ops(obd->obd_fsops);
data->ocd_index);
RETURN(-EBADF);
}
- /* FIXME: Do the same with the MDS UUID and fsd_peeruuid.
+ /* FIXME: Do the same with the MDS UUID and lsd_peeruuid.
* FIXME: We don't strictly need the COMPAT flag for that,
- * FIXME: as fsd_peeruuid[0] will tell us if that is set.
+ * FIXME: as lsd_peeruuid[0] will tell us if that is set.
* FIXME: We needed it for the index, as index 0 is valid. */
}
struct lvfs_run_ctxt saved;
struct lustre_handle conn = { 0 };
struct obd_export *lexp;
- struct filter_export_data *fed;
+ struct tg_export_data *ted;
struct lsd_client_data *lcd = NULL;
__u32 group;
int rc;
lexp = class_conn2export(&conn);
LASSERT(lexp != NULL);
- fed = &lexp->exp_filter_data;
+ ted = &lexp->exp_target_data;
rc = filter_connect_internal(lexp, data, 0);
if (rc)
}
memcpy(lcd->lcd_uuid, cluuid, sizeof(lcd->lcd_uuid));
- fed->fed_lcd = lcd;
+ ted->ted_lcd = lcd;
rc = filter_client_add(obd, lexp, -1);
if (rc)
GOTO(cleanup, rc);
if (rc == 0 && osfs->os_bavail < (osfs->os_blocks >> 10)) {
CDEBUG(D_RPCTRACE,"%s: not enough space for create "
LPU64"\n", obd->obd_name, osfs->os_bavail <<
- filter->fo_vfsmnt->mnt_sb->s_blocksize_bits);
+ obd->u.obt.obt_vfsmnt->mnt_sb->s_blocksize_bits);
*num = 0;
rc = -ENOSPC;
}
void *capa)
{
struct lvfs_run_ctxt saved;
- struct filter_obd *filter;
+ struct obd_device_target *obt;
struct dentry *dentry;
int rc, rc2;
ENTRY;
if (rc)
RETURN(rc);
- filter = &exp->exp_obd->u.filter;
+ obt = &exp->exp_obd->u.obt;
/* An objid of zero is taken to mean "sync whole filesystem" */
if (!oa || !(oa->o_valid & OBD_MD_FLID)) {
- rc = fsfilt_sync(exp->exp_obd, filter->fo_obt.obt_sb);
+ rc = fsfilt_sync(exp->exp_obd, obt->obt_sb);
/* Flush any remaining cancel messages out to the target */
filter_sync_llogs(exp->exp_obd, exp);
RETURN(rc);
rc = filemap_fdatawrite(dentry->d_inode->i_mapping);
if (rc == 0) {
/* just any file to grab fsync method - "file" arg unused */
- struct file *file = filter->fo_rcvd_filp;
+ struct file *file = obt->obt_rcvd_filp;
if (file->f_op && file->f_op->fsync)
rc = file->f_op->fsync(NULL, dentry, 1);
struct obd_device *obd = (struct obd_device *)data;
LASSERT(obd != NULL);
- LASSERT(obd->u.filter.fo_vfsmnt->mnt_devname);
+ LASSERT(obd->u.obt.obt_vfsmnt->mnt_devname);
*eof = 1;
return snprintf(page, count, "%s\n",
- obd->u.filter.fo_vfsmnt->mnt_devname);
+ obd->u.obt.obt_vfsmnt->mnt_devname);
}
static int lprocfs_filter_rd_last_id(char *page, char **start, off_t off,
*/
static int obt_client_data_update(struct obd_export *exp)
{
- struct lu_export_data *led = &exp->exp_target_data;
+ struct tg_export_data *ted = &exp->exp_target_data;
struct obd_device_target *obt = &exp->exp_obd->u.obt;
struct lu_target *lut = class_exp2tgt(exp);
- loff_t off = led->led_lr_off;
+ loff_t off = ted->ted_lr_off;
int rc = 0;
rc = fsfilt_write_record(exp->exp_obd, obt->obt_rcvd_filp,
- led->led_lcd, sizeof(*led->led_lcd), &off, 0);
+ ted->ted_lcd, sizeof(*ted->ted_lcd), &off, 0);
CDEBUG(D_INFO, "update client idx %u last_epoch %#x (%#x)\n",
- led->led_lr_idx, le32_to_cpu(led->led_lcd->lcd_last_epoch),
+ ted->ted_lr_idx, le32_to_cpu(ted->ted_lcd->lcd_last_epoch),
le32_to_cpu(lut->lut_lsd.lsd_start_epoch));
return rc;
*/
void obt_client_epoch_update(struct obd_export *exp)
{
- struct lsd_client_data *lcd = exp->exp_target_data.led_lcd;
+ struct lsd_client_data *lcd = exp->exp_target_data.ted_lcd;
struct lu_target *lut = class_exp2tgt(exp);
/** VBR: set client last_epoch to current epoch */
*/
void lut_client_free(struct obd_export *exp)
{
- struct lu_export_data *led = &exp->exp_target_data;
+ struct tg_export_data *ted = &exp->exp_target_data;
struct lu_target *lut = class_exp2tgt(exp);
- OBD_FREE_PTR(led->led_lcd);
- led->led_lcd = NULL;
+ OBD_FREE_PTR(ted->ted_lcd);
+ ted->ted_lcd = NULL;
/* Clear bit when lcd is freed */
spin_lock(&lut->lut_client_bitmap_lock);
- if (!test_and_clear_bit(led->led_lr_idx, lut->lut_client_bitmap)) {
+ if (!test_and_clear_bit(ted->ted_lr_idx, lut->lut_client_bitmap)) {
CERROR("%s: client %u bit already clear in bitmap\n",
- exp->exp_obd->obd_name, led->led_lr_idx);
+ exp->exp_obd->obd_name, ted->ted_lr_idx);
LBUG();
}
spin_unlock(&lut->lut_client_bitmap_lock);
*/
int lut_client_data_update(const struct lu_env *env, struct obd_export *exp)
{
- struct lu_export_data *led = &exp->exp_target_data;
+ struct tg_export_data *ted = &exp->exp_target_data;
struct lu_target *lut = class_exp2tgt(exp);
struct lsd_client_data tmp_lcd;
- loff_t tmp_off = led->led_lr_off;
+ loff_t tmp_off = ted->ted_lr_off;
struct lu_buf tmp_buf = {
.lb_buf = &tmp_lcd,
.lb_len = sizeof(tmp_lcd)
};
int rc = 0;
- lcd_cpu_to_le(led->led_lcd, &tmp_lcd);
+ lcd_cpu_to_le(ted->ted_lcd, &tmp_lcd);
LASSERT(lut->lut_last_rcvd);
rc = lut_last_rcvd_write(env, lut, &tmp_buf, &tmp_off, 0);
void lut_client_epoch_update(const struct lu_env *env, struct obd_export *exp)
{
- struct lsd_client_data *lcd = exp->exp_target_data.led_lcd;
+ struct lsd_client_data *lcd = exp->exp_target_data.ted_lcd;
struct lu_target *lut = class_exp2tgt(exp);
LASSERT(lut->lut_bottom);