diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index 6890dbd8674aa28e5b6a6f7178dcacab9a1854d1..43fc0bb0e303ba1d9f690368a6fb5bd96883adbf 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -10,12 +10,10 @@ #include <lprocfs_status.h> /* Data stored per client in the last_rcvd file. In le32 order. */ -struct mds_client_data; - 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; + struct lsd_client_data *med_lcd; __u64 med_ibits_known; loff_t med_lr_off; int med_lr_idx; @@ -43,10 +41,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 */ diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index d92026dd5778ee0f8e3220cb282d965e9a97c8a4..6486f05c12c257e97c4bbfa9ef2bedfdfd3795e0 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -327,7 +327,7 @@ static int mds_connect(struct lustre_handle *conn, struct obd_device *obd, { struct obd_export *exp; struct mds_export_data *med; - struct mds_client_data *mcd = NULL; + struct lsd_client_data *lcd = NULL; int rc, abort_recovery; ENTRY; @@ -347,7 +347,7 @@ static int mds_connect(struct lustre_handle *conn, struct obd_device *obd, * * There is a second race between adding the export to the list, * and filling in the client data below. Hence skipping the case - * of NULL mcd above. We should already be controlling multiple + * of NULL lcd above. We should already be controlling multiple * connects at the client, and we can't hold the spinlock over * memory allocations without risk of deadlocking. */ @@ -362,21 +362,21 @@ static int mds_connect(struct lustre_handle *conn, struct obd_device *obd, if (rc) GOTO(out, rc); - OBD_ALLOC(mcd, sizeof(*mcd)); - if (!mcd) + OBD_ALLOC_PTR(lcd); + if (!lcd) GOTO(out, rc = -ENOMEM); - memcpy(mcd->mcd_uuid, cluuid, sizeof(mcd->mcd_uuid)); - med->med_mcd = mcd; + memcpy(lcd->lcd_uuid, cluuid, sizeof(lcd->lcd_uuid)); + med->med_lcd = lcd; rc = mds_client_add(obd, exp, -1, localdata); GOTO(out, rc); out: if (rc) { - if (mcd) { - OBD_FREE(mcd, sizeof(*mcd)); - med->med_mcd = NULL; + if (lcd) { + OBD_FREE_PTR(lcd); + med->med_lcd = NULL; } class_disconnect(exp); } else { @@ -1531,8 +1531,8 @@ int mds_handle(struct ptlrpc_request *req) /* sanity check: if the xid matches, the request must * be marked as a resent or replayed */ - if (req->rq_xid == le64_to_cpu(med->med_mcd->mcd_last_xid) || - req->rq_xid == le64_to_cpu(med->med_mcd->mcd_last_close_xid)) + if (req->rq_xid == le64_to_cpu(med->med_lcd->lcd_last_xid) || + req->rq_xid == le64_to_cpu(med->med_lcd->lcd_last_close_xid)) if (!(lustre_msg_get_flags(req->rq_reqmsg) & (MSG_RESENT | MSG_REPLAY))) { CERROR("rq_xid "LPU64" matches last_xid, " @@ -1834,8 +1834,7 @@ int mds_handle(struct ptlrpc_request *req) /* I don't think last_xid is used for anyway, so I'm not sure if we need to care about last_close_xid here.*/ lustre_msg_set_last_xid(req->rq_repmsg, - le64_to_cpu(med->med_mcd->mcd_last_xid)); - + le64_to_cpu(med->med_lcd->lcd_last_xid)); target_committed_to_req(req); } @@ -2344,11 +2343,11 @@ static void fixup_handle_for_resent_req(struct ptlrpc_request *req, int offset, * and allow it. (It's probably an OPEN, for which we don't * send a lock */ if (req->rq_xid == - le64_to_cpu(exp->exp_mds_data.med_mcd->mcd_last_xid)) + le64_to_cpu(exp->exp_mds_data.med_lcd->lcd_last_xid)) return; if (req->rq_xid == - le64_to_cpu(exp->exp_mds_data.med_mcd->mcd_last_close_xid)) + le64_to_cpu(exp->exp_mds_data.med_lcd->lcd_last_close_xid)) return; /* This remote handle isn't enqueued, so we never received or diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index 3bef1cb6ac12e4146d1aaeb9eb3efb718ef3311b..a747d0b842fbbc1d69ede536eda8bfcac41732c9 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -104,8 +104,8 @@ int mds_client_add(struct obd_device *obd, struct obd_export *exp, LASSERT(bitmap != NULL); LASSERTF(cl_idx > -2, "%d\n", cl_idx); - /* 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)) RETURN(0); /* the bitmap operations can handle cl_idx > sizeof(long) * 8, so @@ -134,7 +134,7 @@ int mds_client_add(struct obd_device *obd, struct obd_export *exp, } 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 = le32_to_cpu(mds->mds_server_data->lsd_client_start) + @@ -162,8 +162,8 @@ int mds_client_add(struct obd_device *obd, struct obd_export *exp, exp->exp_need_sync = 1; spin_unlock(&exp->exp_lock); } - rc = fsfilt_write_record(obd, file, med->med_mcd, - sizeof(*med->med_mcd), + rc = fsfilt_write_record(obd, file, med->med_lcd, + sizeof(*med->med_lcd), &off, rc /* sync if no cb */); fsfilt_commit(obd, file->f_dentry->d_inode, handle, 0); } @@ -172,9 +172,9 @@ int mds_client_add(struct obd_device *obd, struct obd_export *exp, if (rc) return rc; - CDEBUG(D_INFO, "wrote client mcd at idx %u off %llu (len %u)\n", + CDEBUG(D_INFO, "wrote client lcd at idx %u off %llu (len %u)\n", med->med_lr_idx, med->med_lr_off, - (unsigned int)sizeof(*med->med_mcd)); + (unsigned int)sizeof(*med->med_lcd)); } return 0; } @@ -184,21 +184,21 @@ int mds_client_free(struct obd_export *exp) struct mds_export_data *med = &exp->exp_mds_data; struct mds_obd *mds = &exp->exp_obd->u.mds; struct obd_device *obd = exp->exp_obd; - struct mds_client_data zero_mcd; + struct lsd_client_data zero_lcd; struct lvfs_run_ctxt saved; int rc; loff_t off; ENTRY; - if (!med->med_mcd) + if (!med->med_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 with UUID '%s'\n", - med->med_lr_idx, med->med_lr_off, med->med_mcd->mcd_uuid); + med->med_lr_idx, med->med_lr_off, med->med_lcd->lcd_uuid); LASSERT(mds->mds_client_bitmap != NULL); @@ -223,17 +223,17 @@ int mds_client_free(struct obd_export *exp) } if (!(exp->exp_flags & OBD_OPT_FAILOVER)) { - memset(&zero_mcd, 0, sizeof zero_mcd); + memset(&zero_lcd, 0, sizeof(zero_lcd)); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = fsfilt_write_record(obd, mds->mds_rcvd_filp, &zero_mcd, - sizeof(zero_mcd), &off, + rc = fsfilt_write_record(obd, mds->mds_rcvd_filp, &zero_lcd, + sizeof(zero_lcd), &off, (!exp->exp_libclient || exp->exp_need_sync)); pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); CDEBUG(rc == 0 ? D_INFO : D_ERROR, "zeroing out client %s idx %u in %s rc %d\n", - med->med_mcd->mcd_uuid, med->med_lr_idx, LAST_RCVD, rc); + med->med_lcd->lcd_uuid, med->med_lr_idx, LAST_RCVD, rc); } if (!test_and_clear_bit(med->med_lr_idx, mds->mds_client_bitmap)) { @@ -250,8 +250,8 @@ int mds_client_free(struct obd_export *exp) EXIT; free: - OBD_FREE(med->med_mcd, sizeof(*med->med_mcd)); - med->med_mcd = NULL; + OBD_FREE_PTR(med->med_lcd); + med->med_lcd = NULL; return 0; } @@ -269,7 +269,7 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) { struct mds_obd *mds = &obd->u.mds; struct lr_server_data *lsd; - struct mds_client_data *mcd = NULL; + struct lsd_client_data *lcd = NULL; loff_t off = 0; unsigned long last_rcvd_size = i_size_read(file->f_dentry->d_inode); __u64 mount_count; @@ -279,8 +279,8 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) /* ensure padding in the struct is the correct size */ LASSERT(offsetof(struct lr_server_data, lsd_padding) + sizeof(lsd->lsd_padding) == LR_SERVER_SIZE); - LASSERT(offsetof(struct mds_client_data, mcd_padding) + - sizeof(mcd->mcd_padding) == LR_CLIENT_SIZE); + LASSERT(offsetof(struct lsd_client_data, lcd_padding) + + sizeof(lcd->lcd_padding) == LR_CLIENT_SIZE); OBD_ALLOC_WAIT(lsd, sizeof(*lsd)); if (!lsd) @@ -377,59 +377,59 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) struct obd_export *exp; struct mds_export_data *med; - if (!mcd) { - OBD_ALLOC_WAIT(mcd, sizeof(*mcd)); - if (!mcd) + if (!lcd) { + OBD_ALLOC_WAIT(lcd, sizeof(*lcd)); + if (!lcd) GOTO(err_client, rc = -ENOMEM); } /* Don't assume off is incremented properly by - * fsfilt_read_record(), in case sizeof(*mcd) + * fsfilt_read_record(), in case sizeof(*lcd) * 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, file, mcd, sizeof(*mcd), &off); + rc = fsfilt_read_record(obd, file, lcd, sizeof(*lcd), &off); if (rc) { CERROR("error reading MDS %s idx %d, off %llu: rc %d\n", LAST_RCVD, cl_idx, off, rc); 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 = le64_to_cpu(mcd->mcd_last_transno) > - le64_to_cpu(mcd->mcd_last_close_transno) ? - le64_to_cpu(mcd->mcd_last_transno) : - le64_to_cpu(mcd->mcd_last_close_transno); + last_transno = le64_to_cpu(lcd->lcd_last_transno) > + le64_to_cpu(lcd->lcd_last_close_transno) ? + le64_to_cpu(lcd->lcd_last_transno) : + le64_to_cpu(lcd->lcd_last_close_transno); /* These exports are cleaned up by mds_disconnect(), so they * need to be set up like real exports as mds_connect() does. */ CDEBUG(D_HA, "RCVRNG CLIENT uuid: %s idx: %d lr: "LPU64 - " srv lr: "LPU64" lx: "LPU64"\n", mcd->mcd_uuid, cl_idx, + " srv lr: "LPU64" lx: "LPU64"\n", lcd->lcd_uuid, cl_idx, last_transno, le64_to_cpu(lsd->lsd_last_transno), - le64_to_cpu(mcd->mcd_last_xid)); + le64_to_cpu(lcd->lcd_last_xid)); - 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 { med = &exp->exp_mds_data; - med->med_mcd = mcd; + med->med_lcd = lcd; rc = mds_client_add(obd, exp, cl_idx, NULL); /* can't fail for existing client */ LASSERTF(rc == 0, "rc = %d\n", rc); - mcd = NULL; + lcd = NULL; spin_lock(&exp->exp_lock); exp->exp_replay_needed = 1; @@ -449,8 +449,8 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file) mds->mds_last_transno = last_transno; } - if (mcd) - OBD_FREE(mcd, sizeof(*mcd)); + if (lcd) + OBD_FREE_PTR(lcd); obd->obd_last_committed = mds->mds_last_transno; diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index b13619309d7817d77941df4c8cbe16603d7a50f9..1b4d6a227610df029723f079b5a0d7bcba4ab7c4 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -11,21 +11,6 @@ #define MDT_ROCOMPAT_SUPP (OBD_ROCOMPAT_LOVOBJID) #define MDT_INCOMPAT_SUPP (OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR) -/* Data stored per client in the last_rcvd file. In le32 order. */ -struct mds_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 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 */ - __u32 mcd_last_close_data; /* per-op data (disposition for open &c.) */ - __u8 mcd_padding[LR_CLIENT_SIZE - 88]; -}; - #define MDS_SERVICE_WATCHDOG_FACTOR 2000 #define MAX_ATIME_DIFF 60 @@ -112,18 +97,18 @@ static inline void mds_inode_unset_orphan(struct inode *inode) #define MDS_CHECK_RESENT(req, reconstruct) \ { \ if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) { \ - struct mds_client_data *mcd = \ - req->rq_export->exp_mds_data.med_mcd; \ - if (le64_to_cpu(mcd->mcd_last_xid) == req->rq_xid) { \ + struct lsd_client_data *lcd = \ + req->rq_export->exp_mds_data.med_lcd; \ + if (le64_to_cpu(lcd->lcd_last_xid) == req->rq_xid) { \ reconstruct; \ - RETURN(le32_to_cpu(mcd->mcd_last_result)); \ + RETURN(le32_to_cpu(lcd->lcd_last_result)); \ } \ - if (le64_to_cpu(mcd->mcd_last_close_xid) == req->rq_xid) { \ + if (le64_to_cpu(lcd->lcd_last_close_xid) == req->rq_xid) { \ reconstruct; \ - RETURN(le32_to_cpu(mcd->mcd_last_close_result)); \ + RETURN(le32_to_cpu(lcd->lcd_last_close_result)); \ } \ DEBUG_REQ(D_HA, req, "no reply for RESENT req (have "LPD64")",\ - mcd->mcd_last_xid); \ + lcd->lcd_last_xid); \ } \ } @@ -141,7 +126,7 @@ int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle, struct ptlrpc_request *req, int rc, __u32 op_data, int force_sync); void mds_reconstruct_generic(struct ptlrpc_request *req); -void mds_req_from_mcd(struct ptlrpc_request *req, struct mds_client_data *mcd); +void mds_req_from_lcd(struct ptlrpc_request *req, struct lsd_client_data *cd); int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds, struct ll_fid *fid, struct lustre_handle *parent_lockh, diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index e652c7e5ca92d258e09c163868ab2cd99a0df041..e7d4023325c823c91b025ba4373426ab58f92dd1 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -498,7 +498,7 @@ static void reconstruct_open(struct mds_update_record *rec, int offset, struct lustre_handle *child_lockh) { struct mds_export_data *med = &req->rq_export->exp_mds_data; - struct mds_client_data *mcd = med->med_mcd; + struct lsd_client_data *lcd = med->med_lcd; struct mds_obd *mds = mds_req2mds(req); struct mds_file_data *mfd; struct obd_export *exp = req->rq_export; @@ -516,8 +516,8 @@ static void reconstruct_open(struct mds_update_record *rec, int offset, body = lustre_msg_buf(req->rq_repmsg, DLM_REPLY_REC_OFF, sizeof(*body)); /* copy rc, transno and disp; steal locks */ - mds_req_from_mcd(req, mcd); - intent_set_disposition(rep, le32_to_cpu(mcd->mcd_last_data)); + mds_req_from_lcd(req, lcd); + intent_set_disposition(rep, le32_to_cpu(lcd->lcd_last_data)); /* Only replay if create or open actually happened. */ if (!intent_disposition(rep, DISP_OPEN_CREATE | DISP_OPEN_OPEN) ) { diff --git a/lustre/mds/mds_reint.c b/lustre/mds/mds_reint.c index 61e010881405a2ebea832ff587b3cf5f206306ac..57b9b7bee4858c9a24e36abdb970d653742ef932 100644 --- a/lustre/mds/mds_reint.c +++ b/lustre/mds/mds_reint.c @@ -108,7 +108,7 @@ int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle, int force_sync) { struct mds_export_data *med = &req->rq_export->exp_mds_data; - struct mds_client_data *mcd = med->med_mcd; + struct lsd_client_data *lcd = med->med_lcd; struct obd_device *obd = req->rq_export->exp_obd; __u64 transno, prev_transno; int err; @@ -167,20 +167,20 @@ int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle, req->rq_transno = transno; lustre_msg_set_transno(req->rq_repmsg, transno); if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE) { - prev_transno = le64_to_cpu(mcd->mcd_last_close_transno); - mcd->mcd_last_close_transno = cpu_to_le64(transno); - mcd->mcd_last_close_xid = cpu_to_le64(req->rq_xid); - mcd->mcd_last_close_result = cpu_to_le32(rc); - mcd->mcd_last_close_data = cpu_to_le32(op_data); + prev_transno = le64_to_cpu(lcd->lcd_last_close_transno); + lcd->lcd_last_close_transno = cpu_to_le64(transno); + lcd->lcd_last_close_xid = cpu_to_le64(req->rq_xid); + lcd->lcd_last_close_result = cpu_to_le32(rc); + lcd->lcd_last_close_data = cpu_to_le32(op_data); } else { - prev_transno = le64_to_cpu(mcd->mcd_last_transno); + prev_transno = le64_to_cpu(lcd->lcd_last_transno); if (((lustre_msg_get_flags(req->rq_reqmsg) & (MSG_RESENT | MSG_REPLAY)) == 0) || (transno > prev_transno)) { - mcd->mcd_last_transno = cpu_to_le64(transno); - mcd->mcd_last_xid = cpu_to_le64(req->rq_xid); - mcd->mcd_last_result = cpu_to_le32(rc); - mcd->mcd_last_data = cpu_to_le32(op_data); + lcd->lcd_last_transno = cpu_to_le64(transno); + lcd->lcd_last_xid = cpu_to_le64(req->rq_xid); + lcd->lcd_last_result = cpu_to_le32(rc); + lcd->lcd_last_data = cpu_to_le32(op_data); } } /* update the server data to not lose the greatest transno. Bug 11125 */ @@ -198,8 +198,8 @@ int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle, handle, mds_commit_cb, NULL); - err = fsfilt_write_record(obd, mds->mds_rcvd_filp, mcd, - sizeof(*mcd), &off, + err = fsfilt_write_record(obd, mds->mds_rcvd_filp, lcd, + sizeof(*lcd), &off, force_sync | exp->exp_need_sync); if (force_sync) mds_commit_cb(obd, transno, NULL, err); @@ -213,7 +213,7 @@ int mds_finish_transno(struct mds_obd *mds, struct inode *inode, void *handle, DEBUG_REQ(log_pri, req, "wrote trans #"LPU64" rc %d client %s at idx %u: err = %d", - transno, rc, mcd->mcd_uuid, med->med_lr_idx, err); + transno, rc, lcd->lcd_uuid, med->med_lr_idx, err); err = mds_lov_write_objids(obd); if (err) { @@ -380,17 +380,17 @@ void mds_steal_ack_locks(struct ptlrpc_request *req) spin_unlock(&exp->exp_lock); } -void mds_req_from_mcd(struct ptlrpc_request *req, struct mds_client_data *mcd) +void mds_req_from_lcd(struct ptlrpc_request *req, struct lsd_client_data *lcd) { if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE) { - req->rq_transno = le64_to_cpu(mcd->mcd_last_close_transno); + req->rq_transno = le64_to_cpu(lcd->lcd_last_close_transno); lustre_msg_set_transno(req->rq_repmsg, req->rq_transno); - req->rq_status = le32_to_cpu(mcd->mcd_last_close_result); + req->rq_status = le32_to_cpu(lcd->lcd_last_close_result); lustre_msg_set_status(req->rq_repmsg, req->rq_status); } else { - req->rq_transno = le64_to_cpu(mcd->mcd_last_transno); + req->rq_transno = le64_to_cpu(lcd->lcd_last_transno); lustre_msg_set_transno(req->rq_repmsg, req->rq_transno); - req->rq_status = le32_to_cpu(mcd->mcd_last_result); + req->rq_status = le32_to_cpu(lcd->lcd_last_result); lustre_msg_set_status(req->rq_repmsg, req->rq_status); } DEBUG_REQ(D_RPCTRACE, req, "restoring transno "LPD64"/status %d", @@ -408,7 +408,7 @@ static void reconstruct_reint_setattr(struct mds_update_record *rec, struct dentry *de; struct mds_body *body; - mds_req_from_mcd(req, med->med_mcd); + mds_req_from_lcd(req, med->med_lcd); de = mds_fid2dentry(obd, rec->ur_fid1, NULL); if (IS_ERR(de)) { @@ -753,7 +753,7 @@ static void reconstruct_reint_create(struct mds_update_record *rec, int offset, struct mds_body *body; int rc; - mds_req_from_mcd(req, med->med_mcd); + mds_req_from_lcd(req, med->med_lcd); if (req->rq_status) return; @@ -1482,7 +1482,7 @@ void mds_reconstruct_generic(struct ptlrpc_request *req) { struct mds_export_data *med = &req->rq_export->exp_mds_data; - mds_req_from_mcd(req, med->med_mcd); + mds_req_from_lcd(req, med->med_lcd); } /* If we are unlinking an open file/dir (i.e. creating an orphan) then diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 82455641739fbcb5286f08c40f650c00a9874da6..d4db97063186ff75668f40897114e1615c7b0cd2 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -78,7 +78,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; @@ -105,10 +105,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) { @@ -124,7 +124,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); @@ -136,7 +136,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); } @@ -247,7 +247,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 @@ -280,7 +280,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; @@ -288,8 +288,8 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp, void *handle; int rc; - 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 */ @@ -308,8 +308,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, @@ -331,21 +331,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, off, fed->fed_fcd->fcd_uuid); + fed->fed_lr_idx, off, fed->fed_lcd->lcd_uuid); LASSERT(filter->fo_last_rcvd_slots != NULL); @@ -368,10 +368,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)); @@ -384,7 +384,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); } @@ -396,8 +396,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; } @@ -648,7 +648,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; @@ -659,8 +659,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) @@ -751,57 +751,57 @@ 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"\n", fcd->fcd_uuid, cl_idx, + " 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_lcd = lcd; 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_replay_needed = 1; @@ -821,8 +821,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); @@ -2159,7 +2159,7 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, { struct obd_export *exp; struct filter_export_data *fed; - struct filter_client_data *fcd = NULL; + struct lsd_client_data *lcd = NULL; int rc; ENTRY; @@ -2183,14 +2183,14 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, if (!obd->obd_replayable) GOTO(cleanup, rc = 0); - OBD_ALLOC(fcd, sizeof(*fcd)); - if (!fcd) { + OBD_ALLOC_PTR(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; + memcpy(lcd->lcd_uuid, cluuid, sizeof(lcd->lcd_uuid)); + fed->fed_lcd = lcd; rc = filter_client_add(obd, exp, -1); @@ -2198,9 +2198,9 @@ static int filter_connect(struct lustre_handle *conn, struct obd_device *obd, 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 27611c94de98f3b25cc1f54d0ede524fba0633c3..615d6cea61239a1d4065e228f05364c191490682 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -32,14 +32,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 */ - __u8 fcd_padding[LR_CLIENT_SIZE - 56]; -}; - /* 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|\