diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/ptlrpc')
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/client.c | 28 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/events.c | 5 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/import.c | 2 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/layout.c | 26 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 5 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/nrs.c | 3 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 103 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/pers.c | 2 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 3 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 18 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/recover.c | 24 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/service.c | 21 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 194 |
13 files changed, 208 insertions, 226 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 804741362bc0..04a98a08ece1 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1160,7 +1160,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, if (atomic_read(&imp->imp_inval_count) != 0) { DEBUG_REQ(D_ERROR, req, "invalidate in flight"); *status = -EIO; - } else if (imp->imp_dlm_fake || req->rq_no_delay) { + } else if (req->rq_no_delay) { *status = -EWOULDBLOCK; } else if (req->rq_allow_replay && (imp->imp_state == LUSTRE_IMP_REPLAY || @@ -2662,11 +2662,16 @@ free_req: list_for_each_entry_safe(req, saved, &imp->imp_committed_list, rq_replay_list) { LASSERT(req->rq_transno != 0); - if (req->rq_import_generation < imp->imp_generation) { - DEBUG_REQ(D_RPCTRACE, req, "free stale open request"); - ptlrpc_free_request(req); - } else if (!req->rq_replay) { - DEBUG_REQ(D_RPCTRACE, req, "free closed open request"); + if (req->rq_import_generation < imp->imp_generation || + !req->rq_replay) { + DEBUG_REQ(D_RPCTRACE, req, "free %s open request", + req->rq_import_generation < + imp->imp_generation ? "stale" : "closed"); + + if (imp->imp_replay_cursor == &req->rq_replay_list) + imp->imp_replay_cursor = + req->rq_replay_list.next; + ptlrpc_free_request(req); } } @@ -3070,7 +3075,7 @@ void ptlrpc_init_xid(void) } /* Always need to be aligned to a power-of-two for multi-bulk BRW */ - CLASSERT(((PTLRPC_BULK_OPS_COUNT - 1) & PTLRPC_BULK_OPS_COUNT) == 0); + BUILD_BUG_ON(((PTLRPC_BULK_OPS_COUNT - 1) & PTLRPC_BULK_OPS_COUNT) != 0); ptlrpc_last_xid &= PTLRPC_BULK_OPS_MASK; } @@ -3123,8 +3128,11 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req) req->rq_mbits = ptlrpc_next_xid(); } else { /* old version transfers rq_xid to peer as matchbits */ - req->rq_mbits = ptlrpc_next_xid(); - req->rq_xid = req->rq_mbits; + spin_lock(&req->rq_import->imp_lock); + list_del_init(&req->rq_unreplied_list); + ptlrpc_assign_next_xid_nolock(req); + req->rq_mbits = req->rq_xid; + spin_unlock(&req->rq_import->imp_lock); } CDEBUG(D_HA, "resend bulk old x%llu new x%llu\n", @@ -3256,7 +3264,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, req->rq_no_resend = 1; req->rq_pill.rc_fmt = (void *)&worker_format; - CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args)); + BUILD_BUG_ON(sizeof(*args) > sizeof(req->rq_async_args)); args = ptlrpc_req_async_args(req); args->cb = cb; args->cbdata = cbdata; diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 49f3e6368415..dc0fe9d660da 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -277,7 +277,7 @@ static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt, * then we hope there will be less RPCs per bucket at some * point, and sequence will catch up again */ - svcpt->scp_hist_seq += (1U << REQS_SEQ_SHIFT(svcpt)); + svcpt->scp_hist_seq += (1ULL << REQS_SEQ_SHIFT(svcpt)); new_seq = svcpt->scp_hist_seq; } @@ -420,7 +420,8 @@ void reply_out_callback(lnet_event_t *ev) rs->rs_on_net = 0; if (!rs->rs_no_ack || rs->rs_transno <= - rs->rs_export->exp_obd->obd_last_committed) + rs->rs_export->exp_obd->obd_last_committed || + list_empty(&rs->rs_obd_list)) ptlrpc_schedule_difficult_reply(rs); spin_unlock(&rs->rs_lock); diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index e8280194001c..93e172fe9ce4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -703,7 +703,7 @@ int ptlrpc_connect_import(struct obd_import *imp) ptlrpc_request_set_replen(request); request->rq_interpret_reply = ptlrpc_connect_interpret; - CLASSERT(sizeof(*aa) <= sizeof(request->rq_async_args)); + BUILD_BUG_ON(sizeof(*aa) > sizeof(request->rq_async_args)); aa = ptlrpc_req_async_args(request); memset(aa, 0, sizeof(*aa)); diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 99d7c667df28..356d73511ea3 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -42,8 +42,6 @@ * of the format that the request conforms to. */ -#if !defined(__REQ_LAYOUT_USER__) - #define DEBUG_SUBSYSTEM S_RPC #include <linux/module.h> @@ -57,8 +55,6 @@ #include "../include/obd.h" #include "../include/obd_support.h" -/* __REQ_LAYOUT_USER__ */ -#endif /* struct ptlrpc_request, lustre_msg* */ #include "../include/lustre_req_layout.h" #include "../include/lustre_acl.h" @@ -1181,6 +1177,23 @@ struct req_format RQF_FLD_QUERY = DEFINE_REQ_FMT0("FLD_QUERY", fld_query_client, fld_query_server); EXPORT_SYMBOL(RQF_FLD_QUERY); +/* + * The 'fld_read_server' uses 'RMF_GENERIC_DATA' to hold the 'FLD_QUERY' + * RPC reply that is composed of 'struct lu_seq_range_array'. But there + * is not registered swabber function for 'RMF_GENERIC_DATA'. So the RPC + * peers need to handle the RPC reply with fixed little-endian format. + * + * In theory, we can define new structure with some swabber registered to + * handle the 'FLD_QUERY' RPC reply result automatically. But from the + * implementation view, it is not easy to be done within current "struct + * req_msg_field" framework. Because the sequence range array in the RPC + * reply is not fixed length, instead, its length depends on 'lu_seq_range' + * count, that is unknown when prepare the RPC buffer. Generally, for such + * flexible length RPC usage, there will be a field in the RPC layout to + * indicate the data length. But for the 'FLD_READ' RPC, we have no way to + * do that unless we add new length filed that will broken the on-wire RPC + * protocol and cause interoperability trouble with old peer. + */ struct req_format RQF_FLD_READ = DEFINE_REQ_FMT0("FLD_READ", fld_read_client, fld_read_server); EXPORT_SYMBOL(RQF_FLD_READ); @@ -1541,8 +1554,6 @@ struct req_format RQF_OST_GET_INFO_FIEMAP = ost_get_fiemap_server); EXPORT_SYMBOL(RQF_OST_GET_INFO_FIEMAP); -#if !defined(__REQ_LAYOUT_USER__) - /* Convenience macro */ #define FMT_FIELD(fmt, i, j) (fmt)->rf_fields[(i)].d[(j)] @@ -2221,6 +2232,3 @@ void req_capsule_shrink(struct req_capsule *pill, 1); } EXPORT_SYMBOL(req_capsule_shrink); - -/* __REQ_LAYOUT_USER__ */ -#endif diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index da1209e40f03..b8701841ab4a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -522,13 +522,14 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) */ spin_lock(&imp->imp_lock); ptlrpc_assign_next_xid_nolock(request); - request->rq_mbits = request->rq_xid; min_xid = ptlrpc_known_replied_xid(imp); spin_unlock(&imp->imp_lock); lustre_msg_set_last_xid(request->rq_reqmsg, min_xid); DEBUG_REQ(D_RPCTRACE, request, "Allocating new xid for resend on EINPROGRESS"); - } else if (request->rq_bulk) { + } + + if (request->rq_bulk) { ptlrpc_set_bulk_mbits(request); lustre_msg_set_mbits(request->rq_reqmsg, request->rq_mbits); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 7b6ffb195834..ef19dbe2ea5c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -1559,9 +1559,6 @@ out: return rc; } -/* ptlrpc/nrs_fifo.c */ -extern struct ptlrpc_nrs_pol_conf nrs_conf_fifo; - /** * Adds all policies that ship with the ptlrpc module, to NRS core's list of * policies \e nrs_core.nrs_policies. diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 13f00b7cbbe5..9456a1825918 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -469,6 +469,7 @@ int lustre_shrink_msg(struct lustre_msg *msg, int segment, default: LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic); } + return 0; } EXPORT_SYMBOL(lustre_shrink_msg); @@ -509,8 +510,8 @@ static int lustre_unpack_msg_v2(struct lustre_msg_v2 *m, int len) __swab32s(&m->lm_repsize); __swab32s(&m->lm_cksum); __swab32s(&m->lm_flags); - CLASSERT(offsetof(typeof(*m), lm_padding_2) != 0); - CLASSERT(offsetof(typeof(*m), lm_padding_3) != 0); + BUILD_BUG_ON(offsetof(typeof(*m), lm_padding_2) == 0); + BUILD_BUG_ON(offsetof(typeof(*m), lm_padding_3) == 0); } required_len = lustre_msg_hdr_size_v2(m->lm_bufcount); @@ -1525,18 +1526,18 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *b) __swab64s(&b->pb_pre_versions[2]); __swab64s(&b->pb_pre_versions[3]); __swab64s(&b->pb_mbits); - CLASSERT(offsetof(typeof(*b), pb_padding0) != 0); - CLASSERT(offsetof(typeof(*b), pb_padding1) != 0); - CLASSERT(offsetof(typeof(*b), pb_padding64_0) != 0); - CLASSERT(offsetof(typeof(*b), pb_padding64_1) != 0); - CLASSERT(offsetof(typeof(*b), pb_padding64_2) != 0); + BUILD_BUG_ON(offsetof(typeof(*b), pb_padding0) == 0); + BUILD_BUG_ON(offsetof(typeof(*b), pb_padding1) == 0); + BUILD_BUG_ON(offsetof(typeof(*b), pb_padding64_0) == 0); + BUILD_BUG_ON(offsetof(typeof(*b), pb_padding64_1) == 0); + BUILD_BUG_ON(offsetof(typeof(*b), pb_padding64_2) == 0); /* While we need to maintain compatibility between * clients and servers without ptlrpc_body_v2 (< 2.3) * do not swab any fields beyond pb_jobid, as we are * using this swab function for both ptlrpc_body * and ptlrpc_body_v2. */ - CLASSERT(offsetof(typeof(*b), pb_jobid) != 0); + BUILD_BUG_ON(offsetof(typeof(*b), pb_jobid) == 0); } void lustre_swab_connect(struct obd_connect_data *ocd) @@ -1567,23 +1568,23 @@ void lustre_swab_connect(struct obd_connect_data *ocd) __swab64s(&ocd->ocd_maxbytes); if (ocd->ocd_connect_flags & OBD_CONNECT_MULTIMODRPCS) __swab16s(&ocd->ocd_maxmodrpcs); - CLASSERT(offsetof(typeof(*ocd), padding0)); - CLASSERT(offsetof(typeof(*ocd), padding1) != 0); + BUILD_BUG_ON(!offsetof(typeof(*ocd), padding0)); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding1) == 0); if (ocd->ocd_connect_flags & OBD_CONNECT_FLAGS2) __swab64s(&ocd->ocd_connect_flags2); - CLASSERT(offsetof(typeof(*ocd), padding3) != 0); - CLASSERT(offsetof(typeof(*ocd), padding4) != 0); - CLASSERT(offsetof(typeof(*ocd), padding5) != 0); - CLASSERT(offsetof(typeof(*ocd), padding6) != 0); - CLASSERT(offsetof(typeof(*ocd), padding7) != 0); - CLASSERT(offsetof(typeof(*ocd), padding8) != 0); - CLASSERT(offsetof(typeof(*ocd), padding9) != 0); - CLASSERT(offsetof(typeof(*ocd), paddingA) != 0); - CLASSERT(offsetof(typeof(*ocd), paddingB) != 0); - CLASSERT(offsetof(typeof(*ocd), paddingC) != 0); - CLASSERT(offsetof(typeof(*ocd), paddingD) != 0); - CLASSERT(offsetof(typeof(*ocd), paddingE) != 0); - CLASSERT(offsetof(typeof(*ocd), paddingF) != 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding3) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding4) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding5) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding6) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding7) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding8) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), padding9) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), paddingA) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), paddingB) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), paddingC) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), paddingD) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), paddingE) == 0); + BUILD_BUG_ON(offsetof(typeof(*ocd), paddingF) == 0); } static void lustre_swab_obdo(struct obdo *o) @@ -1613,9 +1614,9 @@ static void lustre_swab_obdo(struct obdo *o) __swab32s(&o->o_uid_h); __swab32s(&o->o_gid_h); __swab64s(&o->o_data_version); - CLASSERT(offsetof(typeof(*o), o_padding_4) != 0); - CLASSERT(offsetof(typeof(*o), o_padding_5) != 0); - CLASSERT(offsetof(typeof(*o), o_padding_6) != 0); + BUILD_BUG_ON(offsetof(typeof(*o), o_padding_4) == 0); + BUILD_BUG_ON(offsetof(typeof(*o), o_padding_5) == 0); + BUILD_BUG_ON(offsetof(typeof(*o), o_padding_6) == 0); } void lustre_swab_obd_statfs(struct obd_statfs *os) @@ -1631,15 +1632,15 @@ void lustre_swab_obd_statfs(struct obd_statfs *os) __swab32s(&os->os_namelen); __swab64s(&os->os_maxbytes); __swab32s(&os->os_state); - CLASSERT(offsetof(typeof(*os), os_fprecreated) != 0); - CLASSERT(offsetof(typeof(*os), os_spare2) != 0); - CLASSERT(offsetof(typeof(*os), os_spare3) != 0); - CLASSERT(offsetof(typeof(*os), os_spare4) != 0); - CLASSERT(offsetof(typeof(*os), os_spare5) != 0); - CLASSERT(offsetof(typeof(*os), os_spare6) != 0); - CLASSERT(offsetof(typeof(*os), os_spare7) != 0); - CLASSERT(offsetof(typeof(*os), os_spare8) != 0); - CLASSERT(offsetof(typeof(*os), os_spare9) != 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_fprecreated) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare2) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare3) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare4) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare5) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare6) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare7) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare8) == 0); + BUILD_BUG_ON(offsetof(typeof(*os), os_spare9) == 0); } void lustre_swab_obd_ioobj(struct obd_ioobj *ioo) @@ -1679,7 +1680,7 @@ void lustre_swab_gl_desc(union ldlm_gl_desc *desc) __swab64s(&desc->lquota_desc.gl_hardlimit); __swab64s(&desc->lquota_desc.gl_softlimit); __swab64s(&desc->lquota_desc.gl_time); - CLASSERT(offsetof(typeof(desc->lquota_desc), gl_pad2) != 0); + BUILD_BUG_ON(offsetof(typeof(desc->lquota_desc), gl_pad2) == 0); } void lustre_swab_ost_lvb_v1(struct ost_lvb_v1 *lvb) @@ -1738,24 +1739,24 @@ void lustre_swab_mdt_body(struct mdt_body *b) __swab32s(&b->mbo_flags); __swab32s(&b->mbo_rdev); __swab32s(&b->mbo_nlink); - CLASSERT(offsetof(typeof(*b), mbo_unused2) != 0); + BUILD_BUG_ON(offsetof(typeof(*b), mbo_unused2) == 0); __swab32s(&b->mbo_suppgid); __swab32s(&b->mbo_eadatasize); __swab32s(&b->mbo_aclsize); __swab32s(&b->mbo_max_mdsize); - CLASSERT(offsetof(typeof(*b), mbo_unused3)); + BUILD_BUG_ON(!offsetof(typeof(*b), mbo_unused3)); __swab32s(&b->mbo_uid_h); __swab32s(&b->mbo_gid_h); - CLASSERT(offsetof(typeof(*b), mbo_padding_5) != 0); + BUILD_BUG_ON(offsetof(typeof(*b), mbo_padding_5) == 0); } void lustre_swab_mdt_ioepoch(struct mdt_ioepoch *b) { /* handle is opaque */ /* mio_handle is opaque */ - CLASSERT(offsetof(typeof(*b), mio_unused1)); - CLASSERT(offsetof(typeof(*b), mio_unused2)); - CLASSERT(offsetof(typeof(*b), mio_padding)); + BUILD_BUG_ON(!offsetof(typeof(*b), mio_unused1)); + BUILD_BUG_ON(!offsetof(typeof(*b), mio_unused2)); + BUILD_BUG_ON(!offsetof(typeof(*b), mio_padding)); } void lustre_swab_mgs_target_info(struct mgs_target_info *mti) @@ -1768,7 +1769,7 @@ void lustre_swab_mgs_target_info(struct mgs_target_info *mti) __swab32s(&mti->mti_flags); __swab32s(&mti->mti_instance); __swab32s(&mti->mti_nid_count); - CLASSERT(sizeof(lnet_nid_t) == sizeof(__u64)); + BUILD_BUG_ON(sizeof(lnet_nid_t) != sizeof(__u64)); for (i = 0; i < MTI_NIDS_MAX; i++) __swab64s(&mti->mti_nids[i]); } @@ -1784,13 +1785,13 @@ void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *entry) /* mne_nid_(count|type) must be one byte size because we're gonna * access it w/o swapping. */ - CLASSERT(sizeof(entry->mne_nid_count) == sizeof(__u8)); - CLASSERT(sizeof(entry->mne_nid_type) == sizeof(__u8)); + BUILD_BUG_ON(sizeof(entry->mne_nid_count) != sizeof(__u8)); + BUILD_BUG_ON(sizeof(entry->mne_nid_type) != sizeof(__u8)); /* remove this assertion if ipv6 is supported. */ LASSERT(entry->mne_nid_type == 0); for (i = 0; i < entry->mne_nid_count; i++) { - CLASSERT(sizeof(lnet_nid_t) == sizeof(__u64)); + BUILD_BUG_ON(sizeof(lnet_nid_t) != sizeof(__u64)); __swab64s(&entry->u.nids[i]); } } @@ -1828,7 +1829,7 @@ static void lustre_swab_obd_dqblk(struct obd_dqblk *b) __swab64s(&b->dqb_btime); __swab64s(&b->dqb_itime); __swab32s(&b->dqb_valid); - CLASSERT(offsetof(typeof(*b), dqb_padding) != 0); + BUILD_BUG_ON(offsetof(typeof(*b), dqb_padding) == 0); } void lustre_swab_obd_quotactl(struct obd_quotactl *q) @@ -1899,7 +1900,7 @@ void lustre_swab_mdt_rec_reint (struct mdt_rec_reint *rr) __swab32s(&rr->rr_flags_h); __swab32s(&rr->rr_umask); - CLASSERT(offsetof(typeof(*rr), rr_padding_4) != 0); + BUILD_BUG_ON(offsetof(typeof(*rr), rr_padding_4) == 0); }; void lustre_swab_lov_desc(struct lov_desc *ld) @@ -1948,7 +1949,7 @@ void lustre_swab_lmv_user_md(struct lmv_user_md *lum) __swab32s(&lum->lum_stripe_offset); __swab32s(&lum->lum_hash_type); __swab32s(&lum->lum_type); - CLASSERT(offsetof(typeof(*lum), lum_padding1)); + BUILD_BUG_ON(!offsetof(typeof(*lum), lum_padding1)); } EXPORT_SYMBOL(lustre_swab_lmv_user_md); @@ -2037,7 +2038,7 @@ void lustre_swab_ldlm_intent(struct ldlm_intent *i) static void lustre_swab_ldlm_resource_desc(struct ldlm_resource_desc *r) { __swab32s(&r->lr_type); - CLASSERT(offsetof(typeof(*r), lr_padding) != 0); + BUILD_BUG_ON(offsetof(typeof(*r), lr_padding) == 0); lustre_swab_ldlm_res_id(&r->lr_name); } @@ -2060,7 +2061,7 @@ void lustre_swab_ldlm_request(struct ldlm_request *rq) void lustre_swab_ldlm_reply(struct ldlm_reply *r) { __swab32s(&r->lock_flags); - CLASSERT(offsetof(typeof(*r), lock_padding) != 0); + BUILD_BUG_ON(offsetof(typeof(*r), lock_padding) == 0); lustre_swab_ldlm_lock_desc(&r->lock_desc); /* lock_handle opaque */ __swab64s(&r->lock_policy_res1); diff --git a/drivers/staging/lustre/lustre/ptlrpc/pers.c b/drivers/staging/lustre/lustre/ptlrpc/pers.c index 94e9fa85d774..601acb84f343 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pers.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pers.c @@ -45,7 +45,7 @@ void ptlrpc_fill_bulk_md(lnet_md_t *md, struct ptlrpc_bulk_desc *desc, { int offset = mdidx * LNET_MAX_IOV; - CLASSERT(PTLRPC_MAX_BRW_PAGES < LI_POISON); + BUILD_BUG_ON(PTLRPC_MAX_BRW_PAGES >= LI_POISON); LASSERT(mdidx < desc->bd_md_max_brw); LASSERT(desc->bd_iov_count <= PTLRPC_MAX_BRW_PAGES); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index e0f859ca6223..8e6a805487ec 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -226,6 +226,9 @@ struct ptlrpc_nrs_policy *nrs_request_policy(struct ptlrpc_nrs_request *nrq) sizeof(NRS_LPROCFS_QUANTUM_NAME_REG __stringify(LPROCFS_NRS_QUANTUM_MAX) " " \ NRS_LPROCFS_QUANTUM_NAME_HP __stringify(LPROCFS_NRS_QUANTUM_MAX)) +/* ptlrpc/nrs_fifo.c */ +extern struct ptlrpc_nrs_pol_conf nrs_conf_fifo; + /* recovd_thread.c */ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 1f55d642aa75..59b5813bd559 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -82,7 +82,8 @@ struct ptlrpcd { */ static int max_ptlrpcds; module_param(max_ptlrpcds, int, 0644); -MODULE_PARM_DESC(max_ptlrpcds, "Max ptlrpcd thread count to be started."); +MODULE_PARM_DESC(max_ptlrpcds, + "Max ptlrpcd thread count to be started (obsolete)."); /* * ptlrpcd_bind_policy is obsolete, but retained to ensure that @@ -102,7 +103,7 @@ MODULE_PARM_DESC(ptlrpcd_bind_policy, static int ptlrpcd_per_cpt_max; module_param(ptlrpcd_per_cpt_max, int, 0644); MODULE_PARM_DESC(ptlrpcd_per_cpt_max, - "Max ptlrpcd thread count to be started per cpt."); + "Max ptlrpcd thread count to be started per CPT."); /* * ptlrpcd_partner_group_size: The desired number of threads in each @@ -562,15 +563,6 @@ int ptlrpcd_start(struct ptlrpcd_ctl *pc) return 0; } - /* - * So far only "client" ptlrpcd uses an environment. In the future, - * ptlrpcd thread (or a thread-set) has to be given an argument, - * describing its "scope". - */ - rc = lu_context_init(&pc->pc_env.le_ctx, LCT_CL_THREAD | LCT_REMEMBER); - if (rc != 0) - goto out; - task = kthread_run(ptlrpcd, pc, "%s", pc->pc_name); if (IS_ERR(task)) { rc = PTR_ERR(task); @@ -593,9 +585,6 @@ out_set: spin_unlock(&pc->pc_lock); ptlrpc_set_destroy(set); } - lu_context_fini(&pc->pc_env.le_ctx); - -out: clear_bit(LIOD_START, &pc->pc_flags); return rc; } @@ -623,7 +612,6 @@ void ptlrpcd_free(struct ptlrpcd_ctl *pc) } wait_for_completion(&pc->pc_finishing); - lu_context_fini(&pc->pc_env.le_ctx); spin_lock(&pc->pc_lock); pc->pc_set = NULL; diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index c00449036884..7b58545c2de4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -78,28 +78,11 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) imp->imp_last_transno_checked = 0; ptlrpc_free_committed(imp); last_transno = imp->imp_last_replay_transno; - spin_unlock(&imp->imp_lock); CDEBUG(D_HA, "import %p from %s committed %llu last %llu\n", imp, obd2cli_tgt(imp->imp_obd), imp->imp_peer_committed_transno, last_transno); - /* Do I need to hold a lock across this iteration? We shouldn't be - * racing with any additions to the list, because we're in recovery - * and are therefore not processing additional requests to add. Calls - * to ptlrpc_free_committed might commit requests, but nothing "newer" - * than the one we're replaying (it can't be committed until it's - * replayed, and we're doing that here). l_f_e_safe protects against - * problems with the current request being committed, in the unlikely - * event of that race. So, in conclusion, I think that it's safe to - * perform this list-walk without the imp_lock held. - * - * But, the {mdc,osc}_replay_open callbacks both iterate - * request lists, and have comments saying they assume the - * imp_lock is being held by ptlrpc_replay, but it's not. it's - * just a little race... - */ - /* Replay all the committed open requests on committed_list first */ if (!list_empty(&imp->imp_committed_list)) { tmp = imp->imp_committed_list.prev; @@ -107,10 +90,6 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) /* The last request on committed_list hasn't been replayed */ if (req->rq_transno > last_transno) { - /* Since the imp_committed_list is immutable before - * all of it's requests being replayed, it's safe to - * use a cursor to accelerate the search - */ if (!imp->imp_resend_replay || imp->imp_replay_cursor == &imp->imp_committed_list) imp->imp_replay_cursor = imp->imp_replay_cursor->next; @@ -124,6 +103,7 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) break; req = NULL; + LASSERT(!list_empty(imp->imp_replay_cursor)); imp->imp_replay_cursor = imp->imp_replay_cursor->next; } @@ -156,7 +136,6 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) if (req && imp->imp_resend_replay) lustre_msg_add_flags(req->rq_reqmsg, MSG_RESENT); - spin_lock(&imp->imp_lock); /* The resend replay request may have been removed from the * unreplied list. */ @@ -221,6 +200,7 @@ int ptlrpc_resend(struct obd_import *imp) } spin_unlock(&imp->imp_lock); + OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT, 2); return 0; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 70c70558e177..b8091c118302 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1264,20 +1264,15 @@ static int ptlrpc_server_hpreq_init(struct ptlrpc_service_part *svcpt, */ if (req->rq_ops->hpreq_check) { rc = req->rq_ops->hpreq_check(req); - /** - * XXX: Out of all current - * ptlrpc_hpreq_ops::hpreq_check(), only - * ldlm_cancel_hpreq_check() can return an error code; - * other functions assert in similar places, which seems - * odd. What also does not seem right is that handlers - * for those RPCs do not assert on the same checks, but - * rather handle the error cases. e.g. see - * ost_rw_hpreq_check(), and ost_brw_read(), - * ost_brw_write(). + if (rc == -ESTALE) { + req->rq_status = rc; + ptlrpc_error(req); + } + /** can only return error, + * 0 for normal request, + * or 1 for high priority request */ - if (rc < 0) - return rc; - LASSERT(rc == 0 || rc == 1); + LASSERT(rc <= 1); } spin_lock_bh(&req->rq_export->exp_rpc_lock); diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index a04e36cf6dd4..367f7e24e3da 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -61,7 +61,7 @@ void lustre_assert_wire_constants(void) MDS_DIR_END_OFF); LASSERTF(DEAD_HANDLE_MAGIC == 0xdeadbeefcafebabeULL, "found 0x%.16llxULL\n", DEAD_HANDLE_MAGIC); - CLASSERT(MTI_NAME_MAXLEN == 64); + BUILD_BUG_ON(MTI_NAME_MAXLEN != 64); LASSERTF(OST_REPLY == 0, "found %lld\n", (long long)OST_REPLY); LASSERTF(OST_GETATTR == 1, "found %lld\n", @@ -306,16 +306,16 @@ void lustre_assert_wire_constants(void) (long long)LCK_MAXMODE); LASSERTF(LCK_MODE_NUM == 8, "found %lld\n", (long long)LCK_MODE_NUM); - CLASSERT(LDLM_PLAIN == 10); - CLASSERT(LDLM_EXTENT == 11); - CLASSERT(LDLM_FLOCK == 12); - CLASSERT(LDLM_IBITS == 13); - CLASSERT(LDLM_MAX_TYPE == 14); - CLASSERT(LUSTRE_RES_ID_SEQ_OFF == 0); - CLASSERT(LUSTRE_RES_ID_VER_OID_OFF == 1); - CLASSERT(LUSTRE_RES_ID_QUOTA_SEQ_OFF == 2); - CLASSERT(LUSTRE_RES_ID_QUOTA_VER_OID_OFF == 3); - CLASSERT(LUSTRE_RES_ID_HSH_OFF == 3); + BUILD_BUG_ON(LDLM_PLAIN != 10); + BUILD_BUG_ON(LDLM_EXTENT != 11); + BUILD_BUG_ON(LDLM_FLOCK != 12); + BUILD_BUG_ON(LDLM_IBITS != 13); + BUILD_BUG_ON(LDLM_MAX_TYPE != 14); + BUILD_BUG_ON(LUSTRE_RES_ID_SEQ_OFF != 0); + BUILD_BUG_ON(LUSTRE_RES_ID_VER_OID_OFF != 1); + BUILD_BUG_ON(LUSTRE_RES_ID_QUOTA_SEQ_OFF != 2); + BUILD_BUG_ON(LUSTRE_RES_ID_QUOTA_VER_OID_OFF != 3); + BUILD_BUG_ON(LUSTRE_RES_ID_HSH_OFF != 3); LASSERTF(OBD_PING == 400, "found %lld\n", (long long)OBD_PING); LASSERTF(OBD_LOG_CANCEL == 401, "found %lld\n", @@ -661,7 +661,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ptlrpc_body_v3, pb_slv)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_slv) == 8, "found %lld\n", (long long)(int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_slv)); - CLASSERT(PTLRPC_NUM_VERSIONS == 4); + BUILD_BUG_ON(PTLRPC_NUM_VERSIONS != 4); LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_pre_versions) == 88, "found %lld\n", (long long)(int)offsetof(struct ptlrpc_body_v3, pb_pre_versions)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_pre_versions) == 32, "found %lld\n", @@ -682,7 +682,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ptlrpc_body_v3, pb_padding64_2)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2) == 8, "found %lld\n", (long long)(int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2)); - CLASSERT(LUSTRE_JOBID_SIZE == 32); + BUILD_BUG_ON(LUSTRE_JOBID_SIZE != 32); LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_jobid) == 152, "found %lld\n", (long long)(int)offsetof(struct ptlrpc_body_v3, pb_jobid)); LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_jobid) == 32, "found %lld\n", @@ -1319,27 +1319,27 @@ void lustre_assert_wire_constants(void) OBD_MD_FLGETATTRLOCK); LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLDATAVERSION); - CLASSERT(OBD_FL_INLINEDATA == 0x00000001); - CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002); - CLASSERT(OBD_FL_DELORPHAN == 0x00000004); - CLASSERT(OBD_FL_NORPC == 0x00000008); - CLASSERT(OBD_FL_IDONLY == 0x00000010); - CLASSERT(OBD_FL_RECREATE_OBJS == 0x00000020); - CLASSERT(OBD_FL_DEBUG_CHECK == 0x00000040); - CLASSERT(OBD_FL_NO_USRQUOTA == 0x00000100); - CLASSERT(OBD_FL_NO_GRPQUOTA == 0x00000200); - CLASSERT(OBD_FL_CREATE_CROW == 0x00000400); - CLASSERT(OBD_FL_SRVLOCK == 0x00000800); - CLASSERT(OBD_FL_CKSUM_CRC32 == 0x00001000); - CLASSERT(OBD_FL_CKSUM_ADLER == 0x00002000); - CLASSERT(OBD_FL_CKSUM_CRC32C == 0x00004000); - CLASSERT(OBD_FL_CKSUM_RSVD2 == 0x00008000); - CLASSERT(OBD_FL_CKSUM_RSVD3 == 0x00010000); - CLASSERT(OBD_FL_SHRINK_GRANT == 0x00020000); - CLASSERT(OBD_FL_MMAP == 0x00040000); - CLASSERT(OBD_FL_RECOV_RESEND == 0x00080000); - CLASSERT(OBD_FL_NOSPC_BLK == 0x00100000); - CLASSERT(OBD_FL_LOCAL_MASK == 0xf0000000); + BUILD_BUG_ON(OBD_FL_INLINEDATA != 0x00000001); + BUILD_BUG_ON(OBD_FL_OBDMDEXISTS != 0x00000002); + BUILD_BUG_ON(OBD_FL_DELORPHAN != 0x00000004); + BUILD_BUG_ON(OBD_FL_NORPC != 0x00000008); + BUILD_BUG_ON(OBD_FL_IDONLY != 0x00000010); + BUILD_BUG_ON(OBD_FL_RECREATE_OBJS != 0x00000020); + BUILD_BUG_ON(OBD_FL_DEBUG_CHECK != 0x00000040); + BUILD_BUG_ON(OBD_FL_NO_USRQUOTA != 0x00000100); + BUILD_BUG_ON(OBD_FL_NO_GRPQUOTA != 0x00000200); + BUILD_BUG_ON(OBD_FL_CREATE_CROW != 0x00000400); + BUILD_BUG_ON(OBD_FL_SRVLOCK != 0x00000800); + BUILD_BUG_ON(OBD_FL_CKSUM_CRC32 != 0x00001000); + BUILD_BUG_ON(OBD_FL_CKSUM_ADLER != 0x00002000); + BUILD_BUG_ON(OBD_FL_CKSUM_CRC32C != 0x00004000); + BUILD_BUG_ON(OBD_FL_CKSUM_RSVD2 != 0x00008000); + BUILD_BUG_ON(OBD_FL_CKSUM_RSVD3 != 0x00010000); + BUILD_BUG_ON(OBD_FL_SHRINK_GRANT != 0x00020000); + BUILD_BUG_ON(OBD_FL_MMAP != 0x00040000); + BUILD_BUG_ON(OBD_FL_RECOV_RESEND != 0x00080000); + BUILD_BUG_ON(OBD_FL_NOSPC_BLK != 0x00100000); + BUILD_BUG_ON(OBD_FL_LOCAL_MASK != 0xf0000000); /* Checks for struct lov_ost_data_v1 */ LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, "found %lld\n", @@ -1388,7 +1388,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects[0])); LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0]) == 24, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0])); - CLASSERT(LOV_MAGIC_V1 == (0x0BD10000 | 0x0BD0)); + BUILD_BUG_ON(LOV_MAGIC_V1 != (0x0BD10000 | 0x0BD0)); /* Checks for struct lov_mds_md_v3 */ LASSERTF((int)sizeof(struct lov_mds_md_v3) == 48, "found %lld\n", @@ -1417,7 +1417,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v3, lmm_layout_gen)); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen) == 2, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen)); - CLASSERT(LOV_MAXPOOLNAME == 15); + BUILD_BUG_ON(LOV_MAXPOOLNAME != 15); LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16]) == 48, "found %lld\n", (long long)(int)offsetof(struct lov_mds_md_v3, lmm_pool_name[16])); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_pool_name[16]) == 1, "found %lld\n", @@ -1426,7 +1426,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_mds_md_v3, lmm_objects[0])); LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_objects[0]) == 24, "found %lld\n", (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_objects[0])); - CLASSERT(LOV_MAGIC_V3 == (0x0BD30000 | 0x0BD0)); + BUILD_BUG_ON(LOV_MAGIC_V3 != (0x0BD30000 | 0x0BD0)); LASSERTF(LOV_PATTERN_RAID0 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned int)LOV_PATTERN_RAID0); LASSERTF(LOV_PATTERN_RAID1 == 0x00000002UL, "found 0x%.8xUL\n", @@ -1479,11 +1479,11 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_stripe_fids[0])); LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_stripe_fids[0]) == 16, "found %lld\n", (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_stripe_fids[0])); - CLASSERT(LMV_MAGIC_V1 == 0x0CD20CD0); - CLASSERT(LMV_MAGIC_STRIPE == 0x0CD40CD0); - CLASSERT(LMV_HASH_TYPE_MASK == 0x0000ffff); - CLASSERT(LMV_HASH_FLAG_MIGRATION == 0x80000000); - CLASSERT(LMV_HASH_FLAG_DEAD == 0x40000000); + BUILD_BUG_ON(LMV_MAGIC_V1 != 0x0CD20CD0); + BUILD_BUG_ON(LMV_MAGIC_STRIPE != 0x0CD40CD0); + BUILD_BUG_ON(LMV_HASH_TYPE_MASK != 0x0000ffff); + BUILD_BUG_ON(LMV_HASH_FLAG_MIGRATION != 0x80000000); + BUILD_BUG_ON(LMV_HASH_FLAG_DEAD != 0x40000000); /* Checks for struct obd_statfs */ LASSERTF((int)sizeof(struct obd_statfs) == 144, "found %lld\n", @@ -2761,12 +2761,12 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lov_desc, ld_uuid)); LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, "found %lld\n", (long long)(int)sizeof(((struct lov_desc *)0)->ld_uuid)); - CLASSERT(LOV_DESC_MAGIC == 0xB0CCDE5C); + BUILD_BUG_ON(LOV_DESC_MAGIC != 0xB0CCDE5C); /* Checks for struct ldlm_res_id */ LASSERTF((int)sizeof(struct ldlm_res_id) == 32, "found %lld\n", (long long)(int)sizeof(struct ldlm_res_id)); - CLASSERT(RES_NAME_SIZE == 4); + BUILD_BUG_ON(RES_NAME_SIZE != 4); LASSERTF((int)offsetof(struct ldlm_res_id, name[4]) == 32, "found %lld\n", (long long)(int)offsetof(struct ldlm_res_id, name[4])); LASSERTF((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8, "found %lld\n", @@ -3037,7 +3037,7 @@ void lustre_assert_wire_constants(void) /* Checks for struct mgs_send_param */ LASSERTF((int)sizeof(struct mgs_send_param) == 1024, "found %lld\n", (long long)(int)sizeof(struct mgs_send_param)); - CLASSERT(MGS_PARAM_MAXLEN == 1024); + BUILD_BUG_ON(MGS_PARAM_MAXLEN != 1024); LASSERTF((int)offsetof(struct mgs_send_param, mgs_param[1024]) == 1024, "found %lld\n", (long long)(int)offsetof(struct mgs_send_param, mgs_param[1024])); LASSERTF((int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024]) == 1, "found %lld\n", @@ -3090,16 +3090,16 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llog_logid, lgl_ogen)); LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n", (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen)); - CLASSERT(OST_SZ_REC == 274730752); - CLASSERT(MDS_UNLINK_REC == 274801668); - CLASSERT(MDS_UNLINK64_REC == 275325956); - CLASSERT(MDS_SETATTR64_REC == 275325953); - CLASSERT(OBD_CFG_REC == 274857984); - CLASSERT(LLOG_GEN_REC == 274989056); - CLASSERT(CHANGELOG_REC == 275120128); - CLASSERT(CHANGELOG_USER_REC == 275185664); - CLASSERT(LLOG_HDR_MAGIC == 275010873); - CLASSERT(LLOG_LOGID_MAGIC == 275010875); + BUILD_BUG_ON(OST_SZ_REC != 274730752); + BUILD_BUG_ON(MDS_UNLINK_REC != 274801668); + BUILD_BUG_ON(MDS_UNLINK64_REC != 275325956); + BUILD_BUG_ON(MDS_SETATTR64_REC != 275325953); + BUILD_BUG_ON(OBD_CFG_REC != 274857984); + BUILD_BUG_ON(LLOG_GEN_REC != 274989056); + BUILD_BUG_ON(CHANGELOG_REC != 275120128); + BUILD_BUG_ON(CHANGELOG_USER_REC != 275185664); + BUILD_BUG_ON(LLOG_HDR_MAGIC != 275010873); + BUILD_BUG_ON(LLOG_LOGID_MAGIC != 275010875); /* Checks for struct llog_catid */ LASSERTF((int)sizeof(struct llog_catid) == 32, "found %lld\n", @@ -3519,30 +3519,30 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct llogd_body, lgd_cur_offset)); LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8, "found %lld\n", (long long)(int)sizeof(((struct llogd_body *)0)->lgd_cur_offset)); - CLASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501); - CLASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502); - CLASSERT(LLOG_ORIGIN_HANDLE_READ_HEADER == 503); - CLASSERT(LLOG_ORIGIN_HANDLE_WRITE_REC == 504); - CLASSERT(LLOG_ORIGIN_HANDLE_CLOSE == 505); - CLASSERT(LLOG_ORIGIN_CONNECT == 506); - CLASSERT(LLOG_CATINFO == 507); - CLASSERT(LLOG_ORIGIN_HANDLE_PREV_BLOCK == 508); - CLASSERT(LLOG_ORIGIN_HANDLE_DESTROY == 509); - CLASSERT(LLOG_FIRST_OPC == 501); - CLASSERT(LLOG_LAST_OPC == 510); - CLASSERT(LLOG_CONFIG_ORIG_CTXT == 0); - CLASSERT(LLOG_CONFIG_REPL_CTXT == 1); - CLASSERT(LLOG_MDS_OST_ORIG_CTXT == 2); - CLASSERT(LLOG_MDS_OST_REPL_CTXT == 3); - CLASSERT(LLOG_SIZE_ORIG_CTXT == 4); - CLASSERT(LLOG_SIZE_REPL_CTXT == 5); - CLASSERT(LLOG_TEST_ORIG_CTXT == 8); - CLASSERT(LLOG_TEST_REPL_CTXT == 9); - CLASSERT(LLOG_CHANGELOG_ORIG_CTXT == 12); - CLASSERT(LLOG_CHANGELOG_REPL_CTXT == 13); - CLASSERT(LLOG_CHANGELOG_USER_ORIG_CTXT == 14); - CLASSERT(LLOG_AGENT_ORIG_CTXT == 15); - CLASSERT(LLOG_MAX_CTXTS == 16); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_CREATE != 501); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_NEXT_BLOCK != 502); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_READ_HEADER != 503); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_WRITE_REC != 504); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_CLOSE != 505); + BUILD_BUG_ON(LLOG_ORIGIN_CONNECT != 506); + BUILD_BUG_ON(LLOG_CATINFO != 507); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_PREV_BLOCK != 508); + BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_DESTROY != 509); + BUILD_BUG_ON(LLOG_FIRST_OPC != 501); + BUILD_BUG_ON(LLOG_LAST_OPC != 510); + BUILD_BUG_ON(LLOG_CONFIG_ORIG_CTXT != 0); + BUILD_BUG_ON(LLOG_CONFIG_REPL_CTXT != 1); + BUILD_BUG_ON(LLOG_MDS_OST_ORIG_CTXT != 2); + BUILD_BUG_ON(LLOG_MDS_OST_REPL_CTXT != 3); + BUILD_BUG_ON(LLOG_SIZE_ORIG_CTXT != 4); + BUILD_BUG_ON(LLOG_SIZE_REPL_CTXT != 5); + BUILD_BUG_ON(LLOG_TEST_ORIG_CTXT != 8); + BUILD_BUG_ON(LLOG_TEST_REPL_CTXT != 9); + BUILD_BUG_ON(LLOG_CHANGELOG_ORIG_CTXT != 12); + BUILD_BUG_ON(LLOG_CHANGELOG_REPL_CTXT != 13); + BUILD_BUG_ON(LLOG_CHANGELOG_USER_ORIG_CTXT != 14); + BUILD_BUG_ON(LLOG_AGENT_ORIG_CTXT != 15); + BUILD_BUG_ON(LLOG_MAX_CTXTS != 16); /* Checks for struct llogd_conn_body */ LASSERTF((int)sizeof(struct llogd_conn_body) == 40, "found %lld\n", @@ -3659,7 +3659,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lustre_capa, lc_expiry)); LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_expiry) == 4, "found %lld\n", (long long)(int)sizeof(((struct lustre_capa *)0)->lc_expiry)); - CLASSERT(CAPA_HMAC_MAX_LEN == 64); + BUILD_BUG_ON(CAPA_HMAC_MAX_LEN != 64); LASSERTF((int)offsetof(struct lustre_capa, lc_hmac[64]) == 120, "found %lld\n", (long long)(int)offsetof(struct lustre_capa, lc_hmac[64])); LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_hmac[64]) == 1, "found %lld\n", @@ -3680,7 +3680,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct lustre_capa_key, lk_padding)); LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_padding) == 4, "found %lld\n", (long long)(int)sizeof(((struct lustre_capa_key *)0)->lk_padding)); - CLASSERT(CAPA_HMAC_KEY_MAX_LEN == 56); + BUILD_BUG_ON(CAPA_HMAC_KEY_MAX_LEN != 56); LASSERTF((int)offsetof(struct lustre_capa_key, lk_key[56]) == 72, "found %lld\n", (long long)(int)offsetof(struct lustre_capa_key, lk_key[56])); LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_key[56]) == 1, "found %lld\n", @@ -3741,9 +3741,9 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct fiemap, fm_extents)); LASSERTF((int)sizeof(((struct fiemap *)0)->fm_extents) == 0, "found %lld\n", (long long)(int)sizeof(((struct fiemap *)0)->fm_extents)); - CLASSERT(FIEMAP_FLAG_SYNC == 0x00000001); - CLASSERT(FIEMAP_FLAG_XATTR == 0x00000002); - CLASSERT(FIEMAP_FLAG_DEVICE_ORDER == 0x40000000); + BUILD_BUG_ON(FIEMAP_FLAG_SYNC != 0x00000001); + BUILD_BUG_ON(FIEMAP_FLAG_XATTR != 0x00000002); + BUILD_BUG_ON(FIEMAP_FLAG_DEVICE_ORDER != 0x40000000); /* Checks for struct fiemap_extent */ LASSERTF((int)sizeof(struct fiemap_extent) == 56, "found %lld\n", @@ -3768,18 +3768,18 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct fiemap_extent, fe_reserved[0])); LASSERTF((int)sizeof(((struct fiemap_extent *)0)->fe_reserved[0]) == 4, "found %lld\n", (long long)(int)sizeof(((struct fiemap_extent *)0)->fe_reserved[0])); - CLASSERT(FIEMAP_EXTENT_LAST == 0x00000001); - CLASSERT(FIEMAP_EXTENT_UNKNOWN == 0x00000002); - CLASSERT(FIEMAP_EXTENT_DELALLOC == 0x00000004); - CLASSERT(FIEMAP_EXTENT_ENCODED == 0x00000008); - CLASSERT(FIEMAP_EXTENT_DATA_ENCRYPTED == 0x00000080); - CLASSERT(FIEMAP_EXTENT_NOT_ALIGNED == 0x00000100); - CLASSERT(FIEMAP_EXTENT_DATA_INLINE == 0x00000200); - CLASSERT(FIEMAP_EXTENT_DATA_TAIL == 0x00000400); - CLASSERT(FIEMAP_EXTENT_UNWRITTEN == 0x00000800); - CLASSERT(FIEMAP_EXTENT_MERGED == 0x00001000); - CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000); - CLASSERT(FIEMAP_EXTENT_NET == 0x80000000); + BUILD_BUG_ON(FIEMAP_EXTENT_LAST != 0x00000001); + BUILD_BUG_ON(FIEMAP_EXTENT_UNKNOWN != 0x00000002); + BUILD_BUG_ON(FIEMAP_EXTENT_DELALLOC != 0x00000004); + BUILD_BUG_ON(FIEMAP_EXTENT_ENCODED != 0x00000008); + BUILD_BUG_ON(FIEMAP_EXTENT_DATA_ENCRYPTED != 0x00000080); + BUILD_BUG_ON(FIEMAP_EXTENT_NOT_ALIGNED != 0x00000100); + BUILD_BUG_ON(FIEMAP_EXTENT_DATA_INLINE != 0x00000200); + BUILD_BUG_ON(FIEMAP_EXTENT_DATA_TAIL != 0x00000400); + BUILD_BUG_ON(FIEMAP_EXTENT_UNWRITTEN != 0x00000800); + BUILD_BUG_ON(FIEMAP_EXTENT_MERGED != 0x00001000); + BUILD_BUG_ON(FIEMAP_EXTENT_NO_DIRECT != 0x40000000); + BUILD_BUG_ON(FIEMAP_EXTENT_NET != 0x80000000); /* Checks for type posix_acl_xattr_entry */ LASSERTF((int)sizeof(struct posix_acl_xattr_entry) == 8, "found %lld\n", @@ -3828,7 +3828,7 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct link_ea_header, padding2)); LASSERTF((int)sizeof(((struct link_ea_header *)0)->padding2) == 4, "found %lld\n", (long long)(int)sizeof(((struct link_ea_header *)0)->padding2)); - CLASSERT(LINK_EA_MAGIC == 0x11EAF1DFUL); + BUILD_BUG_ON(LINK_EA_MAGIC != 0x11EAF1DFUL); /* Checks for struct link_ea_entry */ LASSERTF((int)sizeof(struct link_ea_entry) == 18, "found %lld\n", |