#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;
};
/* 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 */
{
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;
*
* 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.
*/
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 {
/* 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, "
/* 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);
}
* 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
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
}
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) +
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);
}
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;
}
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);
}
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)) {
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;
}
{
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;
/* 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)
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;
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;
#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
#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); \
} \
}
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,
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;
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) ) {
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;
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 */
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);
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) {
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",
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)) {
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;
{
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
{
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;
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) {
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);
}
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);
}
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
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;
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 */
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,
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);
}
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));
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);
}
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;
}
{
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;
/* 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)
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;
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);
{
struct obd_export *exp;
struct filter_export_data *fed;
- struct filter_client_data *fcd = NULL;
+ struct lsd_client_data *lcd = NULL;
int rc;
ENTRY;
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);
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 {
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|\