diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 00eeca08414e46488742a3a3c957f2ce3ac46a3a..ccb13400e75776d549c52571b97de65406778c15 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -53,14 +53,14 @@ #define LDD_F_PARAM 0x0400 /* process as lctl conf_param */ enum ldd_mount_type { - LDD_MT_EXT3 = 0, + LDD_MT_EXT3 = 0, LDD_MT_LDISKFS, - LDD_MT_SMFS, + LDD_MT_SMFS, LDD_MT_REISERFS, LDD_MT_LDISKFS2, LDD_MT_LAST }; - + static inline char *mt_str(enum ldd_mount_type mt) { static char *mount_type_string[] = { @@ -84,7 +84,7 @@ struct lustre_disk_data { __u32 ldd_feature_compat; /* compatible feature flags */ __u32 ldd_feature_rocompat;/* read-only compatible feature flags */ __u32 ldd_feature_incompat;/* incompatible feature flags */ - + __u32 ldd_config_ver; /* config rewrite count - not used */ __u32 ldd_flags; /* LDD_SV_TYPE */ __u32 ldd_svindex; /* server index (0001), must match @@ -93,7 +93,7 @@ struct lustre_disk_data { char ldd_fsname[64]; /* filesystem this server is part of */ char ldd_svname[64]; /* this server's name (lustre-mdt0001)*/ __u8 ldd_uuid[40]; /* server UUID (COMPAT_146) */ - + /*200*/ char ldd_userdata[1024 - 200]; /* arbitrary user string */ /*1024*/__u8 ldd_padding[4096 - 1024]; /*4096*/char ldd_mount_opts[4096]; /* target fs mount opts */ @@ -111,7 +111,7 @@ static inline int server_make_name(__u32 flags, __u16 index, char *fs, { if (flags & (LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST)) { sprintf(name, "%.8s-%s%04x", fs, - (flags & LDD_F_SV_TYPE_MDT) ? "MDT" : "OST", + (flags & LDD_F_SV_TYPE_MDT) ? "MDT" : "OST", index); } else if (flags & LDD_F_SV_TYPE_MGS) { sprintf(name, "MGS"); @@ -169,7 +169,6 @@ struct lustre_mount_data { * 2^n * CFS_PAGE_SIZE * 8 for the number of bits that fit an order-n allocation. */ #define LR_MAX_CLIENTS (CFS_PAGE_SIZE * 8) - /* COMPAT_146 */ #define OBD_COMPAT_OST 0x00000002 /* this is an OST (temporary) */ #define OBD_COMPAT_MDT 0x00000004 /* this is an MDT (temporary) */ diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index 74463218daf830d6cc29b29f3aa0eccb369d04aa..4fdbca33c8acb571baeb7695ec7c5aaf5cbdb64a 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -15,23 +15,11 @@ struct mdt_client_data; struct mds_idmap_table; struct mdt_idmap_table; -struct mds_export_data { - struct list_head med_open_head; - spinlock_t med_open_lock; /* lock med_open_head, mfd_list*/ - struct mds_client_data *med_mcd; - __u64 med_ibits_known; - loff_t med_lr_off; - int med_lr_idx; - unsigned int med_rmtclient:1; /* remote client? */ - struct semaphore med_idmap_sem; - struct lustre_idmap_table *med_idmap; -}; - struct mdt_export_data { struct list_head med_open_head; spinlock_t med_open_lock; /* lock med_open_head, mfd_list*/ - struct semaphore med_mcd_lock; - struct mdt_client_data *med_mcd; + struct semaphore med_lcd_lock; + struct lsd_client_data *med_lcd; __u64 med_ibits_known; loff_t med_lr_off; int med_lr_idx; @@ -62,10 +50,9 @@ struct ec_export_data { /* echo client */ }; /* In-memory access to client data from OST struct */ -struct filter_client_data; struct filter_export_data { spinlock_t fed_lock; /* protects fed_open_head */ - struct filter_client_data *fed_fcd; + struct lsd_client_data *fed_lcd; loff_t fed_lr_off; int fed_lr_idx; long fed_dirty; /* in bytes */ @@ -129,16 +116,13 @@ struct obd_export { cfs_time_t exp_flvr_expire[2]; /* seconds */ union { - struct mds_export_data eu_mds_data; struct mdt_export_data eu_mdt_data; struct filter_export_data eu_filter_data; struct ec_export_data eu_ec_data; } u; }; -#define exp_mds_data u.eu_mds_data #define exp_mdt_data u.eu_mdt_data -#define exp_lov_data u.eu_lov_data #define exp_filter_data u.eu_filter_data #define exp_ec_data u.eu_ec_data diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 31822059b486724dd6575ba1e94a665ff2d94fa8..686addd649c82c817f9e276c3615bcef2862b4fe 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -4264,7 +4264,7 @@ static int mdt_obd_connect(const struct lu_env *env, void *localdata) { struct mdt_thread_info *info; - struct mdt_client_data *mcd; + struct lsd_client_data *lcd; struct obd_export *exp; struct mdt_device *mdt; struct ptlrpc_request *req; @@ -4308,19 +4308,19 @@ static int mdt_obd_connect(const struct lu_env *env, rc = mdt_connect_internal(exp, mdt, data); if (rc == 0) { - OBD_ALLOC_PTR(mcd); - if (mcd != NULL) { + OBD_ALLOC_PTR(lcd); + if (lcd != NULL) { struct mdt_thread_info *mti; mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); LASSERT(mti != NULL); mti->mti_exp = exp; - memcpy(mcd->mcd_uuid, cluuid, sizeof mcd->mcd_uuid); - exp->exp_mdt_data.med_mcd = mcd; + memcpy(lcd->lcd_uuid, cluuid, sizeof lcd->lcd_uuid); + exp->exp_mdt_data.med_lcd = lcd; rc = mdt_client_new(env, mdt); if (rc != 0) { - OBD_FREE_PTR(mcd); - exp->exp_mdt_data.med_mcd = NULL; + OBD_FREE_PTR(lcd); + exp->exp_mdt_data.med_lcd = NULL; } } else rc = -ENOMEM; diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index e2fd60c04f9112035b8bd6cac24f56137ed5b49b..b0d0cf3991b221a800b68461671f2fa0967d7f58 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -58,60 +58,24 @@ #include <lustre_idmap.h> #include <lustre_eacl.h> - -/* Data stored per client in the last_rcvd file. In le32 order. */ -struct mdt_client_data { - __u8 mcd_uuid[40]; /* client UUID */ - __u64 mcd_last_transno; /* last completed transaction ID */ - __u64 mcd_last_xid; /* xid for the last transaction */ - __u32 mcd_last_result; /* result from last RPC */ - __u32 mcd_last_data; /* per-op data (disposition for open &c.) */ - /* for MDS_CLOSE and MDS_DONE_WRITTING requests */ - __u64 mcd_last_close_transno; /* last completed transaction ID */ - __u64 mcd_last_close_xid; /* xid for the last transaction */ - __u32 mcd_last_close_result; /* result from last RPC */ - __u8 mcd_padding[LR_CLIENT_SIZE - 84]; -}; - -static inline __u64 mcd_last_transno(struct mdt_client_data *mcd) +static inline __u64 lcd_last_transno(struct lsd_client_data *lcd) { - return max(mcd->mcd_last_transno, mcd->mcd_last_close_transno); + return max(lcd->lcd_last_transno, lcd->lcd_last_close_transno); } -static inline __u64 mcd_last_xid(struct mdt_client_data *mcd) +static inline __u64 lcd_last_xid(struct lsd_client_data *lcd) { - return max(mcd->mcd_last_xid, mcd->mcd_last_close_xid); + return max(lcd->lcd_last_xid, lcd->lcd_last_close_xid); } /* check if request's xid is equal to last one or not*/ static inline int req_xid_is_last(struct ptlrpc_request *req) { - struct mdt_client_data *mcd = req->rq_export->exp_mdt_data.med_mcd; - return (req->rq_xid == mcd->mcd_last_xid || - req->rq_xid == mcd->mcd_last_close_xid); + struct lsd_client_data *lcd = req->rq_export->exp_mdt_data.med_lcd; + return (req->rq_xid == lcd->lcd_last_xid || + req->rq_xid == lcd->lcd_last_close_xid); } -/* copied from lr_server_data. - * mds data stored at the head of last_rcvd file. In le32 order. */ -struct mdt_server_data { - __u8 msd_uuid[40]; /* server UUID */ - __u64 msd_last_transno; /* last completed transaction ID */ - __u64 msd_mount_count; /* incarnation number */ - __u32 msd_feature_compat; /* compatible feature flags */ - __u32 msd_feature_rocompat;/* read-only compatible feature flags */ - __u32 msd_feature_incompat;/* incompatible feature flags */ - __u32 msd_server_size; /* size of server data area */ - __u32 msd_client_start; /* start of per-client data area */ - __u16 msd_client_size; /* size of per-client data area */ - //__u16 msd_subdir_count; /* number of subdirectories for objects */ - //__u64 msd_catalog_oid; /* recovery catalog object id */ - //__u32 msd_catalog_ogen; /* recovery catalog inode generation */ - //__u8 msd_peeruuid[40]; /* UUID of MDS associated with this OST */ - //__u32 msd_ost_index; /* index number of OST in LOV */ - //__u32 msd_mdt_index; /* index number of MDT in LMV */ - __u8 msd_padding[LR_SERVER_SIZE - 78]; -}; - struct mdt_object; /* file data for open files on MDS */ struct mdt_file_data { @@ -174,7 +138,7 @@ struct mdt_device { __u64 mdt_mount_count; /* last_rcvd data */ - struct mdt_server_data mdt_msd; + struct lr_server_data mdt_lsd; spinlock_t mdt_client_bitmap_lock; unsigned long mdt_client_bitmap[(LR_MAX_CLIENTS >> 3) / sizeof(long)]; @@ -381,8 +345,8 @@ struct mdt_thread_info { __u64 mti_replayepoch; /* server and client data buffers */ - struct mdt_server_data mti_msd; - struct mdt_client_data mti_mcd; + struct lr_server_data mti_lsd; + struct lsd_client_data mti_lcd; loff_t mti_off; struct txn_param mti_txn_param; struct lu_buf mti_buf; @@ -677,7 +641,7 @@ static inline int mdt_check_resent(struct mdt_thread_info *info, RETURN(1); } DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")", - req->rq_export->exp_mdt_data.med_mcd->mcd_last_xid); + req->rq_export->exp_mdt_data.med_lcd->lcd_last_xid); } RETURN(0); } diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index cdda73e478643c15dd17021f2781c8c54adf0013..0e4dfb6f775362041efab3e98e5214c3047cbb83 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -640,8 +640,8 @@ static int mdt_finish_open(struct mdt_thread_info *info, RETURN(rc); } -extern void mdt_req_from_mcd(struct ptlrpc_request *req, - struct mdt_client_data *mcd); +extern void mdt_req_from_lcd(struct ptlrpc_request *req, + struct lsd_client_data *lcd); void mdt_reconstruct_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) @@ -651,7 +651,7 @@ void mdt_reconstruct_open(struct mdt_thread_info *info, 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 mdt_client_data *mcd = med->med_mcd; + struct lsd_client_data *lcd = med->med_lcd; struct md_attr *ma = &info->mti_attr; struct mdt_reint_record *rr = &info->mti_rr; __u32 flags = info->mti_spec.sp_cr_flags; @@ -672,8 +672,8 @@ void mdt_reconstruct_open(struct mdt_thread_info *info, ma->ma_need = MA_INODE | MA_LOV; ma->ma_valid = 0; - mdt_req_from_mcd(req, med->med_mcd); - mdt_set_disposition(info, ldlm_rep, mcd->mcd_last_data); + mdt_req_from_lcd(req, med->med_lcd); + mdt_set_disposition(info, ldlm_rep, lcd->lcd_last_data); CERROR("This is reconstruct open: disp="LPX64", result=%d\n", ldlm_rep->lock_policy_res1, req->rq_status); diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 3ca99be042f113562bf17c172f44bfcdf7aeffb8..131a4f244ca9a2906922db0ae4ed523f5389aa64 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -123,58 +123,58 @@ void mdt_trans_stop(const struct lu_env *env, } /* last_rcvd handling */ -static inline void msd_le_to_cpu(struct mdt_server_data *buf, - struct mdt_server_data *msd) +static inline void lsd_le_to_cpu(struct lr_server_data *buf, + struct lr_server_data *lsd) { - memcpy(msd->msd_uuid, buf->msd_uuid, sizeof (msd->msd_uuid)); - msd->msd_last_transno = le64_to_cpu(buf->msd_last_transno); - msd->msd_mount_count = le64_to_cpu(buf->msd_mount_count); - msd->msd_feature_compat = le32_to_cpu(buf->msd_feature_compat); - msd->msd_feature_rocompat = le32_to_cpu(buf->msd_feature_rocompat); - msd->msd_feature_incompat = le32_to_cpu(buf->msd_feature_incompat); - msd->msd_server_size = le32_to_cpu(buf->msd_server_size); - msd->msd_client_start = le32_to_cpu(buf->msd_client_start); - msd->msd_client_size = le16_to_cpu(buf->msd_client_size); + memcpy(lsd->lsd_uuid, buf->lsd_uuid, sizeof (lsd->lsd_uuid)); + lsd->lsd_last_transno = le64_to_cpu(buf->lsd_last_transno); + lsd->lsd_mount_count = le64_to_cpu(buf->lsd_mount_count); + lsd->lsd_feature_compat = le32_to_cpu(buf->lsd_feature_compat); + lsd->lsd_feature_rocompat = le32_to_cpu(buf->lsd_feature_rocompat); + lsd->lsd_feature_incompat = le32_to_cpu(buf->lsd_feature_incompat); + lsd->lsd_server_size = le32_to_cpu(buf->lsd_server_size); + lsd->lsd_client_start = le32_to_cpu(buf->lsd_client_start); + lsd->lsd_client_size = le16_to_cpu(buf->lsd_client_size); } -static inline void msd_cpu_to_le(struct mdt_server_data *msd, - struct mdt_server_data *buf) +static inline void lsd_cpu_to_le(struct lr_server_data *lsd, + struct lr_server_data *buf) { - memcpy(buf->msd_uuid, msd->msd_uuid, sizeof (msd->msd_uuid)); - buf->msd_last_transno = cpu_to_le64(msd->msd_last_transno); - buf->msd_mount_count = cpu_to_le64(msd->msd_mount_count); - buf->msd_feature_compat = cpu_to_le32(msd->msd_feature_compat); - buf->msd_feature_rocompat = cpu_to_le32(msd->msd_feature_rocompat); - buf->msd_feature_incompat = cpu_to_le32(msd->msd_feature_incompat); - buf->msd_server_size = cpu_to_le32(msd->msd_server_size); - buf->msd_client_start = cpu_to_le32(msd->msd_client_start); - buf->msd_client_size = cpu_to_le16(msd->msd_client_size); + memcpy(buf->lsd_uuid, lsd->lsd_uuid, sizeof (lsd->lsd_uuid)); + buf->lsd_last_transno = cpu_to_le64(lsd->lsd_last_transno); + buf->lsd_mount_count = cpu_to_le64(lsd->lsd_mount_count); + buf->lsd_feature_compat = cpu_to_le32(lsd->lsd_feature_compat); + buf->lsd_feature_rocompat = cpu_to_le32(lsd->lsd_feature_rocompat); + buf->lsd_feature_incompat = cpu_to_le32(lsd->lsd_feature_incompat); + buf->lsd_server_size = cpu_to_le32(lsd->lsd_server_size); + buf->lsd_client_start = cpu_to_le32(lsd->lsd_client_start); + buf->lsd_client_size = cpu_to_le16(lsd->lsd_client_size); } -static inline void mcd_le_to_cpu(struct mdt_client_data *buf, - struct mdt_client_data *mcd) +static inline void lcd_le_to_cpu(struct lsd_client_data *buf, + struct lsd_client_data *lcd) { - memcpy(mcd->mcd_uuid, buf->mcd_uuid, sizeof (mcd->mcd_uuid)); - mcd->mcd_last_transno = le64_to_cpu(buf->mcd_last_transno); - mcd->mcd_last_xid = le64_to_cpu(buf->mcd_last_xid); - mcd->mcd_last_result = le32_to_cpu(buf->mcd_last_result); - mcd->mcd_last_data = le32_to_cpu(buf->mcd_last_data); - mcd->mcd_last_close_transno = le64_to_cpu(buf->mcd_last_close_transno); - mcd->mcd_last_close_xid = le64_to_cpu(buf->mcd_last_close_xid); - mcd->mcd_last_close_result = le32_to_cpu(buf->mcd_last_close_result); + memcpy(lcd->lcd_uuid, buf->lcd_uuid, sizeof (lcd->lcd_uuid)); + lcd->lcd_last_transno = le64_to_cpu(buf->lcd_last_transno); + lcd->lcd_last_xid = le64_to_cpu(buf->lcd_last_xid); + lcd->lcd_last_result = le32_to_cpu(buf->lcd_last_result); + lcd->lcd_last_data = le32_to_cpu(buf->lcd_last_data); + lcd->lcd_last_close_transno = le64_to_cpu(buf->lcd_last_close_transno); + lcd->lcd_last_close_xid = le64_to_cpu(buf->lcd_last_close_xid); + lcd->lcd_last_close_result = le32_to_cpu(buf->lcd_last_close_result); } -static inline void mcd_cpu_to_le(struct mdt_client_data *mcd, - struct mdt_client_data *buf) +static inline void lcd_cpu_to_le(struct lsd_client_data *lcd, + struct lsd_client_data *buf) { - memcpy(buf->mcd_uuid, mcd->mcd_uuid, sizeof (mcd->mcd_uuid)); - buf->mcd_last_transno = cpu_to_le64(mcd->mcd_last_transno); - buf->mcd_last_xid = cpu_to_le64(mcd->mcd_last_xid); - buf->mcd_last_result = cpu_to_le32(mcd->mcd_last_result); - buf->mcd_last_data = cpu_to_le32(mcd->mcd_last_data); - buf->mcd_last_close_transno = cpu_to_le64(mcd->mcd_last_close_transno); - buf->mcd_last_close_xid = cpu_to_le64(mcd->mcd_last_close_xid); - buf->mcd_last_close_result = cpu_to_le32(mcd->mcd_last_close_result); + memcpy(buf->lcd_uuid, lcd->lcd_uuid, sizeof (lcd->lcd_uuid)); + buf->lcd_last_transno = cpu_to_le64(lcd->lcd_last_transno); + buf->lcd_last_xid = cpu_to_le64(lcd->lcd_last_xid); + buf->lcd_last_result = cpu_to_le32(lcd->lcd_last_result); + buf->lcd_last_data = cpu_to_le32(lcd->lcd_last_data); + buf->lcd_last_close_transno = cpu_to_le64(lcd->lcd_last_close_transno); + buf->lcd_last_close_xid = cpu_to_le64(lcd->lcd_last_close_xid); + buf->lcd_last_close_result = cpu_to_le32(lcd->lcd_last_close_result); } static inline int mdt_last_rcvd_header_read(const struct lu_env *env, @@ -187,16 +187,16 @@ static inline int mdt_last_rcvd_header_read(const struct lu_env *env, mti->mti_off = 0; rc = mdt_record_read(env, mdt->mdt_last_rcvd, - mdt_buf(env, &mti->mti_msd, sizeof(mti->mti_msd)), + mdt_buf(env, &mti->mti_lsd, sizeof(mti->mti_lsd)), &mti->mti_off); if (rc == 0) - msd_le_to_cpu(&mti->mti_msd, &mdt->mdt_msd); + lsd_le_to_cpu(&mti->mti_lsd, &mdt->mdt_lsd); CDEBUG(D_INFO, "read last_rcvd header rc = %d:\n" "uuid = %s\n" "last_transno = "LPU64"\n", - rc, mdt->mdt_msd.msd_uuid, - mdt->mdt_msd.msd_last_transno); + rc, mdt->mdt_lsd.lsd_uuid, + mdt->mdt_lsd.lsd_last_transno); return rc; } @@ -215,37 +215,37 @@ static inline int mdt_last_rcvd_header_write(const struct lu_env *env, RETURN(PTR_ERR(th)); mti->mti_off = 0; - msd_cpu_to_le(&mdt->mdt_msd, &mti->mti_msd); + lsd_cpu_to_le(&mdt->mdt_lsd, &mti->mti_lsd); rc = mdt_record_write(env, mdt->mdt_last_rcvd, - mdt_buf_const(env, &mti->mti_msd, sizeof(mti->mti_msd)), + mdt_buf_const(env, &mti->mti_lsd, sizeof(mti->mti_lsd)), &mti->mti_off, th); mdt_trans_stop(env, mdt, th); CDEBUG(D_INFO, "write last_rcvd header rc = %d:\n" "uuid = %s\nlast_transno = "LPU64"\n", - rc, mdt->mdt_msd.msd_uuid, mdt->mdt_msd.msd_last_transno); + rc, mdt->mdt_lsd.lsd_uuid, mdt->mdt_lsd.lsd_last_transno); RETURN(rc); } static int mdt_last_rcvd_read(const struct lu_env *env, struct mdt_device *mdt, - struct mdt_client_data *mcd, loff_t *off) + struct lsd_client_data *lcd, loff_t *off) { struct mdt_thread_info *mti; - struct mdt_client_data *tmp; + struct lsd_client_data *tmp; int rc; mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); - tmp = &mti->mti_mcd; + tmp = &mti->mti_lcd; rc = mdt_record_read(env, mdt->mdt_last_rcvd, mdt_buf(env, tmp, sizeof(*tmp)), off); if (rc == 0) - mcd_le_to_cpu(tmp, mcd); + lcd_le_to_cpu(tmp, lcd); - CDEBUG(D_INFO, "read mcd @%d rc = %d:\n" + CDEBUG(D_INFO, "read lcd @%d rc = %d:\n" "uuid = %s\n" "last_transno = "LPU64"\n" "last_xid = "LPU64"\n" @@ -256,36 +256,36 @@ static int mdt_last_rcvd_read(const struct lu_env *env, "last_close_result = %d\n", (int)*off - sizeof(*tmp), rc, - mcd->mcd_uuid, - mcd->mcd_last_transno, - mcd->mcd_last_xid, - mcd->mcd_last_result, - mcd->mcd_last_data, - mcd->mcd_last_close_transno, - mcd->mcd_last_close_xid, - mcd->mcd_last_close_result); + lcd->lcd_uuid, + lcd->lcd_last_transno, + lcd->lcd_last_xid, + lcd->lcd_last_result, + lcd->lcd_last_data, + lcd->lcd_last_close_transno, + lcd->lcd_last_close_xid, + lcd->lcd_last_close_result); return rc; } static int mdt_last_rcvd_write(const struct lu_env *env, struct mdt_device *mdt, - struct mdt_client_data *mcd, + struct lsd_client_data *lcd, loff_t *off, struct thandle *th) { struct mdt_thread_info *mti; - struct mdt_client_data *tmp; + struct lsd_client_data *tmp; int rc; LASSERT(th != NULL); mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); - tmp = &mti->mti_mcd; + tmp = &mti->mti_lcd; - mcd_cpu_to_le(mcd, tmp); + lcd_cpu_to_le(lcd, tmp); rc = mdt_record_write(env, mdt->mdt_last_rcvd, mdt_buf_const(env, tmp, sizeof(*tmp)), off, th); - CDEBUG(D_INFO, "write mcd @%d rc = %d:\n" + CDEBUG(D_INFO, "write lcd @%d rc = %d:\n" "uuid = %s\n" "last_transno = "LPU64"\n" "last_xid = "LPU64"\n" @@ -296,14 +296,14 @@ static int mdt_last_rcvd_write(const struct lu_env *env, "last_close_result = %d\n", (int)*off - sizeof(*tmp), rc, - mcd->mcd_uuid, - mcd->mcd_last_transno, - mcd->mcd_last_xid, - mcd->mcd_last_result, - mcd->mcd_last_data, - mcd->mcd_last_close_transno, - mcd->mcd_last_close_xid, - mcd->mcd_last_close_result); + lcd->lcd_uuid, + lcd->lcd_last_transno, + lcd->lcd_last_xid, + lcd->lcd_last_result, + lcd->lcd_last_data, + lcd->lcd_last_close_transno, + lcd->lcd_last_close_xid, + lcd->lcd_last_close_result); return rc; } @@ -312,8 +312,8 @@ static int mdt_clients_data_init(const struct lu_env *env, struct mdt_device *mdt, unsigned long last_size) { - struct mdt_server_data *msd = &mdt->mdt_msd; - struct mdt_client_data *mcd = NULL; + struct lr_server_data *lsd = &mdt->mdt_lsd; + struct lsd_client_data *lcd = NULL; struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd; loff_t off; int cl_idx; @@ -324,21 +324,21 @@ static int mdt_clients_data_init(const struct lu_env *env, * the header. If we find clients with higher last_transno values * then those clients may need recovery done. */ LASSERT(atomic_read(&obd->obd_req_replay_clients) == 0); - for (cl_idx = 0, off = msd->msd_client_start; + for (cl_idx = 0, off = lsd->lsd_client_start; off < last_size; cl_idx++) { __u64 last_transno; struct obd_export *exp; - if (!mcd) { - OBD_ALLOC_PTR(mcd); - if (!mcd) + if (!lcd) { + OBD_ALLOC_PTR(lcd); + if (!lcd) RETURN(-ENOMEM); } - off = msd->msd_client_start + - cl_idx * msd->msd_client_size; + off = lsd->lsd_client_start + + cl_idx * lsd->lsd_client_size; - rc = mdt_last_rcvd_read(env, mdt, mcd, &off); + rc = mdt_last_rcvd_read(env, mdt, lcd, &off); if (rc) { CERROR("error reading MDS %s idx %d, off %llu: rc %d\n", LAST_RCVD, cl_idx, off, rc); @@ -346,28 +346,28 @@ static int mdt_clients_data_init(const struct lu_env *env, break; /* read error shouldn't cause startup to fail */ } - if (mcd->mcd_uuid[0] == '\0') { + if (lcd->lcd_uuid[0] == '\0') { CDEBUG(D_INFO, "skipping zeroed client at offset %d\n", cl_idx); continue; } - last_transno = mcd_last_transno(mcd); + last_transno = lcd_last_transno(lcd); /* These exports are cleaned up by mdt_obd_disconnect(), so * they need to be set up like real exports as * mdt_obd_connect() does. */ CDEBUG(D_HA, "RCVRNG CLIENT uuid: %s idx: %d lr: "LPU64 - " srv lr: "LPU64" lx: "LPU64"\n", mcd->mcd_uuid, cl_idx, - last_transno, msd->msd_last_transno, - mcd_last_xid(mcd)); + " srv lr: "LPU64" lx: "LPU64"\n", lcd->lcd_uuid, cl_idx, + last_transno, lsd->lsd_last_transno, + lcd_last_xid(lcd)); - exp = class_new_export(obd, (struct obd_uuid *)mcd->mcd_uuid); + exp = class_new_export(obd, (struct obd_uuid *)lcd->lcd_uuid); if (IS_ERR(exp)) { if (PTR_ERR(exp) == -EALREADY) { /* export already exists, zero out this one */ - mcd->mcd_uuid[0] = '\0'; + lcd->lcd_uuid[0] = '\0'; } else GOTO(err_client, rc = PTR_ERR(exp)); } else { @@ -375,11 +375,11 @@ static int mdt_clients_data_init(const struct lu_env *env, mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); LASSERT(mti != NULL); mti->mti_exp = exp; - exp->exp_mdt_data.med_mcd = mcd; + exp->exp_mdt_data.med_lcd = lcd; rc = mdt_client_add(env, mdt, cl_idx); /* can't fail existing */ LASSERTF(rc == 0, "rc = %d\n", rc); - mcd = NULL; + lcd = NULL; spin_lock(&exp->exp_lock); exp->exp_connecting = 0; exp->exp_in_recovery = 0; @@ -398,16 +398,16 @@ static int mdt_clients_data_init(const struct lu_env *env, } err_client: - if (mcd) - OBD_FREE_PTR(mcd); + if (lcd) + OBD_FREE_PTR(lcd); RETURN(rc); } static int mdt_server_data_init(const struct lu_env *env, struct mdt_device *mdt) { - struct mdt_server_data *msd = &mdt->mdt_msd; - struct mdt_client_data *mcd = NULL; + struct lr_server_data *lsd = &mdt->mdt_lsd; + struct lsd_client_data *lcd = NULL; struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd; struct mdt_thread_info *mti; struct dt_object *obj; @@ -418,10 +418,10 @@ static int mdt_server_data_init(const struct lu_env *env, ENTRY; /* ensure padding in the struct is the correct size */ - CLASSERT(offsetof(struct mdt_server_data, msd_padding) + - sizeof(msd->msd_padding) == LR_SERVER_SIZE); - CLASSERT(offsetof(struct mdt_client_data, mcd_padding) + - sizeof(mcd->mcd_padding) == LR_CLIENT_SIZE); + CLASSERT(offsetof(struct lr_server_data, lsd_padding) + + sizeof(lsd->lsd_padding) == LR_SERVER_SIZE); + CLASSERT(offsetof(struct lsd_client_data, lcd_padding) + + sizeof(lcd->lcd_padding) == LR_CLIENT_SIZE); mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); LASSERT(mti != NULL); @@ -437,15 +437,15 @@ static int mdt_server_data_init(const struct lu_env *env, if (last_rcvd_size == 0) { LCONSOLE_WARN("%s: new disk, initializing\n", obd->obd_name); - memcpy(msd->msd_uuid, obd->obd_uuid.uuid, - sizeof(msd->msd_uuid)); - msd->msd_last_transno = 0; - msd->msd_mount_count = 0; - msd->msd_server_size = LR_SERVER_SIZE; - msd->msd_client_start = LR_CLIENT_START; - msd->msd_client_size = LR_CLIENT_SIZE; - msd->msd_feature_rocompat = OBD_ROCOMPAT_LOVOBJID; - msd->msd_feature_incompat = OBD_INCOMPAT_MDT | + memcpy(lsd->lsd_uuid, obd->obd_uuid.uuid, + sizeof(lsd->lsd_uuid)); + lsd->lsd_last_transno = 0; + lsd->lsd_mount_count = 0; + lsd->lsd_server_size = LR_SERVER_SIZE; + lsd->lsd_client_start = LR_CLIENT_START; + lsd->lsd_client_size = LR_CLIENT_SIZE; + lsd->lsd_feature_rocompat = OBD_ROCOMPAT_LOVOBJID; + lsd->lsd_feature_incompat = OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR; } else { LCONSOLE_WARN("%s: used disk, loading\n", obd->obd_name); @@ -454,20 +454,20 @@ static int mdt_server_data_init(const struct lu_env *env, CERROR("error reading MDS %s: rc %d\n", LAST_RCVD, rc); GOTO(out, rc); } - if (strcmp(msd->msd_uuid, obd->obd_uuid.uuid) != 0) { + if (strcmp(lsd->lsd_uuid, obd->obd_uuid.uuid) != 0) { LCONSOLE_ERROR_MSG(0x157, "Trying to start OBD %s using" "the wrong disk %s. Were the /dev/ " "assignments rearranged?\n", - obd->obd_uuid.uuid, msd->msd_uuid); + obd->obd_uuid.uuid, lsd->lsd_uuid); GOTO(out, rc = -EINVAL); } } - mount_count = msd->msd_mount_count; + mount_count = lsd->lsd_mount_count; - msd->msd_feature_compat = OBD_COMPAT_MDT; + lsd->lsd_feature_compat = OBD_COMPAT_MDT; spin_lock(&mdt->mdt_transno_lock); - mdt->mdt_last_transno = msd->msd_last_transno; + mdt->mdt_last_transno = lsd->lsd_last_transno; spin_unlock(&mdt->mdt_transno_lock); CDEBUG(D_INODE, "========BEGIN DUMPING LAST_RCVD========\n"); @@ -476,21 +476,21 @@ static int mdt_server_data_init(const struct lu_env *env, 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, msd->msd_server_size); + obd->obd_name, lsd->lsd_server_size); CDEBUG(D_INODE, "%s: per-client data start: %u\n", - obd->obd_name, msd->msd_client_start); + obd->obd_name, lsd->lsd_client_start); CDEBUG(D_INODE, "%s: per-client data size: %u\n", - obd->obd_name, msd->msd_client_size); + obd->obd_name, lsd->lsd_client_size); CDEBUG(D_INODE, "%s: last_rcvd size: %lu\n", obd->obd_name, last_rcvd_size); CDEBUG(D_INODE, "%s: last_rcvd clients: %lu\n", obd->obd_name, - last_rcvd_size <= msd->msd_client_start ? 0 : - (last_rcvd_size - msd->msd_client_start) / - msd->msd_client_size); + last_rcvd_size <= lsd->lsd_client_start ? 0 : + (last_rcvd_size - lsd->lsd_client_start) / + lsd->lsd_client_size); CDEBUG(D_INODE, "========END DUMPING LAST_RCVD========\n"); - if (!msd->msd_server_size || !msd->msd_client_start || - !msd->msd_client_size) { + if (!lsd->lsd_server_size || !lsd->lsd_client_start || + !lsd->lsd_client_size) { CERROR("Bad last_rcvd contents!\n"); GOTO(out, rc = -EINVAL); } @@ -506,7 +506,7 @@ static int mdt_server_data_init(const struct lu_env *env, spin_unlock(&mdt->mdt_transno_lock); mdt->mdt_mount_count++; - msd->msd_mount_count = mdt->mdt_mount_count; + lsd->lsd_mount_count = mdt->mdt_mount_count; /* save it, so mount count and last_transno is current */ rc = mdt_server_data_update(env, mdt); @@ -531,7 +531,7 @@ static int mdt_server_data_update(const struct lu_env *env, mdt->mdt_mount_count, mdt->mdt_last_transno); spin_lock(&mdt->mdt_transno_lock); - mdt->mdt_msd.msd_last_transno = mdt->mdt_last_transno; + mdt->mdt_lsd.lsd_last_transno = mdt->mdt_last_transno; spin_unlock(&mdt->mdt_transno_lock); /* @@ -547,7 +547,7 @@ void mdt_cb_new_client(const struct mdt_device *mdt, __u64 transno, void *data, int err) { struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd; - + target_client_add_cb(obd, transno, data, err); } @@ -556,8 +556,8 @@ int mdt_client_new(const struct lu_env *env, struct mdt_device *mdt) unsigned long *bitmap = mdt->mdt_client_bitmap; struct mdt_thread_info *mti; struct mdt_export_data *med; - struct mdt_client_data *mcd; - struct mdt_server_data *msd = &mdt->mdt_msd; + struct lsd_client_data *lcd; + struct lr_server_data *lsd = &mdt->mdt_lsd; struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd; struct thandle *th; loff_t off; @@ -569,10 +569,10 @@ int mdt_client_new(const struct lu_env *env, struct mdt_device *mdt) LASSERT(mti != NULL); med = &mti->mti_exp->exp_mdt_data; - mcd = med->med_mcd; + lcd = med->med_lcd; LASSERT(bitmap != NULL); - if (!strcmp(med->med_mcd->mcd_uuid, obd->obd_uuid.uuid)) + if (!strcmp(med->med_lcd->lcd_uuid, obd->obd_uuid.uuid)) RETURN(0); /* the bitmap operations can handle cl_idx > sizeof(long) * 8, so @@ -591,12 +591,12 @@ int mdt_client_new(const struct lu_env *env, struct mdt_device *mdt) spin_unlock(&mdt->mdt_client_bitmap_lock); CDEBUG(D_INFO, "client at idx %d with UUID '%s' added\n", - cl_idx, med->med_mcd->mcd_uuid); + cl_idx, med->med_lcd->lcd_uuid); med->med_lr_idx = cl_idx; - med->med_lr_off = msd->msd_client_start + - (cl_idx * msd->msd_client_size); - init_mutex(&med->med_mcd_lock); + med->med_lr_off = lsd->lsd_client_start + + (cl_idx * lsd->lsd_client_size); + init_mutex(&med->med_lcd_lock); LASSERTF(med->med_lr_off > 0, "med_lr_off = %llu\n", med->med_lr_off); /* write new client data */ @@ -612,9 +612,9 @@ int mdt_client_new(const struct lu_env *env, struct mdt_device *mdt) mti->mti_exp->exp_need_sync = 1; spin_unlock(&mti->mti_exp->exp_lock); - rc = mdt_last_rcvd_write(env, mdt, mcd, &off, th); - CDEBUG(D_INFO, "wrote client mcd at idx %u off %llu (len %u)\n", - cl_idx, med->med_lr_off, sizeof(*mcd)); + rc = mdt_last_rcvd_write(env, mdt, lcd, &off, th); + CDEBUG(D_INFO, "wrote client lcd at idx %u off %llu (len %u)\n", + cl_idx, med->med_lr_off, sizeof(*lcd)); mdt_trans_stop(env, mdt, th); RETURN(rc); @@ -635,7 +635,7 @@ int mdt_client_add(const struct lu_env *env, struct mdt_export_data *med; unsigned long *bitmap = mdt->mdt_client_bitmap; struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd; - struct mdt_server_data *msd = &mdt->mdt_msd; + struct lr_server_data *lsd = &mdt->mdt_lsd; int rc = 0; ENTRY; @@ -647,7 +647,7 @@ int mdt_client_add(const struct lu_env *env, LASSERT(bitmap != NULL); LASSERTF(cl_idx >= 0, "%d\n", cl_idx); - if (!strcmp(med->med_mcd->mcd_uuid, obd->obd_uuid.uuid)) + if (!strcmp(med->med_lcd->lcd_uuid, obd->obd_uuid.uuid)) RETURN(0); spin_lock(&mdt->mdt_client_bitmap_lock); @@ -659,12 +659,12 @@ int mdt_client_add(const struct lu_env *env, spin_unlock(&mdt->mdt_client_bitmap_lock); CDEBUG(D_INFO, "client at idx %d with UUID '%s' added\n", - cl_idx, med->med_mcd->mcd_uuid); + cl_idx, med->med_lcd->lcd_uuid); med->med_lr_idx = cl_idx; - med->med_lr_off = msd->msd_client_start + - (cl_idx * msd->msd_client_size); - init_mutex(&med->med_mcd_lock); + med->med_lr_off = lsd->lsd_client_start + + (cl_idx * lsd->lsd_client_size); + init_mutex(&med->med_lcd_lock); LASSERTF(med->med_lr_off > 0, "med_lr_off = %llu\n", med->med_lr_off); @@ -675,7 +675,7 @@ int mdt_client_del(const struct lu_env *env, struct mdt_device *mdt) { struct mdt_thread_info *mti; struct mdt_export_data *med; - struct mdt_client_data *mcd; + struct lsd_client_data *lcd; struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd; struct thandle *th; loff_t off; @@ -686,12 +686,12 @@ int mdt_client_del(const struct lu_env *env, struct mdt_device *mdt) LASSERT(mti != NULL); med = &mti->mti_exp->exp_mdt_data; - mcd = med->med_mcd; - if (!mcd) + lcd = med->med_lcd; + if (!lcd) RETURN(0); - /* XXX: If mcd_uuid were a real obd_uuid, I could use obd_uuid_equals */ - if (!strcmp(med->med_mcd->mcd_uuid, obd->obd_uuid.uuid)) + /* XXX: If lcd_uuid were a real obd_uuid, I could use obd_uuid_equals */ + if (!strcmp(med->med_lcd->lcd_uuid, obd->obd_uuid.uuid)) GOTO(free, 0); CDEBUG(D_INFO, "freeing client at idx %u, offset %lld\n", @@ -728,11 +728,11 @@ int mdt_client_del(const struct lu_env *env, struct mdt_device *mdt) if (IS_ERR(th)) GOTO(free, rc = PTR_ERR(th)); - mutex_down(&med->med_mcd_lock); - memset(mcd, 0, sizeof *mcd); + mutex_down(&med->med_lcd_lock); + memset(lcd, 0, sizeof *lcd); - rc = mdt_last_rcvd_write(env, mdt, mcd, &off, th); - mutex_up(&med->med_mcd_lock); + rc = mdt_last_rcvd_write(env, mdt, lcd, &off, th); + mutex_up(&med->med_lcd_lock); mdt_trans_stop(env, mdt, th); } @@ -742,7 +742,7 @@ int mdt_client_del(const struct lu_env *env, struct mdt_device *mdt) spin_lock(&mdt->mdt_client_bitmap_lock); clear_bit(med->med_lr_idx, mdt->mdt_client_bitmap); spin_unlock(&mdt->mdt_client_bitmap_lock); - + /* * Make sure the server's last_transno is up to date. Do this after the * client is freed so we know all the client's transactions have been @@ -751,8 +751,8 @@ int mdt_client_del(const struct lu_env *env, struct mdt_device *mdt) mdt_server_data_update(env, mdt); EXIT; free: - OBD_FREE_PTR(mcd); - med->med_mcd = NULL; + OBD_FREE_PTR(lcd); + med->med_lcd = NULL; return 0; } @@ -765,7 +765,7 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti, struct mdt_device *mdt = mti->mti_mdt; struct ptlrpc_request *req = mdt_info_req(mti); struct mdt_export_data *med; - struct mdt_client_data *mcd; + struct lsd_client_data *lcd; loff_t off; int err; __s32 rc = th->th_result; @@ -777,7 +777,7 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti, LASSERT(mdt); med = &req->rq_export->exp_mdt_data; LASSERT(med); - mcd = med->med_mcd; + lcd = med->med_lcd; /* if the export has already been failed, we have no last_rcvd slot */ if (req->rq_export->exp_failed) { CWARN("commit transaction for disconnected client %s: rc %d\n", @@ -788,25 +788,25 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti, } off = med->med_lr_off; - mutex_down(&med->med_mcd_lock); + mutex_down(&med->med_lcd_lock); if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE || lustre_msg_get_opc(req->rq_reqmsg) == MDS_DONE_WRITING) { - transno_p = &mcd->mcd_last_close_transno; - mcd->mcd_last_close_xid = req->rq_xid; - mcd->mcd_last_close_result = rc; + transno_p = &lcd->lcd_last_close_transno; + lcd->lcd_last_close_xid = req->rq_xid; + lcd->lcd_last_close_result = rc; } else { - transno_p = &mcd->mcd_last_transno; - mcd->mcd_last_xid = req->rq_xid; - mcd->mcd_last_result = rc; + transno_p = &lcd->lcd_last_transno; + lcd->lcd_last_xid = req->rq_xid; + lcd->lcd_last_result = rc; /*XXX: save intent_disposition in mdt_thread_info? * also there is bug - intent_dispostion is __u64, * see struct ldlm_reply->lock_policy_res1; */ - mcd->mcd_last_data = mti->mti_opdata; + lcd->lcd_last_data = mti->mti_opdata; } /* - * When we store zero transno in mcd we can lost last transno value - * because mcd contains 0, but msd is not yet written + * When we store zero transno in lcd we can lost last transno value + * because lcd contains 0, but lsd is not yet written * The server data should be updated also if the latest * transno is rewritten by zero. See the bug 11125 for details. */ @@ -820,9 +820,9 @@ static int mdt_last_rcvd_update(struct mdt_thread_info *mti, CERROR("client idx %d has offset %lld\n", med->med_lr_idx, off); err = -EINVAL; } else { - err = mdt_last_rcvd_write(mti->mti_env, mdt, mcd, &off, th); + err = mdt_last_rcvd_write(mti->mti_env, mdt, lcd, &off, th); } - mutex_up(&med->med_mcd_lock); + mutex_up(&med->med_lcd_lock); RETURN(err); } @@ -889,7 +889,7 @@ static int mdt_txn_stop_cb(const struct lu_env *env, req->rq_transno = mti->mti_transno; lustre_msg_set_transno(req->rq_repmsg, mti->mti_transno); lustre_msg_set_last_xid(req->rq_repmsg, - mcd_last_xid(req->rq_export->exp_mdt_data.med_mcd)); + lcd_last_xid(req->rq_export->exp_mdt_data.med_lcd)); /* save transno for the commit callback */ txi->txi_transno = mti->mti_transno; spin_unlock(&mdt->mdt_transno_lock); @@ -1050,21 +1050,21 @@ static void mdt_steal_ack_locks(struct ptlrpc_request *req) spin_unlock(&exp->exp_lock); } -void mdt_req_from_mcd(struct ptlrpc_request *req, - struct mdt_client_data *mcd) +void mdt_req_from_lcd(struct ptlrpc_request *req, + struct lsd_client_data *lcd) { DEBUG_REQ(D_HA, req, "restoring transno "LPD64"/status %d", - mcd->mcd_last_transno, mcd->mcd_last_result); + lcd->lcd_last_transno, lcd->lcd_last_result); if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE || lustre_msg_get_opc(req->rq_repmsg) == MDS_DONE_WRITING) { - req->rq_transno = mcd->mcd_last_close_transno; - req->rq_status = mcd->mcd_last_close_result; + req->rq_transno = lcd->lcd_last_close_transno; + req->rq_status = lcd->lcd_last_close_result; lustre_msg_set_transno(req->rq_repmsg, req->rq_transno); lustre_msg_set_status(req->rq_repmsg, req->rq_status); } else { - req->rq_transno = mcd->mcd_last_transno; - req->rq_status = mcd->mcd_last_result; + req->rq_transno = lcd->lcd_last_transno; + req->rq_status = lcd->lcd_last_result; lustre_msg_set_transno(req->rq_repmsg, req->rq_transno); lustre_msg_set_status(req->rq_repmsg, req->rq_status); } @@ -1077,7 +1077,7 @@ void mdt_reconstruct_generic(struct mdt_thread_info *mti, struct ptlrpc_request *req = mdt_info_req(mti); struct mdt_export_data *med = &req->rq_export->exp_mdt_data; - return mdt_req_from_mcd(req, med->med_mcd); + return mdt_req_from_lcd(req, med->med_lcd); } static void mdt_reconstruct_create(struct mdt_thread_info *mti, @@ -1091,7 +1091,7 @@ static void mdt_reconstruct_create(struct mdt_thread_info *mti, struct mdt_body *body; int rc; - mdt_req_from_mcd(req, med->med_mcd); + mdt_req_from_lcd(req, med->med_lcd); if (req->rq_status) return; @@ -1130,7 +1130,7 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti, struct mdt_object *obj; struct mdt_body *body; - mdt_req_from_mcd(req, med->med_mcd); + mdt_req_from_lcd(req, med->med_lcd); if (req->rq_status) return; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 87b6614f874ab806a89f9e9489ebf491cebe8ddc..addaa029fb0b542a5e8ec737d556f1414da4c6a5 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -80,7 +80,7 @@ int filter_finish_transno(struct obd_export *exp, struct obd_trans_info *oti, { struct filter_obd *filter = &exp->exp_obd->u.filter; struct filter_export_data *fed = &exp->exp_filter_data; - struct filter_client_data *fcd = fed->fed_fcd; + struct lsd_client_data *lcd = fed->fed_lcd; __u64 last_rcvd; loff_t off; int err, log_pri = D_RPCTRACE; @@ -107,10 +107,10 @@ int filter_finish_transno(struct obd_export *exp, struct obd_trans_info *oti, cpu_to_le64(last_rcvd); spin_unlock(&filter->fo_translock); } - fcd->fcd_last_rcvd = cpu_to_le64(last_rcvd); + lcd->lcd_last_transno = cpu_to_le64(last_rcvd); /* could get xid from oti, if it's ever needed */ - fcd->fcd_last_xid = 0; + lcd->lcd_last_xid = 0; off = fed->fed_lr_off; if (off <= 0) { @@ -126,7 +126,7 @@ int filter_finish_transno(struct obd_export *exp, struct obd_trans_info *oti, NULL); err = fsfilt_write_record(exp->exp_obd, filter->fo_rcvd_filp, - fcd, sizeof(*fcd), &off, + lcd, sizeof(*lcd), &off, force_sync | exp->exp_need_sync); if (force_sync) filter_commit_cb(exp->exp_obd, last_rcvd, NULL, err); @@ -138,7 +138,7 @@ int filter_finish_transno(struct obd_export *exp, struct obd_trans_info *oti, } CDEBUG(log_pri, "wrote trans "LPU64" for client %s at #%d: err = %d\n", - last_rcvd, fcd->fcd_uuid, fed->fed_lr_idx, err); + last_rcvd, lcd->lcd_uuid, fed->fed_lr_idx, err); RETURN(rc); } @@ -246,7 +246,7 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp, LASSERTF(cl_idx > -2, "%d\n", cl_idx); /* Self-export */ - if (strcmp(fed->fed_fcd->fcd_uuid, obd->obd_uuid.uuid) == 0) + if (strcmp(fed->fed_lcd->lcd_uuid, obd->obd_uuid.uuid) == 0) RETURN(0); /* the bitmap operations can handle cl_idx > sizeof(long) * 8, so @@ -279,7 +279,7 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp, LASSERTF(fed->fed_lr_off > 0, "fed_lr_off = %llu\n", fed->fed_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_fcd->fcd_uuid); + fed->fed_lr_idx, fed->fed_lr_off, fed->fed_lcd->lcd_uuid); if (new_client) { struct lvfs_run_ctxt saved; @@ -287,8 +287,8 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp, int rc; void *handle; - CDEBUG(D_INFO, "writing client fcd at idx %u (%llu) (len %u)\n", - fed->fed_lr_idx,off,(unsigned int)sizeof(*fed->fed_fcd)); + CDEBUG(D_INFO, "writing client lcd at idx %u (%llu) (len %u)\n", + fed->fed_lr_idx,off,(unsigned int)sizeof(*fed->fed_lcd)); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); /* Transaction needed to fix bug 1403 */ @@ -307,8 +307,8 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp, spin_unlock(&exp->exp_lock); } rc = fsfilt_write_record(obd, filter->fo_rcvd_filp, - fed->fed_fcd, - sizeof(*fed->fed_fcd), + fed->fed_lcd, + sizeof(*fed->fed_lcd), &off, rc /* sync if no cb */); fsfilt_commit(obd, filter->fo_rcvd_filp->f_dentry->d_inode, @@ -330,21 +330,21 @@ static int filter_client_free(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 filter_client_data zero_fcd; + struct lsd_client_data zero_lcd; struct lvfs_run_ctxt saved; int rc; loff_t off; ENTRY; - if (fed->fed_fcd == NULL) + if (fed->fed_lcd == NULL) RETURN(0); - /* XXX if fcd_uuid were a real obd_uuid, I could use obd_uuid_equals */ - if (strcmp(fed->fed_fcd->fcd_uuid, obd->obd_uuid.uuid ) == 0) + /* XXX if lcd_uuid were a real obd_uuid, I could use obd_uuid_equals */ + if (strcmp(fed->fed_lcd->lcd_uuid, obd->obd_uuid.uuid ) == 0) GOTO(free, 0); CDEBUG(D_INFO, "freeing client at idx %u, offset %lld with UUID '%s'\n", - fed->fed_lr_idx, fed->fed_lr_off, fed->fed_fcd->fcd_uuid); + fed->fed_lr_idx, fed->fed_lr_off, fed->fed_lcd->lcd_uuid); LASSERT(filter->fo_last_rcvd_slots != NULL); @@ -367,10 +367,10 @@ static int filter_client_free(struct obd_export *exp) } if (!(exp->exp_flags & OBD_OPT_FAILOVER)) { - memset(&zero_fcd, 0, sizeof zero_fcd); + memset(&zero_lcd, 0, sizeof zero_lcd); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = fsfilt_write_record(obd, filter->fo_rcvd_filp, &zero_fcd, - sizeof(zero_fcd), &off, + rc = fsfilt_write_record(obd, filter->fo_rcvd_filp, &zero_lcd, + sizeof(zero_lcd), &off, (!exp->exp_libclient || exp->exp_need_sync)); if (rc == 0) @@ -382,7 +382,7 @@ static int filter_client_free(struct obd_export *exp) CDEBUG(rc == 0 ? D_INFO : D_ERROR, "zeroing out client %s at idx %u (%llu) in %s rc %d\n", - fed->fed_fcd->fcd_uuid, fed->fed_lr_idx, fed->fed_lr_off, + fed->fed_lcd->lcd_uuid, fed->fed_lr_idx, fed->fed_lr_off, LAST_RCVD, rc); } @@ -394,8 +394,8 @@ static int filter_client_free(struct obd_export *exp) EXIT; free: - OBD_FREE(fed->fed_fcd, sizeof(*fed->fed_fcd)); - fed->fed_fcd = NULL; + OBD_FREE_PTR(fed->fed_lcd); + fed->fed_lcd = NULL; return 0; } @@ -646,7 +646,7 @@ 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 filter_client_data *fcd = NULL; + struct lsd_client_data *lcd = NULL; struct inode *inode = filp->f_dentry->d_inode; unsigned long last_rcvd_size = i_size_read(inode); __u64 mount_count; @@ -657,8 +657,8 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) /* ensure padding in the struct is the correct size */ CLASSERT (offsetof(struct lr_server_data, lsd_padding) + sizeof(fsd->lsd_padding) == LR_SERVER_SIZE); - CLASSERT (offsetof(struct filter_client_data, fcd_padding) + - sizeof(fcd->fcd_padding) == LR_CLIENT_SIZE); + CLASSERT (offsetof(struct lsd_client_data, lcd_padding) + + sizeof(lcd->lcd_padding) == LR_CLIENT_SIZE); OBD_ALLOC(fsd, sizeof(*fsd)); if (!fsd) @@ -749,60 +749,59 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) struct obd_export *exp; struct filter_export_data *fed; - if (!fcd) { - OBD_ALLOC(fcd, sizeof(*fcd)); - if (!fcd) + if (!lcd) { + OBD_ALLOC_PTR(lcd); + if (!lcd) GOTO(err_client, rc = -ENOMEM); } /* Don't assume off is incremented properly by - * fsfilt_read_record(), in case sizeof(*fcd) + * 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); - rc = fsfilt_read_record(obd, filp, fcd, sizeof(*fcd), &off); + rc = fsfilt_read_record(obd, filp, lcd, sizeof(*lcd), &off); if (rc) { CERROR("error reading FILT %s idx %d off %llu: rc %d\n", LAST_RCVD, cl_idx, off, rc); break; /* read error shouldn't cause startup to fail */ } - if (fcd->fcd_uuid[0] == '\0') { + if (lcd->lcd_uuid[0] == '\0') { CDEBUG(D_INFO, "skipping zeroed client at offset %d\n", cl_idx); continue; } - last_rcvd = le64_to_cpu(fcd->fcd_last_rcvd); + last_rcvd = le64_to_cpu(lcd->lcd_last_transno); /* These exports are cleaned up by filter_disconnect(), so they * need to be set up like real exports as filter_connect() does. */ - exp = class_new_export(obd, (struct obd_uuid *)fcd->fcd_uuid); + exp = class_new_export(obd, (struct obd_uuid *)lcd->lcd_uuid); CDEBUG(D_HA, "RCVRNG CLIENT uuid: %s idx: %d lr: "LPU64 - " srv lr: "LPU64" fcd_group %d\n", fcd->fcd_uuid, cl_idx, - last_rcvd, le64_to_cpu(fsd->lsd_last_transno), - le32_to_cpu(fcd->fcd_group)); + " srv lr: "LPU64"\n", lcd->lcd_uuid, cl_idx, + last_rcvd, le64_to_cpu(fsd->lsd_last_transno)); if (IS_ERR(exp)) { if (PTR_ERR(exp) == -EALREADY) { /* export already exists, zero out this one */ CERROR("Zeroing out duplicate export due to " "bug 10479.\n"); - fcd->fcd_uuid[0] = '\0'; + lcd->lcd_uuid[0] = '\0'; } else { GOTO(err_client, rc = PTR_ERR(exp)); } } else { fed = &exp->exp_filter_data; - fed->fed_fcd = fcd; - fed->fed_group = le32_to_cpu(fcd->fcd_group); + fed->fed_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); /* can't fail for existing client */ LASSERTF(rc == 0, "rc = %d\n", rc); - fcd = NULL; + lcd = NULL; spin_lock(&exp->exp_lock); exp->exp_connecting = 0; exp->exp_in_recovery = 0; @@ -819,8 +818,8 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) fsd->lsd_last_transno = cpu_to_le64(last_rcvd); } - if (fcd) - OBD_FREE(fcd, sizeof(*fcd)); + if (lcd) + OBD_FREE_PTR(lcd); obd->obd_last_committed = le64_to_cpu(fsd->lsd_last_transno); @@ -2556,7 +2555,7 @@ static int filter_connect(const struct lu_env *env, struct lvfs_run_ctxt saved; struct obd_export *exp; struct filter_export_data *fed; - struct filter_client_data *fcd = NULL; + struct lsd_client_data *lcd = NULL; __u32 group; int rc; ENTRY; @@ -2579,15 +2578,14 @@ static int filter_connect(const struct lu_env *env, filter_export_stats_init(obd, exp, localdata); group = data->ocd_group; if (obd->obd_replayable) { - OBD_ALLOC(fcd, sizeof(*fcd)); - if (!fcd) { + OBD_ALLOC(lcd, sizeof(*lcd)); + if (!lcd) { CERROR("filter: out of memory for client data\n"); GOTO(cleanup, rc = -ENOMEM); } - memcpy(fcd->fcd_uuid, cluuid, sizeof(fcd->fcd_uuid)); - fed->fed_fcd = fcd; - fed->fed_fcd->fcd_group = group; + memcpy(lcd->lcd_uuid, cluuid, sizeof(lcd->lcd_uuid)); + fed->fed_lcd = lcd; rc = filter_client_add(obd, exp, -1); if (rc) GOTO(cleanup, rc); @@ -2618,9 +2616,9 @@ static int filter_connect(const struct lu_env *env, cleanup: if (rc) { - if (fcd) { - OBD_FREE(fcd, sizeof(*fcd)); - fed->fed_fcd = NULL; + if (lcd) { + OBD_FREE_PTR(lcd); + fed->fed_lcd = NULL; } class_disconnect(exp); } else { diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index 2cdf17713c9bc441e608c21d601e224f0f81924e..6f2ac821b0eddf0663af1c3e72be0ae63f51f85b 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -34,15 +34,6 @@ extern struct file_operations filter_per_export_stats_fops; extern struct file_operations filter_per_nid_stats_fops; -/* Data stored per client in the last_rcvd file. In le32 order. */ -struct filter_client_data { - __u8 fcd_uuid[40]; /* client UUID */ - __u64 fcd_last_rcvd; /* last completed transaction ID */ - __u64 fcd_last_xid; /* client RPC xid for the last transaction */ - __u32 fcd_group; /* mds group */ - __u8 fcd_padding[LR_CLIENT_SIZE - 60]; -}; - /* Limit the returned fields marked valid to those that we actually might set */ #define FILTER_VALID_FLAGS (OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLGENER |\ OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ|\