X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Flnet%2Fnet_fault.c;h=3911c960a126629bb2bc7e86f88e6d47312ec1c9;hp=4f1bc3080c3df78ca97f59147db07ae5500d1ca9;hb=41356014f614ce7c3d235163cfab594e1b53b45d;hpb=7a707d4828807b45aeca368e707c243ba68fa51f diff --git a/lnet/lnet/net_fault.c b/lnet/lnet/net_fault.c index 4f1bc30..3911c96 100644 --- a/lnet/lnet/net_fault.c +++ b/lnet/lnet/net_fault.c @@ -88,7 +88,7 @@ lnet_fault_attr_match(struct lnet_fault_attr *attr, lnet_nid_t src, !lnet_fault_nid_match(attr->fa_local_nid, local_nid)) return false; - if (!(attr->fa_msg_mask & (1 << type))) + if (!(attr->fa_msg_mask & BIT(type))) return false; /* NB: ACK and REPLY have no portal, but they should have been @@ -202,12 +202,10 @@ lnet_drop_rule_del(lnet_nid_t src, lnet_nid_t dst) { struct lnet_drop_rule *rule; struct lnet_drop_rule *tmp; - struct list_head zombies; - int n = 0; + LIST_HEAD(zombies); + int n = 0; ENTRY; - INIT_LIST_HEAD(&zombies); - lnet_net_lock(LNET_LOCK_EX); list_for_each_entry_safe(rule, tmp, &the_lnet.ln_drop_rules, dr_link) { if (rule->dr_attr.fa_src != src && src != 0) @@ -315,7 +313,7 @@ lnet_fault_match_health(enum lnet_msg_hstatus *hstatus, __u32 mask) return; } - if (mask & (1 << choice)) { + if (mask & BIT(choice)) { *hstatus = choice; return; } @@ -324,7 +322,7 @@ lnet_fault_match_health(enum lnet_msg_hstatus *hstatus, __u32 mask) i = HSTATUS_END; best_delta = HSTATUS_END; while (i > 0) { - if (mask & (1 << i)) { + if (mask & BIT(i)) { delta = choice - i; if (delta < 0) delta *= -1; @@ -487,8 +485,8 @@ struct lnet_delay_rule { time64_t dl_delay_time; /** baseline to caculate dl_delay_time */ time64_t dl_time_base; - /** jiffies to send the next delayed message */ - unsigned long dl_msg_send; + /** seconds until we send the next delayed message */ + time64_t dl_msg_send; /** delayed message list */ struct list_head dl_msg_list; /** statistic of delayed messages */ @@ -593,7 +591,8 @@ delay_rule_match(struct lnet_delay_rule *rule, lnet_nid_t src, msg->msg_delay_send = ktime_get_seconds() + attr->u.delay.la_latency; if (rule->dl_msg_send == -1) { rule->dl_msg_send = msg->msg_delay_send; - mod_timer(&rule->dl_timer, rule->dl_msg_send); + mod_timer(&rule->dl_timer, + jiffies + cfs_time_seconds(rule->dl_msg_send)); } spin_unlock(&rule->dl_lock); @@ -661,7 +660,8 @@ delayed_msg_check(struct lnet_delay_rule *rule, bool all, msg = list_entry(rule->dl_msg_list.next, struct lnet_msg, msg_list); rule->dl_msg_send = msg->msg_delay_send; - mod_timer(&rule->dl_timer, rule->dl_msg_send); + mod_timer(&rule->dl_timer, + jiffies + cfs_time_seconds(rule->dl_msg_send)); } spin_unlock(&rule->dl_lock); } @@ -701,6 +701,7 @@ delayed_msg_process(struct list_head *msg_list, bool drop) case LNET_CREDIT_OK: lnet_ni_recv(ni, msg->msg_private, msg, 0, 0, msg->msg_len, msg->msg_len); + /* fallthrough */ case LNET_CREDIT_WAIT: continue; default: /* failures */ @@ -721,10 +722,9 @@ delayed_msg_process(struct list_head *msg_list, bool drop) void lnet_delay_rule_check(void) { - struct lnet_delay_rule *rule; - struct list_head msgs; + struct lnet_delay_rule *rule; + LIST_HEAD(msgs); - INIT_LIST_HEAD(&msgs); while (1) { if (list_empty(&delay_dd.dd_sched_rules)) break; @@ -886,16 +886,13 @@ int lnet_delay_rule_del(lnet_nid_t src, lnet_nid_t dst, bool shutdown) { struct lnet_delay_rule *rule; - struct lnet_delay_rule *tmp; - struct list_head rule_list; - struct list_head msg_list; - int n = 0; - bool cleanup; + struct lnet_delay_rule *tmp; + LIST_HEAD(rule_list); + LIST_HEAD(msg_list); + int n = 0; + bool cleanup; ENTRY; - INIT_LIST_HEAD(&rule_list); - INIT_LIST_HEAD(&msg_list); - if (shutdown) src = dst = 0; @@ -1078,10 +1075,10 @@ lnet_fault_ctl(int opc, struct libcfs_ioctl_data *data) int lnet_fault_init(void) { - CLASSERT(LNET_PUT_BIT == 1 << LNET_MSG_PUT); - CLASSERT(LNET_ACK_BIT == 1 << LNET_MSG_ACK); - CLASSERT(LNET_GET_BIT == 1 << LNET_MSG_GET); - CLASSERT(LNET_REPLY_BIT == 1 << LNET_MSG_REPLY); + BUILD_BUG_ON(LNET_PUT_BIT != BIT(LNET_MSG_PUT)); + BUILD_BUG_ON(LNET_ACK_BIT != BIT(LNET_MSG_ACK)); + BUILD_BUG_ON(LNET_GET_BIT != BIT(LNET_MSG_GET)); + BUILD_BUG_ON(LNET_REPLY_BIT != BIT(LNET_MSG_REPLY)); mutex_init(&delay_dd.dd_mutex); spin_lock_init(&delay_dd.dd_lock);