From joe at perches.com Fri Apr 1 13:02:08 2016 From: joe at perches.com (Joe Perches) Date: Fri, 1 Apr 2016 06:02:08 -0700 Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef Message-ID: Question about removing lustre typedefs. Various bits of lustre code use a mix of struct foo and foo_t. When would be an appropriate time to submit patches similar to below that individually remove various typedefs from lustre code? These are pretty trivial to produce and verify so there's no particular hurry to do them now but applying them will require resync points for active and actually useful developers. A few scripted examples are done: Joe Perches (3): staging: lustre: Remove typedef lnet_peer_t staging: lustre: Remove typedef lnd_t staging: lustre: Remove typedef lnet_msg_t .../staging/lustre/include/linux/lnet/lib-lnet.h | 62 +++++++-------- .../staging/lustre/include/linux/lnet/lib-types.h | 22 +++--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 6 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 16 ++-- drivers/staging/lustre/lnet/lnet/lib-move.c | 92 +++++++++++----------- drivers/staging/lustre/lnet/lnet/lib-msg.c | 24 +++--- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 4 +- drivers/staging/lustre/lnet/lnet/lo.c | 8 +- drivers/staging/lustre/lnet/lnet/peer.c | 30 +++---- drivers/staging/lustre/lnet/lnet/router.c | 28 +++---- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 +- 16 files changed, 161 insertions(+), 161 deletions(-) -- 2.8.0.rc4.16.g56331f8 From joe at perches.com Fri Apr 1 13:02:09 2016 From: joe at perches.com (Joe Perches) Date: Fri, 1 Apr 2016 06:02:09 -0700 Subject: [lustre-devel] [RFC PATCH 1/3] staging: lustre: Remove typedef lnet_peer_t In-Reply-To: References: Message-ID: <1c948ef81164fb57e45e2467abd3fd013b2c9068.1459515208.git.joe@perches.com> Just use struct lnet_peer instead. Signed-off-by: Joe Perches --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 18 ++++++------- .../staging/lustre/include/linux/lnet/lib-types.h | 6 ++--- drivers/staging/lustre/lnet/lnet/lib-move.c | 20 +++++++-------- drivers/staging/lustre/lnet/lnet/peer.c | 30 +++++++++++----------- drivers/staging/lustre/lnet/lnet/router.c | 28 ++++++++++---------- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 +-- 6 files changed, 53 insertions(+), 53 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index dfc0208..ea29cb9 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -364,16 +364,16 @@ lnet_handle2me(lnet_handle_me_t *handle) } static inline void -lnet_peer_addref_locked(lnet_peer_t *lp) +lnet_peer_addref_locked(struct lnet_peer *lp) { LASSERT(lp->lp_refcount > 0); lp->lp_refcount++; } -void lnet_destroy_peer_locked(lnet_peer_t *lp); +void lnet_destroy_peer_locked(struct lnet_peer *lp); static inline void -lnet_peer_decref_locked(lnet_peer_t *lp) +lnet_peer_decref_locked(struct lnet_peer *lp) { LASSERT(lp->lp_refcount > 0); lp->lp_refcount--; @@ -382,7 +382,7 @@ lnet_peer_decref_locked(lnet_peer_t *lp) } static inline int -lnet_isrouter(lnet_peer_t *lp) +lnet_isrouter(struct lnet_peer *lp) { return lp->lp_rtr_refcount ? 1 : 0; } @@ -454,7 +454,7 @@ int lnet_lib_init(void); void lnet_lib_exit(void); int lnet_notify(lnet_ni_t *ni, lnet_nid_t peer, int alive, unsigned long when); -void lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, +void lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive, unsigned long when); int lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway_nid, unsigned int priority); @@ -721,7 +721,7 @@ int lnet_peer_buffer_credits(lnet_ni_t *ni); int lnet_router_checker_start(void); void lnet_router_checker_stop(void); -void lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net); +void lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net); void lnet_swap_pinginfo(lnet_ping_info_t *info); int lnet_parse_ip2nets(char **networksp, char *ip2nets); @@ -729,8 +729,8 @@ int lnet_parse_routes(char *route_str, int *im_a_router); int lnet_parse_networks(struct list_head *nilist, char *networks); int lnet_net_unique(__u32 net, struct list_head *nilist); -int lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt); -lnet_peer_t *lnet_find_peer_locked(struct lnet_peer_table *ptable, +int lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt); +struct lnet_peer *lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid); void lnet_peer_tables_cleanup(lnet_ni_t *ni); void lnet_peer_tables_destroy(void); @@ -744,7 +744,7 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_tx_qnob); static inline void -lnet_peer_set_alive(lnet_peer_t *lp) +lnet_peer_set_alive(struct lnet_peer *lp) { lp->lp_last_query = jiffies; lp->lp_last_alive = jiffies; diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 29c72f8..d223de5 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -302,7 +302,7 @@ typedef struct { lnet_ping_info_t *rcd_pinginfo; /* ping buffer */ } lnet_rc_data_t; -typedef struct lnet_peer { +struct lnet_peer { struct list_head lp_hashlist; /* chain on peer hash */ struct list_head lp_txq; /* messages blocking for tx credits */ @@ -343,7 +343,7 @@ typedef struct lnet_peer { unsigned int lp_ping_feats; struct list_head lp_routes; /* routers on this peer */ lnet_rc_data_t *lp_rcd; /* router checker state */ -} lnet_peer_t; +}; /* peer hash size */ #define LNET_PEER_HASH_BITS 9 @@ -369,7 +369,7 @@ struct lnet_peer_table { typedef struct { struct list_head lr_list; /* chain on net */ struct list_head lr_gwlist; /* chain on gateway */ - lnet_peer_t *lr_gateway; /* router node */ + struct lnet_peer *lr_gateway; /* router node */ __u32 lr_net; /* remote network number */ int lr_seq; /* sequence for round-robin */ unsigned int lr_downis; /* number of down NIs */ diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 44e2bd6..4ebf1b4 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -684,7 +684,7 @@ lnet_ni_eager_recv(lnet_ni_t *ni, lnet_msg_t *msg) /* NB: caller shall hold a ref on 'lp' as I'd drop lnet_net_lock */ static void -lnet_ni_query_locked(lnet_ni_t *ni, lnet_peer_t *lp) +lnet_ni_query_locked(lnet_ni_t *ni, struct lnet_peer *lp) { unsigned long last_alive = 0; @@ -703,7 +703,7 @@ lnet_ni_query_locked(lnet_ni_t *ni, lnet_peer_t *lp) /* NB: always called with lnet_net_lock held */ static inline int -lnet_peer_is_alive(lnet_peer_t *lp, unsigned long now) +lnet_peer_is_alive(struct lnet_peer *lp, unsigned long now) { int alive; unsigned long deadline; @@ -737,7 +737,7 @@ lnet_peer_is_alive(lnet_peer_t *lp, unsigned long now) * may drop the lnet_net_lock */ static int -lnet_peer_alive_locked(lnet_peer_t *lp) +lnet_peer_alive_locked(struct lnet_peer *lp) { unsigned long now = cfs_time_current(); @@ -793,7 +793,7 @@ lnet_peer_alive_locked(lnet_peer_t *lp) static int lnet_post_send_locked(lnet_msg_t *msg, int do_send) { - lnet_peer_t *lp = msg->msg_txpeer; + struct lnet_peer *lp = msg->msg_txpeer; lnet_ni_t *ni = lp->lp_ni; int cpt = msg->msg_tx_cpt; struct lnet_tx_queue *tq = ni->ni_tx_queues[cpt]; @@ -904,7 +904,7 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv) * I return LNET_CREDIT_WAIT if msg blocked and LNET_CREDIT_OK if * received or OK to receive */ - lnet_peer_t *lp = msg->msg_rxpeer; + struct lnet_peer *lp = msg->msg_rxpeer; lnet_rtrbufpool_t *rbp; lnet_rtrbuf_t *rb; @@ -974,7 +974,7 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv) void lnet_return_tx_credits_locked(lnet_msg_t *msg) { - lnet_peer_t *txpeer = msg->msg_txpeer; + struct lnet_peer *txpeer = msg->msg_txpeer; lnet_msg_t *msg2; if (msg->msg_txcredit) { @@ -1069,7 +1069,7 @@ lnet_drop_routed_msgs_locked(struct list_head *list, int cpt) void lnet_return_rx_credits_locked(lnet_msg_t *msg) { - lnet_peer_t *rxpeer = msg->msg_rxpeer; + struct lnet_peer *rxpeer = msg->msg_rxpeer; lnet_msg_t *msg2; if (msg->msg_rtrcredit) { @@ -1154,8 +1154,8 @@ routing_off: static int lnet_compare_routes(lnet_route_t *r1, lnet_route_t *r2) { - lnet_peer_t *p1 = r1->lr_gateway; - lnet_peer_t *p2 = r2->lr_gateway; + struct lnet_peer *p1 = r1->lr_gateway; + struct lnet_peer *p2 = r2->lr_gateway; int r1_hops = (r1->lr_hops == LNET_UNDEFINED_HOPS) ? 1 : r1->lr_hops; int r2_hops = (r2->lr_hops == LNET_UNDEFINED_HOPS) ? 1 : r2->lr_hops; @@ -1189,7 +1189,7 @@ lnet_compare_routes(lnet_route_t *r1, lnet_route_t *r2) return -ERANGE; } -static lnet_peer_t * +static struct lnet_peer * lnet_find_route_locked(lnet_ni_t *ni, lnet_nid_t target, lnet_nid_t rtr_nid) { lnet_remotenet_t *rnet; diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c index b026fee..3bb4142 100644 --- a/drivers/staging/lustre/lnet/lnet/peer.c +++ b/drivers/staging/lustre/lnet/lnet/peer.c @@ -108,8 +108,8 @@ static void lnet_peer_table_cleanup_locked(lnet_ni_t *ni, struct lnet_peer_table *ptable) { int i; - lnet_peer_t *lp; - lnet_peer_t *tmp; + struct lnet_peer *lp; + struct lnet_peer *tmp; for (i = 0; i < LNET_PEER_HASH_SIZE; i++) { list_for_each_entry_safe(lp, tmp, &ptable->pt_hash[i], @@ -148,8 +148,8 @@ static void lnet_peer_table_del_rtrs_locked(lnet_ni_t *ni, struct lnet_peer_table *ptable, int cpt_locked) { - lnet_peer_t *lp; - lnet_peer_t *tmp; + struct lnet_peer *lp; + struct lnet_peer *tmp; lnet_nid_t lp_nid; int i; @@ -176,8 +176,8 @@ lnet_peer_tables_cleanup(lnet_ni_t *ni) { struct lnet_peer_table *ptable; struct list_head deathrow; - lnet_peer_t *lp; - lnet_peer_t *temp; + struct lnet_peer *lp; + struct lnet_peer *temp; int i; INIT_LIST_HEAD(&deathrow); @@ -218,7 +218,7 @@ lnet_peer_tables_cleanup(lnet_ni_t *ni) } void -lnet_destroy_peer_locked(lnet_peer_t *lp) +lnet_destroy_peer_locked(struct lnet_peer *lp) { struct lnet_peer_table *ptable; @@ -240,11 +240,11 @@ lnet_destroy_peer_locked(lnet_peer_t *lp) ptable->pt_zombies--; } -lnet_peer_t * +struct lnet_peer * lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) { struct list_head *peers; - lnet_peer_t *lp; + struct lnet_peer *lp; LASSERT(!the_lnet.ln_shutdown); @@ -260,11 +260,11 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) } int -lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt) +lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt) { struct lnet_peer_table *ptable; - lnet_peer_t *lp = NULL; - lnet_peer_t *lp2; + struct lnet_peer *lp = NULL; + struct lnet_peer *lp2; int cpt2; int rc = 0; @@ -284,7 +284,7 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt) if (!list_empty(&ptable->pt_deathrow)) { lp = list_entry(ptable->pt_deathrow.next, - lnet_peer_t, lp_hashlist); + struct lnet_peer, lp_hashlist); list_del(&lp->lp_hashlist); } @@ -366,7 +366,7 @@ void lnet_debug_peer(lnet_nid_t nid) { char *aliveness = "NA"; - lnet_peer_t *lp; + struct lnet_peer *lp; int rc; int cpt; @@ -403,7 +403,7 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_tx_qnob) { struct lnet_peer_table *peer_table; - lnet_peer_t *lp; + struct lnet_peer *lp; bool found = false; int lncpt, j; diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 61459cf..3506cd47 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -97,7 +97,7 @@ lnet_peers_start_down(void) } void -lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, +lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive, unsigned long when) { if (time_before(when, lp->lp_timestamp)) { /* out of date information */ @@ -127,7 +127,7 @@ lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, } static void -lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp) +lnet_ni_notify_locked(lnet_ni_t *ni, struct lnet_peer *lp) { int alive; int notifylnd; @@ -166,7 +166,7 @@ lnet_ni_notify_locked(lnet_ni_t *ni, lnet_peer_t *lp) } static void -lnet_rtr_addref_locked(lnet_peer_t *lp) +lnet_rtr_addref_locked(struct lnet_peer *lp) { LASSERT(lp->lp_refcount > 0); LASSERT(lp->lp_rtr_refcount >= 0); @@ -178,7 +178,7 @@ lnet_rtr_addref_locked(lnet_peer_t *lp) /* a simple insertion sort */ list_for_each_prev(pos, &the_lnet.ln_routers) { - lnet_peer_t *rtr = list_entry(pos, lnet_peer_t, + struct lnet_peer *rtr = list_entry(pos, struct lnet_peer, lp_rtr_list); if (rtr->lp_nid < lp->lp_nid) @@ -193,7 +193,7 @@ lnet_rtr_addref_locked(lnet_peer_t *lp) } static void -lnet_rtr_decref_locked(lnet_peer_t *lp) +lnet_rtr_decref_locked(struct lnet_peer *lp) { LASSERT(lp->lp_refcount > 0); LASSERT(lp->lp_rtr_refcount > 0); @@ -790,7 +790,7 @@ lnet_router_checker_event(lnet_event_t *event) static void lnet_wait_known_routerstate(void) { - lnet_peer_t *rtr; + struct lnet_peer *rtr; struct list_head *entry; int all_known; @@ -801,7 +801,7 @@ lnet_wait_known_routerstate(void) all_known = 1; list_for_each(entry, &the_lnet.ln_routers) { - rtr = list_entry(entry, lnet_peer_t, lp_rtr_list); + rtr = list_entry(entry, struct lnet_peer, lp_rtr_list); if (!rtr->lp_alive_count) { all_known = 0; @@ -820,7 +820,7 @@ lnet_wait_known_routerstate(void) } void -lnet_router_ni_update_locked(lnet_peer_t *gw, __u32 net) +lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net) { lnet_route_t *rte; @@ -898,7 +898,7 @@ lnet_destroy_rc_data(lnet_rc_data_t *rcd) } static lnet_rc_data_t * -lnet_create_rc_data_locked(lnet_peer_t *gateway) +lnet_create_rc_data_locked(struct lnet_peer *gateway) { lnet_rc_data_t *rcd = NULL; lnet_ping_info_t *pi; @@ -967,7 +967,7 @@ lnet_create_rc_data_locked(lnet_peer_t *gateway) } static int -lnet_router_check_interval(lnet_peer_t *rtr) +lnet_router_check_interval(struct lnet_peer *rtr) { int secs; @@ -980,7 +980,7 @@ lnet_router_check_interval(lnet_peer_t *rtr) } static void -lnet_ping_router_locked(lnet_peer_t *rtr) +lnet_ping_router_locked(struct lnet_peer *rtr) { lnet_rc_data_t *rcd = NULL; unsigned long now = cfs_time_current(); @@ -1124,7 +1124,7 @@ lnet_prune_rc_data(int wait_unlink) { lnet_rc_data_t *rcd; lnet_rc_data_t *tmp; - lnet_peer_t *lp; + struct lnet_peer *lp; struct list_head head; int i = 2; @@ -1230,7 +1230,7 @@ lnet_router_checker_active(void) static int lnet_router_checker(void *arg) { - lnet_peer_t *rtr; + struct lnet_peer *rtr; struct list_head *entry; cfs_block_allsigs(); @@ -1245,7 +1245,7 @@ rescan: version = the_lnet.ln_routers_version; list_for_each(entry, &the_lnet.ln_routers) { - rtr = list_entry(entry, lnet_peer_t, lp_rtr_list); + rtr = list_entry(entry, struct lnet_peer, lp_rtr_list); cpt2 = lnet_cpt_of_nid_locked(rtr->lp_nid); if (cpt != cpt2) { diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index 65f65a3..2d10238 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -307,7 +307,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, r = the_lnet.ln_routers.next; while (r != &the_lnet.ln_routers) { - lnet_peer_t *lp = list_entry(r, lnet_peer_t, + struct lnet_peer *lp = list_entry(r, struct lnet_peer, lp_rtr_list); if (!skip) { @@ -454,7 +454,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write, p = ptable->pt_hash[hash].next; while (p != &ptable->pt_hash[hash]) { - lnet_peer_t *lp = list_entry(p, lnet_peer_t, + struct lnet_peer *lp = list_entry(p, struct lnet_peer, lp_hashlist); if (!skip) { peer = lp; -- 2.8.0.rc4.16.g56331f8 From joe at perches.com Fri Apr 1 13:02:10 2016 From: joe at perches.com (Joe Perches) Date: Fri, 1 Apr 2016 06:02:10 -0700 Subject: [lustre-devel] [RFC PATCH 2/3] staging: lustre: Remove typedef lnd_t In-Reply-To: References: Message-ID: <314e44c510821a87827ccc248e64a70a0da260ce.1459515208.git.joe@perches.com> Just use struct lnet_lnd instead. Signed-off-by: Joe Perches --- drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 6 +++--- drivers/staging/lustre/include/linux/lnet/lib-types.h | 6 +++--- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 ++-- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 14 +++++++------- drivers/staging/lustre/lnet/lnet/lo.c | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index ea29cb9..2390d94 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -439,7 +439,7 @@ lnet_net2rnethash(__u32 net) ((1U << the_lnet.ln_remote_nets_hbits) - 1)]; } -extern lnd_t the_lolnd; +extern struct lnet_lnd the_lolnd; extern int avoid_asym_router_failure; int lnet_cpt_of_nid_locked(lnet_nid_t nid); @@ -683,8 +683,8 @@ void lnet_me_unlink(lnet_me_t *me); void lnet_md_unlink(lnet_libmd_t *md); void lnet_md_deconstruct(lnet_libmd_t *lmd, lnet_md_t *umd); -void lnet_register_lnd(lnd_t *lnd); -void lnet_unregister_lnd(lnd_t *lnd); +void lnet_register_lnd(struct lnet_lnd *lnd); +void lnet_unregister_lnd(struct lnet_lnd *lnd); int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, __u32 local_ip, __u32 peer_ip, int peer_port); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index d223de5..62baaca 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -178,7 +178,7 @@ typedef struct { struct lnet_ni; /* forward ref */ -typedef struct lnet_lnd { +struct lnet_lnd { /* fields managed by portals */ struct list_head lnd_list; /* stash in the LND table */ int lnd_refcount; /* # active instances */ @@ -244,7 +244,7 @@ typedef struct lnet_lnd { /* accept a new connection */ int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock); -} lnd_t; +}; struct lnet_tx_queue { int tq_credits; /* # tx credits free */ @@ -268,7 +268,7 @@ typedef struct lnet_ni { __u32 *ni_cpts; /* bond NI on some CPTs */ lnet_nid_t ni_nid; /* interface's NID */ void *ni_data; /* instance-specific data */ - lnd_t *ni_lnd; /* procedural interface */ + struct lnet_lnd *ni_lnd; /* procedural interface */ struct lnet_tx_queue **ni_tx_queues; /* percpt TX queues */ int **ni_refs; /* percpt reference count */ time64_t ni_last_alive;/* when I was last alive */ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index e89c2a1..3e3d92c 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -42,7 +42,7 @@ #include #include "o2iblnd.h" -static lnd_t the_o2iblnd; +static struct lnet_lnd the_o2iblnd; kib_data_t kiblnd_data; @@ -2770,7 +2770,7 @@ net_failed: return -ENETDOWN; } -static lnd_t the_o2iblnd = { +static struct lnet_lnd the_o2iblnd = { .lnd_type = O2IBLND, .lnd_startup = kiblnd_startup, .lnd_shutdown = kiblnd_shutdown, diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 406c0e7..3cfdc17 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -43,7 +43,7 @@ #include "socklnd.h" -static lnd_t the_ksocklnd; +static struct lnet_lnd the_ksocklnd; ksock_nal_data_t ksocknal_data; static ksock_interface_t * diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index f825784..19ad5a3 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -269,15 +269,15 @@ static void lnet_assert_wire_constants(void) CLASSERT((int)sizeof(((lnet_hdr_t *)0)->msg.hello.type) == 4); } -static lnd_t * +static struct lnet_lnd * lnet_find_lnd_by_type(__u32 type) { - lnd_t *lnd; + struct lnet_lnd *lnd; struct list_head *tmp; /* holding lnd mutex */ list_for_each(tmp, &the_lnet.ln_lnds) { - lnd = list_entry(tmp, lnd_t, lnd_list); + lnd = list_entry(tmp, struct lnet_lnd, lnd_list); if (lnd->lnd_type == type) return lnd; @@ -287,7 +287,7 @@ lnet_find_lnd_by_type(__u32 type) } void -lnet_register_lnd(lnd_t *lnd) +lnet_register_lnd(struct lnet_lnd *lnd) { mutex_lock(&the_lnet.ln_lnd_mutex); @@ -304,7 +304,7 @@ lnet_register_lnd(lnd_t *lnd) EXPORT_SYMBOL(lnet_register_lnd); void -lnet_unregister_lnd(lnd_t *lnd) +lnet_unregister_lnd(struct lnet_lnd *lnd) { mutex_lock(&the_lnet.ln_lnd_mutex); @@ -1220,7 +1220,7 @@ lnet_startup_lndni(struct lnet_ni *ni, __s32 peer_timeout, { int rc = -EINVAL; int lnd_type; - lnd_t *lnd; + struct lnet_lnd *lnd; struct lnet_tx_queue *tq; int i; @@ -1460,7 +1460,7 @@ void lnet_lib_exit(void) while (!list_empty(&the_lnet.ln_lnds)) lnet_unregister_lnd(list_entry(the_lnet.ln_lnds.next, - lnd_t, lnd_list)); + struct lnet_lnd, lnd_list)); lnet_destroy_locks(); } diff --git a/drivers/staging/lustre/lnet/lnet/lo.c b/drivers/staging/lustre/lnet/lnet/lo.c index 468eda6..2216301 100644 --- a/drivers/staging/lustre/lnet/lnet/lo.c +++ b/drivers/staging/lustre/lnet/lnet/lo.c @@ -105,7 +105,7 @@ lolnd_startup(lnet_ni_t *ni) return 0; } -lnd_t the_lolnd = { +struct lnet_lnd the_lolnd = { /* .lnd_list = */ {&the_lolnd.lnd_list, &the_lolnd.lnd_list}, /* .lnd_refcount = */ 0, /* .lnd_type = */ LOLND, -- 2.8.0.rc4.16.g56331f8 From joe at perches.com Fri Apr 1 13:02:11 2016 From: joe at perches.com (Joe Perches) Date: Fri, 1 Apr 2016 06:02:11 -0700 Subject: [lustre-devel] [RFC PATCH 3/3] staging: lustre: Remove typedef lnet_msg_t In-Reply-To: References: Message-ID: <4e5c312f7bd010cbca483583cdff090c387df465.1459515208.git.joe@perches.com> Just use struct lnet_msg instead. Signed-off-by: Joe Perches --- .../staging/lustre/include/linux/lnet/lib-lnet.h | 38 ++++++------ .../staging/lustre/include/linux/lnet/lib-types.h | 10 +-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 +-- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 6 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 72 +++++++++++----------- drivers/staging/lustre/lnet/lnet/lib-msg.c | 24 ++++---- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 4 +- drivers/staging/lustre/lnet/lnet/lo.c | 6 +- 11 files changed, 91 insertions(+), 91 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 2390d94..827afe6 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -248,10 +248,10 @@ lnet_me_free(lnet_me_t *me) LIBCFS_FREE(me, sizeof(*me)); } -static inline lnet_msg_t * +static inline struct lnet_msg * lnet_msg_alloc(void) { - lnet_msg_t *msg; + struct lnet_msg *msg; LIBCFS_ALLOC(msg, sizeof(*msg)); @@ -260,7 +260,7 @@ lnet_msg_alloc(void) } static inline void -lnet_msg_free(lnet_msg_t *msg) +lnet_msg_free(struct lnet_msg *msg) { LASSERT(!msg->msg_onactivelist); LIBCFS_FREE(msg, sizeof(*msg)); @@ -487,20 +487,20 @@ int lnet_clear_lazy_portal(struct lnet_ni *ni, int portal, char *reason); int lnet_islocalnid(lnet_nid_t nid); int lnet_islocalnet(__u32 net); -void lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md, +void lnet_msg_attach_md(struct lnet_msg *msg, lnet_libmd_t *md, unsigned int offset, unsigned int mlen); -void lnet_msg_detach_md(lnet_msg_t *msg, int status); +void lnet_msg_detach_md(struct lnet_msg *msg, int status); void lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev); -void lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type); -void lnet_msg_commit(lnet_msg_t *msg, int cpt); -void lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status); +void lnet_build_msg_event(struct lnet_msg *msg, lnet_event_kind_t ev_type); +void lnet_msg_commit(struct lnet_msg *msg, int cpt); +void lnet_msg_decommit(struct lnet_msg *msg, int cpt, int status); void lnet_eq_enqueue_event(lnet_eq_t *eq, lnet_event_t *ev); -void lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target, +void lnet_prep_send(struct lnet_msg *msg, int type, lnet_process_id_t target, unsigned int offset, unsigned int len); -int lnet_send(lnet_nid_t nid, lnet_msg_t *msg, lnet_nid_t rtr_nid); -void lnet_return_tx_credits_locked(lnet_msg_t *msg); -void lnet_return_rx_credits_locked(lnet_msg_t *msg); +int lnet_send(lnet_nid_t nid, struct lnet_msg *msg, lnet_nid_t rtr_nid); +void lnet_return_tx_credits_locked(struct lnet_msg *msg); +void lnet_return_rx_credits_locked(struct lnet_msg *msg); void lnet_schedule_blocked_locked(lnet_rtrbufpool_t *rbp); void lnet_drop_routed_msgs_locked(struct list_head *list, int cpt); @@ -559,19 +559,19 @@ void lnet_portals_destroy(void); /* message functions */ int lnet_parse(lnet_ni_t *ni, lnet_hdr_t *hdr, lnet_nid_t fromnid, void *private, int rdma_req); -int lnet_parse_local(lnet_ni_t *ni, lnet_msg_t *msg); -int lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg); +int lnet_parse_local(lnet_ni_t *ni, struct lnet_msg *msg); +int lnet_parse_forward_locked(lnet_ni_t *ni, struct lnet_msg *msg); -void lnet_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, +void lnet_recv(lnet_ni_t *ni, void *private, struct lnet_msg *msg, int delayed, unsigned int offset, unsigned int mlen, unsigned int rlen); -void lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, +void lnet_ni_recv(lnet_ni_t *ni, void *private, struct lnet_msg *msg, int delayed, unsigned int offset, unsigned int mlen, unsigned int rlen); -lnet_msg_t *lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *get_msg); -void lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *msg, unsigned int len); +struct lnet_msg *lnet_create_reply_msg(lnet_ni_t *ni, struct lnet_msg *get_msg); +void lnet_set_reply_msg_len(lnet_ni_t *ni, struct lnet_msg *msg, unsigned int len); -void lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int rc); +void lnet_finalize(lnet_ni_t *ni, struct lnet_msg *msg, int rc); void lnet_drop_message(lnet_ni_t *ni, int cpt, void *private, unsigned int nob); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 62baaca..33729f2 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -53,7 +53,7 @@ /* forward refs */ struct lnet_libmd; -typedef struct lnet_msg { +struct lnet_msg { struct list_head msg_activelist; struct list_head msg_list; /* Q for credits/MD */ @@ -105,7 +105,7 @@ typedef struct lnet_msg { lnet_event_t msg_ev; lnet_hdr_t msg_hdr; -} lnet_msg_t; +}; typedef struct lnet_libhandle { struct list_head lh_hash_chain; @@ -209,7 +209,7 @@ struct lnet_lnd { * non-zero for immediate failure, otherwise complete later with * lnet_finalize() */ - int (*lnd_send)(struct lnet_ni *ni, void *private, lnet_msg_t *msg); + int (*lnd_send)(struct lnet_ni *ni, void *private, struct lnet_msg *msg); /* * Start receiving 'mlen' bytes of payload data, skipping the following @@ -218,7 +218,7 @@ struct lnet_lnd { * complete later with lnet_finalize(). This also gives back a receive * credit if the LND does flow control. */ - int (*lnd_recv)(struct lnet_ni *ni, void *private, lnet_msg_t *msg, + int (*lnd_recv)(struct lnet_ni *ni, void *private, struct lnet_msg *msg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, @@ -233,7 +233,7 @@ struct lnet_lnd { * release resources; lnd_recv() will not be called. */ int (*lnd_eager_recv)(struct lnet_ni *ni, void *private, - lnet_msg_t *msg, void **new_privatep); + struct lnet_msg *msg, void **new_privatep); /* notification of peer health */ void (*lnd_notify)(struct lnet_ni *ni, lnet_nid_t peer, int alive); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index bfcbdd1..988b727 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -509,7 +509,7 @@ typedef struct kib_tx /* transmit message */ int tx_status; /* LNET completion status */ unsigned long tx_deadline; /* completion deadline */ __u64 tx_cookie; /* completion cookie */ - lnet_msg_t *tx_lntmsg[2]; /* lnet msgs to finalize on completion */ + struct lnet_msg *tx_lntmsg[2]; /* lnet msgs to finalize on completion */ kib_msg_t *tx_msg; /* message buffer (host vaddr) */ __u64 tx_msgaddr; /* message buffer (I/O addr) */ DECLARE_PCI_UNMAP_ADDR(tx_msgunmap); /* for dma_unmap_single() */ @@ -1003,7 +1003,7 @@ void kiblnd_pack_msg(lnet_ni_t *ni, kib_msg_t *msg, int version, int kiblnd_unpack_msg(kib_msg_t *msg, int nob); int kiblnd_post_rx(kib_rx_t *rx, int credit); -int kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg); -int kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, +int kiblnd_send(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg); +int kiblnd_recv(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index cd3fde7..6f00bba 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -54,7 +54,7 @@ static void kiblnd_unmap_tx(lnet_ni_t *ni, kib_tx_t *tx); static void kiblnd_tx_done(lnet_ni_t *ni, kib_tx_t *tx) { - lnet_msg_t *lntmsg[2]; + struct lnet_msg *lntmsg[2]; kib_net_t *net = ni->ni_data; int rc; int i; @@ -1486,7 +1486,7 @@ kiblnd_launch_tx(lnet_ni_t *ni, kib_tx_t *tx, lnet_nid_t nid) } int -kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) +kiblnd_send(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg) { lnet_hdr_t *hdr = &lntmsg->msg_hdr; int type = lntmsg->msg_type; @@ -1656,7 +1656,7 @@ kiblnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) } static void -kiblnd_reply(lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) +kiblnd_reply(lnet_ni_t *ni, kib_rx_t *rx, struct lnet_msg *lntmsg) { lnet_process_id_t target = lntmsg->msg_target; unsigned int niov = lntmsg->msg_niov; @@ -1717,7 +1717,7 @@ kiblnd_reply(lnet_ni_t *ni, kib_rx_t *rx, lnet_msg_t *lntmsg) } int -kiblnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, +kiblnd_recv(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen) { diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index a60d72f..13dc69e 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -267,7 +267,7 @@ typedef struct /* transmit packet */ unsigned short tx_nonblk:1; /* it's a non-blocking ACK */ lnet_kiov_t *tx_kiov; /* packet page frags */ struct ksock_conn *tx_conn; /* owning conn */ - lnet_msg_t *tx_lnetmsg; /* lnet message for lnet_finalize() + struct lnet_msg *tx_lnetmsg; /* lnet message for lnet_finalize() */ unsigned long tx_deadline; /* when (in jiffies) tx times out */ ksock_msg_t tx_msg; /* socklnd message buffer */ @@ -617,8 +617,8 @@ ksocknal_peer_decref(ksock_peer_t *peer) int ksocknal_startup(lnet_ni_t *ni); void ksocknal_shutdown(lnet_ni_t *ni); int ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg); -int ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg); -int ksocknal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, +int ksocknal_send(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg); +int ksocknal_recv(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 976fd78..228146c 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -393,7 +393,7 @@ ksocknal_receive(ksock_conn_t *conn) void ksocknal_tx_done(lnet_ni_t *ni, ksock_tx_t *tx) { - lnet_msg_t *lnetmsg = tx->tx_lnetmsg; + struct lnet_msg *lnetmsg = tx->tx_lnetmsg; int rc = (!tx->tx_resid && !tx->tx_zc_aborted) ? 0 : -EIO; LASSERT(ni || tx->tx_conn); @@ -932,7 +932,7 @@ ksocknal_launch_packet(lnet_ni_t *ni, ksock_tx_t *tx, lnet_process_id_t id) } int -ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) +ksocknal_send(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg) { int mpflag = 1; int type = lntmsg->msg_type; @@ -1324,7 +1324,7 @@ ksocknal_process_receive(ksock_conn_t *conn) } int -ksocknal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, +ksocknal_recv(lnet_ni_t *ni, void *private, struct lnet_msg *msg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen) { diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 19ad5a3..a5104b1 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1174,7 +1174,7 @@ lnet_shutdown_lndnis(void) /* * Clear lazy portals and drop delayed messages which hold refs - * on their lnet_msg_t::msg_rxpeer + * on their struct lnet_msg::msg_rxpeer */ for (i = 0; i < the_lnet.ln_nportals; i++) LNetClearLazyPortal(i); diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 4ebf1b4..d9389a9 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -567,7 +567,7 @@ lnet_extract_kiov(int dst_niov, lnet_kiov_t *dst, EXPORT_SYMBOL(lnet_extract_kiov); void -lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, +lnet_ni_recv(lnet_ni_t *ni, void *private, struct lnet_msg *msg, int delayed, unsigned int offset, unsigned int mlen, unsigned int rlen) { unsigned int niov = 0; @@ -605,7 +605,7 @@ lnet_ni_recv(lnet_ni_t *ni, void *private, lnet_msg_t *msg, int delayed, } static void -lnet_setpayloadbuffer(lnet_msg_t *msg) +lnet_setpayloadbuffer(struct lnet_msg *msg) { lnet_libmd_t *md = msg->msg_md; @@ -624,7 +624,7 @@ lnet_setpayloadbuffer(lnet_msg_t *msg) } void -lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target, +lnet_prep_send(struct lnet_msg *msg, int type, lnet_process_id_t target, unsigned int offset, unsigned int len) { msg->msg_type = type; @@ -645,7 +645,7 @@ lnet_prep_send(lnet_msg_t *msg, int type, lnet_process_id_t target, } static void -lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_ni_send(lnet_ni_t *ni, struct lnet_msg *msg) { void *priv = msg->msg_private; int rc; @@ -660,7 +660,7 @@ lnet_ni_send(lnet_ni_t *ni, lnet_msg_t *msg) } static int -lnet_ni_eager_recv(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_ni_eager_recv(lnet_ni_t *ni, struct lnet_msg *msg) { int rc; @@ -791,7 +791,7 @@ lnet_peer_alive_locked(struct lnet_peer *lp) * \retval -ECANCELED If the MD of the message has been unlinked. */ static int -lnet_post_send_locked(lnet_msg_t *msg, int do_send) +lnet_post_send_locked(struct lnet_msg *msg, int do_send) { struct lnet_peer *lp = msg->msg_txpeer; lnet_ni_t *ni = lp->lp_ni; @@ -876,7 +876,7 @@ lnet_post_send_locked(lnet_msg_t *msg, int do_send) } static lnet_rtrbufpool_t * -lnet_msg2bufpool(lnet_msg_t *msg) +lnet_msg2bufpool(struct lnet_msg *msg) { lnet_rtrbufpool_t *rbp; int cpt; @@ -896,7 +896,7 @@ lnet_msg2bufpool(lnet_msg_t *msg) } static int -lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv) +lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv) { /* * lnet_parse is going to lnet_net_unlock immediately after this, so it @@ -972,10 +972,10 @@ lnet_post_routed_recv_locked(lnet_msg_t *msg, int do_recv) } void -lnet_return_tx_credits_locked(lnet_msg_t *msg) +lnet_return_tx_credits_locked(struct lnet_msg *msg) { struct lnet_peer *txpeer = msg->msg_txpeer; - lnet_msg_t *msg2; + struct lnet_msg *msg2; if (msg->msg_txcredit) { struct lnet_ni *ni = txpeer->lp_ni; @@ -990,7 +990,7 @@ lnet_return_tx_credits_locked(lnet_msg_t *msg) tq->tq_credits++; if (tq->tq_credits <= 0) { msg2 = list_entry(tq->tq_delayed.next, - lnet_msg_t, msg_list); + struct lnet_msg, msg_list); list_del(&msg2->msg_list); LASSERT(msg2->msg_txpeer->lp_ni == ni); @@ -1013,7 +1013,7 @@ lnet_return_tx_credits_locked(lnet_msg_t *msg) txpeer->lp_txcredits++; if (txpeer->lp_txcredits <= 0) { msg2 = list_entry(txpeer->lp_txq.next, - lnet_msg_t, msg_list); + struct lnet_msg, msg_list); list_del(&msg2->msg_list); LASSERT(msg2->msg_txpeer == txpeer); @@ -1032,12 +1032,12 @@ lnet_return_tx_credits_locked(lnet_msg_t *msg) void lnet_schedule_blocked_locked(lnet_rtrbufpool_t *rbp) { - lnet_msg_t *msg; + struct lnet_msg *msg; if (list_empty(&rbp->rbp_msgs)) return; msg = list_entry(rbp->rbp_msgs.next, - lnet_msg_t, msg_list); + struct lnet_msg, msg_list); list_del(&msg->msg_list); (void)lnet_post_routed_recv_locked(msg, 1); @@ -1047,8 +1047,8 @@ void lnet_drop_routed_msgs_locked(struct list_head *list, int cpt) { struct list_head drop; - lnet_msg_t *msg; - lnet_msg_t *tmp; + struct lnet_msg *msg; + struct lnet_msg *tmp; INIT_LIST_HEAD(&drop); @@ -1067,10 +1067,10 @@ lnet_drop_routed_msgs_locked(struct list_head *list, int cpt) } void -lnet_return_rx_credits_locked(lnet_msg_t *msg) +lnet_return_rx_credits_locked(struct lnet_msg *msg) { struct lnet_peer *rxpeer = msg->msg_rxpeer; - lnet_msg_t *msg2; + struct lnet_msg *msg2; if (msg->msg_rtrcredit) { /* give back global router credits */ @@ -1139,7 +1139,7 @@ routing_off: msg->msg_rx_cpt); } else if (rxpeer->lp_rtrcredits <= 0) { msg2 = list_entry(rxpeer->lp_rtrq.next, - lnet_msg_t, msg_list); + struct lnet_msg, msg_list); list_del(&msg2->msg_list); (void)lnet_post_routed_recv_locked(msg2, 1); @@ -1253,7 +1253,7 @@ lnet_find_route_locked(lnet_ni_t *ni, lnet_nid_t target, lnet_nid_t rtr_nid) } int -lnet_send(lnet_nid_t src_nid, lnet_msg_t *msg, lnet_nid_t rtr_nid) +lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid) { lnet_nid_t dst_nid = msg->msg_target.nid; struct lnet_ni *src_ni; @@ -1439,7 +1439,7 @@ lnet_drop_message(lnet_ni_t *ni, int cpt, void *private, unsigned int nob) } static void -lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_recv_put(lnet_ni_t *ni, struct lnet_msg *msg) { lnet_hdr_t *hdr = &msg->msg_hdr; @@ -1460,7 +1460,7 @@ lnet_recv_put(lnet_ni_t *ni, lnet_msg_t *msg) } static int -lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_parse_put(lnet_ni_t *ni, struct lnet_msg *msg) { lnet_hdr_t *hdr = &msg->msg_hdr; struct lnet_match_info info; @@ -1518,7 +1518,7 @@ lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg) } static int -lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get) +lnet_parse_get(lnet_ni_t *ni, struct lnet_msg *msg, int rdma_get) { struct lnet_match_info info; lnet_hdr_t *hdr = &msg->msg_hdr; @@ -1582,7 +1582,7 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get) } static int -lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_parse_reply(lnet_ni_t *ni, struct lnet_msg *msg) { void *private = msg->msg_private; lnet_hdr_t *hdr = &msg->msg_hdr; @@ -1647,7 +1647,7 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg) } static int -lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_parse_ack(lnet_ni_t *ni, struct lnet_msg *msg) { lnet_hdr_t *hdr = &msg->msg_hdr; lnet_process_id_t src = {0}; @@ -1702,7 +1702,7 @@ lnet_parse_ack(lnet_ni_t *ni, lnet_msg_t *msg) * \retval -ve error code */ int -lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_parse_forward_locked(lnet_ni_t *ni, struct lnet_msg *msg) { int rc = 0; @@ -1726,7 +1726,7 @@ lnet_parse_forward_locked(lnet_ni_t *ni, lnet_msg_t *msg) } int -lnet_parse_local(lnet_ni_t *ni, lnet_msg_t *msg) +lnet_parse_local(lnet_ni_t *ni, struct lnet_msg *msg) { int rc; @@ -2067,9 +2067,9 @@ lnet_drop_delayed_msg_list(struct list_head *head, char *reason) { while (!list_empty(head)) { lnet_process_id_t id = {0}; - lnet_msg_t *msg; + struct lnet_msg *msg; - msg = list_entry(head->next, lnet_msg_t, msg_list); + msg = list_entry(head->next, struct lnet_msg, msg_list); list_del(&msg->msg_list); id.nid = msg->msg_hdr.src_nid; @@ -2108,10 +2108,10 @@ void lnet_recv_delayed_msg_list(struct list_head *head) { while (!list_empty(head)) { - lnet_msg_t *msg; + struct lnet_msg *msg; lnet_process_id_t id; - msg = list_entry(head->next, lnet_msg_t, msg_list); + msg = list_entry(head->next, struct lnet_msg, msg_list); list_del(&msg->msg_list); /* @@ -2202,7 +2202,7 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack, msg = lnet_msg_alloc(); if (!msg) { - CERROR("Dropping PUT to %s: ENOMEM on lnet_msg_t\n", + CERROR("Dropping PUT to %s: ENOMEM on struct lnet_msg\n", libcfs_id2str(target)); return -ENOMEM; } @@ -2265,8 +2265,8 @@ LNetPut(lnet_nid_t self, lnet_handle_md_t mdh, lnet_ack_req_t ack, } EXPORT_SYMBOL(LNetPut); -lnet_msg_t * -lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *getmsg) +struct lnet_msg * +lnet_create_reply_msg(lnet_ni_t *ni, struct lnet_msg *getmsg) { /* * The LND can DMA direct to the GET md (i.e. no REPLY msg). This @@ -2344,7 +2344,7 @@ lnet_create_reply_msg(lnet_ni_t *ni, lnet_msg_t *getmsg) EXPORT_SYMBOL(lnet_create_reply_msg); void -lnet_set_reply_msg_len(lnet_ni_t *ni, lnet_msg_t *reply, unsigned int len) +lnet_set_reply_msg_len(lnet_ni_t *ni, struct lnet_msg *reply, unsigned int len) { /* * Set the REPLY length, now the RDMA that elides the REPLY message has @@ -2406,7 +2406,7 @@ LNetGet(lnet_nid_t self, lnet_handle_md_t mdh, msg = lnet_msg_alloc(); if (!msg) { - CERROR("Dropping GET to %s: ENOMEM on lnet_msg_t\n", + CERROR("Dropping GET to %s: ENOMEM on struct lnet_msg\n", libcfs_id2str(target)); return -ENOMEM; } diff --git a/drivers/staging/lustre/lnet/lnet/lib-msg.c b/drivers/staging/lustre/lnet/lnet/lib-msg.c index f879d7f..fd31267 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-msg.c +++ b/drivers/staging/lustre/lnet/lnet/lib-msg.c @@ -58,7 +58,7 @@ lnet_build_unlink_event(lnet_libmd_t *md, lnet_event_t *ev) * Don't need any lock, must be called after lnet_commit_md */ void -lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type) +lnet_build_msg_event(struct lnet_msg *msg, lnet_event_kind_t ev_type) { lnet_hdr_t *hdr = &msg->msg_hdr; lnet_event_t *ev = &msg->msg_ev; @@ -133,7 +133,7 @@ lnet_build_msg_event(lnet_msg_t *msg, lnet_event_kind_t ev_type) } void -lnet_msg_commit(lnet_msg_t *msg, int cpt) +lnet_msg_commit(struct lnet_msg *msg, int cpt) { struct lnet_msg_container *container = the_lnet.ln_msg_containers[cpt]; lnet_counters_t *counters = the_lnet.ln_counters[cpt]; @@ -166,7 +166,7 @@ lnet_msg_commit(lnet_msg_t *msg, int cpt) } static void -lnet_msg_decommit_tx(lnet_msg_t *msg, int status) +lnet_msg_decommit_tx(struct lnet_msg *msg, int status) { lnet_counters_t *counters; lnet_event_t *ev = &msg->msg_ev; @@ -218,7 +218,7 @@ lnet_msg_decommit_tx(lnet_msg_t *msg, int status) } static void -lnet_msg_decommit_rx(lnet_msg_t *msg, int status) +lnet_msg_decommit_rx(struct lnet_msg *msg, int status) { lnet_counters_t *counters; lnet_event_t *ev = &msg->msg_ev; @@ -276,7 +276,7 @@ lnet_msg_decommit_rx(lnet_msg_t *msg, int status) } void -lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status) +lnet_msg_decommit(struct lnet_msg *msg, int cpt, int status) { int cpt2 = cpt; @@ -310,7 +310,7 @@ lnet_msg_decommit(lnet_msg_t *msg, int cpt, int status) } void -lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md, +lnet_msg_attach_md(struct lnet_msg *msg, lnet_libmd_t *md, unsigned int offset, unsigned int mlen) { /* NB: @offset and @len are only useful for receiving */ @@ -340,7 +340,7 @@ lnet_msg_attach_md(lnet_msg_t *msg, lnet_libmd_t *md, } void -lnet_msg_detach_md(lnet_msg_t *msg, int status) +lnet_msg_detach_md(struct lnet_msg *msg, int status) { lnet_libmd_t *md = msg->msg_md; int unlink; @@ -363,7 +363,7 @@ lnet_msg_detach_md(lnet_msg_t *msg, int status) } static int -lnet_complete_msg_locked(lnet_msg_t *msg, int cpt) +lnet_complete_msg_locked(struct lnet_msg *msg, int cpt) { lnet_handle_wire_t ack_wmd; int rc; @@ -441,7 +441,7 @@ lnet_complete_msg_locked(lnet_msg_t *msg, int cpt) } void -lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status) +lnet_finalize(lnet_ni_t *ni, struct lnet_msg *msg, int status) { struct lnet_msg_container *container; int my_slot; @@ -522,7 +522,7 @@ lnet_finalize(lnet_ni_t *ni, lnet_msg_t *msg, int status) while (!list_empty(&container->msc_finalizing)) { msg = list_entry(container->msc_finalizing.next, - lnet_msg_t, msg_list); + struct lnet_msg, msg_list); list_del(&msg->msg_list); @@ -558,8 +558,8 @@ lnet_msg_container_cleanup(struct lnet_msg_container *container) return; while (!list_empty(&container->msc_active)) { - lnet_msg_t *msg = list_entry(container->msc_active.next, - lnet_msg_t, msg_activelist); + struct lnet_msg *msg = list_entry(container->msc_active.next, + struct lnet_msg, msg_activelist); LASSERT(msg->msg_onactivelist); msg->msg_onactivelist = 0; diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c index 3947e8b..bfec6c4 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c +++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c @@ -657,8 +657,8 @@ lnet_ptl_attach_md(lnet_me_t *me, lnet_libmd_t *md, struct lnet_portal *ptl = the_lnet.ln_portals[me->me_portal]; struct lnet_match_table *mtable; struct list_head *head; - lnet_msg_t *tmp; - lnet_msg_t *msg; + struct lnet_msg *tmp; + struct lnet_msg *msg; int exhausted = 0; int cpt; diff --git a/drivers/staging/lustre/lnet/lnet/lo.c b/drivers/staging/lustre/lnet/lnet/lo.c index 2216301..80c2101 100644 --- a/drivers/staging/lustre/lnet/lnet/lo.c +++ b/drivers/staging/lustre/lnet/lnet/lo.c @@ -36,7 +36,7 @@ #include "../../include/linux/lnet/lib-lnet.h" static int -lolnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) +lolnd_send(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg) { LASSERT(!lntmsg->msg_routing); LASSERT(!lntmsg->msg_target_is_router); @@ -45,12 +45,12 @@ lolnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) } static int -lolnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, +lolnd_recv(lnet_ni_t *ni, void *private, struct lnet_msg *lntmsg, int delayed, unsigned int niov, struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen) { - lnet_msg_t *sendmsg = private; + struct lnet_msg *sendmsg = private; if (lntmsg) { /* not discarding */ if (sendmsg->msg_iov) { -- 2.8.0.rc4.16.g56331f8 From oleg.drokin at intel.com Fri Apr 1 14:23:03 2016 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Fri, 1 Apr 2016 14:23:03 +0000 Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: References: Message-ID: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> On Apr 1, 2016, at 9:02 AM, Joe Perches wrote: > Question about removing lustre typedefs. > > Various bits of lustre code use a mix of struct foo and foo_t. > > When would be an appropriate time to submit patches similar to > below that individually remove various typedefs from lustre code? I think now is as good time as any. the only small correction is those are LNet typedefs. While LNet is technically part of Lustre, it's a bit of a separate thing useful without Lustre too. I know James is working on cleaning up LNet, but I don't know if he has anything this would be conflicting at this moment or not. Thanks for the patches. I wonder if you are generating them automatically? Because it would be great if it also fixes the alignment issues due to longer definitions, like: --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -307,7 +307,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, r = the_lnet.ln_routers.next; while (r != &the_lnet.ln_routers) { - lnet_peer_t *lp = list_entry(r, lnet_peer_t, + struct lnet_peer *lp = list_entry(r, struct lnet_peer, lp_rtr_list); that would need a separate patch to fix later. > > These are pretty trivial to produce and verify so there's no > particular hurry to do them now but applying them will require > resync points for active and actually useful developers. > > A few scripted examples are done: > > Joe Perches (3): > staging: lustre: Remove typedef lnet_peer_t > staging: lustre: Remove typedef lnd_t > staging: lustre: Remove typedef lnet_msg_t > > .../staging/lustre/include/linux/lnet/lib-lnet.h | 62 +++++++-------- > .../staging/lustre/include/linux/lnet/lib-types.h | 22 +++--- > .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 +- > .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 6 +- > .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 +- > .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- > .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 6 +- > .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 6 +- > drivers/staging/lustre/lnet/lnet/api-ni.c | 16 ++-- > drivers/staging/lustre/lnet/lnet/lib-move.c | 92 +++++++++++----------- > drivers/staging/lustre/lnet/lnet/lib-msg.c | 24 +++--- > drivers/staging/lustre/lnet/lnet/lib-ptl.c | 4 +- > drivers/staging/lustre/lnet/lnet/lo.c | 8 +- > drivers/staging/lustre/lnet/lnet/peer.c | 30 +++---- > drivers/staging/lustre/lnet/lnet/router.c | 28 +++---- > drivers/staging/lustre/lnet/lnet/router_proc.c | 4 +- > 16 files changed, 161 insertions(+), 161 deletions(-) > > -- > 2.8.0.rc4.16.g56331f8 > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org From simmonsja at ornl.gov Fri Apr 1 15:58:20 2016 From: simmonsja at ornl.gov (Simmons, James A.) Date: Fri, 1 Apr 2016 15:58:20 +0000 Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: References: Message-ID: >Question about removing lustre typedefs. > >Various bits of lustre code use a mix of struct foo and foo_t. > >When would be an appropriate time to submit patches similar to >below that individually remove various typedefs from lustre code? > >These are pretty trivial to produce and verify so there's no >particular hurry to do them now but applying them will require >resync points for active and actually useful developers. Actually could you hold off for the LNet core and LND drivers these changes. I have plans to push a few more LNet patches soon. I have been just waiting for everyone to figure out how to deal with the latest changes to the infinband layer first. So the plan is to push FMR support for the ko2iblnd driver. Also we have additional work too handle setting the size of the DMA pools for o2iblnd but that patch touches some of the core LNet code as well. Once those are landed we can look at removing most of the typedefs. When its time for the typedef to be cleaned up lets do just the structs first. There are a few typedefs like lnet_nid_t I like to keep or if it has to be changed turn it into a struct then. Things like lnet_nid_t act like a cookie handle. Now the best place to do this cleanup right now is LNet selftest. No new code is planned for landing. We have lots of typedefs to remove and I was planning to do that cleanup but if you want to do it just CC me, jsimmons at infradead.org, so I can test the changes. From joe at perches.com Fri Apr 1 18:44:13 2016 From: joe at perches.com (Joe Perches) Date: Fri, 01 Apr 2016 11:44:13 -0700 Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> Message-ID: <1459536253.1744.26.camel@perches.com> On Fri, 2016-04-01 at 14:23 +0000, Drokin, Oleg wrote: > On Apr 1, 2016, at 9:02 AM, Joe Perches wrote: > > > > Question about removing lustre typedefs. > > > > Various bits of lustre code use a mix of struct foo and foo_t. > > > > When would be an appropriate time to submit patches similar to > > below that individually remove various typedefs from lustre code? > I think now is as good time as any. > the only small correction is those are LNet typedefs. > While LNet is technically part of Lustre, it's a bit of a separate > thing useful without Lustre too. > > I know James is working on cleaning up LNet, but I don't know if he has > anything this would be conflicting at this moment or not. > > Thanks for the patches. I wonder if you are generating them automatically? > Because it would be great if it also fixes the alignment issues It's pretty automatic. It's a trivial variant of the detypedef perl script I wrote awhile ago: http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 I think changing the alignment issues is better done in a separate patch. James isn't cc'd on these patches as he's not a listed maintainer.  Maybe he should be added for all of it or some part of it? I don't know what email address James prefers as there are several in git log for him. James Simmons James Simmons James Simmons "Simmons, James A." but maybe something like this: ---  MAINTAINERS | 1 +  1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 16ccda4..d585631 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10578,6 +10578,7 @@ F: drivers/staging/media/lirc/  STAGING - LUSTRE PARALLEL FILESYSTEM  M: Oleg Drokin  M: Andreas Dilger +R: James Simmons  L: lustre-devel at lists.lustre.org (moderated for non-subscribers)  W: http://wiki.lustre.org/  S: Maintained From joe at perches.com Fri Apr 1 18:54:18 2016 From: joe at perches.com (Joe Perches) Date: Fri, 01 Apr 2016 11:54:18 -0700 Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: References: Message-ID: <1459536858.1744.30.camel@perches.com> On Fri, 2016-04-01 at 15:58 +0000, Simmons, James A. wrote: > > When would be an appropriate time to submit patches similar to > > below that individually remove various typedefs from lustre code? > > > > These are pretty trivial to produce and verify so there's no > > particular hurry to do them now but applying them will require > > resync points for active and actually useful developers. > Actually could you hold off for the LNet core and LND drivers these > changes. I have plans to push a few more LNet patches soon. I have > been just waiting for everyone to figure out how to deal with the  > latest changes to the infinband layer first. Sure.  No worries. > There are a few typedefs like lnet_nid_t I like to keep or if it has to > be changed turn it into a struct then. Things like lnet_nid_t act like > a cookie handle. Fine by me. From oleg.drokin at intel.com Fri Apr 1 19:14:45 2016 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Fri, 1 Apr 2016 19:14:45 +0000 Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <1459536253.1744.26.camel@perches.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> Message-ID: <46D8C648-9F97-4D8D-B869-055B81A5E1EE@intel.com> On Apr 1, 2016, at 2:44 PM, Joe Perches wrote: > On Fri, 2016-04-01 at 14:23 +0000, Drokin, Oleg wrote: >> On Apr 1, 2016, at 9:02 AM, Joe Perches wrote: >>> >>> Question about removing lustre typedefs. >>> >>> Various bits of lustre code use a mix of struct foo and foo_t. >>> >>> When would be an appropriate time to submit patches similar to >>> below that individually remove various typedefs from lustre code? >> I think now is as good time as any. >> the only small correction is those are LNet typedefs. >> While LNet is technically part of Lustre, it's a bit of a separate >> thing useful without Lustre too. >> >> I know James is working on cleaning up LNet, but I don't know if he has >> anything this would be conflicting at this moment or not. >> >> Thanks for the patches. I wonder if you are generating them automatically? >> Because it would be great if it also fixes the alignment issues > > It's pretty automatic. > > It's a trivial variant of the detypedef perl script I wrote awhile ago: > http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 > > > I think changing the alignment issues is better done in a > separate patch. but then it's two patches per change in a way. fixing one thing breaking the other warning-wise, that's why I typically try to make such cleanup patches not to introduce any new warnings. > > James isn't cc'd on these patches as he's not a listed > maintainer. Maybe he should be added for all of it or > some part of it? > for drivers/staging/lustre/lnet for the drivers/staging/lustre/lustre - the only remaining few typedefs I am going to address, it's just some of the code using them will go away or change the users significantly - that's why they were left out in the first round of lustre detypedefisation. Thanks. From green at linuxhacker.ru Fri Apr 1 19:18:00 2016 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Fri, 1 Apr 2016 15:18:00 -0400 Subject: [lustre-devel] [PATCH 0/3] A few more Lustre styel cleanups Message-ID: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> From: Oleg Drokin More of the checkpatch warning fixes. Oleg Drokin (3): staging/lustre: Fix braces {} style staging/lustre: Fix blank line after/before {/} style staging/lustre: Get rid of ldlm_policy_res_t typedef drivers/staging/lustre/lustre/fld/fld_cache.c | 3 +- drivers/staging/lustre/lustre/fld/fld_request.c | 1 - drivers/staging/lustre/lustre/include/lu_object.h | 1 - .../lustre/lustre/include/lustre/lustre_idl.h | 3 +- drivers/staging/lustre/lustre/include/obd_class.h | 3 +- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 50 +++++++++++----------- drivers/staging/lustre/lustre/llite/dir.c | 22 +++++----- drivers/staging/lustre/lustre/llite/llite_close.c | 3 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 9 ++-- drivers/staging/lustre/lustre/llite/lloop.c | 3 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 1 - drivers/staging/lustre/lustre/llite/namei.c | 6 ++- drivers/staging/lustre/lustre/llite/rw.c | 6 ++- drivers/staging/lustre/lustre/llite/rw26.c | 3 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 12 ++++-- drivers/staging/lustre/lustre/llite/vvp_io.c | 3 +- drivers/staging/lustre/lustre/llite/xattr.c | 4 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 1 - drivers/staging/lustre/lustre/lmv/lmv_obd.c | 3 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 10 +++-- drivers/staging/lustre/lustre/lov/lov_io.c | 10 +++-- drivers/staging/lustre/lustre/lov/lov_obd.c | 1 - drivers/staging/lustre/lustre/lov/lov_object.c | 6 ++- drivers/staging/lustre/lustre/lov/lov_pack.c | 5 +-- drivers/staging/lustre/lustre/lov/lov_request.c | 1 - drivers/staging/lustre/lustre/lov/lovsub_dev.c | 9 ++-- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 3 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 7 +-- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_locks.c | 1 - drivers/staging/lustre/lustre/mgc/mgc_request.c | 1 - drivers/staging/lustre/lustre/obdclass/cl_io.c | 13 +++--- drivers/staging/lustre/lustre/obdclass/cl_object.c | 9 ++-- drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 - drivers/staging/lustre/lustre/obdclass/genops.c | 1 - drivers/staging/lustre/lustre/obdclass/llog.c | 1 - .../lustre/lustre/obdclass/lprocfs_status.c | 3 +- drivers/staging/lustre/lustre/obdclass/lu_object.c | 5 +-- .../staging/lustre/lustre/obdclass/lustre_peer.c | 3 +- .../staging/lustre/lustre/obdclass/obd_config.c | 1 - .../staging/lustre/lustre/obdecho/echo_client.c | 2 - drivers/staging/lustre/lustre/osc/osc_cache.c | 1 - drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 +- drivers/staging/lustre/lustre/osc/osc_object.c | 3 +- drivers/staging/lustre/lustre/osc/osc_page.c | 4 +- drivers/staging/lustre/lustre/osc/osc_request.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 5 +-- drivers/staging/lustre/lustre/ptlrpc/events.c | 1 - drivers/staging/lustre/lustre/ptlrpc/import.c | 3 -- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 10 ++--- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - .../staging/lustre/lustre/ptlrpc/pack_generic.c | 3 -- 56 files changed, 141 insertions(+), 136 deletions(-) -- 2.1.0 From green at linuxhacker.ru Fri Apr 1 19:18:01 2016 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Fri, 1 Apr 2016 15:18:01 -0400 Subject: [lustre-devel] [PATCH 1/3] staging/lustre: Fix braces {} style In-Reply-To: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> References: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> Message-ID: <1459538283-3031249-2-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This fixes all checkpatch form of this from the Lustre tree: CHECK: braces {} should be used on all arms of this statement Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/fld/fld_cache.c | 3 ++- .../lustre/lustre/include/lustre/lustre_idl.h | 3 ++- drivers/staging/lustre/lustre/include/obd_class.h | 3 ++- drivers/staging/lustre/lustre/llite/dir.c | 20 +++++++++++--------- drivers/staging/lustre/lustre/llite/llite_close.c | 3 ++- drivers/staging/lustre/lustre/llite/llite_lib.c | 9 +++++---- drivers/staging/lustre/lustre/llite/lloop.c | 3 ++- drivers/staging/lustre/lustre/llite/namei.c | 6 ++++-- drivers/staging/lustre/lustre/llite/rw.c | 6 ++++-- drivers/staging/lustre/lustre/llite/rw26.c | 3 ++- drivers/staging/lustre/lustre/llite/vvp_dev.c | 12 ++++++++---- drivers/staging/lustre/lustre/llite/vvp_io.c | 3 ++- drivers/staging/lustre/lustre/llite/xattr.c | 3 ++- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 3 ++- drivers/staging/lustre/lustre/lov/lov_dev.c | 10 ++++++---- drivers/staging/lustre/lustre/lov/lov_io.c | 9 ++++++--- drivers/staging/lustre/lustre/lov/lov_object.c | 6 ++++-- drivers/staging/lustre/lustre/lov/lov_pack.c | 4 ++-- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 9 ++++++--- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 3 ++- drivers/staging/lustre/lustre/lov/lovsub_object.c | 6 ++++-- drivers/staging/lustre/lustre/obdclass/cl_io.c | 13 ++++++++----- drivers/staging/lustre/lustre/obdclass/cl_object.c | 9 ++++++--- .../staging/lustre/lustre/obdclass/lprocfs_status.c | 3 ++- drivers/staging/lustre/lustre/obdclass/lu_object.c | 3 ++- drivers/staging/lustre/lustre/obdclass/lustre_peer.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_io.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_object.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_page.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_request.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/client.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 9 +++++---- 33 files changed, 117 insertions(+), 69 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index 062f388..5a04e99 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -178,8 +178,9 @@ restart_fixup: if (n_range->lsr_end <= c_range->lsr_end) { *n_range = *c_range; fld_cache_entry_delete(cache, f_curr); - } else + } else { n_range->lsr_start = c_range->lsr_end; + } } /* we could have overlap over next diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 12e6718..2543eb1 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1001,8 +1001,9 @@ static inline int lu_dirent_calc_size(int namelen, __u16 attr) size = (sizeof(struct lu_dirent) + namelen + align) & ~align; size += sizeof(struct luda_type); - } else + } else { size = sizeof(struct lu_dirent) + namelen; + } return (size + 7) & ~7; } diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 706869f..40f7a23 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -490,8 +490,9 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg) obd->obd_lu_dev = d; d->ld_obd = obd; rc = 0; - } else + } else { rc = PTR_ERR(d); + } } lu_context_exit(&session_ctx); lu_context_fini(&session_ctx); diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index b085fb4..4837894 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1497,8 +1497,9 @@ free_lmv: cmd == LL_IOC_MDC_GETINFO)) { rc = 0; goto skip_lmm; - } else + } else { goto out_req; + } } if (cmd == IOC_MDC_GETFILESTRIPE || @@ -1711,15 +1712,16 @@ out_quotactl: return ll_flush_ctx(inode); #ifdef CONFIG_FS_POSIX_ACL case LL_IOC_RMTACL: { - if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) { - struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) { + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - rc = rct_add(&sbi->ll_rct, current_pid(), arg); - if (!rc) - fd->fd_flags |= LL_FILE_RMTACL; - return rc; - } else - return 0; + rc = rct_add(&sbi->ll_rct, current_pid(), arg); + if (!rc) + fd->fd_flags |= LL_FILE_RMTACL; + return rc; + } else { + return 0; + } } #endif case LL_IOC_GETOBDCOUNT: { diff --git a/drivers/staging/lustre/lustre/llite/llite_close.c b/drivers/staging/lustre/lustre/llite/llite_close.c index 8d23980..92b73ef 100644 --- a/drivers/staging/lustre/lustre/llite/llite_close.c +++ b/drivers/staging/lustre/lustre/llite/llite_close.c @@ -323,8 +323,9 @@ static struct ll_inode_info *ll_close_next_lli(struct ll_close_queue *lcq) lli = list_entry(lcq->lcq_head.next, struct ll_inode_info, lli_close_list); list_del_init(&lli->lli_close_list); - } else if (atomic_read(&lcq->lcq_stop)) + } else if (atomic_read(&lcq->lcq_stop)) { lli = ERR_PTR(-EALREADY); + } spin_unlock(&lcq->lcq_lock); return lli; diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 95c55c3..80f0306 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1596,8 +1596,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) " to the "DFID", inode %lu/%u(%p)\n", PFID(&lli->lli_fid), PFID(&body->fid1), inode->i_ino, inode->i_generation, inode); - } else + } else { lli->lli_fid = body->fid1; + } } LASSERT(fid_seq(&lli->lli_fid) != 0); @@ -2065,11 +2066,11 @@ int ll_obd_statfs(struct inode *inode, void __user *arg) } memcpy(&type, data->ioc_inlbuf1, sizeof(__u32)); - if (type & LL_STATFS_LMV) + if (type & LL_STATFS_LMV) { exp = sbi->ll_md_exp; - else if (type & LL_STATFS_LOV) + } else if (type & LL_STATFS_LOV) { exp = sbi->ll_dt_exp; - else { + } else { rc = -ENODEV; goto out_statfs; } diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index b725fc1..cfa2752 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -274,8 +274,9 @@ static void loop_add_bio(struct lloop_device *lo, struct bio *bio) if (lo->lo_biotail) { lo->lo_biotail->bi_next = bio; lo->lo_biotail = bio; - } else + } else { lo->lo_bio = lo->lo_biotail = bio; + } spin_unlock_irqrestore(&lo->lo_lock, flags); atomic_inc(&lo->lo_pending); diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index f8f98e4..8561707 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -128,10 +128,12 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, if (rc != 0) { iget_failed(inode); inode = NULL; - } else + } else { unlock_new_inode(inode); - } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) + } + } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) { ll_update_inode(inode, md); + } CDEBUG(D_VFSTRACE, "got inode: %p for "DFID"\n", inode, PFID(&md->body->fid1)); } diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 7d5dd38..ebf1ddb 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -132,8 +132,9 @@ struct ll_cl_context *ll_cl_init(struct file *file, struct page *vmpage) lcc->lcc_page = page; lu_ref_add(&page->cp_reference, "cl_io", io); result = 0; - } else + } else { result = PTR_ERR(page); + } } if (result) { ll_cl_fini(lcc); @@ -488,8 +489,9 @@ static int ll_read_ahead_pages(const struct lu_env *env, if (rc == 1) { (*reserved_pages)--; count++; - } else if (rc == -ENOLCK) + } else if (rc == -ENOLCK) { break; + } } else if (stride_ria) { /* If it is not in the read-ahead window, and it is * read-ahead mode, then check whether it should skip diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 65baeeb..021415b 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -98,8 +98,9 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset, cl_page_delete(env, page); cl_page_put(env, page); } - } else + } else { LASSERT(vmpage->private == 0); + } cl_env_put(env, &refcheck); } } diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index e35c1a1..d252e10 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -342,8 +342,9 @@ int cl_sb_init(struct super_block *sb) sbi->ll_site = cl2lu_dev(cl)->ld_site; } cl_env_put(env, &refcheck); - } else + } else { rc = PTR_ERR(env); + } return rc; } @@ -589,16 +590,19 @@ static int vvp_pgcache_show(struct seq_file *f, void *v) if (page) { vvp_pgcache_page_show(env, f, page); cl_page_put(env, page); - } else + } else { seq_puts(f, "missing\n"); + } lu_object_ref_del(&clob->co_lu, "dump", current); cl_object_put(env, clob); - } else + } else { seq_printf(f, "%llx missing\n", pos); + } cl_env_put(env, &refcheck); result = 0; - } else + } else { result = PTR_ERR(env); + } return result; } diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index aed7b8e..9103c6a 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -1179,8 +1179,9 @@ static int vvp_io_fault_start(const struct lu_env *env, if (result == -EDQUOT) result = -ENOSPC; goto out; - } else + } else { cl_page_disown(env, io, page); + } } } diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index b68dcc9..be5cb21 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -181,8 +181,9 @@ int ll_setxattr_common(struct inode *inode, const char *name, size = rc; pv = (const char *)new_value; - } else + } else { return -EOPNOTSUPP; + } valid |= rce_ops2valid(rce->rce_ops); } diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 8bd2dc5..1b1dff2 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1122,8 +1122,9 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, if (!rc) rc = err; } - } else + } else { set = 1; + } } if (!set && !rc) rc = -EIO; diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index dccc634..dae8e89 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -262,8 +262,9 @@ static int lov_req_init(const struct lu_env *env, struct cl_device *dev, if (lr) { cl_req_slice_add(req, &lr->lr_cl, dev, &lov_req_ops); result = 0; - } else + } else { result = -ENOMEM; + } return result; } @@ -332,14 +333,15 @@ static struct lov_device_emerg **lov_emerg_alloc(int nr) cl_page_list_init(&em->emrg_page_list); em->emrg_env = cl_env_alloc(&em->emrg_refcheck, LCT_REMEMBER | LCT_NOREF); - if (!IS_ERR(em->emrg_env)) + if (!IS_ERR(em->emrg_env)) { em->emrg_env->le_ctx.lc_cookie = 0x2; - else { + } else { result = PTR_ERR(em->emrg_env); em->emrg_env = NULL; } - } else + } else { result = -ENOMEM; + } } if (result != 0) { lov_emerg_free(emerg, nr); diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 4151237..f443778 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -225,8 +225,9 @@ struct lov_io_sub *lov_sub_get(const struct lu_env *env, if (!sub->sub_io_initialized) { sub->sub_stripe = stripe; rc = lov_io_sub_init(env, lio, sub); - } else + } else { rc = 0; + } if (rc == 0) lov_sub_enter(sub); else @@ -294,8 +295,9 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, lio->lis_single_subio_index = -1; lio->lis_active_subios = 0; result = 0; - } else + } else { result = -ENOMEM; + } return result; } @@ -413,8 +415,9 @@ static int lov_io_iter_init(const struct lu_env *env, lov_sub_put(sub); CDEBUG(D_VFSTRACE, "shrink: %d [%llu, %llu)\n", stripe, start, end); - } else + } else { rc = PTR_ERR(sub); + } if (!rc) list_add_tail(&sub->sub_linkage, &lio->lis_active); diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 6a353d1..561d493 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -283,8 +283,9 @@ static int lov_init_raid0(const struct lu_env *env, } if (result == 0) cl_object_header(&lov->lo_cl)->coh_page_bufsize += psz; - } else + } else { result = -ENOMEM; + } out: return result; } @@ -935,8 +936,9 @@ struct lu_object *lov_object_alloc(const struct lu_env *env, * for object with different layouts. */ obj->lo_ops = &lov_lu_obj_ops; - } else + } else { obj = NULL; + } return obj; } diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 3925633..9723d2e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -457,9 +457,9 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, } /* User wasn't expecting this many OST entries */ - if (lum.lmm_stripe_count == 0) + if (lum.lmm_stripe_count == 0) { lmm_size = lum_size; - else if (lum.lmm_stripe_count < lmmk->lmm_stripe_count) { + } else if (lum.lmm_stripe_count < lmmk->lmm_stripe_count) { rc = -EOVERFLOW; goto out_set; } diff --git a/drivers/staging/lustre/lustre/lov/lovsub_dev.c b/drivers/staging/lustre/lustre/lov/lovsub_dev.c index c335c02..35f6b1d 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_dev.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_dev.c @@ -151,8 +151,9 @@ static int lovsub_req_init(const struct lu_env *env, struct cl_device *dev, if (lsr) { cl_req_slice_add(req, &lsr->lsrq_cl, dev, &lovsub_req_ops); result = 0; - } else + } else { result = -ENOMEM; + } return result; } @@ -182,10 +183,12 @@ static struct lu_device *lovsub_device_alloc(const struct lu_env *env, d = lovsub2lu_dev(lsd); d->ld_ops = &lovsub_lu_ops; lsd->acid_cl.cd_ops = &lovsub_cl_ops; - } else + } else { d = ERR_PTR(result); - } else + } + } else { d = ERR_PTR(-ENOMEM); + } return d; } diff --git a/drivers/staging/lustre/lustre/lov/lovsub_lock.c b/drivers/staging/lustre/lustre/lov/lovsub_lock.c index 670d203..e92edfb 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_lock.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_lock.c @@ -77,8 +77,9 @@ int lovsub_lock_init(const struct lu_env *env, struct cl_object *obj, INIT_LIST_HEAD(&lsk->lss_parents); cl_lock_slice_add(lock, &lsk->lss_cl, obj, &lovsub_lock_ops); result = 0; - } else + } else { result = -ENOMEM; + } return result; } diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index 6c5430d..3f51f0d 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -67,8 +67,9 @@ int lovsub_object_init(const struct lu_env *env, struct lu_object *obj, lu_object_add(obj, below); cl_object_page_init(lu2cl(obj), sizeof(struct lovsub_page)); result = 0; - } else + } else { result = -ENOMEM; + } return result; } @@ -154,8 +155,9 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, lu_object_add_top(&hdr->coh_lu, obj); los->lso_cl.co_ops = &lovsub_ops; obj->lo_ops = &lovsub_lu_obj_ops; - } else + } else { obj = NULL; + } return obj; } diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index f4b3178..583fb5f 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -504,9 +504,9 @@ int cl_io_lock_add(const struct lu_env *env, struct cl_io *io, { int result; - if (cl_lockset_merge(&io->ci_lockset, &link->cill_descr)) + if (cl_lockset_merge(&io->ci_lockset, &link->cill_descr)) { result = 1; - else { + } else { list_add(&link->cill_linkage, &io->ci_lockset.cls_todo); result = 0; } @@ -536,8 +536,9 @@ int cl_io_lock_alloc_add(const struct lu_env *env, struct cl_io *io, result = cl_io_lock_add(env, io, link); if (result) /* lock match */ link->cill_fini(env, link); - } else + } else { result = -ENOMEM; + } return result; } @@ -1202,14 +1203,16 @@ struct cl_req *cl_req_alloc(const struct lu_env *env, struct cl_page *page, if (req->crq_o) { req->crq_nrobjs = nr_objects; result = cl_req_init(env, req, page); - } else + } else { result = -ENOMEM; + } if (result != 0) { cl_req_completion(env, req, result); req = ERR_PTR(result); } - } else + } else { req = ERR_PTR(-ENOMEM); + } return req; } EXPORT_SYMBOL(cl_req_alloc); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 395b92c..a068e08 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -654,8 +654,9 @@ static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug) lu_context_enter(&cle->ce_ses); env->le_ses = &cle->ce_ses; cl_env_init0(cle, debug); - } else + } else { lu_env_fini(env); + } } if (rc != 0) { kmem_cache_free(cl_env_kmem, cle); @@ -664,8 +665,9 @@ static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug) CL_ENV_INC(create); CL_ENV_INC(total); } - } else + } else { env = ERR_PTR(-ENOMEM); + } return env; } @@ -1095,8 +1097,9 @@ struct cl_device *cl_type_setup(const struct lu_env *env, struct lu_site *site, CERROR("can't init device '%s', %d\n", typename, rc); d = ERR_PTR(rc); } - } else + } else { CERROR("Cannot allocate device: '%s'\n", typename); + } return lu2cl_dev(d); } EXPORT_SYMBOL(cl_type_setup); diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index d93f42f..9824c88 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -694,8 +694,9 @@ int lprocfs_rd_import(struct seq_file *m, void *data) do_div(sum, ret.lc_count); ret.lc_sum = sum; - } else + } else { ret.lc_sum = 0; + } seq_printf(m, " rpcs:\n" " inflight: %u\n" diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 770d5bd..a0d3f0c 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -716,8 +716,9 @@ struct lu_object *lu_object_find_slice(const struct lu_env *env, obj = lu_object_locate(top->lo_header, dev->ld_type); if (!obj) lu_object_put(env, top); - } else + } else { obj = top; + } return obj; } EXPORT_SYMBOL(lu_object_find_slice); diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c index 5f81246..b1abe02 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c @@ -163,8 +163,9 @@ int class_del_uuid(const char *uuid) break; } } - } else + } else { list_splice_init(&g_uuid_list, &deathrow); + } spin_unlock(&g_uuid_lock); if (uuid && list_empty(&deathrow)) { diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index cf7743d..bc08f38 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -842,8 +842,9 @@ int osc_req_init(const struct lu_env *env, struct cl_device *dev, if (or) { cl_req_slice_add(req, &or->or_cl, dev, &osc_req_ops); result = 0; - } else + } else { result = -ENOMEM; + } return result; } diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 49dfe9f..7ea6489 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -624,8 +624,9 @@ static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) result = -ELDLM_NO_LOCK_DATA; } cl_env_nested_put(&nest, env); - } else + } else { result = PTR_ERR(env); + } req->rq_status = result; return result; } diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index a06bdf1..738ab10 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -292,8 +292,9 @@ struct lu_object *osc_object_alloc(const struct lu_env *env, lu_object_init(obj, NULL, dev); osc->oo_cl.co_ops = &osc_ops; obj->lo_ops = &osc_lu_obj_ops; - } else + } else { obj = NULL; + } return obj; } diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 82979f4..74aca89 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -421,8 +421,9 @@ static int osc_cache_too_much(struct client_obd *cli) return lru_shrink_max; else if (pages >= budget / 2) return lru_shrink_min; - } else if (pages >= budget * 2) + } else if (pages >= budget * 2) { return lru_shrink_min; + } return 0; } diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 547539c..2f6f6be 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -3065,8 +3065,9 @@ static int osc_import_event(struct obd_device *obd, ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY); cl_env_put(env, &refcheck); - } else + } else { rc = PTR_ERR(env); + } break; } case IMP_EVENT_ACTIVE: { diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 32a7c87..93746ec 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -595,9 +595,9 @@ static int __ptlrpc_request_bufs_pack(struct ptlrpc_request *request, struct obd_import *imp = request->rq_import; int rc; - if (unlikely(ctx)) + if (unlikely(ctx)) { request->rq_cli_ctx = sptlrpc_cli_ctx_get(ctx); - else { + } else { rc = sptlrpc_req_get_ctx(request); if (rc) goto out_free; diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index cee04ef..419478b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -679,11 +679,11 @@ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file, /** * The second token is either NULL, or an optional [reg|hp] string */ - if (strcmp(cmd, "reg") == 0) + if (strcmp(cmd, "reg") == 0) { queue = PTLRPC_NRS_QUEUE_REG; - else if (strcmp(cmd, "hp") == 0) + } else if (strcmp(cmd, "hp") == 0) { queue = PTLRPC_NRS_QUEUE_HP; - else { + } else { rc = -EINVAL; goto out; } @@ -693,8 +693,9 @@ default_queue: if (queue == PTLRPC_NRS_QUEUE_HP && !nrs_svc_has_hp(svc)) { rc = -ENODEV; goto out; - } else if (queue == PTLRPC_NRS_QUEUE_BOTH && !nrs_svc_has_hp(svc)) + } else if (queue == PTLRPC_NRS_QUEUE_BOTH && !nrs_svc_has_hp(svc)) { queue = PTLRPC_NRS_QUEUE_REG; + } /** * Serialize NRS core lprocfs operations with policy registration/ -- 2.1.0 From green at linuxhacker.ru Fri Apr 1 19:18:03 2016 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Fri, 1 Apr 2016 15:18:03 -0400 Subject: [lustre-devel] [PATCH 3/3] staging/lustre: Get rid of ldlm_policy_res_t typedef In-Reply-To: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> References: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> Message-ID: <1459538283-3031249-4-git-send-email-green@linuxhacker.ru> From: Oleg Drokin Directly use enum ldlm_policy_res everywhere. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 49 +++++++++++----------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index 351f8b4..ba643e6 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -218,8 +218,6 @@ enum ldlm_policy_res { LDLM_POLICY_SKIP_LOCK }; -typedef enum ldlm_policy_res ldlm_policy_res_t; - #define LDLM_POOL_SYSFS_PRINT_int(v) sprintf(buf, "%d\n", v) #define LDLM_POOL_SYSFS_SET_int(a, b) { a = b; } #define LDLM_POOL_SYSFS_PRINT_u64(v) sprintf(buf, "%lld\n", v) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 9ff5ad0..9de9fa0 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -1131,12 +1131,11 @@ EXPORT_SYMBOL(ldlm_cli_cancel_list_local); * dirty data, to close a file, ...) or waiting for any RPCs in-flight (e.g. * readahead requests, ...) */ -static ldlm_policy_res_t ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns, - struct ldlm_lock *lock, - int unused, int added, - int count) +static enum ldlm_policy_res +ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns, struct ldlm_lock *lock, + int unused, int added, int count) { - ldlm_policy_res_t result = LDLM_POLICY_CANCEL_LOCK; + enum ldlm_policy_res result = LDLM_POLICY_CANCEL_LOCK; /* don't check added & count since we want to process all locks * from unused list. @@ -1168,10 +1167,10 @@ static ldlm_policy_res_t ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns, * * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU */ -static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, - struct ldlm_lock *lock, - int unused, int added, - int count) +static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, + struct ldlm_lock *lock, + int unused, int added, + int count) { unsigned long cur = cfs_time_current(); struct ldlm_pool *pl = &ns->ns_pool; @@ -1214,10 +1213,10 @@ static ldlm_policy_res_t ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, * * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU */ -static ldlm_policy_res_t ldlm_cancel_passed_policy(struct ldlm_namespace *ns, - struct ldlm_lock *lock, - int unused, int added, - int count) +static enum ldlm_policy_res ldlm_cancel_passed_policy(struct ldlm_namespace *ns, + struct ldlm_lock *lock, + int unused, int added, + int count) { /* Stop LRU processing when we reach past @count or have checked all * locks in LRU. @@ -1235,10 +1234,10 @@ static ldlm_policy_res_t ldlm_cancel_passed_policy(struct ldlm_namespace *ns, * * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU */ -static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns, - struct ldlm_lock *lock, - int unused, int added, - int count) +static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns, + struct ldlm_lock *lock, + int unused, int added, + int count) { if ((added >= count) && time_before(cfs_time_current(), @@ -1251,13 +1250,13 @@ static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns, return LDLM_POLICY_CANCEL_LOCK; } -static ldlm_policy_res_t +static enum ldlm_policy_res ldlm_cancel_lrur_no_wait_policy(struct ldlm_namespace *ns, struct ldlm_lock *lock, int unused, int added, int count) { - ldlm_policy_res_t result; + enum ldlm_policy_res result; result = ldlm_cancel_lrur_policy(ns, lock, unused, added, count); if (result == LDLM_POLICY_KEEP_LOCK) @@ -1275,10 +1274,9 @@ ldlm_cancel_lrur_no_wait_policy(struct ldlm_namespace *ns, * * \retval LDLM_POLICY_CANCEL_LOCK cancel lock from LRU */ -static ldlm_policy_res_t ldlm_cancel_default_policy(struct ldlm_namespace *ns, - struct ldlm_lock *lock, - int unused, int added, - int count) +static enum ldlm_policy_res +ldlm_cancel_default_policy(struct ldlm_namespace *ns, struct ldlm_lock *lock, + int unused, int added, int count) { /* Stop LRU processing when we reach past count or have checked all * locks in LRU. @@ -1287,7 +1285,8 @@ static ldlm_policy_res_t ldlm_cancel_default_policy(struct ldlm_namespace *ns, LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK; } -typedef ldlm_policy_res_t (*ldlm_cancel_lru_policy_t)(struct ldlm_namespace *, +typedef enum ldlm_policy_res (*ldlm_cancel_lru_policy_t)( + struct ldlm_namespace *, struct ldlm_lock *, int, int, int); @@ -1368,7 +1367,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, LASSERT(pf); while (!list_empty(&ns->ns_unused_list)) { - ldlm_policy_res_t result; + enum ldlm_policy_res result; time_t last_use = 0; /* all unused locks */ -- 2.1.0 From green at linuxhacker.ru Fri Apr 1 19:18:02 2016 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Fri, 1 Apr 2016 15:18:02 -0400 Subject: [lustre-devel] [PATCH 2/3] staging/lustre: Fix blank line after/before {/} style In-Reply-To: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> References: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> Message-ID: <1459538283-3031249-3-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This patch fixes all checkpatch occurences of CHECK: Blank lines aren't necessary after an open brace '{' CHECK: Blank lines aren't necessary before a close brace '}' in Lustre code. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/fld/fld_request.c | 1 - drivers/staging/lustre/lustre/include/lu_object.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 1 - drivers/staging/lustre/lustre/llite/dir.c | 2 -- drivers/staging/lustre/lustre/llite/lproc_llite.c | 1 - drivers/staging/lustre/lustre/llite/xattr.c | 1 - drivers/staging/lustre/lustre/llite/xattr_cache.c | 1 - drivers/staging/lustre/lustre/lov/lov_io.c | 1 - drivers/staging/lustre/lustre/lov/lov_obd.c | 1 - drivers/staging/lustre/lustre/lov/lov_pack.c | 1 - drivers/staging/lustre/lustre/lov/lov_request.c | 1 - drivers/staging/lustre/lustre/lov/lovsub_object.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_lib.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_locks.c | 1 - drivers/staging/lustre/lustre/mgc/mgc_request.c | 1 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 - drivers/staging/lustre/lustre/obdclass/genops.c | 1 - drivers/staging/lustre/lustre/obdclass/llog.c | 1 - drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 -- drivers/staging/lustre/lustre/obdclass/obd_config.c | 1 - drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 -- drivers/staging/lustre/lustre/osc/osc_cache.c | 1 - drivers/staging/lustre/lustre/osc/osc_io.c | 1 - drivers/staging/lustre/lustre/osc/osc_page.c | 1 - drivers/staging/lustre/lustre/osc/osc_request.c | 1 - drivers/staging/lustre/lustre/ptlrpc/client.c | 1 - drivers/staging/lustre/lustre/ptlrpc/events.c | 1 - drivers/staging/lustre/lustre/ptlrpc/import.c | 3 --- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 - drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 3 --- 33 files changed, 40 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 2dfdb51..64c387e 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -95,7 +95,6 @@ static void fld_exit_request(struct client_obd *cli) spin_lock(&cli->cl_loi_list_lock); cli->cl_r_in_flight--; list_for_each_safe(l, tmp, &cli->cl_cache_waiters) { - if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) { /* No free request slots anymore */ break; diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index fcb9db6..1ea5f6a 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -198,7 +198,6 @@ typedef int (*lu_printer_t)(const struct lu_env *env, * Operations specific for particular lu_object. */ struct lu_object_operations { - /** * Allocate lower-layer parts of the object by calling * lu_device_operations::ldo_object_alloc() of the corresponding diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 7fedbec..3dd4e2a 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -429,7 +429,6 @@ err_ldlm: ldlm_put_ref(); err: return rc; - } EXPORT_SYMBOL(client_obd_setup); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 3f9b8526..6c27b23 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -810,7 +810,6 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) } else if (!lock->l_readers && !lock->l_writers && !(lock->l_flags & LDLM_FL_NO_LRU) && !(lock->l_flags & LDLM_FL_BL_AST)) { - LDLM_DEBUG(lock, "add lock into lru list"); /* If this is a client-side namespace and this was the last diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 5b0e396..9ff5ad0 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -1804,7 +1804,6 @@ static void ldlm_namespace_foreach(struct ldlm_namespace *ns, cfs_hash_for_each_nolock(ns->ns_rs_hash, ldlm_res_iter_helper, &helper); - } /* non-blocking function to manipulate a lock whose cb_data is being put away. diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 4837894..8e2efec 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1056,7 +1056,6 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) /* hpk_errval must be >= 0 */ hpk.hpk_errval = EBUSY; } - } progress: @@ -1385,7 +1384,6 @@ out_free: lmv_out_free: obd_ioctl_freedata(buf, len); return rc; - } case LL_IOC_LOV_SETSTRIPE: { struct lov_user_md_v3 lumv3; diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 091144f..30bdd5a 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -254,7 +254,6 @@ static ssize_t max_read_ahead_mb_store(struct kobject *kobj, pages_number *= 1 << (20 - PAGE_CACHE_SHIFT); /* MB -> pages */ if (pages_number > totalram_pages / 2) { - CERROR("can't set file readahead more than %lu MB\n", totalram_pages >> (20 - PAGE_CACHE_SHIFT + 1)); /*1/2 of RAM*/ return -ERANGE; diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index be5cb21..95a7b51 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -339,7 +339,6 @@ int ll_getxattr_common(struct inode *inode, const char *name, */ if (xattr_type == XATTR_ACL_ACCESS_T && !(sbi->ll_flags & LL_SBI_RMT_CLIENT)) { - struct posix_acl *acl; spin_lock(&lli->lli_lock); diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 3480ce2..d7e17ab 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -229,7 +229,6 @@ static int ll_xattr_cache_valid(struct ll_inode_info *lli) */ static int ll_xattr_cache_destroy_locked(struct ll_inode_info *lli) { - if (!ll_xattr_cache_valid(lli)) return 0; diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index f443778..de57a84 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -441,7 +441,6 @@ static int lov_io_rw_iter_init(const struct lu_env *env, /* fast path for common case. */ if (lio->lis_nr_subios != 1 && !cl_io_is_append(io)) { - lov_do_div64(start, ssize); next = (start + 1) * ssize; if (next <= start * ssize) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 1a9e3e8..6d02914 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -964,7 +964,6 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, CERROR("Unknown command: %d\n", lcfg->lcfg_command); rc = -EINVAL; goto out; - } } out: diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 9723d2e..f9e66cd 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -136,7 +136,6 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, CERROR("bad mem LOV MAGIC: 0x%08X != 0x%08X nor 0x%08X\n", lmm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3); return -EINVAL; - } if (lsm) { diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 7178a02..8226ab2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -235,7 +235,6 @@ out: if (tmp_oa) kmem_cache_free(obdo_cachep, tmp_oa); return rc; - } int lov_fini_getattr_set(struct lov_request_set *set) diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index 3f51f0d..bcaae1e 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -71,7 +71,6 @@ int lovsub_object_init(const struct lu_env *env, struct lu_object *obj, result = -ENOMEM; } return result; - } static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index be0acf7..bc377e7 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -438,7 +438,6 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags, char *tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME); LOGL0(op_data->op_name, op_data->op_namelen, tmp); - } } diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 958a164..9e970ab 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -963,7 +963,6 @@ static int mdc_finish_intent_lock(struct obd_export *exp, if (fid_is_sane(&op_data->op_fid2) && it->it_create_mode & M_CHECK_STALE && it->it_op != IT_GETATTR) { - /* Also: did we find the same inode? */ /* sever can return one of two fids: * op_fid2 - new allocated fid - if file is created. diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index b7dc872..c9e9044 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1720,7 +1720,6 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf) CERROR("Unknown command: %d\n", lcfg->lcfg_command); rc = -EINVAL; goto out; - } } out: diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index d9844ba..376b128 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -335,7 +335,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) err = 0; goto out; } - } if (data->ioc_dev == OBD_DEV_BY_DEVNAME) { diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index cf97b8f0..d95f11d 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -604,7 +604,6 @@ int obd_init_caches(void) out: obd_cleanup_caches(); return -ENOMEM; - } /* map connection to client */ diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index 992573e..79194d8 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -265,7 +265,6 @@ repeat: for (rec = (struct llog_rec_hdr *)buf; (char *)rec < buf + LLOG_CHUNK_SIZE; rec = (struct llog_rec_hdr *)((char *)rec + rec->lrh_len)) { - CDEBUG(D_OTHER, "processing rec 0x%p type %#x\n", rec, rec->lrh_type); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index a0d3f0c..0b478fb 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -104,7 +104,6 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o) if (!cfs_hash_bd_dec_and_lock(site->ls_obj_hash, &bd, &top->loh_ref)) { if (lu_object_is_dying(top)) { - /* * somebody may be waiting for this, currently only * used for cl_object, see cl_object_put_last(). @@ -358,7 +357,6 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) if (count > 0 && --count == 0) break; - } cfs_hash_bd_unlock(s->ls_obj_hash, &bd, 1); cond_resched(); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 5395e99..318a2e3 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -961,7 +961,6 @@ int class_process_config(struct lustre_cfg *lcfg) default: { err = obd_process_config(obd, sizeof(*lcfg), lcfg); goto out; - } } out: diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index a752bb4..b805465 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1368,7 +1368,6 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, for (i = 0, pgp = pga, off = offset; i < npages; i++, pgp++, off += PAGE_CACHE_SIZE) { - LASSERT(!pgp->pg); /* for cleanup */ rc = -ENOMEM; @@ -1845,7 +1844,6 @@ static int __init obdecho_init(void) static void /*__exit*/ obdecho_exit(void) { echo_client_exit(); - } MODULE_AUTHOR("OpenSFS, Inc. "); diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index d01f2a2..c92cc29 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1820,7 +1820,6 @@ static void osc_process_ar(struct osc_async_rc *ar, __u64 xid, ar->ar_force_sync = 1; ar->ar_min_xid = ptlrpc_sample_next_xid(); return; - } if (ar->ar_force_sync && (xid >= ar->ar_min_xid)) diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index bc08f38..547b1a0 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -782,7 +782,6 @@ static void osc_req_attr_set(const struct lu_env *env, oa->o_valid |= OBD_MD_FLID; } if (flags & OBD_MD_FLHANDLE) { - clerq = slice->crs_req; LASSERT(!list_empty(&clerq->crq_pages)); apage = container_of(clerq->crq_pages.next, diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 74aca89..a316733 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -759,7 +759,6 @@ static int osc_lru_reserve(const struct lu_env *env, struct osc_object *obj, LASSERT(atomic_read(cli->cl_lru_left) >= 0); while (!atomic_add_unless(cli->cl_lru_left, -1, 0)) { - /* run out of LRU spaces, try to drop some by itself */ rc = osc_lru_reclaim(cli); if (rc < 0) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 2f6f6be..ab3ac7b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -837,7 +837,6 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, spin_unlock(&cli->cl_loi_list_lock); CDEBUG(D_CACHE, "dirty: %llu undirty: %u dropped %u grant: %llu\n", oa->o_dirty, oa->o_undirty, oa->o_dropped, oa->o_grant); - } void osc_update_next_shrink(struct client_obd *cli) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 93746ec..adf1abd 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1082,7 +1082,6 @@ static int ptlrpc_console_allow(struct ptlrpc_request *req) */ if ((lustre_handle_is_used(&req->rq_import->imp_remote_handle)) && (opc == OST_CONNECT || opc == MDS_CONNECT || opc == MGS_CONNECT)) { - /* Suppress timed out reconnect requests */ if (req->rq_timedout) return 0; diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 47be21a..fdcde9b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -69,7 +69,6 @@ void request_out_callback(lnet_event_t *ev) req->rq_req_unlink = 0; if (ev->type == LNET_EVENT_UNLINK || ev->status != 0) { - /* Failed send: make it seem like the reply timed out, just * like failing sends in client.c does currently... */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index b4eddf2..99ef51f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -1001,7 +1001,6 @@ finish: return 0; } } else { - spin_lock(&imp->imp_lock); list_del(&imp->imp_conn_current->oic_item); list_add(&imp->imp_conn_current->oic_item, &imp->imp_conn_list); @@ -1370,7 +1369,6 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) if (rc) goto out; } - } if (imp->imp_state == LUSTRE_IMP_REPLAY_WAIT) { @@ -1453,7 +1451,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) back_to_sleep, LWI_ON_SIGNAL_NOOP, NULL); rc = l_wait_event(imp->imp_recovery_waitq, !ptlrpc_import_in_recovery(imp), &lwi); - } spin_lock(&imp->imp_lock); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 419478b..c9abff8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -1321,6 +1321,5 @@ int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, up_read(&obd->u.cli.cl_sem); return count; - } EXPORT_SYMBOL(lprocfs_wr_pinger_recov); diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 710fb80..99ff6e8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -1038,7 +1038,6 @@ static int nrs_policy_unregister_locked(struct ptlrpc_nrs_pol_desc *desc) LASSERT(mutex_is_locked(&ptlrpc_all_services_mutex)); list_for_each_entry(svc, &ptlrpc_all_services, srv_list) { - if (!nrs_policy_compatible(svc, desc) || unlikely(svc->srv_is_stopping)) continue; diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 492d63f..811acf6 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -1160,7 +1160,6 @@ __u32 lustre_msg_get_timeout(struct lustre_msg *msg) if (!pb) { CERROR("invalid msg %p: no ptlrpc body!\n", msg); return 0; - } return pb->pb_timeout; } @@ -1179,7 +1178,6 @@ __u32 lustre_msg_get_service_time(struct lustre_msg *msg) if (!pb) { CERROR("invalid msg %p: no ptlrpc body!\n", msg); return 0; - } return pb->pb_service_time; } @@ -1572,7 +1570,6 @@ static void lustre_swab_obdo(struct obdo *o) CLASSERT(offsetof(typeof(*o), o_padding_4) != 0); CLASSERT(offsetof(typeof(*o), o_padding_5) != 0); CLASSERT(offsetof(typeof(*o), o_padding_6) != 0); - } void lustre_swab_obd_statfs(struct obd_statfs *os) -- 2.1.0 From joe at perches.com Fri Apr 1 19:27:23 2016 From: joe at perches.com (Joe Perches) Date: Fri, 01 Apr 2016 12:27:23 -0700 Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <46D8C648-9F97-4D8D-B869-055B81A5E1EE@intel.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> <46D8C648-9F97-4D8D-B869-055B81A5E1EE@intel.com> Message-ID: <1459538843.1744.34.camel@perches.com> On Fri, 2016-04-01 at 19:14 +0000, Drokin, Oleg wrote: > On Apr 1, 2016, at 2:44 PM, Joe Perches wrote: > > On Fri, 2016-04-01 at 14:23 +0000, Drokin, Oleg wrote: > > > On Apr 1, 2016, at 9:02 AM, Joe Perches wrote: > > > > Question about removing lustre typedefs. > > > > > > > > Various bits of lustre code use a mix of struct foo and foo_t. > > > > > > > > When would be an appropriate time to submit patches similar to > > > > below that individually remove various typedefs from lustre code? > > > I think now is as good time as any. > > > the only small correction is those are LNet typedefs. > > > While LNet is technically part of Lustre, it's a bit of a separate > > > thing useful without Lustre too. > > > > > > I know James is working on cleaning up LNet, but I don't know if he has > > > anything this would be conflicting at this moment or not. > > > > > > Thanks for the patches. I wonder if you are generating them automatically? > > > Because it would be great if it also fixes the alignment issues > > It's pretty automatic. > > > > It's a trivial variant of the detypedef perl script I wrote awhile ago: > > http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 > > > > I think changing the alignment issues is better done in a > > separate patch. > but then it's two patches per change in a way. fixing one thing breaking > the other warning-wise, that's why I typically try to make such cleanup > patches not to introduce any new warnings. detypedef frequently introduces > 80 column lines. It's much easier to verify this way without introducing changes like rewrapping to 80 column. From jsimmons at infradead.org Fri Apr 1 19:56:23 2016 From: jsimmons at infradead.org (James Simmons) Date: Fri, 1 Apr 2016 20:56:23 +0100 (BST) Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <1459536253.1744.26.camel@perches.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> Message-ID: > > I know James is working on cleaning up LNet, but I don't know if he has > > anything this would be conflicting at this moment or not. > > > > Thanks for the patches. I wonder if you are generating them automatically? > > Because it would be great if it also fixes the alignment issues > > It's pretty automatic. > > It's a trivial variant of the detypedef perl script I wrote awhile ago: > http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 > > > I think changing the alignment issues is better done in a > separate patch. > > James isn't cc'd on these patches as he's not a listed > maintainer.  Maybe he should be added for all of it or > some part of it? Yes please add me to the maintainer list. Currently the work is divided between Oleg and I. I also actively test this client to find any regressions. I have been working on the LNet, libcfs cleanups and bug fixes. Any libcfs/LNet changes please send my way. Also now that LNet is close to being synced with our production code it means I have free cycles to find all the earlier dropped patches in the Lustre code. We have gaps in various places where patches were dropped. So I will be working on pushing those patches as well. Oleg still is the main person for the Lustre core client code. > I don't know what email address James prefers as there > are several in git log for him. > > James Simmons > James Simmons > James Simmons > "Simmons, James A." The infradead.org account is the main one. The ornl.gov is my day job account. The yahoo and gmail accounts are used, for openid, to push patches to the OpenSFS Lustre branch which is why you see those Signed-Off with various patch ports. > but maybe something like this: > --- >  MAINTAINERS | 1 + >  1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 16ccda4..d585631 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -10578,6 +10578,7 @@ F: drivers/staging/media/lirc/ >  STAGING - LUSTRE PARALLEL FILESYSTEM >  M: Oleg Drokin >  M: Andreas Dilger > +R: James Simmons >  L: lustre-devel at lists.lustre.org (moderated for non-subscribers) >  W: http://wiki.lustre.org/ >  S: Maintained From jsimmons at infradead.org Fri Apr 1 19:56:35 2016 From: jsimmons at infradead.org (James Simmons) Date: Fri, 1 Apr 2016 20:56:35 +0100 (BST) Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <1459536253.1744.26.camel@perches.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> Message-ID: > > I know James is working on cleaning up LNet, but I don't know if he has > > anything this would be conflicting at this moment or not. > > > > Thanks for the patches. I wonder if you are generating them automatically? > > Because it would be great if it also fixes the alignment issues > > It's pretty automatic. > > It's a trivial variant of the detypedef perl script I wrote awhile ago: > http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 > > > I think changing the alignment issues is better done in a > separate patch. > > James isn't cc'd on these patches as he's not a listed > maintainer.  Maybe he should be added for all of it or > some part of it? Yes please add me to the maintainer list. Currently the work is divided between Oleg and I. I also actively test this client to find any regressions. I have been working on the LNet, libcfs cleanups and bug fixes. Any libcfs/LNet changes please send my way. Also now that LNet is close to being synced with our production code it means I have free cycles to find all the earlier dropped patches in the Lustre code. We have gaps in various places where patches were dropped. So I will be working on pushing those patches as well. Oleg still is the main person for the Lustre core client code. > I don't know what email address James prefers as there > are several in git log for him. > > James Simmons > James Simmons > James Simmons > "Simmons, James A." The infradead.org account is the main one. The ornl.gov is my day job account. The yahoo and gmail accounts are used, for openid, to push patches to the OpenSFS Lustre branch which is why you see those Signed-Off with various patch ports. > but maybe something like this: > --- >  MAINTAINERS | 1 + >  1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 16ccda4..d585631 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -10578,6 +10578,7 @@ F: drivers/staging/media/lirc/ >  STAGING - LUSTRE PARALLEL FILESYSTEM >  M: Oleg Drokin >  M: Andreas Dilger > +R: James Simmons >  L: lustre-devel at lists.lustre.org (moderated for non-subscribers) >  W: http://wiki.lustre.org/ >  S: Maintained From jsimmons at infradead.org Fri Apr 1 19:57:01 2016 From: jsimmons at infradead.org (James Simmons) Date: Fri, 1 Apr 2016 20:57:01 +0100 (BST) Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <1459536253.1744.26.camel@perches.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> Message-ID: > > I know James is working on cleaning up LNet, but I don't know if he has > > anything this would be conflicting at this moment or not. > > > > Thanks for the patches. I wonder if you are generating them automatically? > > Because it would be great if it also fixes the alignment issues > > It's pretty automatic. > > It's a trivial variant of the detypedef perl script I wrote awhile ago: > http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 > > > I think changing the alignment issues is better done in a > separate patch. > > James isn't cc'd on these patches as he's not a listed > maintainer.  Maybe he should be added for all of it or > some part of it? Yes please add me to the maintainer list. Currently the work is divided between Oleg and I. I also actively test this client to find any regressions. I have been working on the LNet, libcfs cleanups and bug fixes. Any libcfs/LNet changes please send my way. Also now that LNet is close to being synced with our production code it means I have free cycles to find all the earlier dropped patches in the Lustre code. We have gaps in various places where patches were dropped. So I will be working on pushing those patches as well. Oleg still is the main person for the Lustre core client code. > I don't know what email address James prefers as there > are several in git log for him. > > James Simmons > James Simmons > James Simmons > "Simmons, James A." The infradead.org account is the main one. The ornl.gov is my day job account. The yahoo and gmail accounts are used, for openid, to push patches to the OpenSFS Lustre branch which is why you see those Signed-Off with various patch ports. > but maybe something like this: > --- >  MAINTAINERS | 1 + >  1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 16ccda4..d585631 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -10578,6 +10578,7 @@ F: drivers/staging/media/lirc/ >  STAGING - LUSTRE PARALLEL FILESYSTEM >  M: Oleg Drokin >  M: Andreas Dilger > +R: James Simmons >  L: lustre-devel at lists.lustre.org (moderated for non-subscribers) >  W: http://wiki.lustre.org/ >  S: Maintained From jsimmons at infradead.org Fri Apr 1 19:57:18 2016 From: jsimmons at infradead.org (James Simmons) Date: Fri, 1 Apr 2016 20:57:18 +0100 (BST) Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <1459536253.1744.26.camel@perches.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> Message-ID: > > I know James is working on cleaning up LNet, but I don't know if he has > > anything this would be conflicting at this moment or not. > > > > Thanks for the patches. I wonder if you are generating them automatically? > > Because it would be great if it also fixes the alignment issues > > It's pretty automatic. > > It's a trivial variant of the detypedef perl script I wrote awhile ago: > http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 > > > I think changing the alignment issues is better done in a > separate patch. > > James isn't cc'd on these patches as he's not a listed > maintainer.  Maybe he should be added for all of it or > some part of it? Yes please add me to the maintainer list. Currently the work is divided between Oleg and I. I also actively test this client to find any regressions. I have been working on the LNet, libcfs cleanups and bug fixes. Any libcfs/LNet changes please send my way. Also now that LNet is close to being synced with our production code it means I have free cycles to find all the earlier dropped patches in the Lustre code. We have gaps in various places where patches were dropped. So I will be working on pushing those patches as well. Oleg still is the main person for the Lustre core client code. > I don't know what email address James prefers as there > are several in git log for him. > > James Simmons > James Simmons > James Simmons > "Simmons, James A." The infradead.org account is the main one. The ornl.gov is my day job account. The yahoo and gmail accounts are used, for openid, to push patches to the OpenSFS Lustre branch which is why you see those Signed-Off with various patch ports. > but maybe something like this: > --- >  MAINTAINERS | 1 + >  1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 16ccda4..d585631 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -10578,6 +10578,7 @@ F: drivers/staging/media/lirc/ >  STAGING - LUSTRE PARALLEL FILESYSTEM >  M: Oleg Drokin >  M: Andreas Dilger > +R: James Simmons >  L: lustre-devel at lists.lustre.org (moderated for non-subscribers) >  W: http://wiki.lustre.org/ >  S: Maintained From jsimmons at infradead.org Fri Apr 1 19:59:54 2016 From: jsimmons at infradead.org (James Simmons) Date: Fri, 1 Apr 2016 20:59:54 +0100 (BST) Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypedef In-Reply-To: <1459536253.1744.26.camel@perches.com> References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> Message-ID: > > I know James is working on cleaning up LNet, but I don't know if he has > > anything this would be conflicting at this moment or not. > > > > Thanks for the patches. I wonder if you are generating them automatically? > > Because it would be great if it also fixes the alignment issues > > It's pretty automatic. > > It's a trivial variant of the detypedef perl script I wrote awhile ago: > http://permalink.gmane.org/gmane.linux.drivers.driver-project.devel/18603 > > > I think changing the alignment issues is better done in a > separate patch. > > James isn't cc'd on these patches as he's not a listed > maintainer.  Maybe he should be added for all of it or > some part of it? Yes please add me to the maintainer list. Currently the work is divided between Oleg and I. I also actively test this client to find any regressions. I have been working on the LNet, libcfs cleanups and bug fixes. Any libcfs/LNet changes please send my way. Also now that LNet is close to being synced with our production code it means I have free cycles to find all the earlier dropped patches in the Lustre code. We have gaps in various places where patches were dropped. So I will be working on pushing those patches as well. Oleg still is the main person for the Lustre core client code. > I don't know what email address James prefers as there > are several in git log for him. > > James Simmons > James Simmons > James Simmons > "Simmons, James A." The infradead.org account is the main one. The ornl.gov is my day job account. The yahoo and gmail accounts are used, for openid, to push patches to the OpenSFS Lustre branch which is why you see those Signed-Off with various patch ports. > but maybe something like this: > --- >  MAINTAINERS | 1 + >  1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 16ccda4..d585631 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -10578,6 +10578,7 @@ F: drivers/staging/media/lirc/ >  STAGING - LUSTRE PARALLEL FILESYSTEM >  M: Oleg Drokin >  M: Andreas Dilger > +R: James Simmons >  L: lustre-devel at lists.lustre.org (moderated for non-subscribers) >  W: http://wiki.lustre.org/ >  S: Maintained From jsimmons at infradead.org Fri Apr 1 20:03:07 2016 From: jsimmons at infradead.org (James Simmons) Date: Fri, 1 Apr 2016 21:03:07 +0100 (BST) Subject: [lustre-devel] [RFC PATCH 0/3] staging: lustre: detypede In-Reply-To: References: <0586F4EF-3E2B-419A-8343-3A4A7E34628D@intel.com> <1459536253.1744.26.camel@perches.com> Message-ID: Sorry I was seeing a email error that I thought was preventing my email being sent out. That is not the case. From jsimmons at infradead.org Tue Apr 5 01:36:45 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:45 -0400 Subject: [lustre-devel] [PATCH 00/18] fill in missing patches present in 2.4.92 version Message-ID: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> After the lustre client code was merged patches continued to land but gaps did happen were several patches were missed. This batch of patches are bug fixes that happened after the upstream client merger and before the creation of lustre version 2.4.92 tag. Aurelien Degremont (1): staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED Gaurav Mahajan (1): staging: lustre: llite: Delaying creation of client side proc entries. JC Lafoucriere (2): staging: lustre: hsm: rename hai_zero() HSM function staging: lustre: hsm: Add CLF_RENAME_LAST flag James Simmons (1): staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set Jinshan Xiong (7): staging: lustre: libcfs: remove userland comments in libcfs_debug.h staging: lustre: libcfs: create array of debug names staging: lustre: libcfs: make D_HSM a unique value staging: lustre: hsm: Fix lu_ref for lease handle staging: lustre: llite: reset writeback index in ll_writepages staging: lustre: llite: cancel open lock before closing file staging: lustre: hsm: Add support to drop all pages for ll_data_version Ned Bass (1): staging: lustre: mdc: document mdc_rpc_lock Niu Yawei (1): staging: lustre: llite: use 64bits flags in ll_lov_setea() Sebastien Buisson (3): staging: lustre: ldlm: fix 'deadcode' errors staging: lustre: fix 'NULL pointer dereference' errors staging: lustre: fix 'no effect' errors Swapnil Pimpale (1): staging: lustre: lov: Get the correct address of lmm_objects .../lustre/include/linux/libcfs/libcfs_debug.h | 18 ++- drivers/staging/lustre/lnet/libcfs/debug.c | 126 ++------------------ .../lustre/lustre/include/lustre/lustre_idl.h | 1 + .../lustre/lustre/include/lustre/lustre_user.h | 18 ++- drivers/staging/lustre/lustre/include/lustre_mdc.h | 18 +++ drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 6 - drivers/staging/lustre/lustre/llite/dir.c | 18 ++- drivers/staging/lustre/lustre/llite/file.c | 59 ++++++---- .../staging/lustre/lustre/llite/llite_internal.h | 4 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 16 ++- drivers/staging/lustre/lustre/llite/rw.c | 5 +- drivers/staging/lustre/lustre/llite/xattr.c | 9 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- drivers/staging/lustre/lustre/lov/lov_io.c | 3 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 11 ++ drivers/staging/lustre/lustre/lov/lov_pack.c | 3 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 42 +++++-- 19 files changed, 166 insertions(+), 197 deletions(-) From jsimmons at infradead.org Tue Apr 5 01:36:52 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:52 -0400 Subject: [lustre-devel] [PATCH 07/18] staging: lustre: hsm: rename hai_zero() HSM function In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-8-git-send-email-jsimmons@infradead.org> From: JC Lafoucriere rename hai_zero() to hai_first(). Use a better name for hai helper Signed-off-by: JC Lafoucriere Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3709 Reviewed-on: http://review.whamcloud.com/7254 Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre/lustre_user.h | 6 +++--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index 19f2271..4672145 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -1095,7 +1095,7 @@ struct hsm_action_list { __u32 padding1; char hal_fsname[0]; /* null-terminated */ /* struct hsm_action_item[hal_count] follows, aligned on 8-byte - * boundaries. See hai_zero + * boundaries. See hai_first */ } __packed; @@ -1109,7 +1109,7 @@ static inline int cfs_size_round(int val) #endif /* Return pointer to first hai in action list */ -static inline struct hsm_action_item *hai_zero(struct hsm_action_list *hal) +static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal) { return (struct hsm_action_item *)(hal->hal_fsname + cfs_size_round(strlen(hal-> \ @@ -1131,7 +1131,7 @@ static inline int hal_size(struct hsm_action_list *hal) struct hsm_action_item *hai; sz = sizeof(*hal) + cfs_size_round(strlen(hal->hal_fsname) + 1); - hai = hai_zero(hal); + hai = hai_first(hal); for (i = 0; i < hal->hal_count; i++, hai = hai_next(hai)) sz += cfs_size_round(hai->hai_len); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 98b27f1..a089237 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -1952,7 +1952,7 @@ static void lustre_swab_hal(struct hsm_action_list *h) __swab32s(&h->hal_count); __swab32s(&h->hal_archive_id); __swab64s(&h->hal_flags); - hai = hai_zero(h); + hai = hai_first(h); for (i = 0; i < h->hal_count; i++, hai = hai_next(hai)) lustre_swab_hai(hai); } -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:51 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:51 -0400 Subject: [lustre-devel] [PATCH 06/18] staging: lustre: hsm: Fix lu_ref for lease handle In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-7-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong The lu_ref was not being decremented when releasing the lease handle. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647 Reviewed-on: http://review.whamcloud.com/7243 Reviewed-by: John L. Hammond Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 4 ++-- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 02b5783..000ea58 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -908,7 +908,7 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode, lock_res_and_lock(lock); cancelled = ldlm_is_cancel(lock); unlock_res_and_lock(lock); - ldlm_lock_put(lock); + LDLM_LOCK_PUT(lock); } CDEBUG(D_INODE, "lease for " DFID " broken? %d\n", @@ -2509,7 +2509,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) rc = och->och_flags & (FMODE_READ | FMODE_WRITE); unlock_res_and_lock(lock); - ldlm_lock_put(lock); + LDLM_LOCK_PUT(lock); } } mutex_unlock(&lli->lli_och_mutex); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index be0acf7..53cd56f 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -454,7 +454,7 @@ static void mdc_hsm_release_pack(struct ptlrpc_request *req, lock = ldlm_handle2lock(&op_data->op_lease_handle); if (lock) { data->cd_handle = lock->l_remote_handle; - ldlm_lock_put(lock); + LDLM_LOCK_PUT(lock); } ldlm_cli_cancel(&op_data->op_lease_handle, LCF_LOCAL); -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:53 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:53 -0400 Subject: [lustre-devel] [PATCH 08/18] staging: lustre: hsm: copy start error should set HP_FLAG_COMPLETED In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-9-git-send-email-jsimmons@infradead.org> From: Aurelien Degremont If an error occurs when initializing a HSM request, in ll_ioc_copy_start(), the PROGRESS message, sent to coordinator, should carry the error code but also HP_FLAG_COMPLETED to mark the request as finished (with error). If not, the Coordinator will ignore this message and consider the request is still running. Signed-off-by: Aurelien Degremont Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3685 Reviewed-on: http://review.whamcloud.com/7265 Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index b085fb4..41481cc 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -959,6 +959,9 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) } progress: + /* On error, the request should be considered as completed */ + if (hpk.hpk_errval > 0) + hpk.hpk_flags |= HP_FLAG_COMPLETED; rc = obd_iocontrol(LL_IOC_HSM_PROGRESS, sbi->ll_md_exp, sizeof(hpk), &hpk, NULL); -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:58 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:58 -0400 Subject: [lustre-devel] [PATCH 13/18] staging: lustre: hsm: Add CLF_RENAME_LAST flag In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-14-git-send-email-jsimmons@infradead.org> From: JC Lafoucriere Create a special flag for the last rename event. Signed-off-by: JC Lafoucriere Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3718 Reviewed-on: http://review.whamcloud.com/7260 Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre/lustre_user.h | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index 4672145..e4e42e1 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -676,7 +676,12 @@ static inline const char *changelog_type2str(int type) #define CLF_UNLINK_HSM_EXISTS 0x0002 /* File has something in HSM */ /* HSM cleaning needed */ /* Flags for rename */ -#define CLF_RENAME_LAST 0x0001 /* rename unlink last hardlink of target */ +#define CLF_RENAME_LAST 0x0001 /* rename unlink last hardlink of + * target + */ +#define CLF_RENAME_LAST_EXISTS 0x0002 /* rename unlink last hardlink of target + * has an archive in backend + */ /* Flags for HSM */ /* 12b used (from high weight to low weight): -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:48 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:48 -0400 Subject: [lustre-devel] [PATCH 03/18] staging: lustre: libcfs: remove userland comments in libcfs_debug.h In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-4-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Remove comments about userland use. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647 Reviewed-on: http://review.whamcloud.com/7243 Reviewed-by: John L. Hammond Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_debug.h | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 98430e7..7472a31 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -85,7 +85,6 @@ struct ptldebug_header { #define PH_FLAG_FIRST_RECORD 1 /* Debugging subsystems (32 bits, non-overlapping) */ -/* keep these in sync with lnet/utils/debug.c and lnet/libcfs/debug.c */ #define S_UNDEFINED 0x00000001 #define S_MDC 0x00000002 #define S_MDS 0x00000004 @@ -118,10 +117,8 @@ struct ptldebug_header { #define S_MGS 0x20000000 #define S_FID 0x40000000 /* b_new_cmd */ #define S_FLD 0x80000000 /* b_new_cmd */ -/* keep these in sync with lnet/utils/debug.c and lnet/libcfs/debug.c */ /* Debugging masks (32 bits, non-overlapping) */ -/* keep these in sync with lnet/utils/debug.c and lnet/libcfs/debug.c */ #define D_TRACE 0x00000001 /* ENTRY/EXIT markers */ #define D_INODE 0x00000002 #define D_SUPER 0x00000004 @@ -151,7 +148,6 @@ struct ptldebug_header { #define D_QUOTA 0x04000000 #define D_SEC 0x08000000 #define D_LFSCK 0x10000000 /* For both OI scrub and LFSCK */ -/* keep these in sync with lnet/{utils,libcfs}/debug.c */ #define D_HSM D_TRACE -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:56 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:56 -0400 Subject: [lustre-devel] [PATCH 11/18] staging: lustre: llite: Delaying creation of client side proc entries. In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-12-git-send-email-jsimmons@infradead.org> From: Gaurav Mahajan In client_common_fill_super() proc entries are created before before cl_sb_init() and therefore lu_site is not allocated resulting in client crash when tried reading lu_site stats. Delaying creation of proc entries after creation of all required data structures fixed the problem. Signed-off-by: Gaurav Mahajan Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2941 Reviewed-on: http://review.whamcloud.com/6852 Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_lib.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 95c55c3..9571742 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -166,12 +166,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, return -ENOMEM; } - if (llite_root) { - err = ldebugfs_register_mountpoint(llite_root, sb, dt, md); - if (err < 0) - CERROR("could not register mount in /lustre/llite\n"); - } - /* indicate the features supported by this client */ data->ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_NODEVOH | OBD_CONNECT_ATTRFID | @@ -552,6 +546,15 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, kfree(data); kfree(osfs); + if (llite_root) { + err = ldebugfs_register_mountpoint(llite_root, sb, dt, md); + if (err < 0) { + CERROR("%s: could not register mount in debugfs: " + "rc = %d\n", ll_get_fsname(sb, NULL, 0), err); + err = 0; + } + } + return err; out_root: iput(root); @@ -570,7 +573,6 @@ out_md: out: kfree(data); kfree(osfs); - ldebugfs_unregister_mountpoint(sbi); return err; } -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:47 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:47 -0400 Subject: [lustre-devel] [PATCH 02/18] staging: lustre: llite: use 64bits flags in ll_lov_setea() In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-3-git-send-email-jsimmons@infradead.org> From: Niu Yawei In ll_lov_setea(), setting MDS_OPEN_HAS_OBJS to an int flags will result in the flags being overflowed. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3744 Reviewed-on: http://review.whamcloud.com/7312 Reviewed-by: Emoly Liu Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 7 ++++--- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/xattr.c | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 69b56a8..02b5783 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1363,7 +1363,8 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg) } int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, - int flags, struct lov_user_md *lum, int lum_size) + __u64 flags, struct lov_user_md *lum, + int lum_size) { struct lov_stripe_md *lsm = NULL; struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = flags}; @@ -1487,7 +1488,7 @@ out: static int ll_lov_setea(struct inode *inode, struct file *file, unsigned long arg) { - int flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE; + __u64 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE; struct lov_user_md *lump; int lum_size = sizeof(struct lov_user_md) + sizeof(struct lov_user_ost_data); @@ -1521,7 +1522,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, struct lov_user_md_v1 __user *lumv1p = (void __user *)arg; struct lov_user_md_v3 __user *lumv3p = (void __user *)arg; int lum_size, rc; - int flags = FMODE_WRITE; + __u64 flags = FMODE_WRITE; /* first try with v1 which is smaller than v3 */ lum_size = sizeof(struct lov_user_md_v1); diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index ba24f09..ccbb9be 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -745,7 +745,7 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type); int ll_inode_permission(struct inode *inode, int mask); int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, - int flags, struct lov_user_md *lum, + __u64 flags, struct lov_user_md *lum, int lum_size); int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, struct lov_mds_md **lmm, int *lmm_size, diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index b68dcc9..6282478 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -243,12 +243,12 @@ int ll_setxattr(struct dentry *dentry, const char *name, lump->lmm_stripe_offset = -1; if (lump && S_ISREG(inode->i_mode)) { - int flags = FMODE_WRITE; + __u64 it_flags = FMODE_WRITE; int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ? sizeof(*lump) : sizeof(struct lov_user_md_v3); - rc = ll_lov_setstripe_ea_info(inode, dentry, flags, lump, - lum_size); + rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags, + lump, lum_size); /* b10667: rc always be 0 here for now */ rc = 0; } else if (S_ISDIR(inode->i_mode)) { -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:50 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:50 -0400 Subject: [lustre-devel] [PATCH 05/18] staging: lustre: libcfs: make D_HSM a unique value In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-6-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Redefine D_HSM. It was defined to D_TRACE. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647 Reviewed-on: http://review.whamcloud.com/7243 Reviewed-by: John L. Hammond Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_debug.h | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 5e60c6f..455c54d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -154,8 +154,7 @@ struct ptldebug_header { #define D_QUOTA 0x04000000 #define D_SEC 0x08000000 #define D_LFSCK 0x10000000 /* For both OI scrub and LFSCK */ - -#define D_HSM D_TRACE +#define D_HSM 0x20000000 #define LIBCFS_DEBUG_MASKS_NAMES { \ "trace", "inode", "super", "ext2", "malloc", "cache", "info", \ -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:46 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:46 -0400 Subject: [lustre-devel] [PATCH 01/18] staging: lustre: ldlm: fix 'deadcode' errors In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-2-git-send-email-jsimmons@infradead.org> From: Sebastien Buisson Fix 'deadcode' issues found by Coverity version 6.5.1: Logically dead code (DEADCODE) Execution cannot reach this statement. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3097 Reviewed-on: http://review.whamcloud.com/7167 Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index b88b786..3f97e1c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -530,12 +530,6 @@ granted: return -EIO; } - if (rc) { - LDLM_DEBUG(lock, "client-side enqueue waking up: failed (%d)", - rc); - return rc; - } - LDLM_DEBUG(lock, "client-side enqueue granted"); lock_res_and_lock(lock); -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:49 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:49 -0400 Subject: [lustre-devel] [PATCH 04/18] staging: lustre: libcfs: create array of debug names In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-5-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Instead of a using a growing case statement to handle more debugging options create a array to map debug flags to string names. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647 Reviewed-on: http://review.whamcloud.com/7243 Reviewed-by: John L. Hammond Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_debug.h | 13 ++ drivers/staging/lustre/lnet/libcfs/debug.c | 126 ++------------------ 2 files changed, 23 insertions(+), 116 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 7472a31..5e60c6f 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -118,6 +118,12 @@ struct ptldebug_header { #define S_FID 0x40000000 /* b_new_cmd */ #define S_FLD 0x80000000 /* b_new_cmd */ +#define LIBCFS_DEBUG_SUBSYS_NAMES { \ + "undefined", "mdc", "mds", "osc", "ost", "class", "log", \ + "llite", "rpc", "mgmt", "lnet", "lnd", "pinger", "filter", "", \ + "echo", "ldlm", "lov", "lquota", "osd", "lfsck", "", "", "lmv", \ + "", "sec", "gss", "", "mgc", "mgs", "fid", "fld", NULL } + /* Debugging masks (32 bits, non-overlapping) */ #define D_TRACE 0x00000001 /* ENTRY/EXIT markers */ #define D_INODE 0x00000002 @@ -151,6 +157,13 @@ struct ptldebug_header { #define D_HSM D_TRACE +#define LIBCFS_DEBUG_MASKS_NAMES { \ + "trace", "inode", "super", "ext2", "malloc", "cache", "info", \ + "ioctl", "neterror", "net", "warning", "buffs", "other", \ + "dentry", "nettrace", "page", "dlmtrace", "error", "emerg", \ + "ha", "rpctrace", "vfstrace", "reada", "mmap", "config", \ + "console", "quota", "sec", "lfsck", "hsm", NULL } + #define D_CANTMASK (D_ERROR | D_EMERG | D_WARNING | D_CONSOLE) #ifndef DEBUG_SUBSYSTEM diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c index c90e510..4753c32 100644 --- a/drivers/staging/lustre/lnet/libcfs/debug.c +++ b/drivers/staging/lustre/lnet/libcfs/debug.c @@ -232,130 +232,24 @@ int libcfs_panic_in_progress; static const char * libcfs_debug_subsys2str(int subsys) { - switch (1 << subsys) { - default: + static const char *libcfs_debug_subsystems[] = LIBCFS_DEBUG_SUBSYS_NAMES; + + if (subsys >= ARRAY_SIZE(libcfs_debug_subsystems)) return NULL; - case S_UNDEFINED: - return "undefined"; - case S_MDC: - return "mdc"; - case S_MDS: - return "mds"; - case S_OSC: - return "osc"; - case S_OST: - return "ost"; - case S_CLASS: - return "class"; - case S_LOG: - return "log"; - case S_LLITE: - return "llite"; - case S_RPC: - return "rpc"; - case S_LNET: - return "lnet"; - case S_LND: - return "lnd"; - case S_PINGER: - return "pinger"; - case S_FILTER: - return "filter"; - case S_ECHO: - return "echo"; - case S_LDLM: - return "ldlm"; - case S_LOV: - return "lov"; - case S_LQUOTA: - return "lquota"; - case S_OSD: - return "osd"; - case S_LFSCK: - return "lfsck"; - case S_LMV: - return "lmv"; - case S_SEC: - return "sec"; - case S_GSS: - return "gss"; - case S_MGC: - return "mgc"; - case S_MGS: - return "mgs"; - case S_FID: - return "fid"; - case S_FLD: - return "fld"; - } + + return libcfs_debug_subsystems[subsys]; } /* libcfs_debug_token2mask() expects the returned string in lower-case */ static const char * libcfs_debug_dbg2str(int debug) { - switch (1 << debug) { - default: + static const char *libcfs_debug_masks[] = LIBCFS_DEBUG_MASKS_NAMES; + + if (debug >= ARRAY_SIZE(libcfs_debug_masks)) return NULL; - case D_TRACE: - return "trace"; - case D_INODE: - return "inode"; - case D_SUPER: - return "super"; - case D_EXT2: - return "ext2"; - case D_MALLOC: - return "malloc"; - case D_CACHE: - return "cache"; - case D_INFO: - return "info"; - case D_IOCTL: - return "ioctl"; - case D_NETERROR: - return "neterror"; - case D_NET: - return "net"; - case D_WARNING: - return "warning"; - case D_BUFFS: - return "buffs"; - case D_OTHER: - return "other"; - case D_DENTRY: - return "dentry"; - case D_NETTRACE: - return "nettrace"; - case D_PAGE: - return "page"; - case D_DLMTRACE: - return "dlmtrace"; - case D_ERROR: - return "error"; - case D_EMERG: - return "emerg"; - case D_HA: - return "ha"; - case D_RPCTRACE: - return "rpctrace"; - case D_VFSTRACE: - return "vfstrace"; - case D_READA: - return "reada"; - case D_MMAP: - return "mmap"; - case D_CONFIG: - return "config"; - case D_CONSOLE: - return "console"; - case D_QUOTA: - return "quota"; - case D_SEC: - return "sec"; - case D_LFSCK: - return "lfsck"; - } + + return libcfs_debug_masks[debug]; } int -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:37:01 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:37:01 -0400 Subject: [lustre-devel] [PATCH 16/18] staging: lustre: hsm: Add support to drop all pages for ll_data_version In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-17-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong This will be used by HSM release to get data version and drop all caching pages from all clients, before sending IT_RELEASE close REQ to MDT. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647 Reviewed-on: http://review.whamcloud.com/6794 Reviewed-by: John L. Hammond Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre/lustre_idl.h | 1 + .../lustre/lustre/include/lustre/lustre_user.h | 5 +-- drivers/staging/lustre/lustre/llite/dir.c | 5 +-- drivers/staging/lustre/lustre/llite/file.c | 35 ++++++++++++-------- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 11 ++++++ 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 12e6718..fa4cbbe 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1428,6 +1428,7 @@ enum obdo_flags { */ OBD_FL_RECOV_RESEND = 0x00080000, /* recoverable resent */ OBD_FL_NOSPC_BLK = 0x00100000, /* no more block space on OST */ + OBD_FL_FLUSH = 0x00200000, /* flush pages on the OST */ /* Note that while these checksum values are currently separate bits, * in 2.x we can actually allow all values from 1-31 if we wanted. diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index e4e42e1..59ba48a 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -838,9 +838,8 @@ struct ioc_data_version { __u64 idv_flags; /* See LL_DV_xxx */ }; -#define LL_DV_NOFLUSH 0x01 /* Do not take READ EXTENT LOCK before sampling - * version. Dirty caches are left unchanged. - */ +#define LL_DV_RD_FLUSH BIT(0) /* Flush dirty pages from clients */ +#define LL_DV_WR_FLUSH BIT(1) /* Flush all caching pages from clients */ #ifndef offsetof # define offsetof(typ, memb) ((unsigned long)((char *)&(((typ *)0)->memb))) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 7251bef..45bdf8f 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -941,7 +941,7 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) } /* Read current file data version */ - rc = ll_data_version(inode, &data_version, 1); + rc = ll_data_version(inode, &data_version, LL_DV_RD_FLUSH); iput(inode); if (rc != 0) { CDEBUG(D_HSM, "Could not read file data version of " @@ -1025,8 +1025,7 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) goto progress; } - rc = ll_data_version(inode, &data_version, - copy->hc_hai.hai_action == HSMA_ARCHIVE); + rc = ll_data_version(inode, &data_version, LL_DV_RD_FLUSH); iput(inode); if (rc) { CDEBUG(D_HSM, "Could not read file data version. Request could not be confirmed.\n"); diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index ac17360..9b553d2 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -929,7 +929,7 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode, /* Fills the obdo with the attributes for the lsm */ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp, - struct obdo *obdo, __u64 ioepoch, int sync) + struct obdo *obdo, __u64 ioepoch, int dv_flags) { struct ptlrpc_request_set *set; struct obd_info oinfo = { }; @@ -948,9 +948,11 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp, OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLGROUP | OBD_MD_FLEPOCH | OBD_MD_FLDATAVERSION; - if (sync) { + if (dv_flags & (LL_DV_WR_FLUSH | LL_DV_RD_FLUSH)) { oinfo.oi_oa->o_valid |= OBD_MD_FLFLAGS; oinfo.oi_oa->o_flags |= OBD_FL_SRVLOCK; + if (dv_flags & LL_DV_WR_FLUSH) + oinfo.oi_oa->o_flags |= OBD_FL_FLUSH; } set = ptlrpc_prep_set(); @@ -963,11 +965,16 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp, rc = ptlrpc_set_wait(set); ptlrpc_set_destroy(set); } - if (rc == 0) + if (rc == 0) { oinfo.oi_oa->o_valid &= (OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ | OBD_MD_FLATIME | OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLSIZE | - OBD_MD_FLDATAVERSION); + OBD_MD_FLDATAVERSION | OBD_MD_FLFLAGS); + if (dv_flags & LL_DV_WR_FLUSH && + !(oinfo.oi_oa->o_valid & OBD_MD_FLFLAGS && + oinfo.oi_oa->o_flags & OBD_FL_FLUSH)) + return -ENOTSUPP; + } return rc; } @@ -983,7 +990,7 @@ int ll_inode_getattr(struct inode *inode, struct obdo *obdo, lsm = ccc_inode_lsm_get(inode); rc = ll_lsm_getattr(lsm, ll_i2dtexp(inode), - obdo, ioepoch, sync); + obdo, ioepoch, sync ? LL_DV_RD_FLUSH : 0); if (rc == 0) { struct ost_id *oi = lsm ? &lsm->lsm_oi : &obdo->o_oi; @@ -1874,11 +1881,12 @@ error: * This value is computed using stripe object version on OST. * Version is computed using server side locking. * - * @param extent_lock Take extent lock. Not needed if a process is already - * holding the OST object group locks. + * @param sync if do sync on the OST side; + * 0: no sync + * LL_DV_RD_FLUSH: flush dirty pages, LCK_PR on OSTs + * LL_DV_WR_FLUSH: drop all caching pages, LCK_PW on OSTs */ -int ll_data_version(struct inode *inode, __u64 *data_version, - int extent_lock) +int ll_data_version(struct inode *inode, __u64 *data_version, int flags) { struct lov_stripe_md *lsm = NULL; struct ll_sb_info *sbi = ll_i2sbi(inode); @@ -1900,7 +1908,7 @@ int ll_data_version(struct inode *inode, __u64 *data_version, goto out; } - rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, obdo, 0, extent_lock); + rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, obdo, 0, flags); if (rc == 0) { if (!(obdo->o_valid & OBD_MD_FLDATAVERSION)) rc = -EOPNOTSUPP; @@ -1936,7 +1944,7 @@ int ll_hsm_release(struct inode *inode) } /* Grab latest data_version and [am]time values */ - rc = ll_data_version(inode, &data_version, 1); + rc = ll_data_version(inode, &data_version, LL_DV_WR_FLUSH); if (rc != 0) goto out; @@ -2344,9 +2352,8 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (copy_from_user(&idv, (char __user *)arg, sizeof(idv))) return -EFAULT; - rc = ll_data_version(inode, &idv.idv_version, - !(idv.idv_flags & LL_DV_NOFLUSH)); - + idv.idv_flags &= LL_DV_RD_FLUSH | LL_DV_WR_FLUSH; + rc = ll_data_version(inode, &idv.idv_version, idv.idv_flags); if (rc == 0 && copy_to_user((char __user *)arg, &idv, sizeof(idv))) return -EFAULT; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index ccbb9be..d67c8c0 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -757,7 +757,7 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, int ll_fsync(struct file *file, loff_t start, loff_t end, int data); int ll_merge_attr(const struct lu_env *env, struct inode *inode); int ll_fid2path(struct inode *inode, void __user *arg); -int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock); +int ll_data_version(struct inode *inode, __u64 *data_version, int flags); int ll_hsm_release(struct inode *inode); /* llite/dcache.c */ diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index 029cd4d..56ef41d 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -154,6 +154,7 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid, valid &= src->o_valid; if (*set) { + tgt->o_valid &= valid; if (valid & OBD_MD_FLSIZE) { /* this handles sparse files properly */ u64 lov_size; @@ -172,12 +173,22 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid, tgt->o_mtime = src->o_mtime; if (valid & OBD_MD_FLDATAVERSION) tgt->o_data_version += src->o_data_version; + + /* handle flags */ + if (valid & OBD_MD_FLFLAGS) + tgt->o_flags &= src->o_flags; + else + tgt->o_flags = 0; } else { memcpy(tgt, src, sizeof(*tgt)); tgt->o_oi = lsm->lsm_oi; + tgt->o_valid = valid; if (valid & OBD_MD_FLSIZE) tgt->o_size = lov_stripe_size(lsm, src->o_size, stripeno); + tgt->o_flags = 0; + if (valid & OBD_MD_FLFLAGS) + tgt->o_flags = src->o_flags; } /* data_version needs to be valid on all stripes to be correct! */ -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:55 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:55 -0400 Subject: [lustre-devel] [PATCH 10/18] staging: lustre: llite: reset writeback index in ll_writepages In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-11-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Otherwise after one round the writeback index will become beyond the file size and ->writepages() turns into an empty operation. Also, a safety guard is added to limit the wait time for grant to 10 minutes(take recovery into consideration) at maximum in the osc_enter_cache() function. Otherwise, EDQUOT will be returned to the applications to start sync write. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3416 Reviewed-on: http://review.whamcloud.com/6554 Reviewed-by: Bobi Jam Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/rw.c | 5 ++- drivers/staging/lustre/lustre/osc/osc_cache.c | 31 +++++++++++++++++-------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 7d5dd38..ab490a5 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -1110,8 +1110,9 @@ int ll_writepages(struct address_space *mapping, struct writeback_control *wbc) if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) { if (end == OBD_OBJECT_EOF) - end = i_size_read(inode); - mapping->writeback_index = (end >> PAGE_CACHE_SHIFT) + 1; + mapping->writeback_index = 0; + else + mapping->writeback_index = (end >> PAGE_CACHE_SHIFT) + 1; } return result; } diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index d01f2a2..f09b89d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1379,15 +1379,19 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, return 0; } -#define OSC_DUMP_GRANT(cli, fmt, args...) do { \ +#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do { \ struct client_obd *__tmp = (cli); \ - CDEBUG(D_CACHE, "%s: { dirty: %ld/%ld dirty_pages: %d/%d " \ - "dropped: %ld avail: %ld, reserved: %ld, flight: %d } " fmt, \ + CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %d/%d " \ + "dropped: %ld avail: %ld, reserved: %ld, flight: %d } " \ + "lru {in list: %d, left: %d, waiters: %d }" fmt, \ __tmp->cl_import->imp_obd->obd_name, \ __tmp->cl_dirty, __tmp->cl_dirty_max, \ atomic_read(&obd_dirty_pages), obd_max_dirty_pages, \ __tmp->cl_lost_grant, __tmp->cl_avail_grant, \ - __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, ##args); \ + __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, \ + atomic_read(&__tmp->cl_lru_in_list), \ + atomic_read(&__tmp->cl_lru_busy), \ + atomic_read(&__tmp->cl_lru_shrinkers), ##args); \ } while (0) /* caller must hold loi_list_lock */ @@ -1527,7 +1531,7 @@ static int osc_enter_cache_try(struct client_obd *cli, { int rc; - OSC_DUMP_GRANT(cli, "need:%d.\n", bytes); + OSC_DUMP_GRANT(D_CACHE, cli, "need:%d.\n", bytes); rc = osc_reserve_grant(cli, bytes); if (rc < 0) @@ -1572,10 +1576,11 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, struct osc_object *osc = oap->oap_obj; struct lov_oinfo *loi = osc->oo_oinfo; struct osc_cache_waiter ocw; - struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); + struct l_wait_info lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(600), NULL, + LWI_ON_SIGNAL_NOOP, NULL); int rc = -EDQUOT; - OSC_DUMP_GRANT(cli, "need:%d.\n", bytes); + OSC_DUMP_GRANT(D_CACHE, cli, "need:%d.\n", bytes); spin_lock(&cli->cl_loi_list_lock); @@ -1619,8 +1624,14 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, spin_lock(&cli->cl_loi_list_lock); - /* l_wait_event is interrupted by signal */ + /* l_wait_event is interrupted by signal, or timed out */ if (rc < 0) { + if (rc == -ETIMEDOUT) { + OSC_DUMP_GRANT(D_ERROR, cli, + "try to reserve %d.\n", bytes); + osc_extent_tree_dump(D_ERROR, osc); + rc = -EDQUOT; + } list_del_init(&ocw.ocw_entry); goto out; } @@ -1637,7 +1648,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, } out: spin_unlock(&cli->cl_loi_list_lock); - OSC_DUMP_GRANT(cli, "returned %d.\n", rc); + OSC_DUMP_GRANT(D_CACHE, cli, "returned %d.\n", rc); return rc; } @@ -3007,7 +3018,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, result = rc; } - OSC_IO_DEBUG(obj, "cache page out.\n"); + OSC_IO_DEBUG(obj, "pageout [%lu, %lu], %d.\n", start, end, result); return result; } -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:37:00 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:37:00 -0400 Subject: [lustre-devel] [PATCH 15/18] staging: lustre: llite: cancel open lock before closing file In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-16-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong In error handling path of ll_lease_open(), och has already been freed in ll_close_inode_openhandle() so the sequence of cancel open lock and close open handle need adjusting. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3647 Reviewed-on: http://review.whamcloud.com/7346 Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 000ea58..ac17360 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -875,16 +875,19 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode, return och; out_close: - rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och, NULL); - if (rc2) - CERROR("Close openhandle returned %d\n", rc2); - - /* cancel open lock */ + /* Cancel open lock */ if (it.d.lustre.it_lock_mode != 0) { ldlm_lock_decref_and_cancel(&och->och_lease_handle, it.d.lustre.it_lock_mode); it.d.lustre.it_lock_mode = 0; + och->och_lease_handle.cookie = 0ULL; } + rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, inode, och, NULL); + if (rc2 < 0) + CERROR("%s: error closing file "DFID": %d\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(&ll_i2info(inode)->lli_fid), rc2); + och = NULL; /* och has been freed in ll_close_inode_openhandle() */ out_release_it: ll_intent_release(&it); out: -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:37:03 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:37:03 -0400 Subject: [lustre-devel] [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-19-git-send-email-jsimmons@infradead.org> When Lustre is in a read or write system call and receives a SIGALRM, it will return EINTR if interrupted in osc_enter_cache. This prevents the system call from being restarted if SA_RESTART is set in the handler. This patch changes behavior in this location to return ERESTARTSYS when a signal arrives during the call to l_wait_event. Signed-off-by: Patrick Farrell Signed-off-by: James Simmons ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581 Reviewed-on: http://review.whamcloud.com/7002 Reviewed-by: Rahul Deshmukh Reviewed-by: Cory Spitz Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_cache.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index f09b89d..956d57b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1626,11 +1626,22 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, /* l_wait_event is interrupted by signal, or timed out */ if (rc < 0) { - if (rc == -ETIMEDOUT) { + switch (rc) { + case -ETIMEDOUT: OSC_DUMP_GRANT(D_ERROR, cli, "try to reserve %d.\n", bytes); osc_extent_tree_dump(D_ERROR, osc); rc = -EDQUOT; + break; + case -EINTR: + /* Ensures restartability - LU-3581 */ + rc = -ERESTARTSYS; + break; + default: + CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d\n", + cli->cl_import->imp_obd->obd_name, + &ocw, rc); + break; } list_del_init(&ocw.ocw_entry); goto out; -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:59 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:59 -0400 Subject: [lustre-devel] [PATCH 14/18] staging: lustre: fix 'NULL pointer dereference' errors In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-15-git-send-email-jsimmons@infradead.org> From: Sebastien Buisson Fix 'NULL pointer dereference' defects found by Coverity version 6.5.0: Dereference after null check (FORWARD_NULL) For instance, Passing null pointer to a function which dereferences it. Dereference before null check (REVERSE_INULL) Null-checking variable suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Dereference null return value (NULL_RETURNS) Signed-off-by: Sebastien Buisson Signed-off-by: James Nunez Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3042 Reviewed-on: http://review.whamcloud.com/5868 Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 10 ++++++---- drivers/staging/lustre/lustre/lov/lov_io.c | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 41481cc..7251bef 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -612,15 +612,16 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) struct inode *inode = file_inode(filp); struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); struct ll_sb_info *sbi = ll_i2sbi(inode); + __u64 pos = lfd ? lfd->lfd_pos : 0; int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; int api32 = ll_need_32bit_api(sbi); int rc; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu 32bit_api %d\n", inode->i_ino, inode->i_generation, - inode, (unsigned long)lfd->lfd_pos, i_size_read(inode), api32); + inode, (unsigned long)pos, i_size_read(inode), api32); - if (lfd->lfd_pos == MDS_DIR_END_OFF) { + if (pos == MDS_DIR_END_OFF) { /* * end-of-file. */ @@ -628,9 +629,10 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) goto out; } - ctx->pos = lfd->lfd_pos; + ctx->pos = pos; rc = ll_dir_read(inode, ctx); - lfd->lfd_pos = ctx->pos; + if (lfd) + lfd->lfd_pos = ctx->pos; if (ctx->pos == MDS_DIR_END_OFF) { if (api32) ctx->pos = LL_DIR_END_OFF_32BIT; diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 4151237..0b59393 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -276,10 +276,11 @@ struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio, static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, struct cl_io *io) { - struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; + struct lov_stripe_md *lsm; int result; LASSERT(lio->lis_object); + lsm = lio->lis_object->lo_lsm; /* * Need to be optimized, we can't afford to allocate a piece of memory -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:57 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:57 -0400 Subject: [lustre-devel] [PATCH 12/18] staging: lustre: mdc: document mdc_rpc_lock In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-13-git-send-email-jsimmons@infradead.org> From: Ned Bass As this lock can be a bottleneck, clarifying why it is needed may be helpful to those working on client performance. Signed-off-by: Ned Bass Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3443 Reviewed-on: http://review.whamcloud.com/6593 Reviewed-by: Andreas Dilger Reviewed-by: Keith Mannthey Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre_mdc.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h b/drivers/staging/lustre/lustre/include/lustre_mdc.h index df94f9f..9e54790 100644 --- a/drivers/staging/lustre/lustre/include/lustre_mdc.h +++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h @@ -64,9 +64,27 @@ struct obd_export; struct ptlrpc_request; struct obd_device; +/** + * Serializes in-flight MDT-modifying RPC requests to preserve idempotency. + * + * This mutex is used to implement execute-once semantics on the MDT. + * The MDT stores the last transaction ID and result for every client in + * its last_rcvd file. If the client doesn't get a reply, it can safely + * resend the request and the MDT will reconstruct the reply being aware + * that the request has already been executed. Without this lock, + * execution status of concurrent in-flight requests would be + * overwritten. + * + * This design limits the extent to which we can keep a full pipeline of + * in-flight requests from a single client. This limitation could be + * overcome by allowing multiple slots per client in the last_rcvd file. + */ struct mdc_rpc_lock { + /** Lock protecting in-flight RPC concurrency. */ struct mutex rpcl_mutex; + /** Intent associated with currently executing request. */ struct lookup_intent *rpcl_it; + /** Used for MDS/RPC load testing purposes. */ int rpcl_fakes; }; -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:36:54 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:36:54 -0400 Subject: [lustre-devel] [PATCH 09/18] staging: lustre: lov: Get the correct address of lmm_objects In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-10-git-send-email-jsimmons@infradead.org> From: Swapnil Pimpale The introduction of lmm_layout_gen makes the assumption that lmm_objects is present after lmm_stripe_count incorrect. Fixed this to get the correct address of lmm_objects when lmmk is cast to lov_mds_md_v1. Signed-off-by: Swapnil Pimpale Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3162 Reviewed-on: http://review.whamcloud.com/7258 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_pack.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 3925633..2f02be5 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -444,8 +444,7 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, if (lum.lmm_magic == LOV_USER_MAGIC) { /* User request for v1, we need skip lmm_pool_name */ if (lmmk->lmm_magic == LOV_MAGIC_V3) { - memmove((char *)(&lmmk->lmm_stripe_count) + - sizeof(lmmk->lmm_stripe_count), + memmove(((struct lov_mds_md_v1 *)lmmk)->lmm_objects, ((struct lov_mds_md_v3 *)lmmk)->lmm_objects, lmmk->lmm_stripe_count * sizeof(struct lov_ost_data_v1)); -- 1.7.1 From jsimmons at infradead.org Tue Apr 5 01:37:02 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 4 Apr 2016 21:37:02 -0400 Subject: [lustre-devel] [PATCH 17/18] staging: lustre: fix 'no effect' errors In-Reply-To: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459820223-24754-18-git-send-email-jsimmons@infradead.org> From: Sebastien Buisson Fix 'no effect' issues found by Coverity version 6.5.1: Unsigned compared against 0 (NO_EFFECT) This greater-than-or-equal-to-zero comparison of an unsigned value is always true. Remove useless cast. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3907 Reviewed-on: http://review.whamcloud.com/7166 Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/xattr.c | 3 +-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 6282478..6589108 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -423,8 +423,7 @@ getxattr_nocache: if (rce && rce->rce_ops == RMT_LSETFACL) { ext_acl_xattr_header *acl; - acl = lustre_posix_acl_xattr_2ext( - (posix_acl_xattr_header *)buffer, rc); + acl = lustre_posix_acl_xattr_2ext(buffer, rc); if (IS_ERR(acl)) { rc = PTR_ERR(acl); goto out; diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 8bd2dc5..3969732 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -926,7 +926,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, struct obd_quotactl *oqctl; if (qctl->qc_valid == QC_MDTIDX) { - if (qctl->qc_idx < 0 || count <= qctl->qc_idx) + if (count <= qctl->qc_idx) return -EINVAL; tgt = lmv->tgts[qctl->qc_idx]; -- 1.7.1 From gregkh at linuxfoundation.org Tue Apr 5 12:59:27 2016 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Tue, 5 Apr 2016 08:59:27 -0400 Subject: [lustre-devel] [PATCH 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> Message-ID: <20160405125927.GA25853@kroah.com> On Tue, Apr 05, 2016 at 07:56:53PM +0800, Ming Lei wrote: > Signed-off-by: Ming Lei A bit more of a commit message is always nice :) Acked-by: Greg Kroah-Hartman From sudipm.mukherjee at gmail.com Tue Apr 5 14:45:34 2016 From: sudipm.mukherjee at gmail.com (Sudip Mukherjee) Date: Tue, 5 Apr 2016 20:15:34 +0530 Subject: [lustre-devel] [PATCH] staging/lustre/obdclass: fix build warning Message-ID: <1459867534-4507-1-git-send-email-sudipm.mukherjee@gmail.com> While building with W=1 we were getting the warning: drivers/staging/lustre/lustre/obdclass/cl_object.c:1056:16: warning: old-style function definition struct lu_env *cl_env_percpu_get() ^ Signed-off-by: Sudip Mukherjee --- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 395b92c..d84ec00 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -1053,7 +1053,7 @@ void cl_env_percpu_put(struct lu_env *env) } EXPORT_SYMBOL(cl_env_percpu_put); -struct lu_env *cl_env_percpu_get() +struct lu_env *cl_env_percpu_get(void) { struct cl_env *cle; -- 1.9.1 From hch at infradead.org Tue Apr 5 13:01:09 2016 From: hch at infradead.org (Christoph Hellwig) Date: Tue, 5 Apr 2016 06:01:09 -0700 Subject: [lustre-devel] [PATCH 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> Message-ID: <20160405130109.GB32576@infradead.org> The lloop driver should be removed entirely - use the loop driver instead. From tom.leiming at gmail.com Tue Apr 5 11:56:53 2016 From: tom.leiming at gmail.com (Ming Lei) Date: Tue, 5 Apr 2016 19:56:53 +0800 Subject: [lustre-devel] [PATCH 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> Message-ID: <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> Signed-off-by: Ming Lei --- drivers/staging/lustre/lustre/llite/lloop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index b725fc1..67323db 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -302,19 +302,20 @@ static unsigned int loop_get_bio(struct lloop_device *lo, struct bio **req) } /* TODO: need to split the bio, too bad. */ - LASSERT(first->bi_vcnt <= LLOOP_MAX_SEGMENTS); + LASSERT(bio_pages(first) <= LLOOP_MAX_SEGMENTS); rw = first->bi_rw; bio = &lo->lo_bio; while (*bio && (*bio)->bi_rw == rw) { + unsigned curr_cnt = bio_pages(*bio); CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt%u\n", (unsigned long long)(*bio)->bi_iter.bi_sector, (*bio)->bi_iter.bi_size, - page_count, (*bio)->bi_vcnt); - if (page_count + (*bio)->bi_vcnt > LLOOP_MAX_SEGMENTS) + page_count, curr_cnt); + if (page_count + curr_cnt > LLOOP_MAX_SEGMENTS) break; - page_count += (*bio)->bi_vcnt; + page_count += curr_cnt; count++; bio = &(*bio)->bi_next; } -- 1.9.1 From tom.leiming at gmail.com Tue Apr 5 11:56:45 2016 From: tom.leiming at gmail.com (Ming Lei) Date: Tue, 5 Apr 2016 19:56:45 +0800 Subject: [lustre-devel] [PATCH 00/27] block: cleanup direct access on .bi_vcnt & .bi_io_vec Message-ID: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> Hi Guys, It is always not a good practice to access bio->bi_vcnt and bio->bi_io_vec from drivers directly. Also this kind of direct access will cause trouble when converting to multipage bvecs. The 1st patch introduces the following 4 bio helpers which can be used inside drivers for avoiding direct access to .bi_vcnt and .bi_io_vec. bio_pages() bio_is_full() bio_get_base_vec() bio_set_vec_table() Both bio_pages() and bio_is_full() can be easy to convert to multipage bvecs. For bio_get_base_vec() and bio_set_vec_table(), they are often used during initializing a new bio or in case of single bvec bio. With the two new helpers, it becomes quite easy to audit access to .bi_io_vec and .bi_vcnt. Most of the other patches use the 4 helpers to clean up most of direct access to .bi_vcnt and .bi_io_vec from drivers, except for MD and btrfs, which two subsystems will be done in the future. Also bio_add_page() is used in floppy, dm-crypt and fs/logfs to avoiding direct access to .bi_vcnt & .bi_io_vec. Thanks, Ming Ming Lei (27): block: bio: introduce 4 helpers for cleanup block: drbd: use bio_get_base_vec() to retrieve the 1st bvec block: drbd: remove impossible failure handling block: loop: use bio_get_base_vec() to retrive bvec table block: pktcdvd: use bio_get_base_vec() to retrive bvec table block: floppy: use bio_set_vec_table() block: floppy: use bio_add_page() staging: lustre: avoid to use bio->bi_vcnt directly target: use bio_is_full() bcache: debug: avoid to access .bi_io_vec directly bcache: io.c: use bio_set_vec_table bcache: journal.c: use bio_set_vec_table() bcache: movinggc: use bio_set_vec_table() bcache: writeback: use bio_set_vec_table() bcache: super: use bio_set_vec_table() bcache: super: use bio_get_base_vec dm: crypt: use bio_add_page() dm: dm-io.c: use bio_get_base_vec() dm: dm.c: replace 'bio->bi_vcnt == 1' with !bio_multiple_segments dm: dm-bufio.c: use bio_set_vec_table() fs: logfs: use bio_set_vec_table() fs: logfs: convert to bio_add_page() in sync_request() fs: logfs: use bio_add_page() in __bdev_writeseg() fs: logfs: use bio_add_page() in do_erase() fs: logfs: remove unnecesary check kernel/power/swap.c: use bio_get_base_vec() mm: page_io.c: use bio_get_base_vec() drivers/block/drbd/drbd_bitmap.c | 4 +- drivers/block/drbd/drbd_receiver.c | 14 +--- drivers/block/floppy.c | 9 +-- drivers/block/loop.c | 5 +- drivers/block/pktcdvd.c | 3 +- drivers/md/bcache/debug.c | 11 ++- drivers/md/bcache/io.c | 3 +- drivers/md/bcache/journal.c | 3 +- drivers/md/bcache/movinggc.c | 6 +- drivers/md/bcache/super.c | 28 +++++--- drivers/md/bcache/writeback.c | 4 +- drivers/md/dm-bufio.c | 3 +- drivers/md/dm-crypt.c | 8 +-- drivers/md/dm-io.c | 7 +- drivers/md/dm.c | 3 +- drivers/staging/lustre/lustre/llite/lloop.c | 9 +-- drivers/target/target_core_pscsi.c | 2 +- fs/logfs/dev_bdev.c | 107 +++++++++++----------------- include/linux/bio.h | 28 ++++++++ kernel/power/swap.c | 10 ++- mm/page_io.c | 18 ++++- 21 files changed, 156 insertions(+), 129 deletions(-) -- 1.9.1 From jsimmons at infradead.org Wed Apr 6 18:55:52 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 19:55:52 +0100 (BST) Subject: [lustre-devel] [PATCH] staging/lustre/obdclass: fix build warning In-Reply-To: <1459867534-4507-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1459867534-4507-1-git-send-email-sudipm.mukherjee@gmail.com> Message-ID: > While building with W=1 we were getting the warning: > > drivers/staging/lustre/lustre/obdclass/cl_object.c:1056:16: > warning: old-style function definition > struct lu_env *cl_env_percpu_get() > ^ > > Signed-off-by: Sudip Mukherjee Acked-by: James Simmons > --- > drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c > index 395b92c..d84ec00 100644 > --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c > +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c > @@ -1053,7 +1053,7 @@ void cl_env_percpu_put(struct lu_env *env) > } > EXPORT_SYMBOL(cl_env_percpu_put); > > -struct lu_env *cl_env_percpu_get() > +struct lu_env *cl_env_percpu_get(void) > { > struct cl_env *cle; > > -- > 1.9.1 > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From jsimmons at infradead.org Wed Apr 6 19:25:29 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:29 -0400 Subject: [lustre-devel] [PATCH 03/24] staging: lustre: selftest: convert srpc_bulk_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-4-git-send-email-jsimmons@infradead.org> Turn typedef srpc_bulk_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 14 +++++++------- drivers/staging/lustre/lnet/selftest/conrpc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/framework.c | 2 +- drivers/staging/lustre/lnet/selftest/rpc.c | 18 +++++++++--------- drivers/staging/lustre/lnet/selftest/selftest.h | 17 +++++++++-------- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 1988cee..a3dec89 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -51,7 +51,7 @@ MODULE_PARM_DESC(brw_inject_errors, "# data errors to inject randomly, zero by d static void brw_client_fini(sfw_test_instance_t *tsi) { - srpc_bulk_t *bulk; + struct srpc_bulk *bulk; sfw_test_unit_t *tsu; LASSERT(tsi->tsi_is_client); @@ -74,7 +74,7 @@ brw_client_init(sfw_test_instance_t *tsi) int npg; int len; int opc; - srpc_bulk_t *bulk; + struct srpc_bulk *bulk; sfw_test_unit_t *tsu; LASSERT(sn); @@ -224,7 +224,7 @@ bad_data: } static void -brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic) +brw_fill_bulk(struct srpc_bulk *bk, int pattern, __u64 magic) { int i; struct page *pg; @@ -236,7 +236,7 @@ brw_fill_bulk(srpc_bulk_t *bk, int pattern, __u64 magic) } static int -brw_check_bulk(srpc_bulk_t *bk, int pattern, __u64 magic) +brw_check_bulk(struct srpc_bulk *bk, int pattern, __u64 magic) { int i; struct page *pg; @@ -257,7 +257,7 @@ static int brw_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, srpc_client_rpc_t **rpcpp) { - srpc_bulk_t *bulk = tsu->tsu_private; + struct srpc_bulk *bulk = tsu->tsu_private; sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_session_t *sn = tsi->tsi_batch->bat_session; srpc_client_rpc_t *rpc; @@ -297,7 +297,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, if (rc) return rc; - memcpy(&rpc->crpc_bulk, bulk, offsetof(srpc_bulk_t, bk_iovs[npg])); + memcpy(&rpc->crpc_bulk, bulk, offsetof(struct srpc_bulk, bk_iovs[npg])); if (opc == LST_BRW_WRITE) brw_fill_bulk(&rpc->crpc_bulk, flags, BRW_MAGIC); else @@ -361,7 +361,7 @@ brw_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) static void brw_server_rpc_done(struct srpc_server_rpc *rpc) { - srpc_bulk_t *blk = rpc->srpc_bulk; + struct srpc_bulk *blk = rpc->srpc_bulk; if (!blk) return; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 3908c10..53da5cb 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -150,7 +150,7 @@ lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats, void lstcon_rpc_put(lstcon_rpc_t *crpc) { - srpc_bulk_t *bulk = &crpc->crp_rpc->crpc_bulk; + struct srpc_bulk *bulk = &crpc->crp_rpc->crpc_bulk; int i; LASSERT(list_empty(&crpc->crp_link)); @@ -812,7 +812,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, lstcon_group_t *sgrp = test->tes_src_grp; lstcon_group_t *dgrp = test->tes_dst_grp; srpc_test_reqst_t *trq; - srpc_bulk_t *bulk; + struct srpc_bulk *bulk; int i; int npg = 0; int nob = 0; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index aa646a7..40a3da9 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -733,7 +733,7 @@ sfw_add_test_instance(sfw_batch_t *tsb, struct srpc_server_rpc *rpc) { srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg; srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; - srpc_bulk_t *bk = rpc->srpc_bulk; + struct srpc_bulk *bk = rpc->srpc_bulk; int ndest = req->tsr_ndest; sfw_test_unit_t *tsu; sfw_test_instance_t *tsi; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index ba75b34..387c306 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -88,7 +88,7 @@ void srpc_set_counters(const srpc_counters_t *cnt) } static int -srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob) +srpc_add_bulk_page(struct srpc_bulk *bk, struct page *pg, int i, int nob) { nob = min_t(int, nob, PAGE_CACHE_SIZE); @@ -102,7 +102,7 @@ srpc_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i, int nob) } void -srpc_free_bulk(srpc_bulk_t *bk) +srpc_free_bulk(struct srpc_bulk *bk) { int i; struct page *pg; @@ -117,25 +117,25 @@ srpc_free_bulk(srpc_bulk_t *bk) __free_page(pg); } - LIBCFS_FREE(bk, offsetof(srpc_bulk_t, bk_iovs[bk->bk_niov])); + LIBCFS_FREE(bk, offsetof(struct srpc_bulk, bk_iovs[bk->bk_niov])); } -srpc_bulk_t * +struct srpc_bulk * srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink) { - srpc_bulk_t *bk; + struct srpc_bulk *bk; int i; LASSERT(bulk_npg > 0 && bulk_npg <= LNET_MAX_IOV); LIBCFS_CPT_ALLOC(bk, lnet_cpt_table(), cpt, - offsetof(srpc_bulk_t, bk_iovs[bulk_npg])); + offsetof(struct srpc_bulk, bk_iovs[bulk_npg])); if (!bk) { CERROR("Can't allocate descriptor for %d pages\n", bulk_npg); return NULL; } - memset(bk, 0, offsetof(srpc_bulk_t, bk_iovs[bulk_npg])); + memset(bk, 0, offsetof(struct srpc_bulk, bk_iovs[bulk_npg])); bk->bk_sink = sink; bk->bk_len = bulk_len; bk->bk_niov = bulk_npg; @@ -840,7 +840,7 @@ srpc_prepare_reply(srpc_client_rpc_t *rpc) static int srpc_prepare_bulk(srpc_client_rpc_t *rpc) { - srpc_bulk_t *bk = &rpc->crpc_bulk; + struct srpc_bulk *bk = &rpc->crpc_bulk; struct srpc_event *ev = &rpc->crpc_bulkev; __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.bulkid; int rc; @@ -874,7 +874,7 @@ static int srpc_do_bulk(struct srpc_server_rpc *rpc) { struct srpc_event *ev = &rpc->srpc_ev; - srpc_bulk_t *bk = rpc->srpc_bulk; + struct srpc_bulk *bk = rpc->srpc_bulk; __u64 id = rpc->srpc_reqstbuf->buf_msg.msg_body.reqst.bulkid; int rc; int opt; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 43972eb..fdf62cc 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -154,13 +154,14 @@ struct srpc_event { void *ev_data; /* owning server/client RPC */ }; -typedef struct { +/* bulk descriptor */ +struct srpc_bulk { int bk_len; /* len of bulk data */ lnet_handle_md_t bk_mdh; int bk_sink; /* sink/source */ int bk_niov; /* # iov in bk_iovs */ lnet_kiov_t bk_iovs[0]; -} srpc_bulk_t; /* bulk descriptor */ +}; /* message buffer descriptor */ typedef struct srpc_buffer { @@ -193,7 +194,7 @@ struct srpc_server_rpc { srpc_msg_t srpc_replymsg; lnet_handle_md_t srpc_replymdh; srpc_buffer_t *srpc_reqstbuf; - srpc_bulk_t *srpc_bulk; + struct srpc_bulk *srpc_bulk; unsigned int srpc_aborted; /* being given up */ int srpc_status; @@ -230,7 +231,7 @@ typedef struct srpc_client_rpc { srpc_msg_t crpc_replymsg; lnet_handle_md_t crpc_reqstmdh; lnet_handle_md_t crpc_replymdh; - srpc_bulk_t crpc_bulk; + struct srpc_bulk crpc_bulk; } srpc_client_rpc_t; #define srpc_client_rpc_size(rpc) \ @@ -424,7 +425,7 @@ void sfw_post_rpc(srpc_client_rpc_t *rpc); void sfw_client_rpc_done(srpc_client_rpc_t *rpc); void sfw_unpack_message(srpc_msg_t *msg); void sfw_free_pages(struct srpc_server_rpc *rpc); -void sfw_add_bulk_page(srpc_bulk_t *bk, struct page *pg, int i); +void sfw_add_bulk_page(struct srpc_bulk *bk, struct page *pg, int i); int sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, int sink); int sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply); @@ -436,9 +437,9 @@ srpc_create_client_rpc(lnet_process_id_t peer, int service, void (*rpc_fini)(srpc_client_rpc_t *), void *priv); void srpc_post_rpc(srpc_client_rpc_t *rpc); void srpc_abort_rpc(srpc_client_rpc_t *rpc, int why); -void srpc_free_bulk(srpc_bulk_t *bk); -srpc_bulk_t *srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, - int sink); +void srpc_free_bulk(struct srpc_bulk *bk); +struct srpc_bulk *srpc_alloc_bulk(int cpt, unsigned bulk_npg, + unsigned bulk_len, int sink); int srpc_send_rpc(swi_workitem_t *wi); int srpc_send_reply(struct srpc_server_rpc *rpc); int srpc_add_service(srpc_service_t *sv); -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:32 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:32 -0400 Subject: [lustre-devel] [PATCH 06/24] staging: lustre: selftest: convert srpc_client_rpc_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-7-git-send-email-jsimmons@infradead.org> Turn typedef srpc_client_rpc_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 6 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 8 ++-- drivers/staging/lustre/lnet/selftest/conrpc.h | 2 +- drivers/staging/lustre/lnet/selftest/framework.c | 36 +++++++++--------- drivers/staging/lustre/lnet/selftest/ping_test.c | 4 +- drivers/staging/lustre/lnet/selftest/rpc.c | 32 ++++++++-------- drivers/staging/lustre/lnet/selftest/selftest.h | 42 +++++++++++----------- 7 files changed, 65 insertions(+), 65 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index a3dec89..442f431 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -255,12 +255,12 @@ brw_check_bulk(struct srpc_bulk *bk, int pattern, __u64 magic) static int brw_client_prep_rpc(sfw_test_unit_t *tsu, - lnet_process_id_t dest, srpc_client_rpc_t **rpcpp) + lnet_process_id_t dest, struct srpc_client_rpc **rpcpp) { struct srpc_bulk *bulk = tsu->tsu_private; sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_session_t *sn = tsi->tsi_batch->bat_session; - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; srpc_brw_reqst_t *req; int flags; int npg; @@ -313,7 +313,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, } static void -brw_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) +brw_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) { __u64 magic = BRW_MAGIC; sfw_test_instance_t *tsi = tsu->tsu_instance; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 53da5cb..0032457 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -50,7 +50,7 @@ void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *, lstcon_node_t *, lstcon_trans_stat_t *); static void -lstcon_rpc_done(srpc_client_rpc_t *rpc) +lstcon_rpc_done(struct srpc_client_rpc *rpc) { lstcon_rpc_t *crpc = (lstcon_rpc_t *)rpc->crpc_priv; @@ -287,7 +287,7 @@ lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, lstcon_rpc_t *crpc) void lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error) { - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; lstcon_rpc_t *crpc; lstcon_node_t *nd; @@ -389,7 +389,7 @@ static int lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp) { lstcon_node_t *nd = crpc->crp_node; - srpc_client_rpc_t *rpc = crpc->crp_rpc; + struct srpc_client_rpc *rpc = crpc->crp_rpc; srpc_generic_reply_t *rep; LASSERT(nd && rpc); @@ -541,7 +541,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, void lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans) { - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; lstcon_rpc_t *crpc; lstcon_rpc_t *tmp; int count = 0; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h b/drivers/staging/lustre/lnet/selftest/conrpc.h index 3e7839d..6ddf088 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.h +++ b/drivers/staging/lustre/lnet/selftest/conrpc.h @@ -65,7 +65,7 @@ struct lstcon_node; typedef struct lstcon_rpc { struct list_head crp_link; /* chain on rpc transaction */ - srpc_client_rpc_t *crp_rpc; /* client rpc */ + struct srpc_client_rpc *crp_rpc; /* client rpc */ struct lstcon_node *crp_node; /* destination node */ struct lstcon_rpc_trans *crp_trans; /* conrpc transaction */ diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index b2df184..6c0af58 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -298,7 +298,7 @@ sfw_server_rpc_done(struct srpc_server_rpc *rpc) } static void -sfw_client_rpc_fini(srpc_client_rpc_t *rpc) +sfw_client_rpc_fini(struct srpc_client_rpc *rpc) { LASSERT(!rpc->crpc_bulk.bk_niov); LASSERT(list_empty(&rpc->crpc_list)); @@ -526,7 +526,7 @@ sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) } static void -sfw_test_rpc_fini(srpc_client_rpc_t *rpc) +sfw_test_rpc_fini(struct srpc_client_rpc *rpc) { sfw_test_unit_t *tsu = rpc->crpc_priv; sfw_test_instance_t *tsi = tsu->tsu_instance; @@ -616,7 +616,7 @@ sfw_unload_test(struct sfw_test_instance *tsi) static void sfw_destroy_test_instance(sfw_test_instance_t *tsi) { - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; sfw_test_unit_t *tsu; if (!tsi->tsi_is_client) @@ -637,7 +637,7 @@ sfw_destroy_test_instance(sfw_test_instance_t *tsi) while (!list_empty(&tsi->tsi_free_rpcs)) { rpc = list_entry(tsi->tsi_free_rpcs.next, - srpc_client_rpc_t, crpc_list); + struct srpc_client_rpc, crpc_list); list_del(&rpc->crpc_list); LIBCFS_FREE(rpc, srpc_client_rpc_size(rpc)); } @@ -866,7 +866,7 @@ sfw_test_unit_done(sfw_test_unit_t *tsu) } static void -sfw_test_rpc_done(srpc_client_rpc_t *rpc) +sfw_test_rpc_done(struct srpc_client_rpc *rpc) { sfw_test_unit_t *tsu = rpc->crpc_priv; sfw_test_instance_t *tsi = tsu->tsu_instance; @@ -902,9 +902,9 @@ sfw_test_rpc_done(srpc_client_rpc_t *rpc) int sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, unsigned features, int nblk, int blklen, - srpc_client_rpc_t **rpcpp) + struct srpc_client_rpc **rpcpp) { - srpc_client_rpc_t *rpc = NULL; + struct srpc_client_rpc *rpc = NULL; sfw_test_instance_t *tsi = tsu->tsu_instance; spin_lock(&tsi->tsi_lock); @@ -912,7 +912,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, LASSERT(sfw_test_active(tsi)); /* pick request from buffer */ rpc = list_first_entry_or_null(&tsi->tsi_free_rpcs, - srpc_client_rpc_t, crpc_list); + struct srpc_client_rpc, crpc_list); if (rpc) { LASSERT(nblk == rpc->crpc_bulk.bk_niov); list_del_init(&rpc->crpc_list); @@ -946,7 +946,7 @@ sfw_run_test(struct swi_workitem *wi) { sfw_test_unit_t *tsu = wi->swi_workitem.wi_data; sfw_test_instance_t *tsi = tsu->tsu_instance; - srpc_client_rpc_t *rpc = NULL; + struct srpc_client_rpc *rpc = NULL; LASSERT(wi == &tsu->tsu_worker); @@ -1029,7 +1029,7 @@ int sfw_stop_batch(sfw_batch_t *tsb, int force) { sfw_test_instance_t *tsi; - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; if (!sfw_batch_active(tsb)) { CDEBUG(D_NET, "Batch %llu inactive\n", tsb->bat_id.bat_id); @@ -1377,12 +1377,12 @@ sfw_bulk_ready(struct srpc_server_rpc *rpc, int status) return rc; } -srpc_client_rpc_t * +struct srpc_client_rpc * sfw_create_rpc(lnet_process_id_t peer, int service, unsigned features, int nbulkiov, int bulklen, - void (*done)(srpc_client_rpc_t *), void *priv) + void (*done)(struct srpc_client_rpc *), void *priv) { - srpc_client_rpc_t *rpc = NULL; + struct srpc_client_rpc *rpc = NULL; spin_lock(&sfw_data.fw_lock); @@ -1391,7 +1391,7 @@ sfw_create_rpc(lnet_process_id_t peer, int service, if (!nbulkiov && !list_empty(&sfw_data.fw_zombie_rpcs)) { rpc = list_entry(sfw_data.fw_zombie_rpcs.next, - srpc_client_rpc_t, crpc_list); + struct srpc_client_rpc, crpc_list); list_del(&rpc->crpc_list); srpc_init_client_rpc(rpc, peer, service, 0, 0, @@ -1558,7 +1558,7 @@ sfw_unpack_message(srpc_msg_t *msg) } void -sfw_abort_rpc(srpc_client_rpc_t *rpc) +sfw_abort_rpc(struct srpc_client_rpc *rpc) { LASSERT(atomic_read(&rpc->crpc_refcount) > 0); LASSERT(rpc->crpc_service <= SRPC_FRAMEWORK_SERVICE_MAX_ID); @@ -1569,7 +1569,7 @@ sfw_abort_rpc(srpc_client_rpc_t *rpc) } void -sfw_post_rpc(srpc_client_rpc_t *rpc) +sfw_post_rpc(struct srpc_client_rpc *rpc) { spin_lock(&rpc->crpc_lock); @@ -1759,10 +1759,10 @@ sfw_shutdown(void) } while (!list_empty(&sfw_data.fw_zombie_rpcs)) { - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; rpc = list_entry(sfw_data.fw_zombie_rpcs.next, - srpc_client_rpc_t, crpc_list); + struct srpc_client_rpc, crpc_list); list_del(&rpc->crpc_list); LIBCFS_FREE(rpc, srpc_client_rpc_size(rpc)); diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index c7c50be..1f2ddf6 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -87,7 +87,7 @@ ping_client_fini(sfw_test_instance_t *tsi) static int ping_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, - srpc_client_rpc_t **rpc) + struct srpc_client_rpc **rpc) { srpc_ping_reqst_t *req; sfw_test_instance_t *tsi = tsu->tsu_instance; @@ -118,7 +118,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, } static void -ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc) +ping_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) { sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_session_t *sn = tsi->tsi_batch->bat_session; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index b0d5a89..e711571 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -792,7 +792,7 @@ srpc_shutdown_service(srpc_service_t *sv) } static int -srpc_send_request(srpc_client_rpc_t *rpc) +srpc_send_request(struct srpc_client_rpc *rpc) { struct srpc_event *ev = &rpc->crpc_reqstev; int rc; @@ -814,7 +814,7 @@ srpc_send_request(srpc_client_rpc_t *rpc) } static int -srpc_prepare_reply(srpc_client_rpc_t *rpc) +srpc_prepare_reply(struct srpc_client_rpc *rpc) { struct srpc_event *ev = &rpc->crpc_replyev; __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid; @@ -838,7 +838,7 @@ srpc_prepare_reply(srpc_client_rpc_t *rpc) } static int -srpc_prepare_bulk(srpc_client_rpc_t *rpc) +srpc_prepare_bulk(struct srpc_client_rpc *rpc) { struct srpc_bulk *bk = &rpc->crpc_bulk; struct srpc_event *ev = &rpc->crpc_bulkev; @@ -1077,7 +1077,7 @@ srpc_handle_rpc(struct swi_workitem *wi) static void srpc_client_rpc_expired(void *data) { - srpc_client_rpc_t *rpc = data; + struct srpc_client_rpc *rpc = data; CWARN("Client RPC expired: service %d, peer %s, timeout %d.\n", rpc->crpc_service, libcfs_id2str(rpc->crpc_dest), @@ -1096,7 +1096,7 @@ srpc_client_rpc_expired(void *data) } static void -srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) +srpc_add_client_rpc_timer(struct srpc_client_rpc *rpc) { struct stt_timer *timer = &rpc->crpc_timer; @@ -1117,7 +1117,7 @@ srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) * running on any CPU. */ static void -srpc_del_client_rpc_timer(srpc_client_rpc_t *rpc) +srpc_del_client_rpc_timer(struct srpc_client_rpc *rpc) { /* timer not planted or already exploded */ if (!rpc->crpc_timeout) @@ -1138,7 +1138,7 @@ srpc_del_client_rpc_timer(srpc_client_rpc_t *rpc) } static void -srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status) +srpc_client_rpc_done(struct srpc_client_rpc *rpc, int status) { struct swi_workitem *wi = &rpc->crpc_wi; @@ -1178,7 +1178,7 @@ int srpc_send_rpc(struct swi_workitem *wi) { int rc = 0; - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; srpc_msg_t *reply; int do_bulk; @@ -1308,15 +1308,15 @@ abort: return 0; } -srpc_client_rpc_t * +struct srpc_client_rpc * srpc_create_client_rpc(lnet_process_id_t peer, int service, int nbulkiov, int bulklen, - void (*rpc_done)(srpc_client_rpc_t *), - void (*rpc_fini)(srpc_client_rpc_t *), void *priv) + void (*rpc_done)(struct srpc_client_rpc *), + void (*rpc_fini)(struct srpc_client_rpc *), void *priv) { - srpc_client_rpc_t *rpc; + struct srpc_client_rpc *rpc; - LIBCFS_ALLOC(rpc, offsetof(srpc_client_rpc_t, + LIBCFS_ALLOC(rpc, offsetof(struct srpc_client_rpc, crpc_bulk.bk_iovs[nbulkiov])); if (!rpc) return NULL; @@ -1328,7 +1328,7 @@ srpc_create_client_rpc(lnet_process_id_t peer, int service, /* called with rpc->crpc_lock held */ void -srpc_abort_rpc(srpc_client_rpc_t *rpc, int why) +srpc_abort_rpc(struct srpc_client_rpc *rpc, int why) { LASSERT(why); @@ -1347,7 +1347,7 @@ srpc_abort_rpc(srpc_client_rpc_t *rpc, int why) /* called with rpc->crpc_lock held */ void -srpc_post_rpc(srpc_client_rpc_t *rpc) +srpc_post_rpc(struct srpc_client_rpc *rpc) { LASSERT(!rpc->crpc_aborted); LASSERT(srpc_data.rpc_state == SRPC_STATE_RUNNING); @@ -1411,7 +1411,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) { struct srpc_service_cd *scd; struct srpc_event *rpcev = ev->md.user_ptr; - srpc_client_rpc_t *crpc; + struct srpc_client_rpc *crpc; struct srpc_server_rpc *srpc; struct srpc_buffer *buffer; srpc_service_t *sv; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index d6799b6..55f8154 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -202,7 +202,7 @@ struct srpc_server_rpc { }; /* client-side state of a RPC */ -typedef struct srpc_client_rpc { +struct srpc_client_rpc { struct list_head crpc_list; /* chain on user's lists */ spinlock_t crpc_lock; /* serialize */ int crpc_service; @@ -232,10 +232,10 @@ typedef struct srpc_client_rpc { lnet_handle_md_t crpc_reqstmdh; lnet_handle_md_t crpc_replymdh; struct srpc_bulk crpc_bulk; -} srpc_client_rpc_t; +}; #define srpc_client_rpc_size(rpc) \ -offsetof(srpc_client_rpc_t, crpc_bulk.bk_iovs[(rpc)->crpc_bulk.bk_niov]) +offsetof(struct srpc_client_rpc, crpc_bulk.bk_iovs[(rpc)->crpc_bulk.bk_niov]) #define srpc_client_rpc_addref(rpc) \ do { \ @@ -357,9 +357,9 @@ typedef struct { * client */ int (*tso_prep_rpc)(struct sfw_test_unit *tsu, lnet_process_id_t dest, - srpc_client_rpc_t **rpc); /* prep a tests rpc */ + struct srpc_client_rpc **rpc); /* prep a tests rpc */ void (*tso_done_rpc)(struct sfw_test_unit *tsu, - srpc_client_rpc_t *rpc); /* done a test rpc */ + struct srpc_client_rpc *rpc); /* done a test rpc */ } sfw_test_client_ops_t; typedef struct sfw_test_instance { @@ -413,16 +413,16 @@ typedef struct sfw_test_case { sfw_test_client_ops_t *tsc_cli_ops; /* ops of test client */ } sfw_test_case_t; -srpc_client_rpc_t * +struct srpc_client_rpc * sfw_create_rpc(lnet_process_id_t peer, int service, unsigned features, int nbulkiov, int bulklen, - void (*done)(srpc_client_rpc_t *), void *priv); + void (*done)(struct srpc_client_rpc *), void *priv); int sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, unsigned features, - int nblk, int blklen, srpc_client_rpc_t **rpc); -void sfw_abort_rpc(srpc_client_rpc_t *rpc); -void sfw_post_rpc(srpc_client_rpc_t *rpc); -void sfw_client_rpc_done(srpc_client_rpc_t *rpc); + int nblk, int blklen, struct srpc_client_rpc **rpc); +void sfw_abort_rpc(struct srpc_client_rpc *rpc); +void sfw_post_rpc(struct srpc_client_rpc *rpc); +void sfw_client_rpc_done(struct srpc_client_rpc *rpc); void sfw_unpack_message(srpc_msg_t *msg); void sfw_free_pages(struct srpc_server_rpc *rpc); void sfw_add_bulk_page(struct srpc_bulk *bk, struct page *pg, int i); @@ -430,13 +430,13 @@ int sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, int sink); int sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply); -srpc_client_rpc_t * +struct srpc_client_rpc * srpc_create_client_rpc(lnet_process_id_t peer, int service, int nbulkiov, int bulklen, - void (*rpc_done)(srpc_client_rpc_t *), - void (*rpc_fini)(srpc_client_rpc_t *), void *priv); -void srpc_post_rpc(srpc_client_rpc_t *rpc); -void srpc_abort_rpc(srpc_client_rpc_t *rpc, int why); + void (*rpc_done)(struct srpc_client_rpc *), + void (*rpc_fini)(struct srpc_client_rpc *), void *priv); +void srpc_post_rpc(struct srpc_client_rpc *rpc); +void srpc_abort_rpc(struct srpc_client_rpc *rpc, int why); void srpc_free_bulk(struct srpc_bulk *bk); struct srpc_bulk *srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink); @@ -505,7 +505,7 @@ void sfw_shutdown(void); void srpc_shutdown(void); static inline void -srpc_destroy_client_rpc(srpc_client_rpc_t *rpc) +srpc_destroy_client_rpc(struct srpc_client_rpc *rpc) { LASSERT(rpc); LASSERT(!srpc_event_pending(rpc)); @@ -518,14 +518,14 @@ srpc_destroy_client_rpc(srpc_client_rpc_t *rpc) } static inline void -srpc_init_client_rpc(srpc_client_rpc_t *rpc, lnet_process_id_t peer, +srpc_init_client_rpc(struct srpc_client_rpc *rpc, lnet_process_id_t peer, int service, int nbulkiov, int bulklen, - void (*rpc_done)(srpc_client_rpc_t *), - void (*rpc_fini)(srpc_client_rpc_t *), void *priv) + void (*rpc_done)(struct srpc_client_rpc *), + void (*rpc_fini)(struct srpc_client_rpc *), void *priv) { LASSERT(nbulkiov <= LNET_MAX_IOV); - memset(rpc, 0, offsetof(srpc_client_rpc_t, + memset(rpc, 0, offsetof(struct srpc_client_rpc, crpc_bulk.bk_iovs[nbulkiov])); INIT_LIST_HEAD(&rpc->crpc_list); -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:28 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:28 -0400 Subject: [lustre-devel] [PATCH 02/24] staging: lustre: selftest: convert srpc_event_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-3-git-send-email-jsimmons@infradead.org> Turn typedef srpc_event_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/rpc.c | 20 ++++++++++---------- drivers/staging/lustre/lnet/selftest/selftest.h | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 5d8908d..ba75b34 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -357,7 +357,7 @@ srpc_remove_service(srpc_service_t *sv) static int srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf, int len, int options, lnet_process_id_t peer, - lnet_handle_md_t *mdh, srpc_event_t *ev) + lnet_handle_md_t *mdh, struct srpc_event *ev) { int rc; lnet_md_t md; @@ -396,7 +396,7 @@ srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf, static int srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, int options, lnet_process_id_t peer, lnet_nid_t self, - lnet_handle_md_t *mdh, srpc_event_t *ev) + lnet_handle_md_t *mdh, struct srpc_event *ev) { int rc; lnet_md_t md; @@ -449,7 +449,7 @@ srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, static int srpc_post_passive_rqtbuf(int service, int local, void *buf, int len, - lnet_handle_md_t *mdh, srpc_event_t *ev) + lnet_handle_md_t *mdh, struct srpc_event *ev) { lnet_process_id_t any = { 0 }; @@ -794,7 +794,7 @@ srpc_shutdown_service(srpc_service_t *sv) static int srpc_send_request(srpc_client_rpc_t *rpc) { - srpc_event_t *ev = &rpc->crpc_reqstev; + struct srpc_event *ev = &rpc->crpc_reqstev; int rc; ev->ev_fired = 0; @@ -816,7 +816,7 @@ srpc_send_request(srpc_client_rpc_t *rpc) static int srpc_prepare_reply(srpc_client_rpc_t *rpc) { - srpc_event_t *ev = &rpc->crpc_replyev; + struct srpc_event *ev = &rpc->crpc_replyev; __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid; int rc; @@ -841,7 +841,7 @@ static int srpc_prepare_bulk(srpc_client_rpc_t *rpc) { srpc_bulk_t *bk = &rpc->crpc_bulk; - srpc_event_t *ev = &rpc->crpc_bulkev; + struct srpc_event *ev = &rpc->crpc_bulkev; __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.bulkid; int rc; int opt; @@ -873,7 +873,7 @@ srpc_prepare_bulk(srpc_client_rpc_t *rpc) static int srpc_do_bulk(struct srpc_server_rpc *rpc) { - srpc_event_t *ev = &rpc->srpc_ev; + struct srpc_event *ev = &rpc->srpc_ev; srpc_bulk_t *bk = rpc->srpc_bulk; __u64 id = rpc->srpc_reqstbuf->buf_msg.msg_body.reqst.bulkid; int rc; @@ -968,7 +968,7 @@ srpc_handle_rpc(swi_workitem_t *wi) struct srpc_server_rpc *rpc = wi->swi_workitem.wi_data; struct srpc_service_cd *scd = rpc->srpc_scd; struct srpc_service *sv = scd->scd_svc; - srpc_event_t *ev = &rpc->srpc_ev; + struct srpc_event *ev = &rpc->srpc_ev; int rc = 0; LASSERT(wi == &rpc->srpc_wi); @@ -1363,7 +1363,7 @@ srpc_post_rpc(srpc_client_rpc_t *rpc) int srpc_send_reply(struct srpc_server_rpc *rpc) { - srpc_event_t *ev = &rpc->srpc_ev; + struct srpc_event *ev = &rpc->srpc_ev; struct srpc_msg *msg = &rpc->srpc_replymsg; struct srpc_buffer *buffer = rpc->srpc_reqstbuf; struct srpc_service_cd *scd = rpc->srpc_scd; @@ -1410,7 +1410,7 @@ static void srpc_lnet_ev_handler(lnet_event_t *ev) { struct srpc_service_cd *scd; - srpc_event_t *rpcev = ev->md.user_ptr; + struct srpc_event *rpcev = ev->md.user_ptr; srpc_client_rpc_t *crpc; struct srpc_server_rpc *srpc; srpc_buffer_t *buffer; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 00d73a1..43972eb 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -146,13 +146,13 @@ enum srpc_event_type { }; /* RPC event */ -typedef struct { +struct srpc_event { enum srpc_event_type ev_type; /* what's up */ lnet_event_kind_t ev_lnet; /* LNet event type */ int ev_fired; /* LNet event fired? */ int ev_status; /* LNet event status */ void *ev_data; /* owning server/client RPC */ -} srpc_event_t; +}; typedef struct { int bk_len; /* len of bulk data */ @@ -187,7 +187,7 @@ struct srpc_server_rpc { struct list_head srpc_list; struct srpc_service_cd *srpc_scd; swi_workitem_t srpc_wi; - srpc_event_t srpc_ev; /* bulk/reply event */ + struct srpc_event srpc_ev; /* bulk/reply event */ lnet_nid_t srpc_self; lnet_process_id_t srpc_peer; srpc_msg_t srpc_replymsg; @@ -221,9 +221,9 @@ typedef struct srpc_client_rpc { unsigned int crpc_closed:1; /* completed */ /* RPC events */ - srpc_event_t crpc_bulkev; /* bulk event */ - srpc_event_t crpc_reqstev; /* request event */ - srpc_event_t crpc_replyev; /* reply event */ + struct srpc_event crpc_bulkev; /* bulk event */ + struct srpc_event crpc_reqstev; /* request event */ + struct srpc_event crpc_replyev; /* reply event */ /* bulk, request(reqst), and reply exchanged on wire */ srpc_msg_t crpc_reqstmsg; @@ -266,7 +266,7 @@ struct srpc_service_cd { /** backref to service */ struct srpc_service *scd_svc; /** event buffer */ - srpc_event_t scd_ev; + struct srpc_event scd_ev; /** free RPC descriptors */ struct list_head scd_rpc_free; /** in-flight RPCs */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:38 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:38 -0400 Subject: [lustre-devel] [PATCH 12/24] staging: lustre: selftest: convert sfw_test_unit_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-13-git-send-email-jsimmons@infradead.org> Turn typedef sfw_test_unit_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 8 ++++---- drivers/staging/lustre/lnet/selftest/framework.c | 20 ++++++++++---------- drivers/staging/lustre/lnet/selftest/ping_test.c | 4 ++-- drivers/staging/lustre/lnet/selftest/selftest.h | 6 +++--- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 90fabd0..3455990 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -52,7 +52,7 @@ static void brw_client_fini(struct sfw_test_instance *tsi) { struct srpc_bulk *bulk; - sfw_test_unit_t *tsu; + struct sfw_test_unit *tsu; LASSERT(tsi->tsi_is_client); @@ -75,7 +75,7 @@ brw_client_init(struct sfw_test_instance *tsi) int len; int opc; struct srpc_bulk *bulk; - sfw_test_unit_t *tsu; + struct sfw_test_unit *tsu; LASSERT(sn); LASSERT(tsi->tsi_is_client); @@ -254,7 +254,7 @@ brw_check_bulk(struct srpc_bulk *bk, int pattern, __u64 magic) } static int -brw_client_prep_rpc(sfw_test_unit_t *tsu, +brw_client_prep_rpc(struct sfw_test_unit *tsu, lnet_process_id_t dest, struct srpc_client_rpc **rpcpp) { struct srpc_bulk *bulk = tsu->tsu_private; @@ -313,7 +313,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, } static void -brw_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) +brw_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) { __u64 magic = BRW_MAGIC; struct sfw_test_instance *tsi = tsu->tsu_instance; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 5cc4807..8d364b0 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -528,7 +528,7 @@ sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) static void sfw_test_rpc_fini(struct srpc_client_rpc *rpc) { - sfw_test_unit_t *tsu = rpc->crpc_priv; + struct sfw_test_unit *tsu = rpc->crpc_priv; struct sfw_test_instance *tsi = tsu->tsu_instance; /* Called with hold of tsi->tsi_lock */ @@ -617,7 +617,7 @@ static void sfw_destroy_test_instance(struct sfw_test_instance *tsi) { struct srpc_client_rpc *rpc; - sfw_test_unit_t *tsu; + struct sfw_test_unit *tsu; if (!tsi->tsi_is_client) goto clean; @@ -630,7 +630,7 @@ sfw_destroy_test_instance(struct sfw_test_instance *tsi) while (!list_empty(&tsi->tsi_units)) { tsu = list_entry(tsi->tsi_units.next, - sfw_test_unit_t, tsu_list); + struct sfw_test_unit, tsu_list); list_del(&tsu->tsu_list); LIBCFS_FREE(tsu, sizeof(*tsu)); } @@ -735,7 +735,7 @@ sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc) srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; struct srpc_bulk *bk = rpc->srpc_bulk; int ndest = req->tsr_ndest; - sfw_test_unit_t *tsu; + struct sfw_test_unit *tsu; struct sfw_test_instance *tsi; int i; int rc; @@ -795,7 +795,7 @@ sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc) sfw_unpack_id(id); for (j = 0; j < tsi->tsi_concur; j++) { - LIBCFS_ALLOC(tsu, sizeof(sfw_test_unit_t)); + LIBCFS_ALLOC(tsu, sizeof(struct sfw_test_unit)); if (!tsu) { rc = -ENOMEM; CERROR("Can't allocate tsu for %d\n", @@ -824,7 +824,7 @@ error: } static void -sfw_test_unit_done(sfw_test_unit_t *tsu) +sfw_test_unit_done(struct sfw_test_unit *tsu) { struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_batch *tsb = tsi->tsi_batch; @@ -868,7 +868,7 @@ sfw_test_unit_done(sfw_test_unit_t *tsu) static void sfw_test_rpc_done(struct srpc_client_rpc *rpc) { - sfw_test_unit_t *tsu = rpc->crpc_priv; + struct sfw_test_unit *tsu = rpc->crpc_priv; struct sfw_test_instance *tsi = tsu->tsu_instance; int done = 0; @@ -900,7 +900,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc) } int -sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, +sfw_create_test_rpc(struct sfw_test_unit *tsu, lnet_process_id_t peer, unsigned features, int nblk, int blklen, struct srpc_client_rpc **rpcpp) { @@ -944,7 +944,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, static int sfw_run_test(struct swi_workitem *wi) { - sfw_test_unit_t *tsu = wi->swi_workitem.wi_data; + struct sfw_test_unit *tsu = wi->swi_workitem.wi_data; struct sfw_test_instance *tsi = tsu->tsu_instance; struct srpc_client_rpc *rpc = NULL; @@ -994,7 +994,7 @@ static int sfw_run_batch(struct sfw_batch *tsb) { struct swi_workitem *wi; - sfw_test_unit_t *tsu; + struct sfw_test_unit *tsu; struct sfw_test_instance *tsi; if (sfw_batch_active(tsb)) { diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index 4e45428..c6f2caa 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -86,7 +86,7 @@ ping_client_fini(struct sfw_test_instance *tsi) } static int -ping_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, +ping_client_prep_rpc(struct sfw_test_unit *tsu, lnet_process_id_t dest, struct srpc_client_rpc **rpc) { srpc_ping_reqst_t *req; @@ -118,7 +118,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, } static void -ping_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) +ping_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) { struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 75743dd..f08bc70 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -398,14 +398,14 @@ struct sfw_test_instance { #define SFW_MAX_NDESTS (LNET_MAX_IOV * SFW_ID_PER_PAGE) #define sfw_id_pages(n) (((n) + SFW_ID_PER_PAGE - 1) / SFW_ID_PER_PAGE) -typedef struct sfw_test_unit { +struct sfw_test_unit { struct list_head tsu_list; /* chain on lst_test_instance */ lnet_process_id_t tsu_dest; /* id of dest node */ int tsu_loop; /* loop count of the test */ struct sfw_test_instance *tsu_instance; /* pointer to test instance */ void *tsu_private; /* private data */ struct swi_workitem tsu_worker; /* workitem of the test unit */ -} sfw_test_unit_t; +}; typedef struct sfw_test_case { struct list_head tsc_list; /* chain on fw_tests */ @@ -417,7 +417,7 @@ struct srpc_client_rpc * sfw_create_rpc(lnet_process_id_t peer, int service, unsigned features, int nbulkiov, int bulklen, void (*done)(struct srpc_client_rpc *), void *priv); -int sfw_create_test_rpc(sfw_test_unit_t *tsu, +int sfw_create_test_rpc(struct sfw_test_unit *tsu, lnet_process_id_t peer, unsigned features, int nblk, int blklen, struct srpc_client_rpc **rpc); void sfw_abort_rpc(struct srpc_client_rpc *rpc); -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:35 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:35 -0400 Subject: [lustre-devel] [PATCH 09/24] staging: lustre: selftest: convert sfw_batch_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-10-git-send-email-jsimmons@infradead.org> Turn typedef sfw_batch_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/framework.c | 38 +++++++++++----------- drivers/staging/lustre/lnet/selftest/selftest.h | 6 ++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 3a20598..0d7c3c5 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -115,7 +115,7 @@ static struct smoketest_framework { } sfw_data; /* forward ref's */ -int sfw_stop_batch(sfw_batch_t *tsb, int force); +int sfw_stop_batch(struct sfw_batch *tsb, int force); void sfw_destroy_session(struct sfw_session *sn); static inline sfw_test_case_t * @@ -198,7 +198,7 @@ __must_hold(&sfw_data.fw_lock) { struct sfw_session *sn = sfw_data.fw_session; int nactive = 0; - sfw_batch_t *tsb; + struct sfw_batch *tsb; sfw_test_case_t *tsc; if (!sn) @@ -318,11 +318,11 @@ sfw_client_rpc_fini(struct srpc_client_rpc *rpc) spin_unlock(&sfw_data.fw_lock); } -static sfw_batch_t * +static struct sfw_batch * sfw_find_batch(lst_bid_t bid) { struct sfw_session *sn = sfw_data.fw_session; - sfw_batch_t *bat; + struct sfw_batch *bat; LASSERT(sn); @@ -334,11 +334,11 @@ sfw_find_batch(lst_bid_t bid) return NULL; } -static sfw_batch_t * +static struct sfw_batch * sfw_bid2batch(lst_bid_t bid) { struct sfw_session *sn = sfw_data.fw_session; - sfw_batch_t *bat; + struct sfw_batch *bat; LASSERT(sn); @@ -346,7 +346,7 @@ sfw_bid2batch(lst_bid_t bid) if (bat) return bat; - LIBCFS_ALLOC(bat, sizeof(sfw_batch_t)); + LIBCFS_ALLOC(bat, sizeof(struct sfw_batch)); if (!bat) return NULL; @@ -365,7 +365,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) { struct sfw_session *sn = sfw_data.fw_session; sfw_counters_t *cnt = &reply->str_fw; - sfw_batch_t *bat; + struct sfw_batch *bat; reply->str_sid = !sn ? LST_INVALID_SID : sn->sn_id; @@ -648,7 +648,7 @@ clean: } static void -sfw_destroy_batch(sfw_batch_t *tsb) +sfw_destroy_batch(struct sfw_batch *tsb) { sfw_test_instance_t *tsi; @@ -662,20 +662,20 @@ sfw_destroy_batch(sfw_batch_t *tsb) sfw_destroy_test_instance(tsi); } - LIBCFS_FREE(tsb, sizeof(sfw_batch_t)); + LIBCFS_FREE(tsb, sizeof(struct sfw_batch)); } void sfw_destroy_session(struct sfw_session *sn) { - sfw_batch_t *batch; + struct sfw_batch *batch; LASSERT(list_empty(&sn->sn_list)); LASSERT(sn != sfw_data.fw_session); while (!list_empty(&sn->sn_batches)) { batch = list_entry(sn->sn_batches.next, - sfw_batch_t, bat_list); + struct sfw_batch, bat_list); list_del_init(&batch->bat_list); sfw_destroy_batch(batch); } @@ -729,7 +729,7 @@ sfw_unpack_addtest_req(srpc_msg_t *msg) } static int -sfw_add_test_instance(sfw_batch_t *tsb, struct srpc_server_rpc *rpc) +sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc) { srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg; srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; @@ -827,7 +827,7 @@ static void sfw_test_unit_done(sfw_test_unit_t *tsu) { sfw_test_instance_t *tsi = tsu->tsu_instance; - sfw_batch_t *tsb = tsi->tsi_batch; + struct sfw_batch *tsb = tsi->tsi_batch; struct sfw_session *sn = tsb->bat_session; LASSERT(sfw_test_active(tsi)); @@ -991,7 +991,7 @@ test_done: } static int -sfw_run_batch(sfw_batch_t *tsb) +sfw_run_batch(struct sfw_batch *tsb) { struct swi_workitem *wi; sfw_test_unit_t *tsu; @@ -1026,7 +1026,7 @@ sfw_run_batch(sfw_batch_t *tsb) } int -sfw_stop_batch(sfw_batch_t *tsb, int force) +sfw_stop_batch(struct sfw_batch *tsb, int force) { sfw_test_instance_t *tsi; struct srpc_client_rpc *rpc; @@ -1068,7 +1068,7 @@ sfw_stop_batch(sfw_batch_t *tsb, int force) } static int -sfw_query_batch(sfw_batch_t *tsb, int testidx, srpc_batch_reply_t *reply) +sfw_query_batch(struct sfw_batch *tsb, int testidx, srpc_batch_reply_t *reply) { sfw_test_instance_t *tsi; @@ -1119,7 +1119,7 @@ sfw_add_test(struct srpc_server_rpc *rpc) srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply; srpc_test_reqst_t *request; int rc; - sfw_batch_t *bat; + struct sfw_batch *bat; request = &rpc->srpc_reqstbuf->buf_msg.msg_body.tes_reqst; reply->tsr_sid = !sn ? LST_INVALID_SID : sn->sn_id; @@ -1187,7 +1187,7 @@ sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) { struct sfw_session *sn = sfw_data.fw_session; int rc = 0; - sfw_batch_t *bat; + struct sfw_batch *bat; reply->bar_sid = !sn ? LST_INVALID_SID : sn->sn_id; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index eee36b1..50237bc 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -341,14 +341,14 @@ struct sfw_session { #define sfw_sid_equal(sid0, sid1) ((sid0).ses_nid == (sid1).ses_nid && \ (sid0).ses_stamp == (sid1).ses_stamp) -typedef struct { +struct sfw_batch { struct list_head bat_list; /* chain on sn_batches */ lst_bid_t bat_id; /* batch id */ int bat_error; /* error code of batch */ struct sfw_session *bat_session; /* batch's session */ atomic_t bat_nactive; /* # of active tests */ struct list_head bat_tests; /* test instances */ -} sfw_batch_t; +}; typedef struct { int (*tso_init)(struct sfw_test_instance *tsi); /* initialize test @@ -365,7 +365,7 @@ typedef struct { typedef struct sfw_test_instance { struct list_head tsi_list; /* chain on batch */ int tsi_service; /* test type */ - sfw_batch_t *tsi_batch; /* batch */ + struct sfw_batch *tsi_batch; /* batch */ sfw_test_client_ops_t *tsi_ops; /* test client operation */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:43 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:43 -0400 Subject: [lustre-devel] [PATCH 17/24] staging: lustre: selftest: convert lstcon_ndlink_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-18-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_ndlink_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +- drivers/staging/lustre/lnet/selftest/console.c | 64 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/console.h | 7 ++- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 194b6dc..5cbd631 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -719,7 +719,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, int dist, int span, int nkiov, lnet_kiov_t *kiov) { lnet_process_id_packed_t *pid; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; struct lstcon_node *nd; int start; int end; @@ -1086,7 +1086,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, struct lstcon_rpc_trans **transpp) { struct lstcon_rpc_trans *trans; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; struct lstcon_node *nd; struct lstcon_rpc *rpc; unsigned feats; @@ -1172,7 +1172,7 @@ lstcon_rpc_pinger(void *arg) struct lstcon_rpc *crpc; srpc_msg_t *rep; srpc_debug_reqst_t *drq; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; struct lstcon_node *nd; int intv; int count = 0; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 32364b4..e068c13 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -71,7 +71,7 @@ lstcon_node_get(struct lstcon_node *nd) static int lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create) { - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE; LASSERT(id.nid != LNET_NID_ANY); @@ -90,11 +90,11 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create) if (!create) return -ENOENT; - LIBCFS_ALLOC(*ndpp, sizeof(struct lstcon_node) + sizeof(lstcon_ndlink_t)); + LIBCFS_ALLOC(*ndpp, sizeof(struct lstcon_node) + sizeof(struct lstcon_ndlink)); if (!*ndpp) return -ENOMEM; - ndl = (lstcon_ndlink_t *)(*ndpp + 1); + ndl = (struct lstcon_ndlink *)(*ndpp + 1); ndl->ndl_node = *ndpp; @@ -119,14 +119,14 @@ lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create) static void lstcon_node_put(struct lstcon_node *nd) { - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; LASSERT(nd->nd_ref > 0); if (--nd->nd_ref > 0) return; - ndl = (lstcon_ndlink_t *)(nd + 1); + ndl = (struct lstcon_ndlink *)(nd + 1); LASSERT(!list_empty(&ndl->ndl_link)); LASSERT(!list_empty(&ndl->ndl_hlink)); @@ -135,15 +135,15 @@ lstcon_node_put(struct lstcon_node *nd) list_del(&ndl->ndl_link); list_del(&ndl->ndl_hlink); - LIBCFS_FREE(nd, sizeof(struct lstcon_node) + sizeof(lstcon_ndlink_t)); + LIBCFS_FREE(nd, sizeof(struct lstcon_node) + sizeof(struct lstcon_ndlink)); } static int lstcon_ndlink_find(struct list_head *hash, - lnet_process_id_t id, lstcon_ndlink_t **ndlpp, int create) + lnet_process_id_t id, struct lstcon_ndlink **ndlpp, int create) { unsigned int idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; struct lstcon_node *nd; int rc; @@ -168,7 +168,7 @@ lstcon_ndlink_find(struct list_head *hash, if (rc) return rc; - LIBCFS_ALLOC(ndl, sizeof(lstcon_ndlink_t)); + LIBCFS_ALLOC(ndl, sizeof(struct lstcon_ndlink)); if (!ndl) { lstcon_node_put(nd); return -ENOMEM; @@ -184,7 +184,7 @@ lstcon_ndlink_find(struct list_head *hash, } static void -lstcon_ndlink_release(lstcon_ndlink_t *ndl) +lstcon_ndlink_release(struct lstcon_ndlink *ndl) { LASSERT(list_empty(&ndl->ndl_link)); LASSERT(!list_empty(&ndl->ndl_hlink)); @@ -234,13 +234,13 @@ lstcon_group_addref(lstcon_group_t *grp) grp->grp_ref++; } -static void lstcon_group_ndlink_release(lstcon_group_t *, lstcon_ndlink_t *); +static void lstcon_group_ndlink_release(lstcon_group_t *, struct lstcon_ndlink *); static void lstcon_group_drain(lstcon_group_t *grp, int keep) { - lstcon_ndlink_t *ndl; - lstcon_ndlink_t *tmp; + struct lstcon_ndlink *ndl; + struct lstcon_ndlink *tmp; list_for_each_entry_safe(ndl, tmp, &grp->grp_ndl_list, ndl_link) { if (!(ndl->ndl_node->nd_state & keep)) @@ -287,7 +287,7 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp) static int lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, - lstcon_ndlink_t **ndlpp, int create) + struct lstcon_ndlink **ndlpp, int create) { int rc; @@ -305,7 +305,7 @@ lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, } static void -lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl) +lstcon_group_ndlink_release(lstcon_group_t *grp, struct lstcon_ndlink *ndl) { list_del_init(&ndl->ndl_link); lstcon_ndlink_release(ndl); @@ -314,7 +314,7 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, lstcon_ndlink_t *ndl) static void lstcon_group_ndlink_move(lstcon_group_t *old, - lstcon_group_t *new, lstcon_ndlink_t *ndl) + lstcon_group_t *new, struct lstcon_ndlink *ndl) { unsigned int idx = LNET_NIDADDR(ndl->ndl_node->nd_id.nid) % LST_NODE_HASHSIZE; @@ -331,11 +331,11 @@ lstcon_group_ndlink_move(lstcon_group_t *old, static void lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new) { - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; while (!list_empty(&old->grp_ndl_list)) { ndl = list_entry(old->grp_ndl_list.next, - lstcon_ndlink_t, ndl_link); + struct lstcon_ndlink, ndl_link); lstcon_group_ndlink_move(old, new, ndl); } } @@ -404,7 +404,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, unsigned *featp, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; lstcon_group_t *tmp; lnet_process_id_t id; int i; @@ -471,7 +471,7 @@ lstcon_group_nodes_remove(lstcon_group_t *grp, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; lstcon_group_t *tmp; lnet_process_id_t id; int rc; @@ -744,7 +744,7 @@ static int lstcon_nodes_getent(struct list_head *head, int *index_p, int *count_p, lstcon_node_ent_t __user *dents_up) { - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; struct lstcon_node *nd; int count = 0; int index = 0; @@ -787,7 +787,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, { lstcon_ndlist_ent_t *gentp; lstcon_group_t *grp; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; int rc; rc = lstcon_group_find(name, &grp); @@ -936,7 +936,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, struct list_head *srvlst; lstcon_test_t *test = NULL; lstcon_batch_t *bat; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; int rc; rc = lstcon_batch_find(name, &bat); @@ -1090,7 +1090,7 @@ lstcon_batch_stop(char *name, int force, struct list_head __user *result_up) static void lstcon_batch_destroy(lstcon_batch_t *bat) { - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; lstcon_test_t *test; int i; @@ -1114,7 +1114,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat) while (!list_empty(&bat->bat_cli_list)) { ndl = list_entry(bat->bat_cli_list.next, - lstcon_ndlink_t, ndl_link); + struct lstcon_ndlink, ndl_link); list_del_init(&ndl->ndl_link); lstcon_ndlink_release(ndl); @@ -1122,7 +1122,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat) while (!list_empty(&bat->bat_srv_list)) { ndl = list_entry(bat->bat_srv_list.next, - lstcon_ndlink_t, ndl_link); + struct lstcon_ndlink, ndl_link); list_del_init(&ndl->ndl_link); lstcon_ndlink_release(ndl); @@ -1145,7 +1145,7 @@ lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) { lstcon_test_t *test; lstcon_batch_t *batch; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; struct list_head *hash; struct list_head *head; @@ -1258,7 +1258,7 @@ static int lstcon_verify_group(const char *name, lstcon_group_t **grp) { int rc; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; rc = lstcon_group_find(name, grp); if (rc) { @@ -1535,7 +1535,7 @@ int lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up, int timeout, struct list_head __user *result_up) { - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; lstcon_group_t *tmp; lnet_process_id_t id; int i; @@ -1648,7 +1648,7 @@ lstcon_nodes_debug(int timeout, struct list_head __user *result_up) { lnet_process_id_t id; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; lstcon_group_t *grp; int i; int rc; @@ -1781,7 +1781,7 @@ lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up, char __user *name_up, int len) { lstcon_ndlist_ent_t *entp; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; int rc = 0; if (console_session.ses_state != LST_SESSION_ACTIVE) @@ -1910,7 +1910,7 @@ lstcon_acceptor_handle(struct srpc_server_rpc *rpc) srpc_join_reqst_t *jreq = &req->msg_body.join_reqst; srpc_join_reply_t *jrep = &rep->msg_body.join_reply; lstcon_group_t *grp = NULL; - lstcon_ndlink_t *ndl; + struct lstcon_ndlink *ndl; int rc = 0; sfw_unpack_message(req); diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index 7c37967..dd9674d 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -60,11 +60,12 @@ struct lstcon_node { struct lstcon_rpc nd_ping; /* ping rpc */ }; -typedef struct { +/* node link descriptor */ +struct lstcon_ndlink { struct list_head ndl_link; /* chain on list */ struct list_head ndl_hlink; /* chain on hash */ - struct lstcon_node *ndl_node; /* pointer to node */ -} lstcon_ndlink_t; /* node link descriptor */ + struct lstcon_node *ndl_node; /* pointer to node */ +}; typedef struct { struct list_head grp_link; /* chain on global group list -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:31 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:31 -0400 Subject: [lustre-devel] [PATCH 05/24] staging: lustre: selftest: convert swi_workitem_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-6-git-send-email-jsimmons@infradead.org> Turn typedef swi_workitem_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/framework.c | 4 +- drivers/staging/lustre/lnet/selftest/rpc.c | 8 +++--- drivers/staging/lustre/lnet/selftest/selftest.h | 26 +++++++++++---------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 40a3da9..b2df184 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -942,7 +942,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, } static int -sfw_run_test(swi_workitem_t *wi) +sfw_run_test(struct swi_workitem *wi) { sfw_test_unit_t *tsu = wi->swi_workitem.wi_data; sfw_test_instance_t *tsi = tsu->tsu_instance; @@ -993,7 +993,7 @@ test_done: static int sfw_run_batch(sfw_batch_t *tsb) { - swi_workitem_t *wi; + struct swi_workitem *wi; sfw_test_unit_t *tsu; sfw_test_instance_t *tsi; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 316ccf7..b0d5a89 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -71,7 +71,7 @@ srpc_serv_portal(int svc_id) } /* forward ref's */ -int srpc_handle_rpc(swi_workitem_t *wi); +int srpc_handle_rpc(struct swi_workitem *wi); void srpc_get_counters(srpc_counters_t *cnt) { @@ -963,7 +963,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int status) /* handles an incoming RPC */ int -srpc_handle_rpc(swi_workitem_t *wi) +srpc_handle_rpc(struct swi_workitem *wi) { struct srpc_server_rpc *rpc = wi->swi_workitem.wi_data; struct srpc_service_cd *scd = rpc->srpc_scd; @@ -1140,7 +1140,7 @@ srpc_del_client_rpc_timer(srpc_client_rpc_t *rpc) static void srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status) { - swi_workitem_t *wi = &rpc->crpc_wi; + struct swi_workitem *wi = &rpc->crpc_wi; LASSERT(status || wi->swi_state == SWI_STATE_DONE); @@ -1175,7 +1175,7 @@ srpc_client_rpc_done(srpc_client_rpc_t *rpc, int status) /* sends an outgoing RPC */ int -srpc_send_rpc(swi_workitem_t *wi) +srpc_send_rpc(struct swi_workitem *wi) { int rc = 0; srpc_client_rpc_t *rpc; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 04e742e..d6799b6 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -175,19 +175,19 @@ struct srpc_buffer { struct swi_workitem; typedef int (*swi_action_t) (struct swi_workitem *); -typedef struct swi_workitem { +struct swi_workitem { struct cfs_wi_sched *swi_sched; struct cfs_workitem swi_workitem; swi_action_t swi_action; int swi_state; -} swi_workitem_t; +}; /* server-side state of a RPC */ struct srpc_server_rpc { /* chain on srpc_service::*_rpcq */ struct list_head srpc_list; struct srpc_service_cd *srpc_scd; - swi_workitem_t srpc_wi; + struct swi_workitem srpc_wi; struct srpc_event srpc_ev; /* bulk/reply event */ lnet_nid_t srpc_self; lnet_process_id_t srpc_peer; @@ -209,7 +209,7 @@ typedef struct srpc_client_rpc { atomic_t crpc_refcount; int crpc_timeout; /* # seconds to wait for reply */ struct stt_timer crpc_timer; - swi_workitem_t crpc_wi; + struct swi_workitem crpc_wi; lnet_process_id_t crpc_dest; void (*crpc_done)(struct srpc_client_rpc *); @@ -273,7 +273,7 @@ struct srpc_service_cd { /** in-flight RPCs */ struct list_head scd_rpc_active; /** workitem for posting buffer */ - swi_workitem_t scd_buf_wi; + struct swi_workitem scd_buf_wi; /** CPT id */ int scd_cpt; /** error code for scd_buf_wi */ @@ -404,7 +404,7 @@ typedef struct sfw_test_unit { int tsu_loop; /* loop count of the test */ sfw_test_instance_t *tsu_instance; /* pointer to test instance */ void *tsu_private; /* private data */ - swi_workitem_t tsu_worker; /* workitem of the test unit */ + struct swi_workitem tsu_worker; /* workitem of the test unit */ } sfw_test_unit_t; typedef struct sfw_test_case { @@ -440,7 +440,7 @@ void srpc_abort_rpc(srpc_client_rpc_t *rpc, int why); void srpc_free_bulk(struct srpc_bulk *bk); struct srpc_bulk *srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink); -int srpc_send_rpc(swi_workitem_t *wi); +int srpc_send_rpc(struct swi_workitem *wi); int srpc_send_reply(struct srpc_server_rpc *rpc); int srpc_add_service(srpc_service_t *sv); int srpc_remove_service(srpc_service_t *sv); @@ -464,13 +464,15 @@ srpc_serv_is_framework(struct srpc_service *svc) static inline int swi_wi_action(struct cfs_workitem *wi) { - swi_workitem_t *swi = container_of(wi, swi_workitem_t, swi_workitem); + struct swi_workitem *swi; + + swi = container_of(wi, struct swi_workitem, swi_workitem); return swi->swi_action(swi); } static inline void -swi_init_workitem(swi_workitem_t *swi, void *data, +swi_init_workitem(struct swi_workitem *swi, void *data, swi_action_t action, struct cfs_wi_sched *sched) { swi->swi_sched = sched; @@ -480,19 +482,19 @@ swi_init_workitem(swi_workitem_t *swi, void *data, } static inline void -swi_schedule_workitem(swi_workitem_t *wi) +swi_schedule_workitem(struct swi_workitem *wi) { cfs_wi_schedule(wi->swi_sched, &wi->swi_workitem); } static inline void -swi_exit_workitem(swi_workitem_t *swi) +swi_exit_workitem(struct swi_workitem *swi) { cfs_wi_exit(swi->swi_sched, &swi->swi_workitem); } static inline int -swi_deschedule_workitem(swi_workitem_t *swi) +swi_deschedule_workitem(struct swi_workitem *swi) { return cfs_wi_deschedule(swi->swi_sched, &swi->swi_workitem); } -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:46 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:46 -0400 Subject: [lustre-devel] [PATCH 20/24] staging: lustre: selftest: convert lstcon_batch_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-21-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_batch_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conrpc.c | 4 +- drivers/staging/lustre/lnet/selftest/console.c | 46 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/console.h | 7 ++-- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index be94b9c..19c9b5c 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -652,7 +652,7 @@ int lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, struct lstcon_tsb_hdr *tsb, struct lstcon_rpc **crpc) { - lstcon_batch_t *batch; + struct lstcon_batch *batch; srpc_batch_reqst_t *brq; int rc; @@ -675,7 +675,7 @@ lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, LASSERT(!tsb->tsb_index); - batch = (lstcon_batch_t *)tsb; + batch = (struct lstcon_batch *)tsb; brq->bar_arg = batch->bat_arg; return 0; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 41f732b..deb0bc0 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -828,9 +828,9 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, } static int -lstcon_batch_find(const char *name, lstcon_batch_t **batpp) +lstcon_batch_find(const char *name, struct lstcon_batch **batpp) { - lstcon_batch_t *bat; + struct lstcon_batch *bat; list_for_each_entry(bat, &console_session.ses_bat_list, bat_link) { if (!strncmp(bat->bat_name, name, LST_NAME_SIZE)) { @@ -845,7 +845,7 @@ lstcon_batch_find(const char *name, lstcon_batch_t **batpp) int lstcon_batch_add(char *name) { - lstcon_batch_t *bat; + struct lstcon_batch *bat; int i; int rc; @@ -855,7 +855,7 @@ lstcon_batch_add(char *name) return rc; } - LIBCFS_ALLOC(bat, sizeof(lstcon_batch_t)); + LIBCFS_ALLOC(bat, sizeof(struct lstcon_batch)); if (!bat) { CERROR("Can't allocate descriptor for batch %s\n", name); return -ENOMEM; @@ -865,7 +865,7 @@ lstcon_batch_add(char *name) sizeof(struct list_head) * LST_NODE_HASHSIZE); if (!bat->bat_cli_hash) { CERROR("Can't allocate hash for batch %s\n", name); - LIBCFS_FREE(bat, sizeof(lstcon_batch_t)); + LIBCFS_FREE(bat, sizeof(struct lstcon_batch)); return -ENOMEM; } @@ -875,7 +875,7 @@ lstcon_batch_add(char *name) if (!bat->bat_srv_hash) { CERROR("Can't allocate hash for batch %s\n", name); LIBCFS_FREE(bat->bat_cli_hash, LST_NODE_HASHSIZE); - LIBCFS_FREE(bat, sizeof(lstcon_batch_t)); + LIBCFS_FREE(bat, sizeof(struct lstcon_batch)); return -ENOMEM; } @@ -883,7 +883,7 @@ lstcon_batch_add(char *name) if (strlen(name) > sizeof(bat->bat_name) - 1) { LIBCFS_FREE(bat->bat_srv_hash, LST_NODE_HASHSIZE); LIBCFS_FREE(bat->bat_cli_hash, LST_NODE_HASHSIZE); - LIBCFS_FREE(bat, sizeof(lstcon_batch_t)); + LIBCFS_FREE(bat, sizeof(struct lstcon_batch)); return -E2BIG; } strncpy(bat->bat_name, name, sizeof(bat->bat_name)); @@ -911,7 +911,7 @@ lstcon_batch_add(char *name) int lstcon_batch_list(int index, int len, char __user *name_up) { - lstcon_batch_t *bat; + struct lstcon_batch *bat; LASSERT(name_up); LASSERT(index >= 0); @@ -935,7 +935,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, struct list_head *clilst; struct list_head *srvlst; lstcon_test_t *test = NULL; - lstcon_batch_t *bat; + struct lstcon_batch *bat; struct lstcon_ndlink *ndl; int rc; @@ -1020,7 +1020,7 @@ lstcon_batrpc_condition(int transop, struct lstcon_node *nd, void *arg) } static int -lstcon_batch_op(lstcon_batch_t *bat, int transop, +lstcon_batch_op(struct lstcon_batch *bat, int transop, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; @@ -1046,7 +1046,7 @@ lstcon_batch_op(lstcon_batch_t *bat, int transop, int lstcon_batch_run(char *name, int timeout, struct list_head __user *result_up) { - lstcon_batch_t *bat; + struct lstcon_batch *bat; int rc; if (lstcon_batch_find(name, &bat)) { @@ -1068,7 +1068,7 @@ lstcon_batch_run(char *name, int timeout, struct list_head __user *result_up) int lstcon_batch_stop(char *name, int force, struct list_head __user *result_up) { - lstcon_batch_t *bat; + struct lstcon_batch *bat; int rc; if (lstcon_batch_find(name, &bat)) { @@ -1088,7 +1088,7 @@ lstcon_batch_stop(char *name, int force, struct list_head __user *result_up) } static void -lstcon_batch_destroy(lstcon_batch_t *bat) +lstcon_batch_destroy(struct lstcon_batch *bat) { struct lstcon_ndlink *ndl; lstcon_test_t *test; @@ -1137,14 +1137,14 @@ lstcon_batch_destroy(lstcon_batch_t *bat) sizeof(struct list_head) * LST_NODE_HASHSIZE); LIBCFS_FREE(bat->bat_srv_hash, sizeof(struct list_head) * LST_NODE_HASHSIZE); - LIBCFS_FREE(bat, sizeof(lstcon_batch_t)); + LIBCFS_FREE(bat, sizeof(struct lstcon_batch)); } static int lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) { lstcon_test_t *test; - lstcon_batch_t *batch; + struct lstcon_batch *batch; struct lstcon_ndlink *ndl; struct list_head *hash; struct list_head *head; @@ -1236,7 +1236,7 @@ again: } static int -lstcon_verify_batch(const char *name, lstcon_batch_t **batch) +lstcon_verify_batch(const char *name, struct lstcon_batch **batch) { int rc; @@ -1287,7 +1287,7 @@ lstcon_test_add(char *batch_name, int type, int loop, int rc; struct lstcon_group *src_grp = NULL; struct lstcon_group *dst_grp = NULL; - lstcon_batch_t *batch = NULL; + struct lstcon_batch *batch = NULL; /* * verify that a batch of the given name exists, and the groups @@ -1368,7 +1368,7 @@ out: } static int -lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp) +lstcon_test_find(struct lstcon_batch *batch, int idx, lstcon_test_t **testpp) { lstcon_test_t *test; @@ -1407,7 +1407,7 @@ lstcon_test_batch_query(char *name, int testidx, int client, struct list_head *translist; struct list_head *ndlist; struct lstcon_tsb_hdr *hdr; - lstcon_batch_t *batch; + struct lstcon_batch *batch; lstcon_test_t *test = NULL; int transop; int rc; @@ -1610,7 +1610,7 @@ int lstcon_batch_debug(int timeout, char *name, int client, struct list_head __user *result_up) { - lstcon_batch_t *bat; + struct lstcon_batch *bat; int rc; rc = lstcon_batch_find(name, &bat); @@ -1757,7 +1757,7 @@ lstcon_session_new(char *name, int key, unsigned feats, rc = lstcon_rpc_pinger_start(); if (rc) { - lstcon_batch_t *bat = NULL; + struct lstcon_batch *bat = NULL; lstcon_batch_find(LST_DEFAULT_BATCH, &bat); lstcon_batch_destroy(bat); @@ -1814,7 +1814,7 @@ lstcon_session_end(void) { struct lstcon_rpc_trans *trans; struct lstcon_group *grp; - lstcon_batch_t *bat; + struct lstcon_batch *bat; int rc = 0; LASSERT(console_session.ses_state == LST_SESSION_ACTIVE); @@ -1848,7 +1848,7 @@ lstcon_session_end(void) /* destroy all batches */ while (!list_empty(&console_session.ses_bat_list)) { bat = list_entry(console_session.ses_bat_list.next, - lstcon_batch_t, bat_link); + struct lstcon_batch, bat_link); lstcon_batch_destroy(bat); } diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index 427bc9b..ccd4982 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -89,7 +89,8 @@ struct lstcon_tsb_hdr { int tsb_index; /* test index */ }; -typedef struct { +/* (tests ) batch descriptor */ +struct lstcon_batch { struct lstcon_tsb_hdr bat_hdr; /* test_batch header */ struct list_head bat_link; /* chain on session's batches list */ int bat_ntest; /* # of test */ @@ -106,12 +107,12 @@ typedef struct { struct list_head *bat_cli_hash; /* hash table of client nodes */ struct list_head bat_srv_list; /* list head of server nodes */ struct list_head *bat_srv_hash; /* hash table of server nodes */ -} lstcon_batch_t; /* (tests ) batch descriptor */ +}; typedef struct lstcon_test { struct lstcon_tsb_hdr tes_hdr; /* test batch header */ struct list_head tes_link; /* chain on batch's tests list */ - lstcon_batch_t *tes_batch; /* pointer to batch */ + struct lstcon_batch *tes_batch; /* pointer to batch */ int tes_type; /* type of the test, i.e: bulk, ping */ int tes_stop_onerr; /* stop on error */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:33 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:33 -0400 Subject: [lustre-devel] [PATCH 07/24] staging: lustre: selftest: convert srpc_service_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-8-git-send-email-jsimmons@infradead.org> Turn typedef srpc_service_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 3 +- drivers/staging/lustre/lnet/selftest/console.c | 3 +- drivers/staging/lustre/lnet/selftest/framework.c | 8 +++--- drivers/staging/lustre/lnet/selftest/ping_test.c | 3 +- drivers/staging/lustre/lnet/selftest/rpc.c | 10 ++++---- drivers/staging/lustre/lnet/selftest/selftest.h | 26 +++++++++++----------- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 442f431..d2a8379 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -497,7 +497,8 @@ void brw_init_test_client(void) brw_test_client.tso_done_rpc = brw_client_done_rpc; }; -srpc_service_t brw_test_service; +struct srpc_service brw_test_service; + void brw_init_test_service(void) { brw_test_service.sv_id = SRPC_SERVICE_BRW; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index dcfc83d..1352310 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1986,7 +1986,8 @@ out: return rc; } -static srpc_service_t lstcon_acceptor_service; +static struct srpc_service lstcon_acceptor_service; + static void lstcon_init_acceptor_service(void) { /* initialize selftest console acceptor service table */ diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 6c0af58..0eb275f 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -135,7 +135,7 @@ sfw_find_test_case(int id) } static int -sfw_register_test(srpc_service_t *service, sfw_test_client_ops_t *cliops) +sfw_register_test(struct srpc_service *service, sfw_test_client_ops_t *cliops) { sfw_test_case_t *tsc; @@ -1584,7 +1584,7 @@ sfw_post_rpc(struct srpc_client_rpc *rpc) spin_unlock(&rpc->crpc_lock); } -static srpc_service_t sfw_services[] = { +static struct srpc_service sfw_services[] = { { /* sv_id */ SRPC_SERVICE_DEBUG, /* sv_name */ "debug", @@ -1628,7 +1628,7 @@ sfw_startup(void) int i; int rc; int error; - srpc_service_t *sv; + struct srpc_service *sv; sfw_test_case_t *tsc; if (session_timeout < 0) { @@ -1721,7 +1721,7 @@ sfw_startup(void) void sfw_shutdown(void) { - srpc_service_t *sv; + struct srpc_service *sv; sfw_test_case_t *tsc; int i; diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index 1f2ddf6..c09b599 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -219,7 +219,8 @@ void ping_init_test_client(void) ping_test_client.tso_done_rpc = ping_client_done_rpc; } -srpc_service_t ping_test_service; +struct srpc_service ping_test_service; + void ping_init_test_service(void) { ping_test_service.sv_id = SRPC_SERVICE_PING; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index e711571..1e2fd8a 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -56,7 +56,7 @@ typedef enum { static struct smoketest_rpc { spinlock_t rpc_glock; /* global lock */ - srpc_service_t *rpc_services[SRPC_SERVICE_MAX_ID + 1]; + struct srpc_service *rpc_services[SRPC_SERVICE_MAX_ID + 1]; lnet_handle_eq_t rpc_lnet_eq; /* _the_ LNet event queue */ srpc_state_t rpc_state; srpc_counters_t rpc_counters; @@ -338,7 +338,7 @@ srpc_add_service(struct srpc_service *sv) } int -srpc_remove_service(srpc_service_t *sv) +srpc_remove_service(struct srpc_service *sv) { int id = sv->sv_id; @@ -755,7 +755,7 @@ srpc_abort_service(struct srpc_service *sv) } void -srpc_shutdown_service(srpc_service_t *sv) +srpc_shutdown_service(struct srpc_service *sv) { struct srpc_service_cd *scd; struct srpc_server_rpc *rpc; @@ -1414,7 +1414,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) struct srpc_client_rpc *crpc; struct srpc_server_rpc *srpc; struct srpc_buffer *buffer; - srpc_service_t *sv; + struct srpc_service *sv; srpc_msg_t *msg; srpc_msg_type_t type; @@ -1663,7 +1663,7 @@ srpc_shutdown(void) spin_lock(&srpc_data.rpc_glock); for (i = 0; i <= SRPC_SERVICE_MAX_ID; i++) { - srpc_service_t *sv = srpc_data.rpc_services[i]; + struct srpc_service *sv = srpc_data.rpc_services[i]; LASSERTF(!sv, "service not empty: id %d, name %s\n", i, sv->sv_name); diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 55f8154..0ad6e53 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -307,7 +307,7 @@ struct srpc_service_cd { #define SFW_FRWK_WI_MIN 16 #define SFW_FRWK_WI_MAX 256 -typedef struct srpc_service { +struct srpc_service { int sv_id; /* service id */ const char *sv_name; /* human readable name */ int sv_wi_total; /* total server workitems */ @@ -321,7 +321,7 @@ typedef struct srpc_service { */ int (*sv_handler)(struct srpc_server_rpc *); int (*sv_bulk_ready)(struct srpc_server_rpc *, int); -} srpc_service_t; +}; typedef struct { struct list_head sn_list; /* chain on fw_zombie_sessions */ @@ -409,7 +409,7 @@ typedef struct sfw_test_unit { typedef struct sfw_test_case { struct list_head tsc_list; /* chain on fw_tests */ - srpc_service_t *tsc_srv_service; /* test service */ + struct srpc_service *tsc_srv_service; /* test service */ sfw_test_client_ops_t *tsc_cli_ops; /* ops of test client */ } sfw_test_case_t; @@ -442,13 +442,13 @@ struct srpc_bulk *srpc_alloc_bulk(int cpt, unsigned bulk_npg, unsigned bulk_len, int sink); int srpc_send_rpc(struct swi_workitem *wi); int srpc_send_reply(struct srpc_server_rpc *rpc); -int srpc_add_service(srpc_service_t *sv); -int srpc_remove_service(srpc_service_t *sv); -void srpc_shutdown_service(srpc_service_t *sv); -void srpc_abort_service(srpc_service_t *sv); -int srpc_finish_service(srpc_service_t *sv); -int srpc_service_add_buffers(srpc_service_t *sv, int nbuffer); -void srpc_service_remove_buffers(srpc_service_t *sv, int nbuffer); +int srpc_add_service(struct srpc_service *sv); +int srpc_remove_service(struct srpc_service *sv); +void srpc_shutdown_service(struct srpc_service *sv); +void srpc_abort_service(struct srpc_service *sv); +int srpc_finish_service(struct srpc_service *sv); +int srpc_service_add_buffers(struct srpc_service *sv, int nbuffer); +void srpc_service_remove_buffers(struct srpc_service *sv, int nbuffer); void srpc_get_counters(srpc_counters_t *cnt); void srpc_set_counters(const srpc_counters_t *cnt); @@ -595,7 +595,7 @@ do { \ } while (0) static inline void -srpc_wait_service_shutdown(srpc_service_t *sv) +srpc_wait_service_shutdown(struct srpc_service *sv) { int i = 2; @@ -613,13 +613,13 @@ srpc_wait_service_shutdown(srpc_service_t *sv) extern sfw_test_client_ops_t brw_test_client; void brw_init_test_client(void); -extern srpc_service_t brw_test_service; +extern struct srpc_service brw_test_service; void brw_init_test_service(void); extern sfw_test_client_ops_t ping_test_client; void ping_init_test_client(void); -extern srpc_service_t ping_test_service; +extern struct srpc_service ping_test_service; void ping_init_test_service(void); #endif /* __SELFTEST_SELFTEST_H__ */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:34 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:34 -0400 Subject: [lustre-devel] [PATCH 08/24] staging: lustre: selftest: convert sfw_session_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-9-git-send-email-jsimmons@infradead.org> Turn typedef sfw_session_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 6 ++-- drivers/staging/lustre/lnet/selftest/framework.c | 40 +++++++++++----------- drivers/staging/lustre/lnet/selftest/ping_test.c | 8 ++-- drivers/staging/lustre/lnet/selftest/selftest.h | 6 ++-- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index d2a8379..8e789ba 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -69,7 +69,7 @@ brw_client_fini(sfw_test_instance_t *tsi) static int brw_client_init(sfw_test_instance_t *tsi) { - sfw_session_t *sn = tsi->tsi_batch->bat_session; + struct sfw_session *sn = tsi->tsi_batch->bat_session; int flags; int npg; int len; @@ -259,7 +259,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, { struct srpc_bulk *bulk = tsu->tsu_private; sfw_test_instance_t *tsi = tsu->tsu_instance; - sfw_session_t *sn = tsi->tsi_batch->bat_session; + struct sfw_session *sn = tsi->tsi_batch->bat_session; struct srpc_client_rpc *rpc; srpc_brw_reqst_t *req; int flags; @@ -317,7 +317,7 @@ brw_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) { __u64 magic = BRW_MAGIC; sfw_test_instance_t *tsi = tsu->tsu_instance; - sfw_session_t *sn = tsi->tsi_batch->bat_session; + struct sfw_session *sn = tsi->tsi_batch->bat_session; srpc_msg_t *msg = &rpc->crpc_replymsg; srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 0eb275f..3a20598 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -109,14 +109,14 @@ static struct smoketest_framework { struct list_head fw_tests; /* registered test cases */ atomic_t fw_nzombies; /* # zombie sessions */ spinlock_t fw_lock; /* serialise */ - sfw_session_t *fw_session; /* _the_ session */ + struct sfw_session *fw_session; /* _the_ session */ int fw_shuttingdown; /* shutdown in progress */ struct srpc_server_rpc *fw_active_srpc;/* running RPC */ } sfw_data; /* forward ref's */ int sfw_stop_batch(sfw_batch_t *tsb, int force); -void sfw_destroy_session(sfw_session_t *sn); +void sfw_destroy_session(struct sfw_session *sn); static inline sfw_test_case_t * sfw_find_test_case(int id) @@ -159,7 +159,7 @@ sfw_register_test(struct srpc_service *service, sfw_test_client_ops_t *cliops) static void sfw_add_session_timer(void) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; struct stt_timer *timer = &sn->sn_timer; LASSERT(!sfw_data.fw_shuttingdown); @@ -177,7 +177,7 @@ sfw_add_session_timer(void) static int sfw_del_session_timer(void) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; if (!sn || !sn->sn_timer_active) return 0; @@ -196,7 +196,7 @@ static void sfw_deactivate_session(void) __must_hold(&sfw_data.fw_lock) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; int nactive = 0; sfw_batch_t *tsb; sfw_test_case_t *tsc; @@ -239,7 +239,7 @@ __must_hold(&sfw_data.fw_lock) static void sfw_session_expired(void *data) { - sfw_session_t *sn = data; + struct sfw_session *sn = data; spin_lock(&sfw_data.fw_lock); @@ -257,12 +257,12 @@ sfw_session_expired(void *data) } static inline void -sfw_init_session(sfw_session_t *sn, lst_sid_t sid, +sfw_init_session(struct sfw_session *sn, lst_sid_t sid, unsigned features, const char *name) { struct stt_timer *timer = &sn->sn_timer; - memset(sn, 0, sizeof(sfw_session_t)); + memset(sn, 0, sizeof(struct sfw_session)); INIT_LIST_HEAD(&sn->sn_list); INIT_LIST_HEAD(&sn->sn_batches); atomic_set(&sn->sn_refcount, 1); /* +1 for caller */ @@ -321,7 +321,7 @@ sfw_client_rpc_fini(struct srpc_client_rpc *rpc) static sfw_batch_t * sfw_find_batch(lst_bid_t bid) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; sfw_batch_t *bat; LASSERT(sn); @@ -337,7 +337,7 @@ sfw_find_batch(lst_bid_t bid) static sfw_batch_t * sfw_bid2batch(lst_bid_t bid) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; sfw_batch_t *bat; LASSERT(sn); @@ -363,7 +363,7 @@ sfw_bid2batch(lst_bid_t bid) static int sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; sfw_counters_t *cnt = &reply->str_fw; sfw_batch_t *bat; @@ -404,7 +404,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) int sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; srpc_msg_t *msg = container_of(request, srpc_msg_t, msg_body.mksn_reqst); int cplen = 0; @@ -449,7 +449,7 @@ sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) } /* brand new or create by force */ - LIBCFS_ALLOC(sn, sizeof(sfw_session_t)); + LIBCFS_ALLOC(sn, sizeof(struct sfw_session)); if (!sn) { CERROR("dropping RPC mksn under memory pressure\n"); return -ENOMEM; @@ -475,7 +475,7 @@ sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) static int sfw_remove_session(srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; reply->rmsn_sid = !sn ? LST_INVALID_SID : sn->sn_id; @@ -507,7 +507,7 @@ sfw_remove_session(srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) static int sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; if (!sn) { reply->dbg_status = ESRCH; @@ -666,7 +666,7 @@ sfw_destroy_batch(sfw_batch_t *tsb) } void -sfw_destroy_session(sfw_session_t *sn) +sfw_destroy_session(struct sfw_session *sn) { sfw_batch_t *batch; @@ -828,7 +828,7 @@ sfw_test_unit_done(sfw_test_unit_t *tsu) { sfw_test_instance_t *tsi = tsu->tsu_instance; sfw_batch_t *tsb = tsi->tsi_batch; - sfw_session_t *sn = tsb->bat_session; + struct sfw_session *sn = tsb->bat_session; LASSERT(sfw_test_active(tsi)); @@ -1115,7 +1115,7 @@ sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, static int sfw_add_test(struct srpc_server_rpc *rpc) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply; srpc_test_reqst_t *request; int rc; @@ -1185,7 +1185,7 @@ sfw_add_test(struct srpc_server_rpc *rpc) static int sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; int rc = 0; sfw_batch_t *bat; @@ -1261,7 +1261,7 @@ sfw_handle_server_rpc(struct srpc_server_rpc *rpc) if (sv->sv_id != SRPC_SERVICE_MAKE_SESSION && sv->sv_id != SRPC_SERVICE_DEBUG) { - sfw_session_t *sn = sfw_data.fw_session; + struct sfw_session *sn = sfw_data.fw_session; if (sn && sn->sn_features != request->msg_ses_feats) { diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index c09b599..df33a13 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -58,7 +58,7 @@ static struct lst_ping_data lst_ping_data; static int ping_client_init(sfw_test_instance_t *tsi) { - sfw_session_t *sn = tsi->tsi_batch->bat_session; + struct sfw_session *sn = tsi->tsi_batch->bat_session; LASSERT(tsi->tsi_is_client); LASSERT(sn && !(sn->sn_features & ~LST_FEATS_MASK)); @@ -72,7 +72,7 @@ ping_client_init(sfw_test_instance_t *tsi) static void ping_client_fini(sfw_test_instance_t *tsi) { - sfw_session_t *sn = tsi->tsi_batch->bat_session; + struct sfw_session *sn = tsi->tsi_batch->bat_session; int errors; LASSERT(sn); @@ -91,7 +91,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, { srpc_ping_reqst_t *req; sfw_test_instance_t *tsi = tsu->tsu_instance; - sfw_session_t *sn = tsi->tsi_batch->bat_session; + struct sfw_session *sn = tsi->tsi_batch->bat_session; struct timespec64 ts; int rc; @@ -121,7 +121,7 @@ static void ping_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) { sfw_test_instance_t *tsi = tsu->tsu_instance; - sfw_session_t *sn = tsi->tsi_batch->bat_session; + struct sfw_session *sn = tsi->tsi_batch->bat_session; srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; struct timespec64 ts; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 0ad6e53..eee36b1 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -323,7 +323,7 @@ struct srpc_service { int (*sv_bulk_ready)(struct srpc_server_rpc *, int); }; -typedef struct { +struct sfw_session { struct list_head sn_list; /* chain on fw_zombie_sessions */ lst_sid_t sn_id; /* unique identifier */ unsigned int sn_timeout; /* # seconds' inactivity to expire */ @@ -336,7 +336,7 @@ typedef struct { atomic_t sn_brw_errors; atomic_t sn_ping_errors; unsigned long sn_started; -} sfw_session_t; +}; #define sfw_sid_equal(sid0, sid1) ((sid0).ses_nid == (sid1).ses_nid && \ (sid0).ses_stamp == (sid1).ses_stamp) @@ -345,7 +345,7 @@ typedef struct { struct list_head bat_list; /* chain on sn_batches */ lst_bid_t bat_id; /* batch id */ int bat_error; /* error code of batch */ - sfw_session_t *bat_session; /* batch's session */ + struct sfw_session *bat_session; /* batch's session */ atomic_t bat_nactive; /* # of active tests */ struct list_head bat_tests; /* test instances */ } sfw_batch_t; -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:30 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:30 -0400 Subject: [lustre-devel] [PATCH 04/24] staging: lustre: selftest: convert srpc_buffer_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-5-git-send-email-jsimmons@infradead.org> Turn typedef srpc_buffer_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/rpc.c | 12 ++++++------ drivers/staging/lustre/lnet/selftest/selftest.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 387c306..316ccf7 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -697,7 +697,7 @@ srpc_finish_service(struct srpc_service *sv) /* called with sv->sv_lock held */ static void -srpc_service_recycle_buffer(struct srpc_service_cd *scd, srpc_buffer_t *buf) +srpc_service_recycle_buffer(struct srpc_service_cd *scd, struct srpc_buffer *buf) __must_hold(&scd->scd_lock) { if (!scd->scd_svc->sv_shuttingdown && scd->scd_buf_adjust >= 0) { @@ -759,7 +759,7 @@ srpc_shutdown_service(srpc_service_t *sv) { struct srpc_service_cd *scd; struct srpc_server_rpc *rpc; - srpc_buffer_t *buf; + struct srpc_buffer *buf; int i; CDEBUG(D_NET, "Shutting down service: id %d, name %s\n", @@ -903,7 +903,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int status) { struct srpc_service_cd *scd = rpc->srpc_scd; struct srpc_service *sv = scd->scd_svc; - srpc_buffer_t *buffer; + struct srpc_buffer *buffer; LASSERT(status || rpc->srpc_wi.swi_state == SWI_STATE_DONE); @@ -948,7 +948,7 @@ srpc_server_rpc_done(struct srpc_server_rpc *rpc, int status) if (!sv->sv_shuttingdown && !list_empty(&scd->scd_buf_blocked)) { buffer = list_entry(scd->scd_buf_blocked.next, - srpc_buffer_t, buf_list); + struct srpc_buffer, buf_list); list_del(&buffer->buf_list); srpc_init_server_rpc(rpc, scd, buffer); @@ -1413,7 +1413,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) struct srpc_event *rpcev = ev->md.user_ptr; srpc_client_rpc_t *crpc; struct srpc_server_rpc *srpc; - srpc_buffer_t *buffer; + struct srpc_buffer *buffer; srpc_service_t *sv; srpc_msg_t *msg; srpc_msg_type_t type; @@ -1486,7 +1486,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) LASSERT(ev->type != LNET_EVENT_UNLINK || sv->sv_shuttingdown); - buffer = container_of(ev->md.start, srpc_buffer_t, buf_msg); + buffer = container_of(ev->md.start, struct srpc_buffer, buf_msg); buffer->buf_peer = ev->initiator; buffer->buf_self = ev->target.nid; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index fdf62cc..04e742e 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -164,13 +164,13 @@ struct srpc_bulk { }; /* message buffer descriptor */ -typedef struct srpc_buffer { +struct srpc_buffer { struct list_head buf_list; /* chain on srpc_service::*_msgq */ srpc_msg_t buf_msg; lnet_handle_md_t buf_mdh; lnet_nid_t buf_self; lnet_process_id_t buf_peer; -} srpc_buffer_t; +}; struct swi_workitem; typedef int (*swi_action_t) (struct swi_workitem *); @@ -193,7 +193,7 @@ struct srpc_server_rpc { lnet_process_id_t srpc_peer; srpc_msg_t srpc_replymsg; lnet_handle_md_t srpc_replymdh; - srpc_buffer_t *srpc_reqstbuf; + struct srpc_buffer *srpc_reqstbuf; struct srpc_bulk *srpc_bulk; unsigned int srpc_aborted; /* being given up */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:37 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:37 -0400 Subject: [lustre-devel] [PATCH 11/24] staging: lustre: selftest: convert sfw_test_instance_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-12-git-send-email-jsimmons@infradead.org> Turn typedef sfw_test_instance_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 8 +++--- drivers/staging/lustre/lnet/selftest/framework.c | 26 +++++++++++----------- drivers/staging/lustre/lnet/selftest/ping_test.c | 8 +++--- drivers/staging/lustre/lnet/selftest/selftest.h | 6 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 5cba2c3..90fabd0 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -49,7 +49,7 @@ module_param(brw_inject_errors, int, 0644); MODULE_PARM_DESC(brw_inject_errors, "# data errors to inject randomly, zero by default"); static void -brw_client_fini(sfw_test_instance_t *tsi) +brw_client_fini(struct sfw_test_instance *tsi) { struct srpc_bulk *bulk; sfw_test_unit_t *tsu; @@ -67,7 +67,7 @@ brw_client_fini(sfw_test_instance_t *tsi) } static int -brw_client_init(sfw_test_instance_t *tsi) +brw_client_init(struct sfw_test_instance *tsi) { struct sfw_session *sn = tsi->tsi_batch->bat_session; int flags; @@ -258,7 +258,7 @@ brw_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, struct srpc_client_rpc **rpcpp) { struct srpc_bulk *bulk = tsu->tsu_private; - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct srpc_client_rpc *rpc; srpc_brw_reqst_t *req; @@ -316,7 +316,7 @@ static void brw_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) { __u64 magic = BRW_MAGIC; - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; srpc_msg_t *msg = &rpc->crpc_replymsg; srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index d42ee18..5cc4807 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -529,7 +529,7 @@ static void sfw_test_rpc_fini(struct srpc_client_rpc *rpc) { sfw_test_unit_t *tsu = rpc->crpc_priv; - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; /* Called with hold of tsi->tsi_lock */ LASSERT(list_empty(&rpc->crpc_list)); @@ -537,7 +537,7 @@ sfw_test_rpc_fini(struct srpc_client_rpc *rpc) } static inline int -sfw_test_buffers(sfw_test_instance_t *tsi) +sfw_test_buffers(struct sfw_test_instance *tsi) { struct sfw_test_case *tsc; struct srpc_service *svc; @@ -614,7 +614,7 @@ sfw_unload_test(struct sfw_test_instance *tsi) } static void -sfw_destroy_test_instance(sfw_test_instance_t *tsi) +sfw_destroy_test_instance(struct sfw_test_instance *tsi) { struct srpc_client_rpc *rpc; sfw_test_unit_t *tsu; @@ -650,14 +650,14 @@ clean: static void sfw_destroy_batch(struct sfw_batch *tsb) { - sfw_test_instance_t *tsi; + struct sfw_test_instance *tsi; LASSERT(!sfw_batch_active(tsb)); LASSERT(list_empty(&tsb->bat_list)); while (!list_empty(&tsb->bat_tests)) { tsi = list_entry(tsb->bat_tests.next, - sfw_test_instance_t, tsi_list); + struct sfw_test_instance, tsi_list); list_del_init(&tsi->tsi_list); sfw_destroy_test_instance(tsi); } @@ -736,7 +736,7 @@ sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc) struct srpc_bulk *bk = rpc->srpc_bulk; int ndest = req->tsr_ndest; sfw_test_unit_t *tsu; - sfw_test_instance_t *tsi; + struct sfw_test_instance *tsi; int i; int rc; @@ -826,7 +826,7 @@ error: static void sfw_test_unit_done(sfw_test_unit_t *tsu) { - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_batch *tsb = tsi->tsi_batch; struct sfw_session *sn = tsb->bat_session; @@ -869,7 +869,7 @@ static void sfw_test_rpc_done(struct srpc_client_rpc *rpc) { sfw_test_unit_t *tsu = rpc->crpc_priv; - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; int done = 0; tsi->tsi_ops->tso_done_rpc(tsu, rpc); @@ -905,7 +905,7 @@ sfw_create_test_rpc(sfw_test_unit_t *tsu, lnet_process_id_t peer, struct srpc_client_rpc **rpcpp) { struct srpc_client_rpc *rpc = NULL; - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; spin_lock(&tsi->tsi_lock); @@ -945,7 +945,7 @@ static int sfw_run_test(struct swi_workitem *wi) { sfw_test_unit_t *tsu = wi->swi_workitem.wi_data; - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; struct srpc_client_rpc *rpc = NULL; LASSERT(wi == &tsu->tsu_worker); @@ -995,7 +995,7 @@ sfw_run_batch(struct sfw_batch *tsb) { struct swi_workitem *wi; sfw_test_unit_t *tsu; - sfw_test_instance_t *tsi; + struct sfw_test_instance *tsi; if (sfw_batch_active(tsb)) { CDEBUG(D_NET, "Batch already active: %llu (%d)\n", @@ -1028,7 +1028,7 @@ sfw_run_batch(struct sfw_batch *tsb) int sfw_stop_batch(struct sfw_batch *tsb, int force) { - sfw_test_instance_t *tsi; + struct sfw_test_instance *tsi; struct srpc_client_rpc *rpc; if (!sfw_batch_active(tsb)) { @@ -1070,7 +1070,7 @@ sfw_stop_batch(struct sfw_batch *tsb, int force) static int sfw_query_batch(struct sfw_batch *tsb, int testidx, srpc_batch_reply_t *reply) { - sfw_test_instance_t *tsi; + struct sfw_test_instance *tsi; if (testidx < 0) return -EINVAL; diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index be13004..4e45428 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -56,7 +56,7 @@ struct lst_ping_data { static struct lst_ping_data lst_ping_data; static int -ping_client_init(sfw_test_instance_t *tsi) +ping_client_init(struct sfw_test_instance *tsi) { struct sfw_session *sn = tsi->tsi_batch->bat_session; @@ -70,7 +70,7 @@ ping_client_init(sfw_test_instance_t *tsi) } static void -ping_client_fini(sfw_test_instance_t *tsi) +ping_client_fini(struct sfw_test_instance *tsi) { struct sfw_session *sn = tsi->tsi_batch->bat_session; int errors; @@ -90,7 +90,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, struct srpc_client_rpc **rpc) { srpc_ping_reqst_t *req; - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct timespec64 ts; int rc; @@ -120,7 +120,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu, lnet_process_id_t dest, static void ping_client_done_rpc(sfw_test_unit_t *tsu, struct srpc_client_rpc *rpc) { - sfw_test_instance_t *tsi = tsu->tsu_instance; + struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index b536e98..75743dd 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -362,7 +362,7 @@ struct sfw_test_client_ops { struct srpc_client_rpc *rpc); /* done a test rpc */ }; -typedef struct sfw_test_instance { +struct sfw_test_instance { struct list_head tsi_list; /* chain on batch */ int tsi_service; /* test type */ struct sfw_batch *tsi_batch; /* batch */ @@ -389,7 +389,7 @@ typedef struct sfw_test_instance { test_bulk_req_t bulk_v0; /* bulk parameter */ test_bulk_req_v1_t bulk_v1; /* bulk v1 parameter */ } tsi_u; -} sfw_test_instance_t; +}; /* XXX: trailing (PAGE_CACHE_SIZE % sizeof(lnet_process_id_t)) bytes at * the end of pages are not used */ @@ -402,7 +402,7 @@ typedef struct sfw_test_unit { struct list_head tsu_list; /* chain on lst_test_instance */ lnet_process_id_t tsu_dest; /* id of dest node */ int tsu_loop; /* loop count of the test */ - sfw_test_instance_t *tsu_instance; /* pointer to test instance */ + struct sfw_test_instance *tsu_instance; /* pointer to test instance */ void *tsu_private; /* private data */ struct swi_workitem tsu_worker; /* workitem of the test unit */ } sfw_test_unit_t; -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:45 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:45 -0400 Subject: [lustre-devel] [PATCH 19/24] staging: lustre: selftest: convert lstcon_tsb_hdr_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-20-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_tsb_hdr_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conrpc.c | 5 +++-- drivers/staging/lustre/lnet/selftest/console.c | 2 +- drivers/staging/lustre/lnet/selftest/console.h | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 3aae59b..be94b9c 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -650,7 +650,7 @@ lstcon_dbgrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc **c int lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, - lstcon_tsb_hdr_t *tsb, struct lstcon_rpc **crpc) + struct lstcon_tsb_hdr *tsb, struct lstcon_rpc **crpc) { lstcon_batch_t *batch; srpc_batch_reqst_t *brq; @@ -1135,7 +1135,8 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, case LST_TRANS_TSBCLIQRY: case LST_TRANS_TSBSRVQRY: rc = lstcon_batrpc_prep(nd, transop, feats, - (lstcon_tsb_hdr_t *)arg, &rpc); + (struct lstcon_tsb_hdr *)arg, + &rpc); break; case LST_TRANS_STATQRY: rc = lstcon_statrpc_prep(nd, feats, &rpc); diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 47338f5..41f732b 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -1406,7 +1406,7 @@ lstcon_test_batch_query(char *name, int testidx, int client, struct lstcon_rpc_trans *trans; struct list_head *translist; struct list_head *ndlist; - lstcon_tsb_hdr_t *hdr; + struct lstcon_tsb_hdr *hdr; lstcon_batch_t *batch; lstcon_test_t *test = NULL; int transop; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index 74bfcd8..427bc9b 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -84,13 +84,13 @@ struct lstcon_group { #define LST_BATCH_IDLE 0xB0 /* idle batch */ #define LST_BATCH_RUNNING 0xB1 /* running batch */ -typedef struct lstcon_tsb_hdr { +struct lstcon_tsb_hdr { lst_bid_t tsb_id; /* batch ID */ int tsb_index; /* test index */ -} lstcon_tsb_hdr_t; +}; typedef struct { - lstcon_tsb_hdr_t bat_hdr; /* test_batch header */ + struct lstcon_tsb_hdr bat_hdr; /* test_batch header */ struct list_head bat_link; /* chain on session's batches list */ int bat_ntest; /* # of test */ int bat_state; /* state of the batch */ @@ -109,7 +109,7 @@ typedef struct { } lstcon_batch_t; /* (tests ) batch descriptor */ typedef struct lstcon_test { - lstcon_tsb_hdr_t tes_hdr; /* test batch header */ + struct lstcon_tsb_hdr tes_hdr; /* test batch header */ struct list_head tes_link; /* chain on batch's tests list */ lstcon_batch_t *tes_batch; /* pointer to batch */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:27 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:27 -0400 Subject: [lustre-devel] [PATCH 01/24] staging: lustre: selftest: convert srpc_event_type to proper enum In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-2-git-send-email-jsimmons@infradead.org> Turn tyepdef srpc_event_type to proper enum Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/selftest.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index f50580e..00d73a1 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -134,7 +134,7 @@ srpc_service2reply(int service) return srpc_service2request(service) + 1; } -typedef enum { +enum srpc_event_type { SRPC_BULK_REQ_RCVD = 1, /* passive bulk request(PUT sink/GET source) * received */ SRPC_BULK_PUT_SENT = 2, /* active bulk PUT sent (source) */ @@ -143,11 +143,11 @@ typedef enum { SRPC_REPLY_SENT = 5, /* outgoing reply sent */ SRPC_REQUEST_RCVD = 6, /* incoming request received */ SRPC_REQUEST_SENT = 7, /* outgoing request sent */ -} srpc_event_type_t; +}; /* RPC event */ typedef struct { - srpc_event_type_t ev_type; /* what's up */ + enum srpc_event_type ev_type; /* what's up */ lnet_event_kind_t ev_lnet; /* LNet event type */ int ev_fired; /* LNet event fired? */ int ev_status; /* LNet event status */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:36 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:36 -0400 Subject: [lustre-devel] [PATCH 10/24] staging: lustre: selftest: convert sfw_test_client_ops_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-11-git-send-email-jsimmons@infradead.org> Turn typedef sfw_test_client_ops_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 3 ++- drivers/staging/lustre/lnet/selftest/framework.c | 2 +- drivers/staging/lustre/lnet/selftest/ping_test.c | 3 ++- drivers/staging/lustre/lnet/selftest/selftest.h | 14 +++++++------- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 8e789ba..5cba2c3 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -488,7 +488,8 @@ brw_server_handle(struct srpc_server_rpc *rpc) return 0; } -sfw_test_client_ops_t brw_test_client; +struct sfw_test_client_ops brw_test_client; + void brw_init_test_client(void) { brw_test_client.tso_init = brw_client_init; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 0d7c3c5..d42ee18 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -135,7 +135,7 @@ sfw_find_test_case(int id) } static int -sfw_register_test(struct srpc_service *service, sfw_test_client_ops_t *cliops) +sfw_register_test(struct srpc_service *service, struct sfw_test_client_ops *cliops) { sfw_test_case_t *tsc; diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index df33a13..be13004 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -210,7 +210,8 @@ ping_server_handle(struct srpc_server_rpc *rpc) return 0; } -sfw_test_client_ops_t ping_test_client; +struct sfw_test_client_ops ping_test_client; + void ping_init_test_client(void) { ping_test_client.tso_init = ping_client_init; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 50237bc..b536e98 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -350,7 +350,7 @@ struct sfw_batch { struct list_head bat_tests; /* test instances */ }; -typedef struct { +struct sfw_test_client_ops { int (*tso_init)(struct sfw_test_instance *tsi); /* initialize test * client */ void (*tso_fini)(struct sfw_test_instance *tsi); /* finalize test @@ -360,13 +360,13 @@ typedef struct { struct srpc_client_rpc **rpc); /* prep a tests rpc */ void (*tso_done_rpc)(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc); /* done a test rpc */ -} sfw_test_client_ops_t; +}; typedef struct sfw_test_instance { struct list_head tsi_list; /* chain on batch */ int tsi_service; /* test type */ struct sfw_batch *tsi_batch; /* batch */ - sfw_test_client_ops_t *tsi_ops; /* test client operation + struct sfw_test_client_ops *tsi_ops; /* test client operation */ /* public parameter for all test units */ @@ -409,8 +409,8 @@ typedef struct sfw_test_unit { typedef struct sfw_test_case { struct list_head tsc_list; /* chain on fw_tests */ - struct srpc_service *tsc_srv_service; /* test service */ - sfw_test_client_ops_t *tsc_cli_ops; /* ops of test client */ + struct srpc_service *tsc_srv_service; /* test service */ + struct sfw_test_client_ops *tsc_cli_ops; /* ops of test client */ } sfw_test_case_t; struct srpc_client_rpc * @@ -610,13 +610,13 @@ srpc_wait_service_shutdown(struct srpc_service *sv) } } -extern sfw_test_client_ops_t brw_test_client; +extern struct sfw_test_client_ops brw_test_client; void brw_init_test_client(void); extern struct srpc_service brw_test_service; void brw_init_test_service(void); -extern sfw_test_client_ops_t ping_test_client; +extern struct sfw_test_client_ops ping_test_client; void ping_init_test_client(void); extern struct srpc_service ping_test_service; -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:41 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:41 -0400 Subject: [lustre-devel] [PATCH 15/24] staging: lustre: selftest: convert lstcon_rpc_trans_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-16-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_rpc_trans_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conrpc.c | 36 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/conrpc.h | 20 ++++++------ drivers/staging/lustre/lnet/selftest/console.c | 20 ++++++------ drivers/staging/lustre/lnet/selftest/console.h | 2 +- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index edef693..aab4be6 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -46,7 +46,7 @@ #include "conrpc.h" #include "console.h" -void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *, +void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, srpc_msg_t *, lstcon_node_t *, lstcon_trans_stat_t *); static void @@ -185,7 +185,7 @@ lstcon_rpc_put(struct lstcon_rpc *crpc) static void lstcon_rpc_post(struct lstcon_rpc *crpc) { - lstcon_rpc_trans_t *trans = crpc->crp_trans; + struct lstcon_rpc_trans *trans = crpc->crp_trans; LASSERT(trans); @@ -236,9 +236,9 @@ lstcon_rpc_trans_name(int transop) int lstcon_rpc_trans_prep(struct list_head *translist, int transop, - lstcon_rpc_trans_t **transpp) + struct lstcon_rpc_trans **transpp) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; if (translist) { list_for_each_entry(trans, translist, tas_link) { @@ -278,14 +278,14 @@ lstcon_rpc_trans_prep(struct list_head *translist, int transop, } void -lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, struct lstcon_rpc *crpc) +lstcon_rpc_trans_addreq(struct lstcon_rpc_trans *trans, struct lstcon_rpc *crpc) { list_add_tail(&crpc->crp_link, &trans->tas_rpcs_list); crpc->crp_trans = trans; } void -lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error) +lstcon_rpc_trans_abort(struct lstcon_rpc_trans *trans, int error) { struct srpc_client_rpc *rpc; struct lstcon_rpc *crpc; @@ -326,7 +326,7 @@ lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error) } static int -lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans) +lstcon_rpc_trans_check(struct lstcon_rpc_trans *trans) { if (console_session.ses_shutdown && !list_empty(&trans->tas_olink)) /* Not an end session RPC */ @@ -336,7 +336,7 @@ lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans) } int -lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout) +lstcon_rpc_trans_postwait(struct lstcon_rpc_trans *trans, int timeout) { struct lstcon_rpc *crpc; int rc; @@ -423,7 +423,7 @@ lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t **msgpp) } void -lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat) +lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, lstcon_trans_stat_t *stat) { struct lstcon_rpc *crpc; srpc_msg_t *rep; @@ -466,7 +466,7 @@ lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat) } int -lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, +lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, struct list_head __user *head_up, lstcon_rpc_readent_func_t readent) { @@ -539,7 +539,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, } void -lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans) +lstcon_rpc_trans_destroy(struct lstcon_rpc_trans *trans) { struct srpc_client_rpc *rpc; struct lstcon_rpc *crpc; @@ -915,7 +915,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, } static int -lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans, +lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans, lstcon_node_t *nd, srpc_msg_t *reply) { srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply; @@ -962,7 +962,7 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans, } void -lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg, +lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, srpc_msg_t *msg, lstcon_node_t *nd, lstcon_trans_stat_t *stat) { srpc_rmsn_reply_t *rmsn_rep; @@ -1083,9 +1083,9 @@ int lstcon_rpc_trans_ndlist(struct list_head *ndlist, struct list_head *translist, int transop, void *arg, lstcon_rpc_cond_func_t condition, - lstcon_rpc_trans_t **transpp) + struct lstcon_rpc_trans **transpp) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; lstcon_ndlink_t *ndl; lstcon_node_t *nd; struct lstcon_rpc *rpc; @@ -1168,7 +1168,7 @@ static void lstcon_rpc_pinger(void *arg) { struct stt_timer *ptimer = (struct stt_timer *)arg; - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; struct lstcon_rpc *crpc; srpc_msg_t *rep; srpc_debug_reqst_t *drq; @@ -1325,7 +1325,7 @@ lstcon_rpc_pinger_stop(void) void lstcon_rpc_cleanup_wait(void) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; struct lstcon_rpc *crpc; struct lstcon_rpc *temp; struct list_head *pacer; @@ -1337,7 +1337,7 @@ lstcon_rpc_cleanup_wait(void) while (!list_empty(&console_session.ses_trans_list)) { list_for_each(pacer, &console_session.ses_trans_list) { - trans = list_entry(pacer, lstcon_rpc_trans_t, + trans = list_entry(pacer, struct lstcon_rpc_trans, tas_link); CDEBUG(D_NET, "Session closed, wakeup transaction %s\n", diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h b/drivers/staging/lustre/lnet/selftest/conrpc.h index abd7bb0..7281abd 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.h +++ b/drivers/staging/lustre/lnet/selftest/conrpc.h @@ -78,7 +78,7 @@ struct lstcon_rpc { unsigned long crp_stamp; /* replied time stamp */ }; -typedef struct lstcon_rpc_trans { +struct lstcon_rpc_trans { struct list_head tas_olink; /* link chain on owner list */ struct list_head tas_link; /* link chain on global list */ int tas_opc; /* operation code of transaction */ @@ -87,7 +87,7 @@ typedef struct lstcon_rpc_trans { wait_queue_head_t tas_waitq; /* wait queue head */ atomic_t tas_remaining; /* # of un-scheduled rpcs */ struct list_head tas_rpcs_list; /* queued requests */ -} lstcon_rpc_trans_t; +}; #define LST_TRANS_PRIVATE 0x1000 @@ -121,20 +121,20 @@ int lstcon_statrpc_prep(struct lstcon_node *nd, unsigned version, struct lstcon_rpc **crpc); void lstcon_rpc_put(struct lstcon_rpc *crpc); int lstcon_rpc_trans_prep(struct list_head *translist, - int transop, lstcon_rpc_trans_t **transpp); + int transop, struct lstcon_rpc_trans **transpp); int lstcon_rpc_trans_ndlist(struct list_head *ndlist, struct list_head *translist, int transop, void *arg, lstcon_rpc_cond_func_t condition, - lstcon_rpc_trans_t **transpp); -void lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, + struct lstcon_rpc_trans **transpp); +void lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, lstcon_trans_stat_t *stat); -int lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, +int lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, struct list_head __user *head_up, lstcon_rpc_readent_func_t readent); -void lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error); -void lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans); -void lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, struct lstcon_rpc *req); -int lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout); +void lstcon_rpc_trans_abort(struct lstcon_rpc_trans *trans, int error); +void lstcon_rpc_trans_destroy(struct lstcon_rpc_trans *trans); +void lstcon_rpc_trans_addreq(struct lstcon_rpc_trans *trans, struct lstcon_rpc *req); +int lstcon_rpc_trans_postwait(struct lstcon_rpc_trans *trans, int timeout); int lstcon_rpc_pinger_start(void); void lstcon_rpc_pinger_stop(void); void lstcon_rpc_cleanup_wait(void); diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 23696e7..08de007 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -403,7 +403,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, int count, lnet_process_id_t __user *ids_up, unsigned *featp, struct list_head __user *result_up) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; lstcon_ndlink_t *ndl; lstcon_group_t *tmp; lnet_process_id_t id; @@ -470,7 +470,7 @@ lstcon_group_nodes_remove(lstcon_group_t *grp, int count, lnet_process_id_t __user *ids_up, struct list_head __user *result_up) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; lstcon_ndlink_t *ndl; lstcon_group_t *tmp; lnet_process_id_t id; @@ -578,7 +578,7 @@ lstcon_nodes_add(char *name, int count, lnet_process_id_t __user *ids_up, int lstcon_group_del(char *name) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; lstcon_group_t *grp; int rc; @@ -683,7 +683,7 @@ lstcon_nodes_remove(char *name, int count, lnet_process_id_t __user *ids_up, int lstcon_group_refresh(char *name, struct list_head __user *result_up) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; lstcon_group_t *grp; int rc; @@ -1023,7 +1023,7 @@ static int lstcon_batch_op(lstcon_batch_t *bat, int transop, struct list_head __user *result_up) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; int rc; rc = lstcon_rpc_trans_ndlist(&bat->bat_cli_list, @@ -1187,7 +1187,7 @@ lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) static int lstcon_test_nodes_add(lstcon_test_t *test, struct list_head __user *result_up) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; lstcon_group_t *grp; int transop; int rc; @@ -1403,7 +1403,7 @@ int lstcon_test_batch_query(char *name, int testidx, int client, int timeout, struct list_head __user *result_up) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; struct list_head *translist; struct list_head *ndlist; lstcon_tsb_hdr_t *hdr; @@ -1490,7 +1490,7 @@ lstcon_ndlist_stat(struct list_head *ndlist, int timeout, struct list_head __user *result_up) { struct list_head head; - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; int rc; INIT_LIST_HEAD(&head); @@ -1580,7 +1580,7 @@ lstcon_debug_ndlist(struct list_head *ndlist, struct list_head *translist, int timeout, struct list_head __user *result_up) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; int rc; rc = lstcon_rpc_trans_ndlist(ndlist, translist, LST_TRANS_SESQRY, @@ -1812,7 +1812,7 @@ lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up, int lstcon_session_end(void) { - lstcon_rpc_trans_t *trans; + struct lstcon_rpc_trans *trans; lstcon_group_t *grp; lstcon_batch_t *bat; int rc = 0; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index 554f582..c573b56 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -152,7 +152,7 @@ struct lstcon_session { unsigned ses_expired:1; /* console is timedout */ __u64 ses_id_cookie; /* batch id cookie */ char ses_name[LST_NAME_SIZE];/* session name */ - lstcon_rpc_trans_t *ses_ping; /* session pinger */ + struct lstcon_rpc_trans *ses_ping; /* session pinger */ struct stt_timer ses_ping_timer; /* timer for pinger */ lstcon_trans_stat_t ses_trans_stat; /* transaction stats */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:44 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:44 -0400 Subject: [lustre-devel] [PATCH 18/24] staging: lustre: selftest: convert lstcon_group_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-19-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_group_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +- drivers/staging/lustre/lnet/selftest/console.c | 80 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/console.h | 9 ++- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 5cbd631..3aae59b 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -715,7 +715,7 @@ lstcon_next_id(int idx, int nkiov, lnet_kiov_t *kiov) } static int -lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, +lstcon_dstnodes_prep(struct lstcon_group *grp, int idx, int dist, int span, int nkiov, lnet_kiov_t *kiov) { lnet_process_id_packed_t *pid; @@ -809,8 +809,8 @@ int lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, lstcon_test_t *test, struct lstcon_rpc **crpc) { - lstcon_group_t *sgrp = test->tes_src_grp; - lstcon_group_t *dgrp = test->tes_dst_grp; + struct lstcon_group *sgrp = test->tes_src_grp; + struct lstcon_group *dgrp = test->tes_dst_grp; srpc_test_reqst_t *trq; struct srpc_bulk *bulk; int i; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index e068c13..47338f5 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -196,12 +196,12 @@ lstcon_ndlink_release(struct lstcon_ndlink *ndl) } static int -lstcon_group_alloc(char *name, lstcon_group_t **grpp) +lstcon_group_alloc(char *name, struct lstcon_group **grpp) { - lstcon_group_t *grp; + struct lstcon_group *grp; int i; - LIBCFS_ALLOC(grp, offsetof(lstcon_group_t, + LIBCFS_ALLOC(grp, offsetof(struct lstcon_group, grp_ndl_hash[LST_NODE_HASHSIZE])); if (!grp) return -ENOMEM; @@ -209,7 +209,7 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp) grp->grp_ref = 1; if (name) { if (strlen(name) > sizeof(grp->grp_name) - 1) { - LIBCFS_FREE(grp, offsetof(lstcon_group_t, + LIBCFS_FREE(grp, offsetof(struct lstcon_group, grp_ndl_hash[LST_NODE_HASHSIZE])); return -E2BIG; } @@ -229,15 +229,15 @@ lstcon_group_alloc(char *name, lstcon_group_t **grpp) } static void -lstcon_group_addref(lstcon_group_t *grp) +lstcon_group_addref(struct lstcon_group *grp) { grp->grp_ref++; } -static void lstcon_group_ndlink_release(lstcon_group_t *, struct lstcon_ndlink *); +static void lstcon_group_ndlink_release(struct lstcon_group *, struct lstcon_ndlink *); static void -lstcon_group_drain(lstcon_group_t *grp, int keep) +lstcon_group_drain(struct lstcon_group *grp, int keep) { struct lstcon_ndlink *ndl; struct lstcon_ndlink *tmp; @@ -249,7 +249,7 @@ lstcon_group_drain(lstcon_group_t *grp, int keep) } static void -lstcon_group_decref(lstcon_group_t *grp) +lstcon_group_decref(struct lstcon_group *grp) { int i; @@ -264,14 +264,14 @@ lstcon_group_decref(lstcon_group_t *grp) for (i = 0; i < LST_NODE_HASHSIZE; i++) LASSERT(list_empty(&grp->grp_ndl_hash[i])); - LIBCFS_FREE(grp, offsetof(lstcon_group_t, + LIBCFS_FREE(grp, offsetof(struct lstcon_group, grp_ndl_hash[LST_NODE_HASHSIZE])); } static int -lstcon_group_find(const char *name, lstcon_group_t **grpp) +lstcon_group_find(const char *name, struct lstcon_group **grpp) { - lstcon_group_t *grp; + struct lstcon_group *grp; list_for_each_entry(grp, &console_session.ses_grp_list, grp_link) { if (strncmp(grp->grp_name, name, LST_NAME_SIZE)) @@ -286,7 +286,7 @@ lstcon_group_find(const char *name, lstcon_group_t **grpp) } static int -lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, +lstcon_group_ndlink_find(struct lstcon_group *grp, lnet_process_id_t id, struct lstcon_ndlink **ndlpp, int create) { int rc; @@ -305,7 +305,7 @@ lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id, } static void -lstcon_group_ndlink_release(lstcon_group_t *grp, struct lstcon_ndlink *ndl) +lstcon_group_ndlink_release(struct lstcon_group *grp, struct lstcon_ndlink *ndl) { list_del_init(&ndl->ndl_link); lstcon_ndlink_release(ndl); @@ -313,8 +313,8 @@ lstcon_group_ndlink_release(lstcon_group_t *grp, struct lstcon_ndlink *ndl) } static void -lstcon_group_ndlink_move(lstcon_group_t *old, - lstcon_group_t *new, struct lstcon_ndlink *ndl) +lstcon_group_ndlink_move(struct lstcon_group *old, + struct lstcon_group *new, struct lstcon_ndlink *ndl) { unsigned int idx = LNET_NIDADDR(ndl->ndl_node->nd_id.nid) % LST_NODE_HASHSIZE; @@ -329,7 +329,7 @@ lstcon_group_ndlink_move(lstcon_group_t *old, } static void -lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new) +lstcon_group_move(struct lstcon_group *old, struct lstcon_group *new) { struct lstcon_ndlink *ndl; @@ -343,7 +343,7 @@ lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new) static int lstcon_sesrpc_condition(int transop, struct lstcon_node *nd, void *arg) { - lstcon_group_t *grp = (lstcon_group_t *)arg; + struct lstcon_group *grp = (struct lstcon_group *)arg; switch (transop) { case LST_TRANS_SESNEW: @@ -399,13 +399,13 @@ lstcon_sesrpc_readent(int transop, srpc_msg_t *msg, } static int -lstcon_group_nodes_add(lstcon_group_t *grp, +lstcon_group_nodes_add(struct lstcon_group *grp, int count, lnet_process_id_t __user *ids_up, unsigned *featp, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; struct lstcon_ndlink *ndl; - lstcon_group_t *tmp; + struct lstcon_group *tmp; lnet_process_id_t id; int i; int rc; @@ -466,13 +466,13 @@ lstcon_group_nodes_add(lstcon_group_t *grp, } static int -lstcon_group_nodes_remove(lstcon_group_t *grp, +lstcon_group_nodes_remove(struct lstcon_group *grp, int count, lnet_process_id_t __user *ids_up, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; struct lstcon_ndlink *ndl; - lstcon_group_t *tmp; + struct lstcon_group *tmp; lnet_process_id_t id; int rc; int i; @@ -523,7 +523,7 @@ error: int lstcon_group_add(char *name) { - lstcon_group_t *grp; + struct lstcon_group *grp; int rc; rc = lstcon_group_find(name, &grp) ? 0 : -EEXIST; @@ -548,7 +548,7 @@ int lstcon_nodes_add(char *name, int count, lnet_process_id_t __user *ids_up, unsigned *featp, struct list_head __user *result_up) { - lstcon_group_t *grp; + struct lstcon_group *grp; int rc; LASSERT(count > 0); @@ -579,7 +579,7 @@ int lstcon_group_del(char *name) { struct lstcon_rpc_trans *trans; - lstcon_group_t *grp; + struct lstcon_group *grp; int rc; rc = lstcon_group_find(name, &grp); @@ -621,7 +621,7 @@ lstcon_group_del(char *name) int lstcon_group_clean(char *name, int args) { - lstcon_group_t *grp = NULL; + struct lstcon_group *grp = NULL; int rc; rc = lstcon_group_find(name, &grp); @@ -654,7 +654,7 @@ int lstcon_nodes_remove(char *name, int count, lnet_process_id_t __user *ids_up, struct list_head __user *result_up) { - lstcon_group_t *grp = NULL; + struct lstcon_group *grp = NULL; int rc; rc = lstcon_group_find(name, &grp); @@ -684,7 +684,7 @@ int lstcon_group_refresh(char *name, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; - lstcon_group_t *grp; + struct lstcon_group *grp; int rc; rc = lstcon_group_find(name, &grp); @@ -725,7 +725,7 @@ lstcon_group_refresh(char *name, struct list_head __user *result_up) int lstcon_group_list(int index, int len, char __user *name_up) { - lstcon_group_t *grp; + struct lstcon_group *grp; LASSERT(index >= 0); LASSERT(name_up); @@ -786,7 +786,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, lstcon_node_ent_t __user *dents_up) { lstcon_ndlist_ent_t *gentp; - lstcon_group_t *grp; + struct lstcon_group *grp; struct lstcon_ndlink *ndl; int rc; @@ -1188,7 +1188,7 @@ static int lstcon_test_nodes_add(lstcon_test_t *test, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; - lstcon_group_t *grp; + struct lstcon_group *grp; int transop; int rc; @@ -1255,7 +1255,7 @@ lstcon_verify_batch(const char *name, lstcon_batch_t **batch) } static int -lstcon_verify_group(const char *name, lstcon_group_t **grp) +lstcon_verify_group(const char *name, struct lstcon_group **grp) { int rc; struct lstcon_ndlink *ndl; @@ -1285,8 +1285,8 @@ lstcon_test_add(char *batch_name, int type, int loop, { lstcon_test_t *test = NULL; int rc; - lstcon_group_t *src_grp = NULL; - lstcon_group_t *dst_grp = NULL; + struct lstcon_group *src_grp = NULL; + struct lstcon_group *dst_grp = NULL; lstcon_batch_t *batch = NULL; /* @@ -1515,7 +1515,7 @@ int lstcon_group_stat(char *grp_name, int timeout, struct list_head __user *result_up) { - lstcon_group_t *grp; + struct lstcon_group *grp; int rc; rc = lstcon_group_find(grp_name, &grp); @@ -1536,7 +1536,7 @@ lstcon_nodes_stat(int count, lnet_process_id_t __user *ids_up, int timeout, struct list_head __user *result_up) { struct lstcon_ndlink *ndl; - lstcon_group_t *tmp; + struct lstcon_group *tmp; lnet_process_id_t id; int i; int rc; @@ -1628,7 +1628,7 @@ int lstcon_group_debug(int timeout, char *name, struct list_head __user *result_up) { - lstcon_group_t *grp; + struct lstcon_group *grp; int rc; rc = lstcon_group_find(name, &grp); @@ -1649,7 +1649,7 @@ lstcon_nodes_debug(int timeout, { lnet_process_id_t id; struct lstcon_ndlink *ndl; - lstcon_group_t *grp; + struct lstcon_group *grp; int i; int rc; @@ -1813,7 +1813,7 @@ int lstcon_session_end(void) { struct lstcon_rpc_trans *trans; - lstcon_group_t *grp; + struct lstcon_group *grp; lstcon_batch_t *bat; int rc = 0; @@ -1856,7 +1856,7 @@ lstcon_session_end(void) /* destroy all groups */ while (!list_empty(&console_session.ses_grp_list)) { grp = list_entry(console_session.ses_grp_list.next, - lstcon_group_t, grp_link); + struct lstcon_group, grp_link); LASSERT(grp->grp_ref == 1); lstcon_group_decref(grp); @@ -1909,7 +1909,7 @@ lstcon_acceptor_handle(struct srpc_server_rpc *rpc) srpc_msg_t *req = &rpc->srpc_reqstbuf->buf_msg; srpc_join_reqst_t *jreq = &req->msg_body.join_reqst; srpc_join_reply_t *jrep = &rep->msg_body.join_reply; - lstcon_group_t *grp = NULL; + struct lstcon_group *grp = NULL; struct lstcon_ndlink *ndl; int rc = 0; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index dd9674d..74bfcd8 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -67,7 +67,8 @@ struct lstcon_ndlink { struct lstcon_node *ndl_node; /* pointer to node */ }; -typedef struct { +/* (alias of nodes) group descriptor */ +struct lstcon_group { struct list_head grp_link; /* chain on global group list */ int grp_ref; /* reference count */ @@ -78,7 +79,7 @@ typedef struct { struct list_head grp_trans_list; /* transaction list */ struct list_head grp_ndl_list; /* nodes list */ struct list_head grp_ndl_hash[0]; /* hash table for nodes */ -} lstcon_group_t; /* (alias of nodes) group descriptor */ +}; #define LST_BATCH_IDLE 0xB0 /* idle batch */ #define LST_BATCH_RUNNING 0xB1 /* running batch */ @@ -122,8 +123,8 @@ typedef struct lstcon_test { int tes_cliidx; /* client index, used for RPC creating */ struct list_head tes_trans_list; /* transaction list */ - lstcon_group_t *tes_src_grp; /* group run the test */ - lstcon_group_t *tes_dst_grp; /* target group */ + struct lstcon_group *tes_src_grp; /* group run the test */ + struct lstcon_group *tes_dst_grp; /* target group */ int tes_paramlen; /* test parameter length */ char tes_param[0]; /* test parameter */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:48 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:48 -0400 Subject: [lustre-devel] [PATCH 22/24] staging: lustre: selftest: convert srpc_msg_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-23-git-send-email-jsimmons@infradead.org> Turn typedef struct srpc_msg to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 8 ++++---- drivers/staging/lustre/lnet/selftest/conrpc.c | 14 +++++++------- drivers/staging/lustre/lnet/selftest/conrpc.h | 2 +- drivers/staging/lustre/lnet/selftest/console.c | 10 +++++----- drivers/staging/lustre/lnet/selftest/framework.c | 14 +++++++------- drivers/staging/lustre/lnet/selftest/ping_test.c | 4 ++-- drivers/staging/lustre/lnet/selftest/rpc.c | 11 ++++++----- drivers/staging/lustre/lnet/selftest/rpc.h | 6 +++--- drivers/staging/lustre/lnet/selftest/selftest.h | 10 +++++----- 9 files changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 3455990..02c8dae 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -318,7 +318,7 @@ brw_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) __u64 magic = BRW_MAGIC; struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; - srpc_msg_t *msg = &rpc->crpc_replymsg; + struct srpc_msg *msg = &rpc->crpc_replymsg; srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; @@ -384,7 +384,7 @@ brw_bulk_ready(struct srpc_server_rpc *rpc, int status) __u64 magic = BRW_MAGIC; srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply; srpc_brw_reqst_t *reqst; - srpc_msg_t *reqstmsg; + struct srpc_msg *reqstmsg; LASSERT(rpc->srpc_bulk); LASSERT(rpc->srpc_reqstbuf); @@ -418,8 +418,8 @@ static int brw_server_handle(struct srpc_server_rpc *rpc) { struct srpc_service *sv = rpc->srpc_scd->scd_svc; - srpc_msg_t *replymsg = &rpc->srpc_replymsg; - srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; + struct srpc_msg *replymsg = &rpc->srpc_replymsg; + struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply; srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst; int npg; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 5cec1c9..caaae8c 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -46,7 +46,7 @@ #include "conrpc.h" #include "console.h" -void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, srpc_msg_t *, +void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, struct srpc_msg *, struct lstcon_node *, lstcon_trans_stat_t *); static void @@ -386,7 +386,7 @@ lstcon_rpc_trans_postwait(struct lstcon_rpc_trans *trans, int timeout) } static int -lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t **msgpp) +lstcon_rpc_get_reply(struct lstcon_rpc *crpc, struct srpc_msg **msgpp) { struct lstcon_node *nd = crpc->crp_node; struct srpc_client_rpc *rpc = crpc->crp_rpc; @@ -426,7 +426,7 @@ void lstcon_rpc_trans_stat(struct lstcon_rpc_trans *trans, lstcon_trans_stat_t *stat) { struct lstcon_rpc *crpc; - srpc_msg_t *rep; + struct srpc_msg *rep; int error; LASSERT(stat); @@ -475,7 +475,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, lstcon_rpc_ent_t *ent; srpc_generic_reply_t *rep; struct lstcon_rpc *crpc; - srpc_msg_t *msg; + struct srpc_msg *msg; struct lstcon_node *nd; long dur; struct timeval tv; @@ -916,7 +916,7 @@ lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, static int lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans, - struct lstcon_node *nd, srpc_msg_t *reply) + struct lstcon_node *nd, struct srpc_msg *reply) { srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply; int status = mksn_rep->mksn_status; @@ -962,7 +962,7 @@ lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans, } void -lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, srpc_msg_t *msg, +lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, struct srpc_msg *msg, struct lstcon_node *nd, lstcon_trans_stat_t *stat) { srpc_rmsn_reply_t *rmsn_rep; @@ -1172,7 +1172,7 @@ lstcon_rpc_pinger(void *arg) struct stt_timer *ptimer = (struct stt_timer *)arg; struct lstcon_rpc_trans *trans; struct lstcon_rpc *crpc; - srpc_msg_t *rep; + struct srpc_msg *rep; srpc_debug_reqst_t *drq; struct lstcon_ndlink *ndl; struct lstcon_node *nd; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h b/drivers/staging/lustre/lnet/selftest/conrpc.h index 7281abd..90c3385 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.h +++ b/drivers/staging/lustre/lnet/selftest/conrpc.h @@ -106,7 +106,7 @@ struct lstcon_rpc_trans { #define LST_TRANS_STATQRY 0x21 typedef int (*lstcon_rpc_cond_func_t)(int, struct lstcon_node *, void *); -typedef int (*lstcon_rpc_readent_func_t)(int, srpc_msg_t *, +typedef int (*lstcon_rpc_readent_func_t)(int, struct srpc_msg *, lstcon_rpc_ent_t __user *); int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index cdbcee7..6568e8e 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -370,7 +370,7 @@ lstcon_sesrpc_condition(int transop, struct lstcon_node *nd, void *arg) } static int -lstcon_sesrpc_readent(int transop, srpc_msg_t *msg, +lstcon_sesrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { srpc_debug_reply_t *rep; @@ -1383,7 +1383,7 @@ lstcon_test_find(struct lstcon_batch *batch, int idx, struct lstcon_test **testp } static int -lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg, +lstcon_tsbrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { srpc_batch_reply_t *rep = &msg->msg_body.bat_reply; @@ -1462,7 +1462,7 @@ lstcon_test_batch_query(char *name, int testidx, int client, } static int -lstcon_statrpc_readent(int transop, srpc_msg_t *msg, +lstcon_statrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; @@ -1905,8 +1905,8 @@ lstcon_session_feats_check(unsigned feats) static int lstcon_acceptor_handle(struct srpc_server_rpc *rpc) { - srpc_msg_t *rep = &rpc->srpc_replymsg; - srpc_msg_t *req = &rpc->srpc_reqstbuf->buf_msg; + struct srpc_msg *rep = &rpc->srpc_replymsg; + struct srpc_msg *req = &rpc->srpc_reqstbuf->buf_msg; srpc_join_reqst_t *jreq = &req->msg_body.join_reqst; srpc_join_reply_t *jrep = &rep->msg_body.join_reply; struct lstcon_group *grp = NULL; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 56bcc8c..f66da54 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -405,7 +405,7 @@ int sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) { struct sfw_session *sn = sfw_data.fw_session; - srpc_msg_t *msg = container_of(request, srpc_msg_t, + struct srpc_msg *msg = container_of(request, struct srpc_msg, msg_body.mksn_reqst); int cplen = 0; @@ -438,7 +438,7 @@ sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) /* * reject the request if it requires unknown features * NB: old version will always accept all features because it's not - * aware of srpc_msg_t::msg_ses_feats, it's a defect but it's also + * aware of srpc_msg::msg_ses_feats, it's a defect but it's also * harmless because it will return zero feature to console, and it's * console's responsibility to make sure all nodes in a session have * same feature mask. @@ -685,7 +685,7 @@ sfw_destroy_session(struct sfw_session *sn) } static void -sfw_unpack_addtest_req(srpc_msg_t *msg) +sfw_unpack_addtest_req(struct srpc_msg *msg) { srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; @@ -731,7 +731,7 @@ sfw_unpack_addtest_req(srpc_msg_t *msg) static int sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc) { - srpc_msg_t *msg = &rpc->srpc_reqstbuf->buf_msg; + struct srpc_msg *msg = &rpc->srpc_reqstbuf->buf_msg; srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; struct srpc_bulk *bk = rpc->srpc_bulk; int ndest = req->tsr_ndest; @@ -1227,8 +1227,8 @@ static int sfw_handle_server_rpc(struct srpc_server_rpc *rpc) { struct srpc_service *sv = rpc->srpc_scd->scd_svc; - srpc_msg_t *reply = &rpc->srpc_replymsg; - srpc_msg_t *request = &rpc->srpc_reqstbuf->buf_msg; + struct srpc_msg *reply = &rpc->srpc_replymsg; + struct srpc_msg *request = &rpc->srpc_reqstbuf->buf_msg; unsigned features = LST_FEATS_MASK; int rc = 0; @@ -1415,7 +1415,7 @@ sfw_create_rpc(lnet_process_id_t peer, int service, } void -sfw_unpack_message(srpc_msg_t *msg) +sfw_unpack_message(struct srpc_msg *msg) { if (msg->msg_magic == SRPC_MSG_MAGIC) return; /* no flipping needed */ diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index c6f2caa..8a9d7a4 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -171,8 +171,8 @@ static int ping_server_handle(struct srpc_server_rpc *rpc) { struct srpc_service *sv = rpc->srpc_scd->scd_svc; - srpc_msg_t *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; - srpc_msg_t *replymsg = &rpc->srpc_replymsg; + struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; + struct srpc_msg *replymsg = &rpc->srpc_replymsg; srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst; srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 1e2fd8a..d9f8c64 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -803,7 +803,7 @@ srpc_send_request(struct srpc_client_rpc *rpc) rc = srpc_post_active_rdma(srpc_serv_portal(rpc->crpc_service), rpc->crpc_service, &rpc->crpc_reqstmsg, - sizeof(srpc_msg_t), LNET_MD_OP_PUT, + sizeof(struct srpc_msg), LNET_MD_OP_PUT, rpc->crpc_dest, LNET_NID_ANY, &rpc->crpc_reqstmdh, ev); if (rc) { @@ -827,7 +827,8 @@ srpc_prepare_reply(struct srpc_client_rpc *rpc) *id = srpc_next_id(); rc = srpc_post_passive_rdma(SRPC_RDMA_PORTAL, 0, *id, - &rpc->crpc_replymsg, sizeof(srpc_msg_t), + &rpc->crpc_replymsg, + sizeof(struct srpc_msg), LNET_MD_OP_PUT, rpc->crpc_dest, &rpc->crpc_replymdh, ev); if (rc) { @@ -995,7 +996,7 @@ srpc_handle_rpc(struct swi_workitem *wi) default: LBUG(); case SWI_STATE_NEWBORN: { - srpc_msg_t *msg; + struct srpc_msg *msg; srpc_generic_reply_t *reply; msg = &rpc->srpc_reqstbuf->buf_msg; @@ -1179,7 +1180,7 @@ srpc_send_rpc(struct swi_workitem *wi) { int rc = 0; struct srpc_client_rpc *rpc; - srpc_msg_t *reply; + struct srpc_msg *reply; int do_bulk; LASSERT(wi); @@ -1415,7 +1416,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) struct srpc_server_rpc *srpc; struct srpc_buffer *buffer; struct srpc_service *sv; - srpc_msg_t *msg; + struct srpc_msg *msg; srpc_msg_type_t type; LASSERT(!in_interrupt()); diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index a79c315..fdf881f 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -242,7 +242,7 @@ typedef struct { #define SRPC_MSG_MAGIC 0xeeb0f00d #define SRPC_MSG_VERSION 1 -typedef struct srpc_msg { +struct srpc_msg { __u32 msg_magic; /* magic number */ __u32 msg_version; /* message version number */ __u32 msg_type; /* type of message body: srpc_msg_type_t */ @@ -273,10 +273,10 @@ typedef struct srpc_msg { srpc_brw_reqst_t brw_reqst; srpc_brw_reply_t brw_reply; } msg_body; -} WIRE_ATTR srpc_msg_t; +} WIRE_ATTR; static inline void -srpc_unpack_msg_hdr(srpc_msg_t *msg) +srpc_unpack_msg_hdr(struct srpc_msg *msg) { if (msg->msg_magic == SRPC_MSG_MAGIC) return; /* no flipping needed */ diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 1a47772..2bc7f9f 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -166,7 +166,7 @@ struct srpc_bulk { /* message buffer descriptor */ struct srpc_buffer { struct list_head buf_list; /* chain on srpc_service::*_msgq */ - srpc_msg_t buf_msg; + struct srpc_msg buf_msg; lnet_handle_md_t buf_mdh; lnet_nid_t buf_self; lnet_process_id_t buf_peer; @@ -191,7 +191,7 @@ struct srpc_server_rpc { struct srpc_event srpc_ev; /* bulk/reply event */ lnet_nid_t srpc_self; lnet_process_id_t srpc_peer; - srpc_msg_t srpc_replymsg; + struct srpc_msg srpc_replymsg; lnet_handle_md_t srpc_replymdh; struct srpc_buffer *srpc_reqstbuf; struct srpc_bulk *srpc_bulk; @@ -227,8 +227,8 @@ struct srpc_client_rpc { struct srpc_event crpc_replyev; /* reply event */ /* bulk, request(reqst), and reply exchanged on wire */ - srpc_msg_t crpc_reqstmsg; - srpc_msg_t crpc_replymsg; + struct srpc_msg crpc_reqstmsg; + struct srpc_msg crpc_replymsg; lnet_handle_md_t crpc_reqstmdh; lnet_handle_md_t crpc_replymdh; struct srpc_bulk crpc_bulk; @@ -423,7 +423,7 @@ int sfw_create_test_rpc(struct sfw_test_unit *tsu, void sfw_abort_rpc(struct srpc_client_rpc *rpc); void sfw_post_rpc(struct srpc_client_rpc *rpc); void sfw_client_rpc_done(struct srpc_client_rpc *rpc); -void sfw_unpack_message(srpc_msg_t *msg); +void sfw_unpack_message(struct srpc_msg *msg); void sfw_free_pages(struct srpc_server_rpc *rpc); void sfw_add_bulk_page(struct srpc_bulk *bk, struct page *pg, int i); int sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:39 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:39 -0400 Subject: [lustre-devel] [PATCH 13/24] staging: lustre: selftest: convert sfw_test_case_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-14-git-send-email-jsimmons@infradead.org> Turn typedef sfw_test_case_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/framework.c | 16 ++++++++-------- drivers/staging/lustre/lnet/selftest/selftest.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 8d364b0..56bcc8c 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -118,10 +118,10 @@ static struct smoketest_framework { int sfw_stop_batch(struct sfw_batch *tsb, int force); void sfw_destroy_session(struct sfw_session *sn); -static inline sfw_test_case_t * +static inline struct sfw_test_case * sfw_find_test_case(int id) { - sfw_test_case_t *tsc; + struct sfw_test_case *tsc; LASSERT(id <= SRPC_SERVICE_MAX_ID); LASSERT(id > SRPC_FRAMEWORK_SERVICE_MAX_ID); @@ -137,7 +137,7 @@ sfw_find_test_case(int id) static int sfw_register_test(struct srpc_service *service, struct sfw_test_client_ops *cliops) { - sfw_test_case_t *tsc; + struct sfw_test_case *tsc; if (sfw_find_test_case(service->sv_id)) { CERROR("Failed to register test %s (%d)\n", @@ -145,7 +145,7 @@ sfw_register_test(struct srpc_service *service, struct sfw_test_client_ops *clio return -EEXIST; } - LIBCFS_ALLOC(tsc, sizeof(sfw_test_case_t)); + LIBCFS_ALLOC(tsc, sizeof(struct sfw_test_case)); if (!tsc) return -ENOMEM; @@ -199,7 +199,7 @@ __must_hold(&sfw_data.fw_lock) struct sfw_session *sn = sfw_data.fw_session; int nactive = 0; struct sfw_batch *tsb; - sfw_test_case_t *tsc; + struct sfw_test_case *tsc; if (!sn) return; @@ -1629,7 +1629,7 @@ sfw_startup(void) int rc; int error; struct srpc_service *sv; - sfw_test_case_t *tsc; + struct sfw_test_case *tsc; if (session_timeout < 0) { CERROR("Session timeout must be non-negative: %d\n", @@ -1722,7 +1722,7 @@ void sfw_shutdown(void) { struct srpc_service *sv; - sfw_test_case_t *tsc; + struct sfw_test_case *tsc; int i; spin_lock(&sfw_data.fw_lock); @@ -1778,7 +1778,7 @@ sfw_shutdown(void) while (!list_empty(&sfw_data.fw_tests)) { tsc = list_entry(sfw_data.fw_tests.next, - sfw_test_case_t, tsc_list); + struct sfw_test_case, tsc_list); srpc_wait_service_shutdown(tsc->tsc_srv_service); diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index f08bc70..1a47772 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -407,11 +407,11 @@ struct sfw_test_unit { struct swi_workitem tsu_worker; /* workitem of the test unit */ }; -typedef struct sfw_test_case { +struct sfw_test_case { struct list_head tsc_list; /* chain on fw_tests */ struct srpc_service *tsc_srv_service; /* test service */ struct sfw_test_client_ops *tsc_cli_ops; /* ops of test client */ -} sfw_test_case_t; +}; struct srpc_client_rpc * sfw_create_rpc(lnet_process_id_t peer, int service, -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:40 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:40 -0400 Subject: [lustre-devel] [PATCH 14/24] staging: lustre: selftest: convert lstcon_rpc_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-15-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_rpc_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conrpc.c | 50 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/conrpc.h | 18 ++++---- drivers/staging/lustre/lnet/selftest/console.c | 2 +- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 0032457..edef693 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -52,7 +52,7 @@ void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *, static void lstcon_rpc_done(struct srpc_client_rpc *rpc) { - lstcon_rpc_t *crpc = (lstcon_rpc_t *)rpc->crpc_priv; + struct lstcon_rpc *crpc = (struct lstcon_rpc *)rpc->crpc_priv; LASSERT(crpc && rpc == crpc->crp_rpc); LASSERT(crpc->crp_posted && !crpc->crp_finished); @@ -91,7 +91,7 @@ lstcon_rpc_done(struct srpc_client_rpc *rpc) static int lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats, - int bulk_npg, int bulk_len, int embedded, lstcon_rpc_t *crpc) + int bulk_npg, int bulk_len, int embedded, struct lstcon_rpc *crpc) { crpc->crp_rpc = sfw_create_rpc(nd->nd_id, service, feats, bulk_npg, bulk_len, @@ -116,15 +116,15 @@ lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats, static int lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats, - int bulk_npg, int bulk_len, lstcon_rpc_t **crpcpp) + int bulk_npg, int bulk_len, struct lstcon_rpc **crpcpp) { - lstcon_rpc_t *crpc = NULL; + struct lstcon_rpc *crpc = NULL; int rc; spin_lock(&console_session.ses_rpc_lock); crpc = list_first_entry_or_null(&console_session.ses_rpc_freelist, - lstcon_rpc_t, crp_link); + struct lstcon_rpc, crp_link); if (crpc) list_del_init(&crpc->crp_link); @@ -148,7 +148,7 @@ lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats, } void -lstcon_rpc_put(lstcon_rpc_t *crpc) +lstcon_rpc_put(struct lstcon_rpc *crpc) { struct srpc_bulk *bulk = &crpc->crp_rpc->crpc_bulk; int i; @@ -183,7 +183,7 @@ lstcon_rpc_put(lstcon_rpc_t *crpc) } static void -lstcon_rpc_post(lstcon_rpc_t *crpc) +lstcon_rpc_post(struct lstcon_rpc *crpc) { lstcon_rpc_trans_t *trans = crpc->crp_trans; @@ -278,7 +278,7 @@ lstcon_rpc_trans_prep(struct list_head *translist, int transop, } void -lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, lstcon_rpc_t *crpc) +lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, struct lstcon_rpc *crpc) { list_add_tail(&crpc->crp_link, &trans->tas_rpcs_list); crpc->crp_trans = trans; @@ -288,7 +288,7 @@ void lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error) { struct srpc_client_rpc *rpc; - lstcon_rpc_t *crpc; + struct lstcon_rpc *crpc; lstcon_node_t *nd; list_for_each_entry(crpc, &trans->tas_rpcs_list, crp_link) { @@ -338,7 +338,7 @@ lstcon_rpc_trans_check(lstcon_rpc_trans_t *trans) int lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout) { - lstcon_rpc_t *crpc; + struct lstcon_rpc *crpc; int rc; if (list_empty(&trans->tas_rpcs_list)) @@ -386,7 +386,7 @@ lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout) } static int -lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp) +lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t **msgpp) { lstcon_node_t *nd = crpc->crp_node; struct srpc_client_rpc *rpc = crpc->crp_rpc; @@ -425,7 +425,7 @@ lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp) void lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat) { - lstcon_rpc_t *crpc; + struct lstcon_rpc *crpc; srpc_msg_t *rep; int error; @@ -474,7 +474,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, struct list_head __user *next; lstcon_rpc_ent_t *ent; srpc_generic_reply_t *rep; - lstcon_rpc_t *crpc; + struct lstcon_rpc *crpc; srpc_msg_t *msg; lstcon_node_t *nd; long dur; @@ -542,8 +542,8 @@ void lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans) { struct srpc_client_rpc *rpc; - lstcon_rpc_t *crpc; - lstcon_rpc_t *tmp; + struct lstcon_rpc *crpc; + struct lstcon_rpc *tmp; int count = 0; list_for_each_entry_safe(crpc, tmp, &trans->tas_rpcs_list, crp_link) { @@ -593,7 +593,7 @@ lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans) int lstcon_sesrpc_prep(lstcon_node_t *nd, int transop, - unsigned feats, lstcon_rpc_t **crpc) + unsigned feats, struct lstcon_rpc **crpc) { srpc_mksn_reqst_t *msrq; srpc_rmsn_reqst_t *rsrq; @@ -631,7 +631,7 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop, } int -lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, lstcon_rpc_t **crpc) +lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, struct lstcon_rpc **crpc) { srpc_debug_reqst_t *drq; int rc; @@ -650,7 +650,7 @@ lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, lstcon_rpc_t **crpc) int lstcon_batrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, - lstcon_tsb_hdr_t *tsb, lstcon_rpc_t **crpc) + lstcon_tsb_hdr_t *tsb, struct lstcon_rpc **crpc) { lstcon_batch_t *batch; srpc_batch_reqst_t *brq; @@ -682,7 +682,7 @@ lstcon_batrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, } int -lstcon_statrpc_prep(lstcon_node_t *nd, unsigned feats, lstcon_rpc_t **crpc) +lstcon_statrpc_prep(lstcon_node_t *nd, unsigned feats, struct lstcon_rpc **crpc) { srpc_stat_reqst_t *srq; int rc; @@ -807,7 +807,7 @@ lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) int lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, - lstcon_test_t *test, lstcon_rpc_t **crpc) + lstcon_test_t *test, struct lstcon_rpc **crpc) { lstcon_group_t *sgrp = test->tes_src_grp; lstcon_group_t *dgrp = test->tes_dst_grp; @@ -1088,7 +1088,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, lstcon_rpc_trans_t *trans; lstcon_ndlink_t *ndl; lstcon_node_t *nd; - lstcon_rpc_t *rpc; + struct lstcon_rpc *rpc; unsigned feats; int rc; @@ -1169,7 +1169,7 @@ lstcon_rpc_pinger(void *arg) { struct stt_timer *ptimer = (struct stt_timer *)arg; lstcon_rpc_trans_t *trans; - lstcon_rpc_t *crpc; + struct lstcon_rpc *crpc; srpc_msg_t *rep; srpc_debug_reqst_t *drq; lstcon_ndlink_t *ndl; @@ -1326,8 +1326,8 @@ void lstcon_rpc_cleanup_wait(void) { lstcon_rpc_trans_t *trans; - lstcon_rpc_t *crpc; - lstcon_rpc_t *temp; + struct lstcon_rpc *crpc; + struct lstcon_rpc *temp; struct list_head *pacer; struct list_head zlist; @@ -1369,7 +1369,7 @@ lstcon_rpc_cleanup_wait(void) list_for_each_entry_safe(crpc, temp, &zlist, crp_link) { list_del(&crpc->crp_link); - LIBCFS_FREE(crpc, sizeof(lstcon_rpc_t)); + LIBCFS_FREE(crpc, sizeof(struct lstcon_rpc)); } } diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.h b/drivers/staging/lustre/lnet/selftest/conrpc.h index 6ddf088..abd7bb0 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.h +++ b/drivers/staging/lustre/lnet/selftest/conrpc.h @@ -63,7 +63,7 @@ struct lstcon_tsb_hdr; struct lstcon_test; struct lstcon_node; -typedef struct lstcon_rpc { +struct lstcon_rpc { struct list_head crp_link; /* chain on rpc transaction */ struct srpc_client_rpc *crp_rpc; /* client rpc */ struct lstcon_node *crp_node; /* destination node */ @@ -76,7 +76,7 @@ typedef struct lstcon_rpc { unsigned int crp_embedded:1; int crp_status; /* console rpc errors */ unsigned long crp_stamp; /* replied time stamp */ -} lstcon_rpc_t; +}; typedef struct lstcon_rpc_trans { struct list_head tas_olink; /* link chain on owner list */ @@ -110,16 +110,16 @@ typedef int (*lstcon_rpc_readent_func_t)(int, srpc_msg_t *, lstcon_rpc_ent_t __user *); int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, - unsigned version, lstcon_rpc_t **crpc); + unsigned version, struct lstcon_rpc **crpc); int lstcon_dbgrpc_prep(struct lstcon_node *nd, - unsigned version, lstcon_rpc_t **crpc); + unsigned version, struct lstcon_rpc **crpc); int lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned version, - struct lstcon_tsb_hdr *tsb, lstcon_rpc_t **crpc); + struct lstcon_tsb_hdr *tsb, struct lstcon_rpc **crpc); int lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned version, - struct lstcon_test *test, lstcon_rpc_t **crpc); + struct lstcon_test *test, struct lstcon_rpc **crpc); int lstcon_statrpc_prep(struct lstcon_node *nd, unsigned version, - lstcon_rpc_t **crpc); -void lstcon_rpc_put(lstcon_rpc_t *crpc); + struct lstcon_rpc **crpc); +void lstcon_rpc_put(struct lstcon_rpc *crpc); int lstcon_rpc_trans_prep(struct list_head *translist, int transop, lstcon_rpc_trans_t **transpp); int lstcon_rpc_trans_ndlist(struct list_head *ndlist, @@ -133,7 +133,7 @@ int lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, lstcon_rpc_readent_func_t readent); void lstcon_rpc_trans_abort(lstcon_rpc_trans_t *trans, int error); void lstcon_rpc_trans_destroy(lstcon_rpc_trans_t *trans); -void lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, lstcon_rpc_t *req); +void lstcon_rpc_trans_addreq(lstcon_rpc_trans_t *trans, struct lstcon_rpc *req); int lstcon_rpc_trans_postwait(lstcon_rpc_trans_t *trans, int timeout); int lstcon_rpc_pinger_start(void); void lstcon_rpc_pinger_stop(void); diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 1352310..23696e7 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -103,7 +103,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) ndl->ndl_node->nd_stamp = cfs_time_current(); ndl->ndl_node->nd_state = LST_NODE_UNKNOWN; ndl->ndl_node->nd_timeout = 0; - memset(&ndl->ndl_node->nd_ping, 0, sizeof(lstcon_rpc_t)); + memset(&ndl->ndl_node->nd_ping, 0, sizeof(struct lstcon_rpc)); /* * queued in global hash & list, no refcount is taken by -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:50 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:50 -0400 Subject: [lustre-devel] [PATCH 24/24] staging: lustre: selftest: change srpc_state_t to proper enum In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-25-git-send-email-jsimmons@infradead.org> Turn typedef srpc_state_t to proper enum Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/rpc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 812b9a5..4a45904 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -46,19 +46,19 @@ #include "selftest.h" -typedef enum { +enum srpc_state { SRPC_STATE_NONE, SRPC_STATE_NI_INIT, SRPC_STATE_EQ_INIT, SRPC_STATE_RUNNING, SRPC_STATE_STOPPING, -} srpc_state_t; +}; static struct smoketest_rpc { spinlock_t rpc_glock; /* global lock */ struct srpc_service *rpc_services[SRPC_SERVICE_MAX_ID + 1]; lnet_handle_eq_t rpc_lnet_eq; /* _the_ LNet event queue */ - srpc_state_t rpc_state; + enum srpc_state rpc_state; srpc_counters_t rpc_counters; __u64 rpc_matchbits; /* matchbits counter */ } srpc_data; -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:49 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:49 -0400 Subject: [lustre-devel] [PATCH 23/24] staging: lustre: selftest: convert wire protocol to use struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-24-git-send-email-jsimmons@infradead.org> Change all the wire protocol typedefs to proper structures Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 22 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 44 +++--- drivers/staging/lustre/lnet/selftest/console.c | 10 +- drivers/staging/lustre/lnet/selftest/framework.c | 54 ++++---- drivers/staging/lustre/lnet/selftest/ping_test.c | 10 +- drivers/staging/lustre/lnet/selftest/rpc.c | 6 +- drivers/staging/lustre/lnet/selftest/rpc.h | 150 +++++++++++----------- drivers/staging/lustre/lnet/selftest/selftest.h | 13 +- 8 files changed, 156 insertions(+), 153 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 02c8dae..da0443c 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -81,7 +81,7 @@ brw_client_init(struct sfw_test_instance *tsi) LASSERT(tsi->tsi_is_client); if (!(sn->sn_features & LST_FEAT_BULK_LEN)) { - test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0; + struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0; opc = breq->blk_opc; flags = breq->blk_flags; @@ -92,7 +92,7 @@ brw_client_init(struct sfw_test_instance *tsi) */ len = npg * PAGE_CACHE_SIZE; } else { - test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; + struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1; /* * I should never get this step if it's unknown feature @@ -261,7 +261,7 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu, struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct srpc_client_rpc *rpc; - srpc_brw_reqst_t *req; + struct srpc_brw_reqst *req; int flags; int npg; int len; @@ -272,14 +272,14 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu, LASSERT(bulk); if (!(sn->sn_features & LST_FEAT_BULK_LEN)) { - test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0; + struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0; opc = breq->blk_opc; flags = breq->blk_flags; npg = breq->blk_npg; len = npg * PAGE_CACHE_SIZE; } else { - test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; + struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1; /* * I should never get this step if it's unknown feature @@ -319,8 +319,8 @@ brw_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct srpc_msg *msg = &rpc->crpc_replymsg; - srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; - srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; + struct srpc_brw_reply *reply = &msg->msg_body.brw_reply; + struct srpc_brw_reqst *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; LASSERT(sn); @@ -382,8 +382,8 @@ static int brw_bulk_ready(struct srpc_server_rpc *rpc, int status) { __u64 magic = BRW_MAGIC; - srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply; - srpc_brw_reqst_t *reqst; + struct srpc_brw_reply *reply = &rpc->srpc_replymsg.msg_body.brw_reply; + struct srpc_brw_reqst *reqst; struct srpc_msg *reqstmsg; LASSERT(rpc->srpc_bulk); @@ -420,8 +420,8 @@ brw_server_handle(struct srpc_server_rpc *rpc) struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_msg *replymsg = &rpc->srpc_replymsg; struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; - srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply; - srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst; + struct srpc_brw_reply *reply = &replymsg->msg_body.brw_reply; + struct srpc_brw_reqst *reqst = &reqstmsg->msg_body.brw_reqst; int npg; int rc; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index caaae8c..065f8fb 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -390,7 +390,7 @@ lstcon_rpc_get_reply(struct lstcon_rpc *crpc, struct srpc_msg **msgpp) { struct lstcon_node *nd = crpc->crp_node; struct srpc_client_rpc *rpc = crpc->crp_rpc; - srpc_generic_reply_t *rep; + struct srpc_generic_reply *rep; LASSERT(nd && rpc); LASSERT(crpc->crp_stamp); @@ -473,7 +473,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, struct list_head tmp; struct list_head __user *next; lstcon_rpc_ent_t *ent; - srpc_generic_reply_t *rep; + struct srpc_generic_reply *rep; struct lstcon_rpc *crpc; struct srpc_msg *msg; struct lstcon_node *nd; @@ -520,7 +520,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, continue; /* RPC is done */ - rep = (srpc_generic_reply_t *)&msg->msg_body.reply; + rep = (struct srpc_generic_reply *)&msg->msg_body.reply; if (copy_to_user(&ent->rpe_sid, &rep->sid, sizeof(lst_sid_t)) || copy_to_user(&ent->rpe_fwk_errno, &rep->status, @@ -595,8 +595,8 @@ int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, struct lstcon_rpc **crpc) { - srpc_mksn_reqst_t *msrq; - srpc_rmsn_reqst_t *rsrq; + struct srpc_mksn_reqst *msrq; + struct srpc_rmsn_reqst *rsrq; int rc; switch (transop) { @@ -633,7 +633,7 @@ lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, int lstcon_dbgrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc **crpc) { - srpc_debug_reqst_t *drq; + struct srpc_debug_reqst *drq; int rc; rc = lstcon_rpc_prep(nd, SRPC_SERVICE_DEBUG, feats, 0, 0, crpc); @@ -653,7 +653,7 @@ lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, struct lstcon_tsb_hdr *tsb, struct lstcon_rpc **crpc) { struct lstcon_batch *batch; - srpc_batch_reqst_t *brq; + struct srpc_batch_reqst *brq; int rc; rc = lstcon_rpc_prep(nd, SRPC_SERVICE_BATCH, feats, 0, 0, crpc); @@ -684,7 +684,7 @@ lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, int lstcon_statrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc **crpc) { - srpc_stat_reqst_t *srq; + struct srpc_stat_reqst *srq; int rc; rc = lstcon_rpc_prep(nd, SRPC_SERVICE_QUERY_STAT, feats, 0, 0, crpc); @@ -769,9 +769,9 @@ lstcon_dstnodes_prep(struct lstcon_group *grp, int idx, } static int -lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req) +lstcon_pingrpc_prep(lst_test_ping_param_t *param, struct srpc_test_reqst *req) { - test_ping_req_t *prq = &req->tsr_u.ping; + struct test_ping_req *prq = &req->tsr_u.ping; prq->png_size = param->png_size; prq->png_flags = param->png_flags; @@ -780,9 +780,9 @@ lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req) } static int -lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) +lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, struct srpc_test_reqst *req) { - test_bulk_req_t *brq = &req->tsr_u.bulk_v0; + struct test_bulk_req *brq = &req->tsr_u.bulk_v0; brq->blk_opc = param->blk_opc; brq->blk_npg = (param->blk_size + PAGE_CACHE_SIZE - 1) / @@ -793,9 +793,9 @@ lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) } static int -lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) +lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, struct srpc_test_reqst *req) { - test_bulk_req_v1_t *brq = &req->tsr_u.bulk_v1; + struct test_bulk_req_v1 *brq = &req->tsr_u.bulk_v1; brq->blk_opc = param->blk_opc; brq->blk_flags = param->blk_flags; @@ -811,7 +811,7 @@ lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, { struct lstcon_group *sgrp = test->tes_src_grp; struct lstcon_group *dgrp = test->tes_dst_grp; - srpc_test_reqst_t *trq; + struct srpc_test_reqst *trq; struct srpc_bulk *bulk; int i; int npg = 0; @@ -918,7 +918,7 @@ static int lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans, struct lstcon_node *nd, struct srpc_msg *reply) { - srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply; + struct srpc_mksn_reply *mksn_rep = &reply->msg_body.mksn_reply; int status = mksn_rep->mksn_status; if (!status && @@ -965,11 +965,11 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, struct srpc_msg *msg, struct lstcon_node *nd, lstcon_trans_stat_t *stat) { - srpc_rmsn_reply_t *rmsn_rep; - srpc_debug_reply_t *dbg_rep; - srpc_batch_reply_t *bat_rep; - srpc_test_reply_t *test_rep; - srpc_stat_reply_t *stat_rep; + struct srpc_rmsn_reply *rmsn_rep; + struct srpc_debug_reply *dbg_rep; + struct srpc_batch_reply *bat_rep; + struct srpc_test_reply *test_rep; + struct srpc_stat_reply *stat_rep; int rc = 0; switch (trans->tas_opc) { @@ -1173,7 +1173,7 @@ lstcon_rpc_pinger(void *arg) struct lstcon_rpc_trans *trans; struct lstcon_rpc *crpc; struct srpc_msg *rep; - srpc_debug_reqst_t *drq; + struct srpc_debug_reqst *drq; struct lstcon_ndlink *ndl; struct lstcon_node *nd; int intv; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 6568e8e..a03e52d 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -373,7 +373,7 @@ static int lstcon_sesrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { - srpc_debug_reply_t *rep; + struct srpc_debug_reply *rep; switch (transop) { case LST_TRANS_SESNEW: @@ -1386,7 +1386,7 @@ static int lstcon_tsbrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { - srpc_batch_reply_t *rep = &msg->msg_body.bat_reply; + struct srpc_batch_reply *rep = &msg->msg_body.bat_reply; LASSERT(transop == LST_TRANS_TSBCLIQRY || transop == LST_TRANS_TSBSRVQRY); @@ -1465,7 +1465,7 @@ static int lstcon_statrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { - srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; + struct srpc_stat_reply *rep = &msg->msg_body.stat_reply; sfw_counters_t __user *sfwk_stat; srpc_counters_t __user *srpc_stat; lnet_counters_t __user *lnet_stat; @@ -1907,8 +1907,8 @@ lstcon_acceptor_handle(struct srpc_server_rpc *rpc) { struct srpc_msg *rep = &rpc->srpc_replymsg; struct srpc_msg *req = &rpc->srpc_reqstbuf->buf_msg; - srpc_join_reqst_t *jreq = &req->msg_body.join_reqst; - srpc_join_reply_t *jrep = &rep->msg_body.join_reply; + struct srpc_join_reqst *jreq = &req->msg_body.join_reqst; + struct srpc_join_reply *jrep = &rep->msg_body.join_reply; struct lstcon_group *grp = NULL; struct lstcon_ndlink *ndl; int rc = 0; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index f66da54..3ad3fae 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -361,7 +361,7 @@ sfw_bid2batch(lst_bid_t bid) } static int -sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) +sfw_get_stats(struct srpc_stat_reqst *request, struct srpc_stat_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; sfw_counters_t *cnt = &reply->str_fw; @@ -402,7 +402,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) } int -sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) +sfw_make_session(struct srpc_mksn_reqst *request, struct srpc_mksn_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; struct srpc_msg *msg = container_of(request, struct srpc_msg, @@ -473,7 +473,7 @@ sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) } static int -sfw_remove_session(srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) +sfw_remove_session(struct srpc_rmsn_reqst *request, struct srpc_rmsn_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; @@ -505,7 +505,7 @@ sfw_remove_session(srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) } static int -sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) +sfw_debug_session(struct srpc_debug_reqst *request, struct srpc_debug_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; @@ -687,7 +687,7 @@ sfw_destroy_session(struct sfw_session *sn) static void sfw_unpack_addtest_req(struct srpc_msg *msg) { - srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; + struct srpc_test_reqst *req = &msg->msg_body.tes_reqst; LASSERT(msg->msg_type == SRPC_MSG_TEST_REQST); LASSERT(req->tsr_is_client); @@ -699,14 +699,14 @@ sfw_unpack_addtest_req(struct srpc_msg *msg) if (req->tsr_service == SRPC_SERVICE_BRW) { if (!(msg->msg_ses_feats & LST_FEAT_BULK_LEN)) { - test_bulk_req_t *bulk = &req->tsr_u.bulk_v0; + struct test_bulk_req *bulk = &req->tsr_u.bulk_v0; __swab32s(&bulk->blk_opc); __swab32s(&bulk->blk_npg); __swab32s(&bulk->blk_flags); } else { - test_bulk_req_v1_t *bulk = &req->tsr_u.bulk_v1; + struct test_bulk_req_v1 *bulk = &req->tsr_u.bulk_v1; __swab16s(&bulk->blk_opc); __swab16s(&bulk->blk_flags); @@ -718,7 +718,7 @@ sfw_unpack_addtest_req(struct srpc_msg *msg) } if (req->tsr_service == SRPC_SERVICE_PING) { - test_ping_req_t *ping = &req->tsr_u.ping; + struct test_ping_req *ping = &req->tsr_u.ping; __swab32s(&ping->png_size); __swab32s(&ping->png_flags); @@ -732,7 +732,7 @@ static int sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc) { struct srpc_msg *msg = &rpc->srpc_reqstbuf->buf_msg; - srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; + struct srpc_test_reqst *req = &msg->msg_body.tes_reqst; struct srpc_bulk *bk = rpc->srpc_bulk; int ndest = req->tsr_ndest; struct sfw_test_unit *tsu; @@ -1068,7 +1068,7 @@ sfw_stop_batch(struct sfw_batch *tsb, int force) } static int -sfw_query_batch(struct sfw_batch *tsb, int testidx, srpc_batch_reply_t *reply) +sfw_query_batch(struct sfw_batch *tsb, int testidx, struct srpc_batch_reply *reply) { struct sfw_test_instance *tsi; @@ -1116,8 +1116,8 @@ static int sfw_add_test(struct srpc_server_rpc *rpc) { struct sfw_session *sn = sfw_data.fw_session; - srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply; - srpc_test_reqst_t *request; + struct srpc_test_reply *reply = &rpc->srpc_replymsg.msg_body.tes_reply; + struct srpc_test_reqst *request; int rc; struct sfw_batch *bat; @@ -1183,7 +1183,7 @@ sfw_add_test(struct srpc_server_rpc *rpc) } static int -sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) +sfw_control_batch(struct srpc_batch_reqst *request, struct srpc_batch_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; int rc = 0; @@ -1424,7 +1424,7 @@ sfw_unpack_message(struct srpc_msg *msg) LASSERT(msg->msg_magic == __swab32(SRPC_MSG_MAGIC)); if (msg->msg_type == SRPC_MSG_STAT_REQST) { - srpc_stat_reqst_t *req = &msg->msg_body.stat_reqst; + struct srpc_stat_reqst *req = &msg->msg_body.stat_reqst; __swab32s(&req->str_type); __swab64s(&req->str_rpyid); @@ -1433,7 +1433,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_STAT_REPLY) { - srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; + struct srpc_stat_reply *rep = &msg->msg_body.stat_reply; __swab32s(&rep->str_status); sfw_unpack_sid(rep->str_sid); @@ -1444,7 +1444,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_MKSN_REQST) { - srpc_mksn_reqst_t *req = &msg->msg_body.mksn_reqst; + struct srpc_mksn_reqst *req = &msg->msg_body.mksn_reqst; __swab64s(&req->mksn_rpyid); __swab32s(&req->mksn_force); @@ -1453,7 +1453,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_MKSN_REPLY) { - srpc_mksn_reply_t *rep = &msg->msg_body.mksn_reply; + struct srpc_mksn_reply *rep = &msg->msg_body.mksn_reply; __swab32s(&rep->mksn_status); __swab32s(&rep->mksn_timeout); @@ -1462,7 +1462,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_RMSN_REQST) { - srpc_rmsn_reqst_t *req = &msg->msg_body.rmsn_reqst; + struct srpc_rmsn_reqst *req = &msg->msg_body.rmsn_reqst; __swab64s(&req->rmsn_rpyid); sfw_unpack_sid(req->rmsn_sid); @@ -1470,7 +1470,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_RMSN_REPLY) { - srpc_rmsn_reply_t *rep = &msg->msg_body.rmsn_reply; + struct srpc_rmsn_reply *rep = &msg->msg_body.rmsn_reply; __swab32s(&rep->rmsn_status); sfw_unpack_sid(rep->rmsn_sid); @@ -1478,7 +1478,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_DEBUG_REQST) { - srpc_debug_reqst_t *req = &msg->msg_body.dbg_reqst; + struct srpc_debug_reqst *req = &msg->msg_body.dbg_reqst; __swab64s(&req->dbg_rpyid); __swab32s(&req->dbg_flags); @@ -1487,7 +1487,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_DEBUG_REPLY) { - srpc_debug_reply_t *rep = &msg->msg_body.dbg_reply; + struct srpc_debug_reply *rep = &msg->msg_body.dbg_reply; __swab32s(&rep->dbg_nbatch); __swab32s(&rep->dbg_timeout); @@ -1496,7 +1496,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_BATCH_REQST) { - srpc_batch_reqst_t *req = &msg->msg_body.bat_reqst; + struct srpc_batch_reqst *req = &msg->msg_body.bat_reqst; __swab32s(&req->bar_opc); __swab64s(&req->bar_rpyid); @@ -1508,7 +1508,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_BATCH_REPLY) { - srpc_batch_reply_t *rep = &msg->msg_body.bat_reply; + struct srpc_batch_reply *rep = &msg->msg_body.bat_reply; __swab32s(&rep->bar_status); sfw_unpack_sid(rep->bar_sid); @@ -1516,7 +1516,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_TEST_REQST) { - srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; + struct srpc_test_reqst *req = &msg->msg_body.tes_reqst; __swab64s(&req->tsr_rpyid); __swab64s(&req->tsr_bulkid); @@ -1530,7 +1530,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_TEST_REPLY) { - srpc_test_reply_t *rep = &msg->msg_body.tes_reply; + struct srpc_test_reply *rep = &msg->msg_body.tes_reply; __swab32s(&rep->tsr_status); sfw_unpack_sid(rep->tsr_sid); @@ -1538,7 +1538,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_JOIN_REQST) { - srpc_join_reqst_t *req = &msg->msg_body.join_reqst; + struct srpc_join_reqst *req = &msg->msg_body.join_reqst; __swab64s(&req->join_rpyid); sfw_unpack_sid(req->join_sid); @@ -1546,7 +1546,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_JOIN_REPLY) { - srpc_join_reply_t *rep = &msg->msg_body.join_reply; + struct srpc_join_reply *rep = &msg->msg_body.join_reply; __swab32s(&rep->join_status); __swab32s(&rep->join_timeout); diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index 8a9d7a4..ad26fe9 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -89,7 +89,7 @@ static int ping_client_prep_rpc(struct sfw_test_unit *tsu, lnet_process_id_t dest, struct srpc_client_rpc **rpc) { - srpc_ping_reqst_t *req; + struct srpc_ping_reqst *req; struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct timespec64 ts; @@ -122,8 +122,8 @@ ping_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) { struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; - srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; - srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; + struct srpc_ping_reqst *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; + struct srpc_ping_reply *reply = &rpc->crpc_replymsg.msg_body.ping_reply; struct timespec64 ts; LASSERT(sn); @@ -173,8 +173,8 @@ ping_server_handle(struct srpc_server_rpc *rpc) struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; struct srpc_msg *replymsg = &rpc->srpc_replymsg; - srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst; - srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply; + struct srpc_ping_reqst *req = &reqstmsg->msg_body.ping_reqst; + struct srpc_ping_reply *rep = &rpc->srpc_replymsg.msg_body.ping_reply; LASSERT(sv->sv_id == SRPC_SERVICE_PING); diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index d9f8c64..812b9a5 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -997,7 +997,7 @@ srpc_handle_rpc(struct swi_workitem *wi) LBUG(); case SWI_STATE_NEWBORN: { struct srpc_msg *msg; - srpc_generic_reply_t *reply; + struct srpc_generic_reply *reply; msg = &rpc->srpc_reqstbuf->buf_msg; reply = &rpc->srpc_replymsg.msg_body.reply; @@ -1238,7 +1238,7 @@ srpc_send_rpc(struct swi_workitem *wi) wi->swi_state = SWI_STATE_REQUEST_SENT; /* perhaps more events, fall thru */ case SWI_STATE_REQUEST_SENT: { - srpc_msg_type_t type = srpc_service2reply(rpc->crpc_service); + enum srpc_msg_type type = srpc_service2reply(rpc->crpc_service); if (!rpc->crpc_replyev.ev_fired) break; @@ -1417,7 +1417,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) struct srpc_buffer *buffer; struct srpc_service *sv; struct srpc_msg *msg; - srpc_msg_type_t type; + enum srpc_msg_type type; LASSERT(!in_interrupt()); diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index fdf881f..114ae14 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -44,7 +44,7 @@ * * XXX: *REPLY == *REQST + 1 */ -typedef enum { +enum srpc_msg_type { SRPC_MSG_MKSN_REQST = 0, SRPC_MSG_MKSN_REPLY = 1, SRPC_MSG_RMSN_REQST = 2, @@ -63,7 +63,7 @@ typedef enum { SRPC_MSG_PING_REPLY = 15, SRPC_MSG_JOIN_REQST = 16, SRPC_MSG_JOIN_REPLY = 17, -} srpc_msg_type_t; +}; /* CAVEAT EMPTOR: * All srpc_*_reqst_t's 1st field must be matchbits of reply buffer, @@ -72,122 +72,122 @@ typedef enum { * All srpc_*_reply_t's 1st field must be a __u32 status, and 2nd field * session id if needed. */ -typedef struct { +struct srpc_generic_reqst { __u64 rpyid; /* reply buffer matchbits */ __u64 bulkid; /* bulk buffer matchbits */ -} WIRE_ATTR srpc_generic_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_generic_reply { __u32 status; lst_sid_t sid; -} WIRE_ATTR srpc_generic_reply_t; +} WIRE_ATTR; /* FRAMEWORK RPCs */ -typedef struct { +struct srpc_mksn_reqst { __u64 mksn_rpyid; /* reply buffer matchbits */ lst_sid_t mksn_sid; /* session id */ __u32 mksn_force; /* use brute force */ char mksn_name[LST_NAME_SIZE]; -} WIRE_ATTR srpc_mksn_reqst_t; /* make session request */ +} WIRE_ATTR; /* make session request */ -typedef struct { +struct srpc_mksn_reply { __u32 mksn_status; /* session status */ lst_sid_t mksn_sid; /* session id */ __u32 mksn_timeout; /* session timeout */ char mksn_name[LST_NAME_SIZE]; -} WIRE_ATTR srpc_mksn_reply_t; /* make session reply */ +} WIRE_ATTR; /* make session reply */ -typedef struct { +struct srpc_rmsn_reqst { __u64 rmsn_rpyid; /* reply buffer matchbits */ lst_sid_t rmsn_sid; /* session id */ -} WIRE_ATTR srpc_rmsn_reqst_t; /* remove session request */ +} WIRE_ATTR; /* remove session request */ -typedef struct { +struct srpc_rmsn_reply { __u32 rmsn_status; lst_sid_t rmsn_sid; /* session id */ -} WIRE_ATTR srpc_rmsn_reply_t; /* remove session reply */ +} WIRE_ATTR; /* remove session reply */ -typedef struct { +struct srpc_join_reqst { __u64 join_rpyid; /* reply buffer matchbits */ lst_sid_t join_sid; /* session id to join */ char join_group[LST_NAME_SIZE]; /* group name */ -} WIRE_ATTR srpc_join_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_join_reply { __u32 join_status; /* returned status */ lst_sid_t join_sid; /* session id */ __u32 join_timeout; /* # seconds' inactivity to * expire */ char join_session[LST_NAME_SIZE]; /* session name */ -} WIRE_ATTR srpc_join_reply_t; +} WIRE_ATTR; -typedef struct { +struct srpc_debug_reqst { __u64 dbg_rpyid; /* reply buffer matchbits */ lst_sid_t dbg_sid; /* session id */ __u32 dbg_flags; /* bitmap of debug */ -} WIRE_ATTR srpc_debug_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_debug_reply { __u32 dbg_status; /* returned code */ lst_sid_t dbg_sid; /* session id */ __u32 dbg_timeout; /* session timeout */ __u32 dbg_nbatch; /* # of batches in the node */ char dbg_name[LST_NAME_SIZE]; /* session name */ -} WIRE_ATTR srpc_debug_reply_t; +} WIRE_ATTR; #define SRPC_BATCH_OPC_RUN 1 #define SRPC_BATCH_OPC_STOP 2 #define SRPC_BATCH_OPC_QUERY 3 -typedef struct { +struct srpc_batch_reqst { __u64 bar_rpyid; /* reply buffer matchbits */ lst_sid_t bar_sid; /* session id */ lst_bid_t bar_bid; /* batch id */ __u32 bar_opc; /* create/start/stop batch */ __u32 bar_testidx; /* index of test */ __u32 bar_arg; /* parameters */ -} WIRE_ATTR srpc_batch_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_batch_reply { __u32 bar_status; /* status of request */ lst_sid_t bar_sid; /* session id */ __u32 bar_active; /* # of active tests in batch/test */ __u32 bar_time; /* remained time */ -} WIRE_ATTR srpc_batch_reply_t; +} WIRE_ATTR; -typedef struct { +struct srpc_stat_reqst { __u64 str_rpyid; /* reply buffer matchbits */ lst_sid_t str_sid; /* session id */ __u32 str_type; /* type of stat */ -} WIRE_ATTR srpc_stat_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_stat_reply { __u32 str_status; lst_sid_t str_sid; sfw_counters_t str_fw; srpc_counters_t str_rpc; lnet_counters_t str_lnet; -} WIRE_ATTR srpc_stat_reply_t; +} WIRE_ATTR; -typedef struct { +struct test_bulk_req { __u32 blk_opc; /* bulk operation code */ __u32 blk_npg; /* # of pages */ __u32 blk_flags; /* reserved flags */ -} WIRE_ATTR test_bulk_req_t; +} WIRE_ATTR; -typedef struct { +struct test_bulk_req_v1 { __u16 blk_opc; /* bulk operation code */ __u16 blk_flags; /* data check flags */ __u32 blk_len; /* data length */ __u32 blk_offset; /* reserved: offset */ -} WIRE_ATTR test_bulk_req_v1_t; +} WIRE_ATTR; -typedef struct { +struct test_ping_req { __u32 png_size; /* size of ping message */ __u32 png_flags; /* reserved flags */ -} WIRE_ATTR test_ping_req_t; +} WIRE_ATTR; -typedef struct { +struct srpc_test_reqst { __u64 tsr_rpyid; /* reply buffer matchbits */ __u64 tsr_bulkid; /* bulk buffer matchbits */ lst_sid_t tsr_sid; /* session id */ @@ -201,43 +201,45 @@ typedef struct { __u32 tsr_ndest; /* # of dest nodes */ union { - test_ping_req_t ping; - test_bulk_req_t bulk_v0; - test_bulk_req_v1_t bulk_v1; + struct test_ping_req ping; + struct test_bulk_req bulk_v0; + struct test_bulk_req_v1 bulk_v1; } tsr_u; -} WIRE_ATTR srpc_test_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_test_reply { __u32 tsr_status; /* returned code */ lst_sid_t tsr_sid; -} WIRE_ATTR srpc_test_reply_t; +} WIRE_ATTR; /* TEST RPCs */ -typedef struct { +struct srpc_ping_reqst { __u64 pnr_rpyid; __u32 pnr_magic; __u32 pnr_seq; __u64 pnr_time_sec; __u64 pnr_time_usec; -} WIRE_ATTR srpc_ping_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_ping_reply { __u32 pnr_status; __u32 pnr_magic; __u32 pnr_seq; -} WIRE_ATTR srpc_ping_reply_t; +} WIRE_ATTR; -typedef struct { +/* bulk r/w request */ +struct srpc_brw_reqst { __u64 brw_rpyid; /* reply buffer matchbits */ __u64 brw_bulkid; /* bulk buffer matchbits */ __u32 brw_rw; /* read or write */ __u32 brw_len; /* bulk data len */ __u32 brw_flags; /* bulk data patterns */ -} WIRE_ATTR srpc_brw_reqst_t; /* bulk r/w request */ +} WIRE_ATTR; -typedef struct { +/* bulk r/w reply */ +struct srpc_brw_reply { __u32 brw_status; -} WIRE_ATTR srpc_brw_reply_t; /* bulk r/w reply */ +} WIRE_ATTR; #define SRPC_MSG_MAGIC 0xeeb0f00d #define SRPC_MSG_VERSION 1 @@ -245,33 +247,33 @@ typedef struct { struct srpc_msg { __u32 msg_magic; /* magic number */ __u32 msg_version; /* message version number */ - __u32 msg_type; /* type of message body: srpc_msg_type_t */ + __u32 msg_type; /* type of message body: srpc_msg_type */ __u32 msg_reserved0; __u32 msg_reserved1; __u32 msg_ses_feats; /* test session features */ union { - srpc_generic_reqst_t reqst; - srpc_generic_reply_t reply; - - srpc_mksn_reqst_t mksn_reqst; - srpc_mksn_reply_t mksn_reply; - srpc_rmsn_reqst_t rmsn_reqst; - srpc_rmsn_reply_t rmsn_reply; - srpc_debug_reqst_t dbg_reqst; - srpc_debug_reply_t dbg_reply; - srpc_batch_reqst_t bat_reqst; - srpc_batch_reply_t bat_reply; - srpc_stat_reqst_t stat_reqst; - srpc_stat_reply_t stat_reply; - srpc_test_reqst_t tes_reqst; - srpc_test_reply_t tes_reply; - srpc_join_reqst_t join_reqst; - srpc_join_reply_t join_reply; - - srpc_ping_reqst_t ping_reqst; - srpc_ping_reply_t ping_reply; - srpc_brw_reqst_t brw_reqst; - srpc_brw_reply_t brw_reply; + struct srpc_generic_reqst reqst; + struct srpc_generic_reply reply; + + struct srpc_mksn_reqst mksn_reqst; + struct srpc_mksn_reply mksn_reply; + struct srpc_rmsn_reqst rmsn_reqst; + struct srpc_rmsn_reply rmsn_reply; + struct srpc_debug_reqst dbg_reqst; + struct srpc_debug_reply dbg_reply; + struct srpc_batch_reqst bat_reqst; + struct srpc_batch_reply bat_reply; + struct srpc_stat_reqst stat_reqst; + struct srpc_stat_reply stat_reply; + struct srpc_test_reqst tes_reqst; + struct srpc_test_reply tes_reply; + struct srpc_join_reqst join_reqst; + struct srpc_join_reply join_reply; + + struct srpc_ping_reqst ping_reqst; + struct srpc_ping_reply ping_reply; + struct srpc_brw_reqst brw_reqst; + struct srpc_brw_reply brw_reply; } msg_body; } WIRE_ATTR; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 2bc7f9f..825ae53 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -93,7 +93,7 @@ struct sfw_test_instance; /* all reply/bulk RDMAs go to this portal */ #define SRPC_RDMA_PORTAL 52 -static inline srpc_msg_type_t +static inline enum srpc_msg_type srpc_service2request(int service) { switch (service) { @@ -128,7 +128,7 @@ srpc_service2request(int service) } } -static inline srpc_msg_type_t +static inline enum srpc_msg_type srpc_service2reply(int service) { return srpc_service2request(service) + 1; @@ -385,9 +385,9 @@ struct sfw_test_instance { struct list_head tsi_active_rpcs; /* active rpcs */ union { - test_ping_req_t ping; /* ping parameter */ - test_bulk_req_t bulk_v0; /* bulk parameter */ - test_bulk_req_v1_t bulk_v1; /* bulk v1 parameter */ + struct test_ping_req ping; /* ping parameter */ + struct test_bulk_req bulk_v0; /* bulk parameter */ + struct test_bulk_req_v1 bulk_v1; /* bulk v1 parameter */ } tsi_u; }; @@ -428,7 +428,8 @@ void sfw_free_pages(struct srpc_server_rpc *rpc); void sfw_add_bulk_page(struct srpc_bulk *bk, struct page *pg, int i); int sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, int sink); -int sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply); +int sfw_make_session(struct srpc_mksn_reqst *request, + struct srpc_mksn_reply *reply); struct srpc_client_rpc * srpc_create_client_rpc(lnet_process_id_t peer, int service, -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:26 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:26 -0400 Subject: [lustre-devel] [PATCH 00/24] staging: lustre: selftest: remove typedefs Message-ID: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> The lnet selftest code is littered with typedefs. Convert these typedefs into their proper data types. James Simmons (24): staging: lustre: selftest: convert srpc_event_type to proper enum staging: lustre: selftest: convert srpc_event_t to proper struct staging: lustre: selftest: convert srpc_bulk_t to proper struct staging: lustre: selftest: convert srpc_buffer_t to proper struct staging: lustre: selftest: convert swi_workitem_t to proper struct staging: lustre: selftest: convert srpc_client_rpc_t to proper struct staging: lustre: selftest: convert srpc_service_t to proper struct staging: lustre: selftest: convert sfw_session_t to proper struct staging: lustre: selftest: convert sfw_batch_t to proper struct staging: lustre: selftest: convert sfw_test_client_ops_t to proper struct staging: lustre: selftest: convert sfw_test_instance_t to proper struct staging: lustre: selftest: convert sfw_test_unit_t to proper struct staging: lustre: selftest: convert sfw_test_case_t to proper struct staging: lustre: selftest: convert lstcon_rpc_t to proper struct staging: lustre: selftest: convert lstcon_rpc_trans_t to proper struct staging: lustre: selftest: convert lstcon_node_t to proper struct staging: lustre: selftest: convert lstcon_ndlink_t to proper struct staging: lustre: selftest: convert lstcon_group_t to proper struct staging: lustre: selftest: convert lstcon_tsb_hdr_t to proper struct staging: lustre: selftest: convert lstcon_batch_t to proper struct staging: lustre: selftest: convert lstcon_test_t to proper struct staging: lustre: selftest: convert srpc_msg_t to proper struct staging: lustre: selftest: convert wire protocol to use struct staging: lustre: selftest: change srpc_state_t to proper enum drivers/staging/lustre/lnet/selftest/brw_test.c | 76 +++--- drivers/staging/lustre/lnet/selftest/conctl.c | 2 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 196 ++++++++-------- drivers/staging/lustre/lnet/selftest/conrpc.h | 40 ++-- drivers/staging/lustre/lnet/selftest/console.c | 271 +++++++++++----------- drivers/staging/lustre/lnet/selftest/console.h | 47 ++-- drivers/staging/lustre/lnet/selftest/framework.c | 256 ++++++++++---------- drivers/staging/lustre/lnet/selftest/ping_test.c | 42 ++-- drivers/staging/lustre/lnet/selftest/rpc.c | 123 +++++----- drivers/staging/lustre/lnet/selftest/rpc.h | 156 +++++++------ drivers/staging/lustre/lnet/selftest/selftest.h | 200 ++++++++-------- 11 files changed, 714 insertions(+), 695 deletions(-) From jsimmons at infradead.org Wed Apr 6 19:25:42 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:42 -0400 Subject: [lustre-devel] [PATCH 16/24] staging: lustre: selftest: convert lstcon_node_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-17-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_node_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conrpc.c | 32 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/console.c | 20 +++++++------- drivers/staging/lustre/lnet/selftest/console.h | 9 +++--- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index aab4be6..194b6dc 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -47,7 +47,7 @@ #include "console.h" void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *, srpc_msg_t *, - lstcon_node_t *, lstcon_trans_stat_t *); + struct lstcon_node *, lstcon_trans_stat_t *); static void lstcon_rpc_done(struct srpc_client_rpc *rpc) @@ -90,7 +90,7 @@ lstcon_rpc_done(struct srpc_client_rpc *rpc) } static int -lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats, +lstcon_rpc_init(struct lstcon_node *nd, int service, unsigned feats, int bulk_npg, int bulk_len, int embedded, struct lstcon_rpc *crpc) { crpc->crp_rpc = sfw_create_rpc(nd->nd_id, service, @@ -115,7 +115,7 @@ lstcon_rpc_init(lstcon_node_t *nd, int service, unsigned feats, } static int -lstcon_rpc_prep(lstcon_node_t *nd, int service, unsigned feats, +lstcon_rpc_prep(struct lstcon_node *nd, int service, unsigned feats, int bulk_npg, int bulk_len, struct lstcon_rpc **crpcpp) { struct lstcon_rpc *crpc = NULL; @@ -289,7 +289,7 @@ lstcon_rpc_trans_abort(struct lstcon_rpc_trans *trans, int error) { struct srpc_client_rpc *rpc; struct lstcon_rpc *crpc; - lstcon_node_t *nd; + struct lstcon_node *nd; list_for_each_entry(crpc, &trans->tas_rpcs_list, crp_link) { rpc = crpc->crp_rpc; @@ -388,7 +388,7 @@ lstcon_rpc_trans_postwait(struct lstcon_rpc_trans *trans, int timeout) static int lstcon_rpc_get_reply(struct lstcon_rpc *crpc, srpc_msg_t **msgpp) { - lstcon_node_t *nd = crpc->crp_node; + struct lstcon_node *nd = crpc->crp_node; struct srpc_client_rpc *rpc = crpc->crp_rpc; srpc_generic_reply_t *rep; @@ -476,7 +476,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, srpc_generic_reply_t *rep; struct lstcon_rpc *crpc; srpc_msg_t *msg; - lstcon_node_t *nd; + struct lstcon_node *nd; long dur; struct timeval tv; int error; @@ -592,7 +592,7 @@ lstcon_rpc_trans_destroy(struct lstcon_rpc_trans *trans) } int -lstcon_sesrpc_prep(lstcon_node_t *nd, int transop, +lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, struct lstcon_rpc **crpc) { srpc_mksn_reqst_t *msrq; @@ -631,7 +631,7 @@ lstcon_sesrpc_prep(lstcon_node_t *nd, int transop, } int -lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, struct lstcon_rpc **crpc) +lstcon_dbgrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc **crpc) { srpc_debug_reqst_t *drq; int rc; @@ -649,7 +649,7 @@ lstcon_dbgrpc_prep(lstcon_node_t *nd, unsigned feats, struct lstcon_rpc **crpc) } int -lstcon_batrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, +lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, lstcon_tsb_hdr_t *tsb, struct lstcon_rpc **crpc) { lstcon_batch_t *batch; @@ -682,7 +682,7 @@ lstcon_batrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, } int -lstcon_statrpc_prep(lstcon_node_t *nd, unsigned feats, struct lstcon_rpc **crpc) +lstcon_statrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc **crpc) { srpc_stat_reqst_t *srq; int rc; @@ -720,7 +720,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx, { lnet_process_id_packed_t *pid; lstcon_ndlink_t *ndl; - lstcon_node_t *nd; + struct lstcon_node *nd; int start; int end; int i = 0; @@ -806,7 +806,7 @@ lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) } int -lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, +lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, lstcon_test_t *test, struct lstcon_rpc **crpc) { lstcon_group_t *sgrp = test->tes_src_grp; @@ -916,7 +916,7 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats, static int lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans, - lstcon_node_t *nd, srpc_msg_t *reply) + struct lstcon_node *nd, srpc_msg_t *reply) { srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply; int status = mksn_rep->mksn_status; @@ -963,7 +963,7 @@ lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans, void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, srpc_msg_t *msg, - lstcon_node_t *nd, lstcon_trans_stat_t *stat) + struct lstcon_node *nd, lstcon_trans_stat_t *stat) { srpc_rmsn_reply_t *rmsn_rep; srpc_debug_reply_t *dbg_rep; @@ -1087,7 +1087,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, { struct lstcon_rpc_trans *trans; lstcon_ndlink_t *ndl; - lstcon_node_t *nd; + struct lstcon_node *nd; struct lstcon_rpc *rpc; unsigned feats; int rc; @@ -1173,7 +1173,7 @@ lstcon_rpc_pinger(void *arg) srpc_msg_t *rep; srpc_debug_reqst_t *drq; lstcon_ndlink_t *ndl; - lstcon_node_t *nd; + struct lstcon_node *nd; int intv; int count = 0; int rc; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 08de007..32364b4 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -61,7 +61,7 @@ do { \ struct lstcon_session console_session; static void -lstcon_node_get(lstcon_node_t *nd) +lstcon_node_get(struct lstcon_node *nd) { LASSERT(nd->nd_ref >= 1); @@ -69,7 +69,7 @@ lstcon_node_get(lstcon_node_t *nd) } static int -lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) +lstcon_node_find(lnet_process_id_t id, struct lstcon_node **ndpp, int create) { lstcon_ndlink_t *ndl; unsigned int idx = LNET_NIDADDR(id.nid) % LST_GLOBAL_HASHSIZE; @@ -90,7 +90,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) if (!create) return -ENOENT; - LIBCFS_ALLOC(*ndpp, sizeof(lstcon_node_t) + sizeof(lstcon_ndlink_t)); + LIBCFS_ALLOC(*ndpp, sizeof(struct lstcon_node) + sizeof(lstcon_ndlink_t)); if (!*ndpp) return -ENOMEM; @@ -117,7 +117,7 @@ lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create) } static void -lstcon_node_put(lstcon_node_t *nd) +lstcon_node_put(struct lstcon_node *nd) { lstcon_ndlink_t *ndl; @@ -135,7 +135,7 @@ lstcon_node_put(lstcon_node_t *nd) list_del(&ndl->ndl_link); list_del(&ndl->ndl_hlink); - LIBCFS_FREE(nd, sizeof(lstcon_node_t) + sizeof(lstcon_ndlink_t)); + LIBCFS_FREE(nd, sizeof(struct lstcon_node) + sizeof(lstcon_ndlink_t)); } static int @@ -144,7 +144,7 @@ lstcon_ndlink_find(struct list_head *hash, { unsigned int idx = LNET_NIDADDR(id.nid) % LST_NODE_HASHSIZE; lstcon_ndlink_t *ndl; - lstcon_node_t *nd; + struct lstcon_node *nd; int rc; if (id.nid == LNET_NID_ANY) @@ -341,7 +341,7 @@ lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new) } static int -lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg) +lstcon_sesrpc_condition(int transop, struct lstcon_node *nd, void *arg) { lstcon_group_t *grp = (lstcon_group_t *)arg; @@ -745,7 +745,7 @@ lstcon_nodes_getent(struct list_head *head, int *index_p, int *count_p, lstcon_node_ent_t __user *dents_up) { lstcon_ndlink_t *ndl; - lstcon_node_t *nd; + struct lstcon_node *nd; int count = 0; int index = 0; @@ -998,7 +998,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, } static int -lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg) +lstcon_batrpc_condition(int transop, struct lstcon_node *nd, void *arg) { switch (transop) { case LST_TRANS_TSBRUN: @@ -1141,7 +1141,7 @@ lstcon_batch_destroy(lstcon_batch_t *bat) } static int -lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg) +lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) { lstcon_test_t *test; lstcon_batch_t *batch; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index c573b56..7c37967 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -50,19 +50,20 @@ #include "selftest.h" #include "conrpc.h" -typedef struct lstcon_node { +/* node descriptor */ +struct lstcon_node { lnet_process_id_t nd_id; /* id of the node */ int nd_ref; /* reference count */ int nd_state; /* state of the node */ int nd_timeout; /* session timeout */ unsigned long nd_stamp; /* timestamp of last replied RPC */ struct lstcon_rpc nd_ping; /* ping rpc */ -} lstcon_node_t; /* node descriptor */ +}; typedef struct { struct list_head ndl_link; /* chain on list */ struct list_head ndl_hlink; /* chain on hash */ - lstcon_node_t *ndl_node; /* pointer to node */ + struct lstcon_node *ndl_node; /* pointer to node */ } lstcon_ndlink_t; /* node link descriptor */ typedef struct { @@ -99,7 +100,7 @@ typedef struct { */ struct list_head bat_trans_list; /* list head of transaction */ struct list_head bat_cli_list; /* list head of client nodes - * (lstcon_node_t) */ + * (struct lstcon_node) */ struct list_head *bat_cli_hash; /* hash table of client nodes */ struct list_head bat_srv_list; /* list head of server nodes */ struct list_head *bat_srv_hash; /* hash table of server nodes */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 6 19:25:47 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 6 Apr 2016 15:25:47 -0400 Subject: [lustre-devel] [PATCH 21/24] staging: lustre: selftest: convert lstcon_test_t to proper struct In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <1459970750-5377-22-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_test_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conctl.c | 2 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 5 ++- drivers/staging/lustre/lnet/selftest/console.c | 26 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/console.h | 7 +++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 6e2a81d..730122f 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -743,7 +743,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) if (args->lstio_tes_param && (args->lstio_tes_param_len <= 0 || args->lstio_tes_param_len > - PAGE_CACHE_SIZE - sizeof(lstcon_test_t))) + PAGE_CACHE_SIZE - sizeof(struct lstcon_test))) return -EINVAL; LIBCFS_ALLOC(batch_name, args->lstio_tes_bat_nmlen + 1); diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 19c9b5c..5cec1c9 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -807,7 +807,7 @@ lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) int lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, - lstcon_test_t *test, struct lstcon_rpc **crpc) + struct lstcon_test *test, struct lstcon_rpc **crpc) { struct lstcon_group *sgrp = test->tes_src_grp; struct lstcon_group *dgrp = test->tes_dst_grp; @@ -1128,7 +1128,8 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, case LST_TRANS_TSBCLIADD: case LST_TRANS_TSBSRVADD: rc = lstcon_testrpc_prep(nd, transop, feats, - (lstcon_test_t *)arg, &rpc); + (struct lstcon_test *)arg, + &rpc); break; case LST_TRANS_TSBRUN: case LST_TRANS_TSBSTOP: diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index deb0bc0..cdbcee7 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -934,7 +934,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, lstcon_test_batch_ent_t *entp; struct list_head *clilst; struct list_head *srvlst; - lstcon_test_t *test = NULL; + struct lstcon_test *test = NULL; struct lstcon_batch *bat; struct lstcon_ndlink *ndl; int rc; @@ -1091,14 +1091,14 @@ static void lstcon_batch_destroy(struct lstcon_batch *bat) { struct lstcon_ndlink *ndl; - lstcon_test_t *test; + struct lstcon_test *test; int i; list_del(&bat->bat_link); while (!list_empty(&bat->bat_test_list)) { test = list_entry(bat->bat_test_list.next, - lstcon_test_t, tes_link); + struct lstcon_test, tes_link); LASSERT(list_empty(&test->tes_trans_list)); list_del(&test->tes_link); @@ -1106,7 +1106,7 @@ lstcon_batch_destroy(struct lstcon_batch *bat) lstcon_group_decref(test->tes_src_grp); lstcon_group_decref(test->tes_dst_grp); - LIBCFS_FREE(test, offsetof(lstcon_test_t, + LIBCFS_FREE(test, offsetof(struct lstcon_test, tes_param[test->tes_paramlen])); } @@ -1143,13 +1143,13 @@ lstcon_batch_destroy(struct lstcon_batch *bat) static int lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) { - lstcon_test_t *test; + struct lstcon_test *test; struct lstcon_batch *batch; struct lstcon_ndlink *ndl; struct list_head *hash; struct list_head *head; - test = (lstcon_test_t *)arg; + test = (struct lstcon_test *)arg; LASSERT(test); batch = test->tes_batch; @@ -1185,7 +1185,7 @@ lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) } static int -lstcon_test_nodes_add(lstcon_test_t *test, struct list_head __user *result_up) +lstcon_test_nodes_add(struct lstcon_test *test, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; struct lstcon_group *grp; @@ -1283,7 +1283,7 @@ lstcon_test_add(char *batch_name, int type, int loop, void *param, int paramlen, int *retp, struct list_head __user *result_up) { - lstcon_test_t *test = NULL; + struct lstcon_test *test = NULL; int rc; struct lstcon_group *src_grp = NULL; struct lstcon_group *dst_grp = NULL; @@ -1309,7 +1309,7 @@ lstcon_test_add(char *batch_name, int type, int loop, if (dst_grp->grp_userland) *retp = 1; - LIBCFS_ALLOC(test, offsetof(lstcon_test_t, tes_param[paramlen])); + LIBCFS_ALLOC(test, offsetof(struct lstcon_test, tes_param[paramlen])); if (!test) { CERROR("Can't allocate test descriptor\n"); rc = -ENOMEM; @@ -1356,7 +1356,7 @@ lstcon_test_add(char *batch_name, int type, int loop, return rc; out: if (test) - LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen])); + LIBCFS_FREE(test, offsetof(struct lstcon_test, tes_param[paramlen])); if (dst_grp) lstcon_group_decref(dst_grp); @@ -1368,9 +1368,9 @@ out: } static int -lstcon_test_find(struct lstcon_batch *batch, int idx, lstcon_test_t **testpp) +lstcon_test_find(struct lstcon_batch *batch, int idx, struct lstcon_test **testpp) { - lstcon_test_t *test; + struct lstcon_test *test; list_for_each_entry(test, &batch->bat_test_list, tes_link) { if (idx == test->tes_hdr.tsb_index) { @@ -1408,7 +1408,7 @@ lstcon_test_batch_query(char *name, int testidx, int client, struct list_head *ndlist; struct lstcon_tsb_hdr *hdr; struct lstcon_batch *batch; - lstcon_test_t *test = NULL; + struct lstcon_test *test = NULL; int transop; int rc; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index ccd4982..becd22e 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -99,7 +99,7 @@ struct lstcon_batch { * for run, force for stop */ char bat_name[LST_NAME_SIZE];/* name of batch */ - struct list_head bat_test_list; /* list head of tests (lstcon_test_t) + struct list_head bat_test_list; /* list head of tests (struct lstcon_test) */ struct list_head bat_trans_list; /* list head of transaction */ struct list_head bat_cli_list; /* list head of client nodes @@ -109,7 +109,8 @@ struct lstcon_batch { struct list_head *bat_srv_hash; /* hash table of server nodes */ }; -typedef struct lstcon_test { +/* a single test descriptor */ +struct lstcon_test { struct lstcon_tsb_hdr tes_hdr; /* test batch header */ struct list_head tes_link; /* chain on batch's tests list */ struct lstcon_batch *tes_batch; /* pointer to batch */ @@ -129,7 +130,7 @@ typedef struct lstcon_test { int tes_paramlen; /* test parameter length */ char tes_param[0]; /* test parameter */ -} lstcon_test_t; /* a single test descriptor */ +}; #define LST_GLOBAL_HASHSIZE 503 /* global nodes hash table size */ #define LST_NODE_HASHSIZE 239 /* node hash table (for batch or group) */ -- 1.7.1 From cakturk at gmail.com Sat Apr 9 18:47:44 2016 From: cakturk at gmail.com (Cihangir Akturk) Date: Sat, 9 Apr 2016 21:47:44 +0300 Subject: [lustre-devel] [PATCH] staging: lustre: split error handling code into multiple labels Message-ID: <1460227664-28540-1-git-send-email-cakturk@gmail.com> Instead of using a switch-case statement to find out what kind of error has just happened, split error handling logic into multiple labels and jump right into the appropriate label to do the error handling. This way it is easier to follow different code paths. It also looks easy on the eyes. Additionally silences the following coccinelle warning: drivers/staging/lustre/lustre/obdecho/echo_client.c:762:22-27: ERROR: ed is NULL but dereferenced. Signed-off-by: Cihangir Akturk --- .../staging/lustre/lustre/obdecho/echo_client.c | 54 ++++++++-------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index a752bb4..f143f7a 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -668,8 +668,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, struct obd_device *obd = NULL; /* to keep compiler happy */ struct obd_device *tgt; const char *tgt_type_name; - int rc; - int cleanup = 0; + int rc, err; ed = kzalloc(sizeof(*ed), GFP_NOFS); if (!ed) { @@ -677,16 +676,14 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, goto out; } - cleanup = 1; cd = &ed->ed_cl; rc = cl_device_init(cd, t); if (rc) - goto out; + goto out_free; cd->cd_lu_dev.ld_ops = &echo_device_lu_ops; cd->cd_ops = &echo_device_cl_ops; - cleanup = 2; obd = class_name2obd(lustre_cfg_string(cfg, 0)); LASSERT(obd); LASSERT(env); @@ -696,28 +693,25 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, CERROR("Can not find tgt device %s\n", lustre_cfg_string(cfg, 1)); rc = -ENODEV; - goto out; + goto out_device_fini; } next = tgt->obd_lu_dev; if (!strcmp(tgt->obd_type->typ_name, LUSTRE_MDT_NAME)) { CERROR("echo MDT client must be run on server\n"); rc = -EOPNOTSUPP; - goto out; + goto out_device_fini; } rc = echo_site_init(env, ed); if (rc) - goto out; - - cleanup = 3; + goto out_device_fini; rc = echo_client_setup(env, obd, cfg); if (rc) - goto out; + goto out_site_fini; ed->ed_ec = &obd->u.echo_client; - cleanup = 4; /* if echo client is to be stacked upon ost device, the next is * NULL since ost is not a clio device so far @@ -729,7 +723,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, if (next) { if (next->ld_site) { rc = -EBUSY; - goto out; + goto out_cleanup; } next->ld_site = &ed->ed_site->cs_lu; @@ -737,7 +731,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, next->ld_type->ldt_name, NULL); if (rc) - goto out; + goto out_cleanup; } else { LASSERT(strcmp(tgt_type_name, LUSTRE_OST_NAME) == 0); @@ -745,27 +739,19 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, ed->ed_next = next; return &cd->cd_lu_dev; -out: - switch (cleanup) { - case 4: { - int rc2; - - rc2 = echo_client_cleanup(obd); - if (rc2) - CERROR("Cleanup obd device %s error(%d)\n", - obd->obd_name, rc2); - } - case 3: - echo_site_fini(env, ed); - case 2: - cl_device_fini(&ed->ed_cl); - case 1: - kfree(ed); - case 0: - default: - break; - } +out_cleanup: + err = echo_client_cleanup(obd); + if (err) + CERROR("Cleanup obd device %s error(%d)\n", + obd->obd_name, err); +out_site_fini: + echo_site_fini(env, ed); +out_device_fini: + cl_device_fini(&ed->ed_cl); +out_free: + kfree(ed); +out: return ERR_PTR(rc); } -- 2.1.4 From jsimmons at infradead.org Sun Apr 10 13:13:24 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:24 -0400 Subject: [lustre-devel] [PATCH 01/17] staging: lustre: osc: fix race issues thanks to oap_lock In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-2-git-send-email-jsimmons@infradead.org> From: Sebastien Buisson Fix 'data race condition' defects found by Coverity version 6.5.0: Data race condition (MISSING_LOCK) Accessing variable without holding lock. Elsewhere, this variable is accessed with lock held. This patch is dedicated to code fragments involving oap_lock. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744 Reviewed-on: http://review.whamcloud.com/6572 Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_cache.c | 8 ++++++++ drivers/staging/lustre/lustre/osc/osc_io.c | 2 ++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 956d57b..846be76 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1147,7 +1147,9 @@ static int osc_extent_make_ready(const struct lu_env *env, last->oap_count = osc_refresh_count(env, last, OBD_BRW_WRITE); LASSERT(last->oap_count > 0); LASSERT(last->oap_page_off + last->oap_count <= PAGE_CACHE_SIZE); + spin_lock(&last->oap_lock); last->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&last->oap_lock); } /* for the rest of pages, we don't need to call osf_refresh_count() @@ -1156,7 +1158,9 @@ static int osc_extent_make_ready(const struct lu_env *env, list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { if (!(oap->oap_async_flags & ASYNC_COUNT_STABLE)) { oap->oap_count = PAGE_CACHE_SIZE - oap->oap_page_off; + spin_lock(&last->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&last->oap_lock); } } @@ -2350,6 +2354,10 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, oap->oap_cmd = cmd; oap->oap_page_off = ops->ops_from; oap->oap_count = ops->ops_to - ops->ops_from; + /* + * No need to hold a lock here, + * since this page is not in any list yet. + */ oap->oap_async_flags = 0; oap->oap_brw_flags = brw_flags; diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index cf7743d..0f50465 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -168,8 +168,10 @@ static int osc_io_submit(const struct lu_env *env, } cl_page_list_move(qout, qin, page); + spin_lock(&oap->oap_lock); oap->oap_async_flags = ASYNC_URGENT|ASYNC_READY; oap->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&oap->oap_lock); osc_page_submit(env, opg, crt, brw_flags); list_add_tail(&oap->oap_pending_item, &list); -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:25 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:25 -0400 Subject: [lustre-devel] [PATCH 02/17] staging: lustre: clio: incorrect assertions in 'enable-invariants' In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-3-git-send-email-jsimmons@infradead.org> From: Niu Yawei Fixed several incorrect assumptions in 'enable-invariants'. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3521 Reviewed-on: http://review.whamcloud.com/6832 Reviewed-by: Bobi Jam Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 8df39ce..03aab85 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -498,7 +498,7 @@ void cl_page_disown0(const struct lu_env *env, state = pg->cp_state; PINVRNT(env, pg, state == CPS_OWNED || state == CPS_FREEING); - PINVRNT(env, pg, cl_page_invariant(pg)); + PINVRNT(env, pg, cl_page_invariant(pg) || state == CPS_FREEING); cl_page_owner_clear(pg); if (state == CPS_OWNED) @@ -670,7 +670,8 @@ EXPORT_SYMBOL(cl_page_unassume); void cl_page_disown(const struct lu_env *env, struct cl_io *io, struct cl_page *pg) { - PINVRNT(env, pg, cl_page_is_owned(pg, io)); + PINVRNT(env, pg, cl_page_is_owned(pg, io) || + pg->cp_state == CPS_FREEING); io = cl_io_top(io); cl_page_disown0(env, io, pg); -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:26 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:26 -0400 Subject: [lustre-devel] [PATCH 03/17] staging: lustre: ldlm: Fix a race during FLock handling In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-4-git-send-email-jsimmons@infradead.org> From: Bruno Faccini Protect against race where lock could have been just destroyed due to overlap, in ldlm_process_flock_lock(). Easy reproducer is BULL's NFS Locktests in pthread mode. (http://nfsv4.bullopensource.org/tools/tests/locktest.php) Signed-off-by: Bruno Faccini Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1126 Reviewed-on: http://review.whamcloud.com/7134 Reviewed-by: Oleg Drokin Reviewed-by: John L. Hammond Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 3f97e1c..5102d78 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -520,11 +520,6 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) granted: OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT, 10); - if (lock->l_flags & LDLM_FL_DESTROYED) { - LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed"); - return 0; - } - if (lock->l_flags & LDLM_FL_FAILED) { LDLM_DEBUG(lock, "client-side enqueue waking up: failed"); return -EIO; @@ -534,6 +529,16 @@ granted: lock_res_and_lock(lock); + /* + * Protect against race where lock could have been just destroyed + * due to overlap in ldlm_process_flock_lock(). + */ + if (lock->l_flags & LDLM_FL_DESTROYED) { + unlock_res_and_lock(lock); + LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed"); + return 0; + } + /* ldlm_lock_enqueue() has already placed lock on the granted list. */ list_del_init(&lock->l_res_link); -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:29 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:29 -0400 Subject: [lustre-devel] [PATCH 06/17] staging: lustre: llite: speedup in unlink/rmdir In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-7-git-send-email-jsimmons@infradead.org> From: Andrew Perepechko Assume dchild argument is fully initialized in ->unlink and ->rmdir callbacks, so additional lookup for ELC is not needed. Signed-off-by: Andrew Perepechko Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473 Xyratex-bug-id: MRP-1027 Reviewed-on: http://review.whamcloud.com/6648 Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/namei.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 6445bc1..7e4247a 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -845,12 +845,6 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, return rc; } -static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) -{ - if (d_really_is_positive(child)) - *fid = *ll_inode2fid(d_inode(child)); -} - int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) { struct mdt_body *body; @@ -943,7 +937,9 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild) if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dchild, &op_data->op_fid3); + if (dchild && dchild->d_inode) + op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); + op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -993,7 +989,9 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild) if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dchild, &op_data->op_fid3); + if (dchild && dchild->d_inode) + op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); + op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -1074,8 +1072,11 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(src_dchild, &op_data->op_fid3); - ll_get_child_fid(tgt_dchild, &op_data->op_fid4); + if (src_dchild && src_dchild->d_inode) + op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode); + if (tgt_dchild && tgt_dchild->d_inode) + op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode); + err = md_rename(sbi->ll_md_exp, op_data, src_dchild->d_name.name, src_dchild->d_name.len, -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:31 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:31 -0400 Subject: [lustre-devel] [PATCH 08/17] staging: lustre: obd: MDT mount fails on MDS w/o MGS on it In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-9-git-send-email-jsimmons@infradead.org> From: Bobi Jam If we specify multiple --mgsnode for a MDT, when we start MDS upon it while MGS is no the other node, the MGC import connection will always select the local nid (which is one of the candidate mgsnode) since it think its the closest connection. This patch treats further --mgsnode nids as failover nids, so that multiple import connections are added for the MGC import. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3829 Reviewed-on: http://review.whamcloud.com/7509 Reviewed-by: Liang Zhen Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index d3e28a3..9474aa9 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -307,7 +307,8 @@ int lustre_start_mgc(struct super_block *sb) while (class_parse_nid(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid, NULL, NULL, NULL); - i++; + if (!rc) + i++; /* Stop at the first failover nid */ if (*ptr == ':') break; @@ -345,16 +346,18 @@ int lustre_start_mgc(struct super_block *sb) sprintf(niduuid, "%s_%x", mgcname, i); j = 0; while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) { - j++; - rc = do_lcfg(mgcname, nid, - LCFG_ADD_UUID, niduuid, NULL, NULL, NULL); + rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid, + NULL, NULL, NULL); + if (!rc) + ++j; if (*ptr == ':') break; } if (j > 0) { rc = do_lcfg(mgcname, 0, LCFG_ADD_CONN, niduuid, NULL, NULL, NULL); - i++; + if (!rc) + i++; } else { /* at ":/fsname" */ break; -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:32 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:32 -0400 Subject: [lustre-devel] [PATCH 09/17] staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init() In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-10-git-send-email-jsimmons@infradead.org> From: Swapnil Pimpale This patch has the following: 1) Fix for the return value from ptlrpcd_init(). It will now return a correct status instead of returning zero always. 2) ptlrpcd_addref() should not increment ptlrpcd_users on error. 3) Added code in a mdc_setup() and mgc_setup() to test the return value of ptlrpcd_addref() and return on error. Signed-off-by: Swapnil Pimpale Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3808 Reviewed-on: http://review.whamcloud.com/7522 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 9 ++++++--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 ++++- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index a089237..97f8669 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2314,12 +2314,14 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) return -ENOMEM; mdc_init_rpc_lock(cli->cl_rpc_lock); - ptlrpcd_addref(); + rc = ptlrpcd_addref(); + if (rc < 0) + goto err_rpc_lock; cli->cl_close_lock = kzalloc(sizeof(*cli->cl_close_lock), GFP_NOFS); if (!cli->cl_close_lock) { rc = -ENOMEM; - goto err_rpc_lock; + goto err_ptlrpcd_decref; } mdc_init_rpc_lock(cli->cl_close_lock); @@ -2345,9 +2347,10 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) err_close_lock: kfree(cli->cl_close_lock); +err_ptlrpcd_decref: + ptlrpcd_decref(); err_rpc_lock: kfree(cli->cl_rpc_lock); - ptlrpcd_decref(); return rc; } diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index b7dc872..3f5f884 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -734,7 +734,9 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) struct task_struct *task; int rc; - ptlrpcd_addref(); + rc = ptlrpcd_addref(); + if (rc < 0) + goto err_noref; rc = client_obd_setup(obd, lcfg); if (rc) @@ -773,6 +775,7 @@ err_cleanup: client_obd_cleanup(obd); err_decref: ptlrpcd_decref(); +err_noref: return rc; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index dbc3376..76a355a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -909,8 +909,11 @@ int ptlrpcd_addref(void) int rc = 0; mutex_lock(&ptlrpcd_mutex); - if (++ptlrpcd_users == 1) + if (++ptlrpcd_users == 1) { rc = ptlrpcd_init(); + if (rc < 0) + ptlrpcd_users--; + } mutex_unlock(&ptlrpcd_mutex); return rc; } -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:23 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:23 -0400 Subject: [lustre-devel] [PATCH 00/17] staging : lustre : rest of missing patches from 2.5.0 release Message-ID: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> This is the last collection of missing fixes present in the Lustre 2.5.0 release. Once these are merged the upstream client will be equal to the pre-2.6 lustre version since the major of clio cleanups from that time frame have already landed. Andrew Perepechko (3): staging: lustre: llite: variable rename in namei.c staging: lustre: llite: speedup in unlink/rmdir staging: lustre: lprocfs: implement log2 using bitops Andriy Skulysh (1): staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY Bobi Jam (1): staging: lustre: obd: MDT mount fails on MDS w/o MGS on it Bruno Faccini (3): staging: lustre: ldlm: Fix a race during FLock handling staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance staging: lustre: lov: return minimal FIEMAP for released files Jeff Mahoney (1): staging: lustre: lloop: Fix build failure on ppc64 Jinshan Xiong (3): staging: lustre: llite: error setting max_cache_mb at mount time staging: lustre: llite: Truncate to restore file staging: lustre: osc: osc_extent_wait() shouldn't be interruptible John L. Hammond (2): staging: lustre: hsm: permission checks for HSM ioctl operations staging: lustre: hsm: don't use real suppgid Niu Yawei (1): staging: lustre: clio: incorrect assertions in 'enable-invariants' Sebastien Buisson (1): staging: lustre: osc: fix race issues thanks to oap_lock Swapnil Pimpale (1): staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init() drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 15 +++-- drivers/staging/lustre/lustre/llite/dir.c | 3 + drivers/staging/lustre/lustre/llite/file.c | 5 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 60 +++++++++---------- drivers/staging/lustre/lustre/llite/lloop.c | 3 - drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 +- drivers/staging/lustre/lustre/llite/namei.c | 65 ++++++++++---------- drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 21 ++++++ drivers/staging/lustre/lustre/lov/lov_request.c | 7 ++- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 17 +++-- drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 5 +- .../lustre/lustre/obdclass/lprocfs_status.c | 6 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 13 +++-- drivers/staging/lustre/lustre/osc/osc_cache.c | 10 +++- drivers/staging/lustre/lustre/osc/osc_io.c | 2 + drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 5 +- 20 files changed, 155 insertions(+), 102 deletions(-) From jsimmons at infradead.org Sun Apr 10 13:13:30 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:30 -0400 Subject: [lustre-devel] [PATCH 07/17] staging: lustre: llite: error setting max_cache_mb at mount time In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-8-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong The root cause is that when max_cache_mb conf parameter is applied, the client isn't connected to the OST yet so that sbi->ll_dt_exp is NULL. However, it's not necessary to shrink the cache memory in this case so success should be returned. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3676 Reviewed-on: http://review.whamcloud.com/7194 Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 091144f..6947913 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -461,8 +461,8 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, break; if (!sbi->ll_dt_exp) { /* being initialized */ - rc = -ENODEV; - break; + rc = 0; + goto out; } /* difficult - have to ask OSCs to drop LRU slots. */ -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:28 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:28 -0400 Subject: [lustre-devel] [PATCH 05/17] staging: lustre: llite: variable rename in namei.c In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-6-git-send-email-jsimmons@infradead.org> From: Andrew Perepechko With the patch 6648 a fee variables were renamed. We do these renames in broken out patch to the fix obvious. Signed-off-by: Andrew Perepechko Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473 Xyratex-bug-id: MRP-1027 Reviewed-on: http://review.whamcloud.com/6648 Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/namei.c | 52 +++++++++++++------------- 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index f8f98e4..6445bc1 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -927,23 +927,23 @@ out: * is any lock existing. They will recycle dentries and inodes based upon locks * too. b=20433 */ -static int ll_unlink(struct inode *dir, struct dentry *dentry) +static int ll_unlink(struct inode *dir, struct dentry *dchild) { struct ptlrpc_request *request = NULL; struct md_op_data *op_data; int rc; CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", - dentry, dir->i_ino, dir->i_generation, dir); + dchild, dir->i_ino, dir->i_generation, dir); op_data = ll_prep_md_op_data(NULL, dir, NULL, - dentry->d_name.name, - dentry->d_name.len, + dchild->d_name.name, + dchild->d_name.len, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dentry, &op_data->op_fid3); + ll_get_child_fid(dchild, &op_data->op_fid3); op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -977,23 +977,23 @@ static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) return err; } -static int ll_rmdir(struct inode *dir, struct dentry *dentry) +static int ll_rmdir(struct inode *dir, struct dentry *dchild) { struct ptlrpc_request *request = NULL; struct md_op_data *op_data; int rc; CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", - dentry, dir->i_ino, dir->i_generation, dir); + dchild, dir->i_ino, dir->i_generation, dir); op_data = ll_prep_md_op_data(NULL, dir, NULL, - dentry->d_name.name, - dentry->d_name.len, + dchild->d_name.name, + dchild->d_name.len, S_IFDIR, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dentry, &op_data->op_fid3); + ll_get_child_fid(dchild, &op_data->op_fid3); op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -1056,42 +1056,42 @@ out: return err; } -static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, - struct inode *new_dir, struct dentry *new_dentry) +static int ll_rename(struct inode *src, struct dentry *src_dchild, + struct inode *tgt, struct dentry *tgt_dchild) { struct ptlrpc_request *request = NULL; - struct ll_sb_info *sbi = ll_i2sbi(old_dir); + struct ll_sb_info *sbi = ll_i2sbi(src); struct md_op_data *op_data; int err; CDEBUG(D_VFSTRACE, "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd,tgt_dir=%lu/%u(%p)\n", - old_dentry, old_dir->i_ino, old_dir->i_generation, old_dir, - new_dentry, new_dir->i_ino, new_dir->i_generation, new_dir); + src_dchild, src->i_ino, src->i_generation, src, + tgt_dchild, tgt->i_ino, tgt->i_generation, tgt); - op_data = ll_prep_md_op_data(NULL, old_dir, new_dir, NULL, 0, 0, + op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(old_dentry, &op_data->op_fid3); - ll_get_child_fid(new_dentry, &op_data->op_fid4); + ll_get_child_fid(src_dchild, &op_data->op_fid3); + ll_get_child_fid(tgt_dchild, &op_data->op_fid4); err = md_rename(sbi->ll_md_exp, op_data, - old_dentry->d_name.name, - old_dentry->d_name.len, - new_dentry->d_name.name, - new_dentry->d_name.len, &request); + src_dchild->d_name.name, + src_dchild->d_name.len, + tgt_dchild->d_name.name, + tgt_dchild->d_name.len, &request); ll_finish_md_op_data(op_data); if (!err) { - ll_update_times(request, old_dir); - ll_update_times(request, new_dir); + ll_update_times(request, src); + ll_update_times(request, tgt); ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1); - err = ll_objects_destroy(request, old_dir); + err = ll_objects_destroy(request, src); } ptlrpc_req_finished(request); if (!err) - d_move(old_dentry, new_dentry); + d_move(src_dchild, tgt_dchild); return err; } -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:40 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:40 -0400 Subject: [lustre-devel] [PATCH 17/17] staging: lustre: hsm: don't use real suppgid In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-18-git-send-email-jsimmons@infradead.org> From: John L. Hammond In the MDC HSM handlers that do not pack a real suppgid, use -1 rather than 0 for the suppgid in mdt_body. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866 Reviewed-on: http://review.whamcloud.com/7565 Reviewed-by: Aurelien Degremont Reviewed-by: Faccini Bruno Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 97f8669..513290f 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -1169,7 +1169,7 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp, goto out; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); /* Copy hsm_progress struct */ req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS); @@ -1203,7 +1203,7 @@ static int mdc_ioc_hsm_ct_register(struct obd_import *imp, __u32 archives) goto out; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); /* Copy hsm_progress struct */ archive_mask = req_capsule_client_get(&req->rq_pill, @@ -1278,7 +1278,7 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp) goto out; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); ptlrpc_request_set_replen(req); @@ -1395,7 +1395,7 @@ static int mdc_ioc_hsm_request(struct obd_export *exp, return rc; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); /* Copy hsm_request struct */ req_hr = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_REQUEST); -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:39 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:39 -0400 Subject: [lustre-devel] [PATCH 16/17] staging: lustre: hsm: permission checks for HSM ioctl operations In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-17-git-send-email-jsimmons@infradead.org> From: John L. Hammond In the LL_IOC_HSM_CT_START case of ll_dir_ioctl() require CAP_SYS_ADMIN, since the local handler for this ioctl may modify the global KUC table. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866 Reviewed-on: http://review.whamcloud.com/7565 Reviewed-by: Aurelien Degremont Reviewed-by: Faccini Bruno Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 45bdf8f..94f3800 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1844,6 +1844,9 @@ out_quotactl: return rc; } case LL_IOC_HSM_CT_START: + if (!capable(CFS_CAP_SYS_ADMIN)) + return -EPERM; + rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg, sizeof(struct lustre_kernelcomm)); return rc; -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:27 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:27 -0400 Subject: [lustre-devel] [PATCH 04/17] staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-5-git-send-email-jsimmons@infradead.org> From: Bruno Faccini Follow-on to patch introduced to fix LU-2665 ticket (Gerrit Change at http://review.whamcloud.com/6415 with Change-Id: I8faa331712abeadee46eabe111ee1c23a05840d5). Original patch introduced regressions against POSIX test suite (fcntl.18/fcntl.35 tests in LSB-VSX POSIX test suite at http://www.opengroup.org/testing/linux-test/lsb-vsx.html), so the idea is to only resend F_UNLCKs to have both LU-2665 bug and POSIX test suite happy. Signed-off-by: Bruno Faccini Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3701 Reviewed-on: http://review.whamcloud.com/7453 Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 958a164..01b6d77 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -869,7 +869,9 @@ resend: * (explicits or automatically generated by Kernel to clean * current FLocks upon exit) that can't be trashed */ - if ((rc == -EINTR) || (rc == -ETIMEDOUT)) + if (((rc == -EINTR) || (rc == -ETIMEDOUT)) && + (einfo->ei_type == LDLM_FLOCK) && + (einfo->ei_mode == LCK_NL)) goto resend; return rc; } -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:36 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:36 -0400 Subject: [lustre-devel] [PATCH 13/17] staging: lustre: lloop: Fix build failure on ppc64 In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-14-git-send-email-jsimmons@infradead.org> From: Jeff Mahoney On ppc64 with 64k pages, we get a build failure in lloop: drivers/staging/lustre/lustre/llite/lloop.c:527:2: note: in expansion of macro 'CLASSERT' CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); There's no need to change the queue's logical block size. Even if it could accept a 64k value, that would result in any file system on top of it needing to also use 64k blocks. It'd be safe to set it to 4k, but there's no actual need for it. It's not used to split requests except for WRITE_SAME, which lloop doesn't implement anyway. Signed-off-by: Jeff Mahoney Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4000 Reviewed-on: http://review.whamcloud.com/7745 Reviewed-by: Jinshan Xiong Reviewed-by: Minh Diep Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/lloop.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index b725fc1..f396753 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -525,9 +525,6 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, lo->lo_queue->queuedata = lo; /* queue parameters */ - CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); - blk_queue_logical_block_size(lo->lo_queue, - (unsigned short)PAGE_CACHE_SIZE); blk_queue_max_hw_sectors(lo->lo_queue, LLOOP_MAX_SEGMENTS << (PAGE_CACHE_SHIFT - 9)); blk_queue_max_segments(lo->lo_queue, LLOOP_MAX_SEGMENTS); -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:35 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:35 -0400 Subject: [lustre-devel] [PATCH 12/17] staging: lustre: lprocfs: implement log2 using bitops In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-13-git-send-email-jsimmons@infradead.org> From: Andrew Perepechko This patch implements log2 using fls. Signed-off-by: Andrew Perepechko Reviewed-by: Alexander Boyko Reviewed-by: alexander_zarochentsev at xyratex.com Reviewed-by: Vitaly Fertman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3496 Xyratex-bug-id: MRP-999 Reviewed-on: http://review.whamcloud.com/6757 Reviewed-by: John L. Hammond Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/obdclass/lprocfs_status.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index d93f42f..172fc91 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -1471,10 +1471,10 @@ EXPORT_SYMBOL(lprocfs_oh_tally); void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) { - unsigned int val; + unsigned int val = 0; - for (val = 0; ((1 << val) < value) && (val <= OBD_HIST_MAX); val++) - ; + if (likely(value != 0)) + val = min(fls(value - 1), OBD_HIST_MAX); lprocfs_oh_tally(oh, val); } -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:38 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:38 -0400 Subject: [lustre-devel] [PATCH 15/17] staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-16-git-send-email-jsimmons@infradead.org> From: Andriy Skulysh Patch for LU-631 which was landed before the upstream merge broke OBD_STATFS_NODELAY behaviour. It adds unnecessary delay while running df command with inactive OSTs. We shouldn't try to recover connection to OST in this case. Signed-off-by: Andriy Skulysh Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4010 Reviewed-on: http://review.whamcloud.com/7762 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_request.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 7178a02..475ca2f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -716,12 +716,15 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, struct lov_request *req; if (!lov->lov_tgts[i] || - (!lov_check_and_wait_active(lov, i) && - (oinfo->oi_flags & OBD_STATFS_NODELAY))) { + (oinfo->oi_flags & OBD_STATFS_NODELAY && + !lov->lov_tgts[i]->ltd_active)) { CDEBUG(D_HA, "lov idx %d inactive\n", i); continue; } + if (!lov->lov_tgts[i]->ltd_active) + lov_check_and_wait_active(lov, i); + /* skip targets that have been explicitly disabled by the * administrator */ -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:33 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:33 -0400 Subject: [lustre-devel] [PATCH 10/17] staging: lustre: llite: Truncate to restore file In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-11-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Truncate up is safe so it won't trigger restore. Copy optimization for truncate down - only copy the part under truncate length. If a file is truncated to zero usually it'll be followed by write so I choose to restore the file and set correct stripe information. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3817 Reviewed-on: http://review.whamcloud.com/7505 Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Henri Doreau Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 5 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 60 +++++++++---------- drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +- 4 files changed, 35 insertions(+), 37 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 9b553d2..24fa24b 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3621,7 +3621,7 @@ again: /** * This function send a restore request to the MDT */ -int ll_layout_restore(struct inode *inode) +int ll_layout_restore(struct inode *inode, loff_t offset, __u64 length) { struct hsm_user_request *hur; int len, rc; @@ -3637,7 +3637,8 @@ int ll_layout_restore(struct inode *inode) hur->hur_request.hr_flags = 0; memcpy(&hur->hur_user_item[0].hui_fid, &ll_i2info(inode)->lli_fid, sizeof(hur->hur_user_item[0].hui_fid)); - hur->hur_user_item[0].hui_extent.length = -1; + hur->hur_user_item[0].hui_extent.offset = offset; + hur->hur_user_item[0].hui_extent.length = length; hur->hur_request.hr_itemcount = 1; rc = obd_iocontrol(LL_IOC_HSM_REQUEST, ll_i2sbi(inode)->ll_md_exp, len, hur, NULL); diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index d67c8c0..bb582f1 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1377,7 +1377,7 @@ enum { int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf); int ll_layout_refresh(struct inode *inode, __u32 *gen); -int ll_layout_restore(struct inode *inode); +int ll_layout_restore(struct inode *inode, loff_t start, __u64 length); int ll_xattr_init(void); void ll_xattr_fini(void); diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 9571742..49bfbbd 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1266,14 +1266,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime), (s64)ktime_get_real_seconds()); - /* If we are changing file size, file content is modified, flag it. */ - if (attr->ia_valid & ATTR_SIZE) { - attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; - spin_lock(&lli->lli_lock); - lli->lli_flags |= LLIF_DATA_MODIFIED; - spin_unlock(&lli->lli_lock); - } - /* We always do an MDS RPC, even if we're only changing the size; * only the MDS knows whether truncate() should fail with -ETXTBUSY */ @@ -1285,13 +1277,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) if (!S_ISDIR(inode->i_mode)) inode_unlock(inode); - memcpy(&op_data->op_attr, attr, sizeof(*attr)); - - /* Open epoch for truncate. */ - if (exp_connect_som(ll_i2mdexp(inode)) && - (attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET))) - op_data->op_flags = MF_EPOCH_OPEN; - /* truncate on a released file must failed with -ENODATA, * so size must not be set on MDS for released file * but other attributes must be set @@ -1305,29 +1290,40 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) if (lsm && lsm->lsm_pattern & LOV_PATTERN_F_RELEASED) file_is_released = true; ccc_inode_lsm_put(inode, lsm); + + if (!hsm_import && attr->ia_valid & ATTR_SIZE) { + if (file_is_released) { + rc = ll_layout_restore(inode, 0, attr->ia_size); + if (rc < 0) + goto out; + + file_is_released = false; + ll_layout_refresh(inode, &gen); + } + + /* + * If we are changing file size, file content is + * modified, flag it. + */ + attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; + spin_lock(&lli->lli_lock); + lli->lli_flags |= LLIF_DATA_MODIFIED; + spin_unlock(&lli->lli_lock); + op_data->op_bias |= MDS_DATA_MODIFIED; + } } - /* if not in HSM import mode, clear size attr for released file - * we clear the attribute send to MDT in op_data, not the original - * received from caller in attr which is used later to - * decide return code - */ - if (file_is_released && (attr->ia_valid & ATTR_SIZE) && !hsm_import) - op_data->op_attr.ia_valid &= ~ATTR_SIZE; + memcpy(&op_data->op_attr, attr, sizeof(*attr)); + + /* Open epoch for truncate. */ + if (exp_connect_som(ll_i2mdexp(inode)) && !hsm_import && + (attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET))) + op_data->op_flags = MF_EPOCH_OPEN; rc = ll_md_setattr(dentry, op_data, &mod); if (rc) goto out; - /* truncate failed (only when non HSM import), others succeed */ - if (file_is_released) { - if ((attr->ia_valid & ATTR_SIZE) && !hsm_import) - rc = -ENODATA; - else - rc = 0; - goto out; - } - /* RPC to MDT is sent, cancel data modification flag */ if (op_data->op_bias & MDS_DATA_MODIFIED) { spin_lock(&lli->lli_lock); @@ -1336,7 +1332,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) } ll_ioepoch_open(lli, op_data->op_ioepoch); - if (!S_ISREG(inode->i_mode)) { + if (!S_ISREG(inode->i_mode) || file_is_released) { rc = 0; goto out; } diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index aed7b8e..65d4637 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -295,6 +295,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) struct cl_io *io = ios->cis_io; struct cl_object *obj = io->ci_obj; struct vvp_io *vio = cl2vvp_io(env, ios); + struct inode *inode = vvp_object_inode(obj); CLOBINVRNT(env, obj, vvp_object_invariant(obj)); @@ -310,7 +311,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) /* file was detected release, we need to restore it * before finishing the io */ - rc = ll_layout_restore(vvp_object_inode(obj)); + rc = ll_layout_restore(inode, 0, OBD_OBJECT_EOF); /* if restore registration failed, no restart, * we will return -ENODATA */ @@ -336,7 +337,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) __u32 gen = 0; /* check layout version */ - ll_layout_refresh(vvp_object_inode(obj), &gen); + ll_layout_refresh(inode, &gen); io->ci_need_restart = vio->vui_layout_gen != gen; if (io->ci_need_restart) { CDEBUG(D_VFSTRACE, -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:34 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:34 -0400 Subject: [lustre-devel] [PATCH 11/17] staging: lustre: osc: osc_extent_wait() shouldn't be interruptible In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-12-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Otherwise it will hit the assertion at cl_lock.c: cl_lock.c:1967:discard_cb()) ASSERTION( (!(page->cp_type == CPT_CACHEABLE) || (!PageWriteback(cl_page_vmpage(env, page)))) ) failed: This is because in osc_lock_flush() we have to make sure the IO is finished before discarding the pages. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2779 Reviewed-on: http://review.whamcloud.com/5419 Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 846be76..a341160 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -965,7 +965,7 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, "%s: wait ext to %d timedout, recovery in progress?\n", osc_export(obj)->exp_obd->obd_name, state); - lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); + lwi = LWI_INTR(NULL, NULL); rc = l_wait_event(ext->oe_waitq, extent_wait_cb(ext, state), &lwi); } -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 13:13:37 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 09:13:37 -0400 Subject: [lustre-devel] [PATCH 14/17] staging: lustre: lov: return minimal FIEMAP for released files In-Reply-To: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460294020-2111-15-git-send-email-jsimmons@infradead.org> From: Bruno Faccini Since st_blocks = NULL is returned for released files, FIEMAP should at least return a minimal mapping to make users aware that file contains data but it is not immediately available. This will make coreutils and tools such tar happy and have them presume file is sparse. Also, add a new test_228 in sanity-hsm to verify it works for "[cp,tar] --sparse" commands. Also fix a LBUG ("lov_fiemap()) ASSERTION( fm_local ) failed") likely to occur when no-object/ENOMEM conditions and also now when released. Signed-off-by: Bruno Faccini Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3864 Reviewed-on: http://review.whamcloud.com/7584 Reviewed-by: Andreas Dilger Reviewed-by: Aurelien Degremont Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_obd.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 1a9e3e8..9b72671 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -1733,6 +1733,27 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, unsigned int buffer_size = FIEMAP_BUFFER_SIZE; if (!lsm_has_objects(lsm)) { + if (lsm && lsm_is_released(lsm) && (fm_key->fiemap.fm_start < + fm_key->oa.o_size)) { + /* + * released file, return a minimal FIEMAP if + * request fits in file-size. + */ + fiemap->fm_mapped_extents = 1; + fiemap->fm_extents[0].fe_logical = + fm_key->fiemap.fm_start; + if (fm_key->fiemap.fm_start + fm_key->fiemap.fm_length < + fm_key->oa.o_size) { + fiemap->fm_extents[0].fe_length = + fm_key->fiemap.fm_length; + } else { + fiemap->fm_extents[0].fe_length = + fm_key->oa.o_size - fm_key->fiemap.fm_start; + fiemap->fm_extents[0].fe_flags |= + (FIEMAP_EXTENT_UNKNOWN | + FIEMAP_EXTENT_LAST); + } + } rc = 0; goto out; } -- 1.7.1 From jsimmons at infradead.org Sun Apr 10 14:04:51 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 15:04:51 +0100 (BST) Subject: [lustre-devel] [PATCH 13/17] staging: lustre: lloop: Fix build failure on ppc64 In-Reply-To: <63807394-FF62-4376-95FD-412309D47BF7@suse.com> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> <1460294020-2111-14-git-send-email-jsimmons@infradead.org> <63807394-FF62-4376-95FD-412309D47BF7@suse.com> Message-ID: > This patch was shown not to work. I just haven't removed it from opensuse yet. Its been running in our production tree as well for some time. Guess that change is a noop. In any case we have been discussing redoing the lloop driver anyways. Just need to find the cycles. > -- > Jeff Mahoney > (apologies for the top post -- from my mobile) > > > On Apr 10, 2016, at 9:13 AM, James Simmons wrote: > > > > From: Jeff Mahoney > > > > On ppc64 with 64k pages, we get a build failure in lloop: > > > > drivers/staging/lustre/lustre/llite/lloop.c:527:2: > > note: in expansion of macro 'CLASSERT' > > CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); > > > > There's no need to change the queue's logical block size. Even if it could > > accept a 64k value, that would result in any file system on top of it > > needing to also use 64k blocks. It'd be safe to set it to 4k, but there's > > no actual need for it. It's not used to split requests except for WRITE_SAME, > > which lloop doesn't implement anyway. > > > > Signed-off-by: Jeff Mahoney > > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4000 > > Reviewed-on: http://review.whamcloud.com/7745 > > Reviewed-by: Jinshan Xiong > > Reviewed-by: Minh Diep > > Reviewed-by: Oleg Drokin > > Signed-off-by: James Simmons > > --- > > drivers/staging/lustre/lustre/llite/lloop.c | 3 --- > > 1 files changed, 0 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c > > index b725fc1..f396753 100644 > > --- a/drivers/staging/lustre/lustre/llite/lloop.c > > +++ b/drivers/staging/lustre/lustre/llite/lloop.c > > @@ -525,9 +525,6 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, > > lo->lo_queue->queuedata = lo; > > > > /* queue parameters */ > > - CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); > > - blk_queue_logical_block_size(lo->lo_queue, > > - (unsigned short)PAGE_CACHE_SIZE); > > blk_queue_max_hw_sectors(lo->lo_queue, > > LLOOP_MAX_SEGMENTS << (PAGE_CACHE_SHIFT - 9)); > > blk_queue_max_segments(lo->lo_queue, LLOOP_MAX_SEGMENTS); > > -- > > 1.7.1 > > > > > > From jsimmons at infradead.org Sun Apr 10 14:37:42 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 15:37:42 +0100 (BST) Subject: [lustre-devel] [PATCH 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: <20160405130109.GB32576@infradead.org> References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> <20160405130109.GB32576@infradead.org> Message-ID: > The lloop driver should be removed entirely - use the loop driver > instead. I talked with Andreas last week at our annual Lustre users group meeting about this. The reason I was told for existance is that some users were using files on a Lustre file system with the loop back device. The performance was really bad at the time so a lloop was developed to overcome those limitations. Its been a long time so perhaps its time to look at the default loop driver again to see if can perform now. If it doesn't we will go the route of reworking the lloop driver in the spirit of the cryptoloop device. From hch at infradead.org Sun Apr 10 14:41:45 2016 From: hch at infradead.org (Christoph Hellwig) Date: Sun, 10 Apr 2016 07:41:45 -0700 Subject: [lustre-devel] [PATCH 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> <20160405130109.GB32576@infradead.org> Message-ID: <20160410144145.GA24062@infradead.org> On Sun, Apr 10, 2016 at 03:37:42PM +0100, James Simmons wrote: > > > The lloop driver should be removed entirely - use the loop driver > > instead. > > I talked with Andreas last week at our annual Lustre users group meeting > about this. The reason I was told for existance is that some users were > using files on a Lustre file system with the loop back device. The > performance was really bad at the time so a lloop was developed to > overcome those limitations. Its been a long time so perhaps its time > to look at the default loop driver again to see if can perform now. If > it doesn't we will go the route of reworking the lloop driver in the > spirit of the cryptoloop device. The loop driver now supports using AIO/DIO on any file systems that implements ->read_iter and ->write_iter. If lustre doesn't support those or doesn't have proper performance using them it should be addressed in the file system. Note that the dio mode in the loop device is not the default and you need to manually enabled it, keep that in mind when testing. From jsimmons at infradead.org Sun Apr 10 15:12:59 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 16:12:59 +0100 (BST) Subject: [lustre-devel] [PATCH] staging: lustre: split error handling code into multiple labels In-Reply-To: <1460227664-28540-1-git-send-email-cakturk@gmail.com> References: <1460227664-28540-1-git-send-email-cakturk@gmail.com> Message-ID: > Instead of using a switch-case statement to find out what kind of error > has just happened, split error handling logic into multiple labels and > jump right into the appropriate label to do the error handling. This way > it is easier to follow different code paths. It also looks easy on the > eyes. > > Additionally silences the following coccinelle warning: > > drivers/staging/lustre/lustre/obdecho/echo_client.c:762:22-27: ERROR: ed > is NULL but dereferenced. > > Signed-off-by: Cihangir Akturk Acked-by: James Simmons I also tested it and saw no regressions. > --- > .../staging/lustre/lustre/obdecho/echo_client.c | 54 ++++++++-------------- > 1 file changed, 20 insertions(+), 34 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c > index a752bb4..f143f7a 100644 > --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c > +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c > @@ -668,8 +668,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, > struct obd_device *obd = NULL; /* to keep compiler happy */ > struct obd_device *tgt; > const char *tgt_type_name; > - int rc; > - int cleanup = 0; > + int rc, err; > > ed = kzalloc(sizeof(*ed), GFP_NOFS); > if (!ed) { > @@ -677,16 +676,14 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, > goto out; > } > > - cleanup = 1; > cd = &ed->ed_cl; > rc = cl_device_init(cd, t); > if (rc) > - goto out; > + goto out_free; > > cd->cd_lu_dev.ld_ops = &echo_device_lu_ops; > cd->cd_ops = &echo_device_cl_ops; > > - cleanup = 2; > obd = class_name2obd(lustre_cfg_string(cfg, 0)); > LASSERT(obd); > LASSERT(env); > @@ -696,28 +693,25 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, > CERROR("Can not find tgt device %s\n", > lustre_cfg_string(cfg, 1)); > rc = -ENODEV; > - goto out; > + goto out_device_fini; > } > > next = tgt->obd_lu_dev; > if (!strcmp(tgt->obd_type->typ_name, LUSTRE_MDT_NAME)) { > CERROR("echo MDT client must be run on server\n"); > rc = -EOPNOTSUPP; > - goto out; > + goto out_device_fini; > } > > rc = echo_site_init(env, ed); > if (rc) > - goto out; > - > - cleanup = 3; > + goto out_device_fini; > > rc = echo_client_setup(env, obd, cfg); > if (rc) > - goto out; > + goto out_site_fini; > > ed->ed_ec = &obd->u.echo_client; > - cleanup = 4; > > /* if echo client is to be stacked upon ost device, the next is > * NULL since ost is not a clio device so far > @@ -729,7 +723,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, > if (next) { > if (next->ld_site) { > rc = -EBUSY; > - goto out; > + goto out_cleanup; > } > > next->ld_site = &ed->ed_site->cs_lu; > @@ -737,7 +731,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, > next->ld_type->ldt_name, > NULL); > if (rc) > - goto out; > + goto out_cleanup; > > } else { > LASSERT(strcmp(tgt_type_name, LUSTRE_OST_NAME) == 0); > @@ -745,27 +739,19 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, > > ed->ed_next = next; > return &cd->cd_lu_dev; > -out: > - switch (cleanup) { > - case 4: { > - int rc2; > - > - rc2 = echo_client_cleanup(obd); > - if (rc2) > - CERROR("Cleanup obd device %s error(%d)\n", > - obd->obd_name, rc2); > - } > > - case 3: > - echo_site_fini(env, ed); > - case 2: > - cl_device_fini(&ed->ed_cl); > - case 1: > - kfree(ed); > - case 0: > - default: > - break; > - } > +out_cleanup: > + err = echo_client_cleanup(obd); > + if (err) > + CERROR("Cleanup obd device %s error(%d)\n", > + obd->obd_name, err); > +out_site_fini: > + echo_site_fini(env, ed); > +out_device_fini: > + cl_device_fini(&ed->ed_cl); > +out_free: > + kfree(ed); > +out: > return ERR_PTR(rc); > } > > -- > 2.1.4 > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From gregkh at linuxfoundation.org Sun Apr 10 15:35:07 2016 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Sun, 10 Apr 2016 08:35:07 -0700 Subject: [lustre-devel] [PATCH 13/17] staging: lustre: lloop: Fix build failure on ppc64 In-Reply-To: References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> <1460294020-2111-14-git-send-email-jsimmons@infradead.org> <63807394-FF62-4376-95FD-412309D47BF7@suse.com> Message-ID: <20160410153507.GA1326@kroah.com> On Sun, Apr 10, 2016 at 03:04:51PM +0100, James Simmons wrote: > > > This patch was shown not to work. I just haven't removed it from opensuse yet. > > Its been running in our production tree as well for some time. Guess that > change is a noop. In any case we have been discussing redoing the lloop > driver anyways. Just need to find the cycles. Why do you need this driver? I know Christoph has pointed out many times that it should just be dropped as it's not needed. And should I drop this patch from the series? thanks, greg k-h From gregkh at linuxfoundation.org Sun Apr 10 15:39:59 2016 From: gregkh at linuxfoundation.org (Greg KH) Date: Sun, 10 Apr 2016 08:39:59 -0700 Subject: [lustre-devel] [PATCH] Mark a pointer as an userspace pointer using __user macro. In-Reply-To: <1460292400-2732-1-git-send-email-antoine.blin@lip6.fr> References: <1460292400-2732-1-git-send-email-antoine.blin@lip6.fr> Message-ID: <20160410153959.GA1564@kroah.com> On Sun, Apr 10, 2016 at 02:46:40PM +0200, Antoine BLIN wrote: > This change fixes below sparse error: "error: incompatible types > in comparison expression (different address spaces)" > > Signed-off-by: Antoine BLIN > --- > drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Please always cc: the driverdev mailing list for staging patches. Also use the name of the driver, and the subsystem in the patch, like the others written for this driver, look at 'git log' for details. > > diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c > index 2be9451..1fdabb3 100644 > --- a/drivers/staging/lustre/lnet/selftest/conrpc.c > +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c > @@ -490,10 +490,10 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, > sizeof(struct list_head))) > return -EFAULT; > > - if (tmp.next == head_up) > - return 0; > + next = (struct list_head __user *)tmp.next; Kernel structures in userspace? While that might be the case, this really should be fixed "properly" and not papered over like this, sorry. Do you have access to a lustre system to test changes like this? thanks, greg k-h From jsimmons at infradead.org Sun Apr 10 15:52:46 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 16:52:46 +0100 (BST) Subject: [lustre-devel] [PATCH 13/17] staging: lustre: lloop: Fix build failure on ppc64 In-Reply-To: <20160410153507.GA1326@kroah.com> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> <1460294020-2111-14-git-send-email-jsimmons@infradead.org> <63807394-FF62-4376-95FD-412309D47BF7@suse.com> <20160410153507.GA1326@kroah.com> Message-ID: > > > This patch was shown not to work. I just haven't removed it from opensuse yet. > > > > Its been running in our production tree as well for some time. Guess that > > change is a noop. In any case we have been discussing redoing the lloop > > driver anyways. Just need to find the cycles. > > Why do you need this driver? I know Christoph has pointed out many > times that it should just be dropped as it's not needed. Please don't drop this driver just yet. The reason we kept it was for the DIO support that the loop back device lacked earlier. We need to do some testing to make sure the loop can completely replace this driver. > And should I drop this patch from the series? Yes since it is a noop. No other patches are dependent on it. From jsimmons at infradead.org Sun Apr 10 16:02:12 2016 From: jsimmons at infradead.org (James Simmons) Date: Sun, 10 Apr 2016 17:02:12 +0100 (BST) Subject: [lustre-devel] [PATCH 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: <20160410144145.GA24062@infradead.org> References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> <20160405130109.GB32576@infradead.org> <20160410144145.GA24062@infradead.org> Message-ID: > On Sun, Apr 10, 2016 at 03:37:42PM +0100, James Simmons wrote: > > > > > The lloop driver should be removed entirely - use the loop driver > > > instead. > > > > I talked with Andreas last week at our annual Lustre users group meeting > > about this. The reason I was told for existance is that some users were > > using files on a Lustre file system with the loop back device. The > > performance was really bad at the time so a lloop was developed to > > overcome those limitations. Its been a long time so perhaps its time > > to look at the default loop driver again to see if can perform now. If > > it doesn't we will go the route of reworking the lloop driver in the > > spirit of the cryptoloop device. > > The loop driver now supports using AIO/DIO on any file systems that > implements ->read_iter and ->write_iter. If lustre doesn't support > those or doesn't have proper performance using them it should be > addressed in the file system. > > Note that the dio mode in the loop device is not the default and you > need to manually enabled it, keep that in mind when testing. This is excellent news. The only sad thing is that most lustre users are running distros that use kernels before the AIO/DIO enhancements were landed :-( We will have to keep a copy around for those guys. But first I need to test the performance of the loop back driver this week before this can be dropped. From tom.leiming at gmail.com Mon Apr 11 03:30:54 2016 From: tom.leiming at gmail.com (Ming Lei) Date: Mon, 11 Apr 2016 11:30:54 +0800 Subject: [lustre-devel] [PATCH 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: References: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> <1459857443-20611-9-git-send-email-tom.leiming@gmail.com> <20160405130109.GB32576@infradead.org> <20160410144145.GA24062@infradead.org> Message-ID: On Mon, Apr 11, 2016 at 12:02 AM, James Simmons wrote: > >> On Sun, Apr 10, 2016 at 03:37:42PM +0100, James Simmons wrote: >> > >> > > The lloop driver should be removed entirely - use the loop driver >> > > instead. >> > >> > I talked with Andreas last week at our annual Lustre users group meeting >> > about this. The reason I was told for existance is that some users were >> > using files on a Lustre file system with the loop back device. The >> > performance was really bad at the time so a lloop was developed to >> > overcome those limitations. Its been a long time so perhaps its time >> > to look at the default loop driver again to see if can perform now. If >> > it doesn't we will go the route of reworking the lloop driver in the >> > spirit of the cryptoloop device. >> >> The loop driver now supports using AIO/DIO on any file systems that >> implements ->read_iter and ->write_iter. If lustre doesn't support >> those or doesn't have proper performance using them it should be >> addressed in the file system. >> >> Note that the dio mode in the loop device is not the default and you >> need to manually enabled it, keep that in mind when testing. > > This is excellent news. The only sad thing is that most lustre users > are running distros that use kernels before the AIO/DIO enhancements > were landed :-( We will have to keep a copy around for those guys. But > first I need to test the performance of the loop back driver this > week before this can be dropped. Considered that this cleanup patch for lustre loop is quite simple and straightforward, I suggest to keep this cleanup patch as so and do the dropping in another patchset. Christoph, are you OK with that? Thanks, Ming Lei From lexa at cfotr.com Mon Apr 11 19:28:51 2016 From: lexa at cfotr.com (Aleksey Fedotov) Date: Mon, 11 Apr 2016 22:28:51 +0300 Subject: [lustre-devel] [PATCH] staging: lustre: Fix warnings reported by sparse Message-ID: <87fuus9c7g.fsf@hp.cfotr.com> A non-text attachment was scrubbed... Name: 0001-staging-lustre-Fix-warnings-reported-by-sparse.patch Type: text/x-patch Size: 1413 bytes Desc: not available URL: From greg at kroah.com Mon Apr 11 20:15:19 2016 From: greg at kroah.com (Greg KH) Date: Mon, 11 Apr 2016 13:15:19 -0700 Subject: [lustre-devel] [PATCH] staging: lustre: Fix warnings reported by sparse In-Reply-To: <87fuus9c7g.fsf@hp.cfotr.com> References: <87fuus9c7g.fsf@hp.cfotr.com> Message-ID: <20160411201519.GB24540@kroah.com> On Mon, Apr 11, 2016 at 10:28:51PM +0300, Aleksey Fedotov wrote: > >From c3b19bf16c1a11f78362847646399309c4ff6d41 Mon Sep 17 00:00:00 2001 > From: Aleksei Fedotov > Date: Mon, 11 Apr 2016 21:13:27 +0300 > Subject: [PATCH] staging: lustre: Fix warnings reported by sparse What is all of this here for? And always cc: the public driverdevel mailing list for all staging patches, like get_maintainer.pl told you to... thanks, greg k-h From lexa at cfotr.com Mon Apr 11 20:50:13 2016 From: lexa at cfotr.com (Aleksey Fedotov) Date: Mon, 11 Apr 2016 23:50:13 +0300 Subject: [lustre-devel] [PATCH] staging: lustre: libcfs: Fix warnings reported by 'make C=1' Message-ID: <87bn5fan0a.fsf@hp.cfotr.com> A non-text attachment was scrubbed... Name: 0001-staging-lustre-libcfs-Fix-warnings-reported-by-spars.patch Type: text/x-patch Size: 1421 bytes Desc: not available URL: From jeffm at suse.com Sun Apr 10 13:22:23 2016 From: jeffm at suse.com (Jeff Mahoney) Date: Sun, 10 Apr 2016 09:22:23 -0400 Subject: [lustre-devel] [PATCH 13/17] staging: lustre: lloop: Fix build failure on ppc64 In-Reply-To: <1460294020-2111-14-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> <1460294020-2111-14-git-send-email-jsimmons@infradead.org> Message-ID: <63807394-FF62-4376-95FD-412309D47BF7@suse.com> This patch was shown not to work. I just haven't removed it from opensuse yet. -Jeff -- Jeff Mahoney (apologies for the top post -- from my mobile) > On Apr 10, 2016, at 9:13 AM, James Simmons wrote: > > From: Jeff Mahoney > > On ppc64 with 64k pages, we get a build failure in lloop: > > drivers/staging/lustre/lustre/llite/lloop.c:527:2: > note: in expansion of macro 'CLASSERT' > CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); > > There's no need to change the queue's logical block size. Even if it could > accept a 64k value, that would result in any file system on top of it > needing to also use 64k blocks. It'd be safe to set it to 4k, but there's > no actual need for it. It's not used to split requests except for WRITE_SAME, > which lloop doesn't implement anyway. > > Signed-off-by: Jeff Mahoney > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4000 > Reviewed-on: http://review.whamcloud.com/7745 > Reviewed-by: Jinshan Xiong > Reviewed-by: Minh Diep > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/llite/lloop.c | 3 --- > 1 files changed, 0 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c > index b725fc1..f396753 100644 > --- a/drivers/staging/lustre/lustre/llite/lloop.c > +++ b/drivers/staging/lustre/lustre/llite/lloop.c > @@ -525,9 +525,6 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, > lo->lo_queue->queuedata = lo; > > /* queue parameters */ > - CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); > - blk_queue_logical_block_size(lo->lo_queue, > - (unsigned short)PAGE_CACHE_SIZE); > blk_queue_max_hw_sectors(lo->lo_queue, > LLOOP_MAX_SEGMENTS << (PAGE_CACHE_SHIFT - 9)); > blk_queue_max_segments(lo->lo_queue, LLOOP_MAX_SEGMENTS); > -- > 1.7.1 > > From jeffm at suse.com Sun Apr 10 21:13:36 2016 From: jeffm at suse.com (Jeff Mahoney) Date: Sun, 10 Apr 2016 17:13:36 -0400 Subject: [lustre-devel] [PATCH 13/17] staging: lustre: lloop: Fix build failure on ppc64 In-Reply-To: References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> <1460294020-2111-14-git-send-email-jsimmons@infradead.org> <63807394-FF62-4376-95FD-412309D47BF7@suse.com> Message-ID: <570AC200.2020401@suse.com> On 4/10/16 10:04 AM, James Simmons wrote: > >> This patch was shown not to work. I just haven't removed it from opensuse yet. > > Its been running in our production tree as well for some time. Guess that > change is a noop. In any case we have been discussing redoing the lloop > driver anyways. Just need to find the cycles. I guess my memory was flakey and I was recalling the first comments in LU-4000. The updated version should be ok. -Jeff >> -- >> Jeff Mahoney >> (apologies for the top post -- from my mobile) >> >>> On Apr 10, 2016, at 9:13 AM, James Simmons wrote: >>> >>> From: Jeff Mahoney >>> >>> On ppc64 with 64k pages, we get a build failure in lloop: >>> >>> drivers/staging/lustre/lustre/llite/lloop.c:527:2: >>> note: in expansion of macro 'CLASSERT' >>> CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); >>> >>> There's no need to change the queue's logical block size. Even if it could >>> accept a 64k value, that would result in any file system on top of it >>> needing to also use 64k blocks. It'd be safe to set it to 4k, but there's >>> no actual need for it. It's not used to split requests except for WRITE_SAME, >>> which lloop doesn't implement anyway. >>> >>> Signed-off-by: Jeff Mahoney >>> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4000 >>> Reviewed-on: http://review.whamcloud.com/7745 >>> Reviewed-by: Jinshan Xiong >>> Reviewed-by: Minh Diep >>> Reviewed-by: Oleg Drokin >>> Signed-off-by: James Simmons >>> --- >>> drivers/staging/lustre/lustre/llite/lloop.c | 3 --- >>> 1 files changed, 0 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c >>> index b725fc1..f396753 100644 >>> --- a/drivers/staging/lustre/lustre/llite/lloop.c >>> +++ b/drivers/staging/lustre/lustre/llite/lloop.c >>> @@ -525,9 +525,6 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused, >>> lo->lo_queue->queuedata = lo; >>> >>> /* queue parameters */ >>> - CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8))); >>> - blk_queue_logical_block_size(lo->lo_queue, >>> - (unsigned short)PAGE_CACHE_SIZE); >>> blk_queue_max_hw_sectors(lo->lo_queue, >>> LLOOP_MAX_SEGMENTS << (PAGE_CACHE_SHIFT - 9)); >>> blk_queue_max_segments(lo->lo_queue, LLOOP_MAX_SEGMENTS); >>> -- >>> 1.7.1 >>> >>> >> >> > -- Jeff Mahoney SUSE Labs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 827 bytes Desc: OpenPGP digital signature URL: From antoine.blin at lip6.fr Sun Apr 10 12:46:40 2016 From: antoine.blin at lip6.fr (Antoine BLIN) Date: Sun, 10 Apr 2016 14:46:40 +0200 Subject: [lustre-devel] [PATCH] Mark a pointer as an userspace pointer using __user macro. Message-ID: <1460292400-2732-1-git-send-email-antoine.blin@lip6.fr> This change fixes below sparse error: "error: incompatible types in comparison expression (different address spaces)" Signed-off-by: Antoine BLIN --- drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 2be9451..1fdabb3 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -490,10 +490,10 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, sizeof(struct list_head))) return -EFAULT; - if (tmp.next == head_up) - return 0; + next = (struct list_head __user *)tmp.next; - next = tmp.next; + if (next == head_up) + return 0; ent = list_entry(next, lstcon_rpc_ent_t, rpe_link); -- 2.7.4 From jsimmons at infradead.org Mon Apr 11 21:20:03 2016 From: jsimmons at infradead.org (James Simmons) Date: Mon, 11 Apr 2016 22:20:03 +0100 (BST) Subject: [lustre-devel] [PATCH] staging: lustre: Fix warnings reported by sparse In-Reply-To: <20160411201519.GB24540@kroah.com> References: <87fuus9c7g.fsf@hp.cfotr.com> <20160411201519.GB24540@kroah.com> Message-ID: > On Mon, Apr 11, 2016 at 10:28:51PM +0300, Aleksey Fedotov wrote: > > >From c3b19bf16c1a11f78362847646399309c4ff6d41 Mon Sep 17 00:00:00 2001 > > From: Aleksei Fedotov > > Date: Mon, 11 Apr 2016 21:13:27 +0300 > > Subject: [PATCH] staging: lustre: Fix warnings reported by sparse > > What is all of this here for? > > And always cc: the public driverdevel mailing list for all staging > patches, like get_maintainer.pl told you to... For the new people wanting to get involved in the lustre upstream client please read this link: http://wiki.lustre.org/Upstream_contributing From gregkh at linuxfoundation.org Mon Apr 11 22:09:11 2016 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 11 Apr 2016 15:09:11 -0700 Subject: [lustre-devel] [PATCH] staging: lustre: libcfs: Fix warnings reported by 'make C=1' In-Reply-To: <87bn5fan0a.fsf@hp.cfotr.com> References: <87bn5fan0a.fsf@hp.cfotr.com> Message-ID: <20160411220911.GA9944@kroah.com> On Mon, Apr 11, 2016 at 11:50:13PM +0300, Aleksey Fedotov wrote: > >From 08473aa48a1726c09dbab43e99059be9b0e88af2 Mon Sep 17 00:00:00 2001 > From: Aleksei Fedotov > Date: Mon, 11 Apr 2016 21:13:27 +0300 > Subject: [PATCH] staging: lustre: libcfs: Fix warnings reported by sparse Why is this here in the body of your patch? Please use git send-email so it does not show up. thanks, greg k-h From oleg.drokin at intel.com Mon Apr 11 22:16:47 2016 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Mon, 11 Apr 2016 22:16:47 +0000 Subject: [lustre-devel] [PATCH] staging: lustre: libcfs: Fix warnings reported by 'make C=1' In-Reply-To: <87bn5fan0a.fsf@hp.cfotr.com> References: <87bn5fan0a.fsf@hp.cfotr.com> Message-ID: <51E52CE1-EB1C-40CB-AC27-392F2003EA4E@intel.com> On Apr 11, 2016, at 4:50 PM, Aleksey Fedotov wrote: > From 08473aa48a1726c09dbab43e99059be9b0e88af2 Mon Sep 17 00:00:00 2001 > From: Aleksei Fedotov > Date: Mon, 11 Apr 2016 21:13:27 +0300 > Subject: [PATCH] staging: lustre: libcfs: Fix warnings reported by sparse A better title would be something like: staging: lustre: libcfs: Fix libcfs_ioctl() prototype. Thanks. > > This patch fixes sparse warnings: > > lustre/lnet/libcfs/linux/linux-module.c:177:35: warning: incorrect type > in argument 2 (different address spaces) > > lustre/lnet/libcfs/module.c:101:5: error: symbol 'libcfs_ioctl' > redeclared with different type > > Signed-off-by: Aleksey Fedotov > --- > drivers/staging/lustre/include/linux/libcfs/libcfs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h > index 9158c61..4141afb 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h > @@ -106,7 +106,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand); > int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, > const struct libcfs_ioctl_hdr __user *uparam); > int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data); > -int libcfs_ioctl(unsigned long cmd, void *arg); > +int libcfs_ioctl(unsigned long cmd, void __user *arg); > > /* container_of depends on "likely" which is defined in libcfs_private.h */ > static inline void *__container_of(void *ptr, unsigned long shift) > -- > 2.5.5 > From jsimmons at infradead.org Tue Apr 12 00:05:32 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 01:05:32 +0100 (BST) Subject: [lustre-devel] [PATCH] Mark a pointer as an userspace pointer using __user macro. In-Reply-To: <1460292400-2732-1-git-send-email-antoine.blin@lip6.fr> References: <1460292400-2732-1-git-send-email-antoine.blin@lip6.fr> Message-ID: > This change fixes below sparse error: "error: incompatible types > in comparison expression (different address spaces)" > > Signed-off-by: Antoine BLIN Sigh, I thought the worst was behind us for the LNet/libcfs cleanup. I agree with Greg this is just papering over the problem. Properly fixing this will require the tools to be fixed as well. I wonder if ioctls are best way to handle this, perhaps debugfs? > --- > drivers/staging/lustre/lnet/selftest/conrpc.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c > index 2be9451..1fdabb3 100644 > --- a/drivers/staging/lustre/lnet/selftest/conrpc.c > +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c > @@ -490,10 +490,10 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans, > sizeof(struct list_head))) > return -EFAULT; > > - if (tmp.next == head_up) > - return 0; > + next = (struct list_head __user *)tmp.next; > > - next = tmp.next; > + if (next == head_up) > + return 0; > > ent = list_entry(next, lstcon_rpc_ent_t, rpe_link); > > -- > 2.7.4 > > _______________________________________________ > lustre-devel mailing list > lustre-devel at lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org > From gregkh at linuxfoundation.org Tue Apr 12 03:46:32 2016 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 11 Apr 2016 20:46:32 -0700 Subject: [lustre-devel] [PATCH 2/3] staging/lustre: Fix blank line after/before {/} style In-Reply-To: <1459538283-3031249-3-git-send-email-green@linuxhacker.ru> References: <1459538283-3031249-1-git-send-email-green@linuxhacker.ru> <1459538283-3031249-3-git-send-email-green@linuxhacker.ru> Message-ID: <20160412034632.GA17084@kroah.com> On Fri, Apr 01, 2016 at 03:18:02PM -0400, green at linuxhacker.ru wrote: > From: Oleg Drokin > > This patch fixes all checkpatch occurences of > CHECK: Blank lines aren't necessary after an open brace '{' > CHECK: Blank lines aren't necessary before a close brace '}' > in Lustre code. > > Signed-off-by: Oleg Drokin Doesn't apply anymore after merging with 4.6-rc3, can you rebase and resend? thanks, greg k-h From gregkh at linuxfoundation.org Tue Apr 12 03:54:45 2016 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 11 Apr 2016 20:54:45 -0700 Subject: [lustre-devel] [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set In-Reply-To: <1459820223-24754-19-git-send-email-jsimmons@infradead.org> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> <1459820223-24754-19-git-send-email-jsimmons@infradead.org> Message-ID: <20160412035445.GA27982@kroah.com> Some of this series didn't apply, due to merge issues with 4.6-rc3. Can you rebase and resend the remaining patches? thanks, greg k-h On Mon, Apr 04, 2016 at 09:37:03PM -0400, James Simmons wrote: > When Lustre is in a read or write system call and receives a > SIGALRM, it will return EINTR if interrupted in osc_enter_cache. > This prevents the system call from being restarted if > SA_RESTART is set in the handler. > > This patch changes behavior in this location to return ERESTARTSYS > when a signal arrives during the call to l_wait_event. > > Signed-off-by: Patrick Farrell > Signed-off-by: James Simmons > ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581 > Reviewed-on: http://review.whamcloud.com/7002 > Reviewed-by: Rahul Deshmukh > Reviewed-by: Cory Spitz > Reviewed-by: Andreas Dilger > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 13 ++++++++++++- > 1 files changed, 12 insertions(+), 1 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index f09b89d..956d57b 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -1626,11 +1626,22 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, > > /* l_wait_event is interrupted by signal, or timed out */ > if (rc < 0) { > - if (rc == -ETIMEDOUT) { > + switch (rc) { > + case -ETIMEDOUT: > OSC_DUMP_GRANT(D_ERROR, cli, > "try to reserve %d.\n", bytes); > osc_extent_tree_dump(D_ERROR, osc); > rc = -EDQUOT; > + break; > + case -EINTR: > + /* Ensures restartability - LU-3581 */ > + rc = -ERESTARTSYS; > + break; > + default: > + CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d\n", > + cli->cl_import->imp_obd->obd_name, > + &ocw, rc); > + break; > } > list_del_init(&ocw.ocw_entry); > goto out; > -- > 1.7.1 From gregkh at linuxfoundation.org Tue Apr 12 04:03:06 2016 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 11 Apr 2016 21:03:06 -0700 Subject: [lustre-devel] [PATCH 00/24] staging: lustre: selftest: remove typedefs In-Reply-To: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> References: <1459970750-5377-1-git-send-email-jsimmons@infradead.org> Message-ID: <20160412040306.GA28361@kroah.com> On Wed, Apr 06, 2016 at 03:25:26PM -0400, James Simmons wrote: > The lnet selftest code is littered with typedefs. Convert these > typedefs into their proper data types. Not all of these applied, please fix up and resend the remaining ones. thanks, greg k-h From gregkh at linuxfoundation.org Tue Apr 12 04:05:08 2016 From: gregkh at linuxfoundation.org (Greg Kroah-Hartman) Date: Mon, 11 Apr 2016 21:05:08 -0700 Subject: [lustre-devel] [PATCH 01/17] staging: lustre: osc: fix race issues thanks to oap_lock In-Reply-To: <1460294020-2111-2-git-send-email-jsimmons@infradead.org> References: <1460294020-2111-1-git-send-email-jsimmons@infradead.org> <1460294020-2111-2-git-send-email-jsimmons@infradead.org> Message-ID: <20160412040508.GA2578@kroah.com> On Sun, Apr 10, 2016 at 09:13:24AM -0400, James Simmons wrote: > From: Sebastien Buisson > > Fix 'data race condition' defects found by Coverity version 6.5.0: > > Data race condition (MISSING_LOCK) > > Accessing variable without holding lock. Elsewhere, > this variable is accessed with lock held. > > This patch is dedicated to code fragments involving oap_lock. > > Signed-off-by: Sebastien Buisson > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744 > Reviewed-on: http://review.whamcloud.com/6572 > Reviewed-by: Oleg Drokin > Reviewed-by: Andreas Dilger > Signed-off-by: James Simmons > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 8 ++++++++ > drivers/staging/lustre/lustre/osc/osc_io.c | 2 ++ > 2 files changed, 10 insertions(+), 0 deletions(-) This patch doesn't apply at all. Can you rebase the whole series and resend them? thanks, greg k-h From lexa at cfotr.com Tue Apr 12 11:05:49 2016 From: lexa at cfotr.com (Aleksei Fedotov) Date: Tue, 12 Apr 2016 14:05:49 +0300 Subject: [lustre-devel] [PATCH] staging: lustre: libcfs: Fix libcfs_ioctl() prototype. Message-ID: <1460459149-20699-1-git-send-email-lexa@cfotr.com> Fix libcfs_ioctl() prototype according to its definition in libcfs/module.c. Signed-off-by: Aleksei Fedotov --- drivers/staging/lustre/include/linux/libcfs/libcfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h index 9158c61..4141afb 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h @@ -106,7 +106,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand); int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, const struct libcfs_ioctl_hdr __user *uparam); int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data); -int libcfs_ioctl(unsigned long cmd, void *arg); +int libcfs_ioctl(unsigned long cmd, void __user *arg); /* container_of depends on "likely" which is defined in libcfs_private.h */ static inline void *__container_of(void *ptr, unsigned long shift) -- 2.5.5 From jsimmons at infradead.org Tue Apr 12 16:16:00 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 12:16:00 -0400 Subject: [lustre-devel] [PATCH v2 0/2] staging: lustre: selftest: remove typedefs Message-ID: <1460477762-14167-1-git-send-email-jsimmons@infradead.org> Convert the remaining typedefs into their proper data types. Changelog: v1) Based on 4.6-rc1 staging tree. Most patches were merged. v2) Rebased on 4.6-rc3 due to PAGE_CACHE_* going away. James Simmons (2): staging: lustre: selftest: convert lstcon_test_t to proper struct staging: lustre: selftest: convert wire protocol to use struct drivers/staging/lustre/lnet/selftest/brw_test.c | 22 ++-- drivers/staging/lustre/lnet/selftest/conctl.c | 2 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 49 ++++---- drivers/staging/lustre/lnet/selftest/console.c | 36 +++--- drivers/staging/lustre/lnet/selftest/console.h | 7 +- drivers/staging/lustre/lnet/selftest/framework.c | 54 ++++---- drivers/staging/lustre/lnet/selftest/ping_test.c | 10 +- drivers/staging/lustre/lnet/selftest/rpc.c | 6 +- drivers/staging/lustre/lnet/selftest/rpc.h | 150 +++++++++++----------- drivers/staging/lustre/lnet/selftest/selftest.h | 13 +- 10 files changed, 176 insertions(+), 173 deletions(-) From jsimmons at infradead.org Tue Apr 12 16:16:01 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 12:16:01 -0400 Subject: [lustre-devel] [PATCH v2 1/2] staging: lustre: selftest: convert lstcon_test_t to proper struct In-Reply-To: <1460477762-14167-1-git-send-email-jsimmons@infradead.org> References: <1460477762-14167-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460477762-14167-2-git-send-email-jsimmons@infradead.org> Turn typedef lstcon_test_t to proper structure Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/conctl.c | 2 +- drivers/staging/lustre/lnet/selftest/conrpc.c | 5 ++- drivers/staging/lustre/lnet/selftest/console.c | 26 ++++++++++++------------ drivers/staging/lustre/lnet/selftest/console.h | 7 +++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index a76f1c3..408c614 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -743,7 +743,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) if (args->lstio_tes_param && (args->lstio_tes_param_len <= 0 || args->lstio_tes_param_len > - PAGE_SIZE - sizeof(lstcon_test_t))) + PAGE_SIZE - sizeof(struct lstcon_test))) return -EINVAL; LIBCFS_ALLOC(batch_name, args->lstio_tes_bat_nmlen + 1); diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index 31d7b4f..bc96ef8 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -807,7 +807,7 @@ lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) int lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, - lstcon_test_t *test, struct lstcon_rpc **crpc) + struct lstcon_test *test, struct lstcon_rpc **crpc) { struct lstcon_group *sgrp = test->tes_src_grp; struct lstcon_group *dgrp = test->tes_dst_grp; @@ -1128,7 +1128,8 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, case LST_TRANS_TSBCLIADD: case LST_TRANS_TSBSRVADD: rc = lstcon_testrpc_prep(nd, transop, feats, - (lstcon_test_t *)arg, &rpc); + (struct lstcon_test *)arg, + &rpc); break; case LST_TRANS_TSBRUN: case LST_TRANS_TSBSTOP: diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 03c73b0..6568e8e 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -934,7 +934,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t __user *ent_up, lstcon_test_batch_ent_t *entp; struct list_head *clilst; struct list_head *srvlst; - lstcon_test_t *test = NULL; + struct lstcon_test *test = NULL; struct lstcon_batch *bat; struct lstcon_ndlink *ndl; int rc; @@ -1091,14 +1091,14 @@ static void lstcon_batch_destroy(struct lstcon_batch *bat) { struct lstcon_ndlink *ndl; - lstcon_test_t *test; + struct lstcon_test *test; int i; list_del(&bat->bat_link); while (!list_empty(&bat->bat_test_list)) { test = list_entry(bat->bat_test_list.next, - lstcon_test_t, tes_link); + struct lstcon_test, tes_link); LASSERT(list_empty(&test->tes_trans_list)); list_del(&test->tes_link); @@ -1106,7 +1106,7 @@ lstcon_batch_destroy(struct lstcon_batch *bat) lstcon_group_decref(test->tes_src_grp); lstcon_group_decref(test->tes_dst_grp); - LIBCFS_FREE(test, offsetof(lstcon_test_t, + LIBCFS_FREE(test, offsetof(struct lstcon_test, tes_param[test->tes_paramlen])); } @@ -1143,13 +1143,13 @@ lstcon_batch_destroy(struct lstcon_batch *bat) static int lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) { - lstcon_test_t *test; + struct lstcon_test *test; struct lstcon_batch *batch; struct lstcon_ndlink *ndl; struct list_head *hash; struct list_head *head; - test = (lstcon_test_t *)arg; + test = (struct lstcon_test *)arg; LASSERT(test); batch = test->tes_batch; @@ -1185,7 +1185,7 @@ lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg) } static int -lstcon_test_nodes_add(lstcon_test_t *test, struct list_head __user *result_up) +lstcon_test_nodes_add(struct lstcon_test *test, struct list_head __user *result_up) { struct lstcon_rpc_trans *trans; struct lstcon_group *grp; @@ -1283,7 +1283,7 @@ lstcon_test_add(char *batch_name, int type, int loop, void *param, int paramlen, int *retp, struct list_head __user *result_up) { - lstcon_test_t *test = NULL; + struct lstcon_test *test = NULL; int rc; struct lstcon_group *src_grp = NULL; struct lstcon_group *dst_grp = NULL; @@ -1309,7 +1309,7 @@ lstcon_test_add(char *batch_name, int type, int loop, if (dst_grp->grp_userland) *retp = 1; - LIBCFS_ALLOC(test, offsetof(lstcon_test_t, tes_param[paramlen])); + LIBCFS_ALLOC(test, offsetof(struct lstcon_test, tes_param[paramlen])); if (!test) { CERROR("Can't allocate test descriptor\n"); rc = -ENOMEM; @@ -1356,7 +1356,7 @@ lstcon_test_add(char *batch_name, int type, int loop, return rc; out: if (test) - LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen])); + LIBCFS_FREE(test, offsetof(struct lstcon_test, tes_param[paramlen])); if (dst_grp) lstcon_group_decref(dst_grp); @@ -1368,9 +1368,9 @@ out: } static int -lstcon_test_find(struct lstcon_batch *batch, int idx, lstcon_test_t **testpp) +lstcon_test_find(struct lstcon_batch *batch, int idx, struct lstcon_test **testpp) { - lstcon_test_t *test; + struct lstcon_test *test; list_for_each_entry(test, &batch->bat_test_list, tes_link) { if (idx == test->tes_hdr.tsb_index) { @@ -1408,7 +1408,7 @@ lstcon_test_batch_query(char *name, int testidx, int client, struct list_head *ndlist; struct lstcon_tsb_hdr *hdr; struct lstcon_batch *batch; - lstcon_test_t *test = NULL; + struct lstcon_test *test = NULL; int transop; int rc; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index ccd4982..becd22e 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -99,7 +99,7 @@ struct lstcon_batch { * for run, force for stop */ char bat_name[LST_NAME_SIZE];/* name of batch */ - struct list_head bat_test_list; /* list head of tests (lstcon_test_t) + struct list_head bat_test_list; /* list head of tests (struct lstcon_test) */ struct list_head bat_trans_list; /* list head of transaction */ struct list_head bat_cli_list; /* list head of client nodes @@ -109,7 +109,8 @@ struct lstcon_batch { struct list_head *bat_srv_hash; /* hash table of server nodes */ }; -typedef struct lstcon_test { +/* a single test descriptor */ +struct lstcon_test { struct lstcon_tsb_hdr tes_hdr; /* test batch header */ struct list_head tes_link; /* chain on batch's tests list */ struct lstcon_batch *tes_batch; /* pointer to batch */ @@ -129,7 +130,7 @@ typedef struct lstcon_test { int tes_paramlen; /* test parameter length */ char tes_param[0]; /* test parameter */ -} lstcon_test_t; /* a single test descriptor */ +}; #define LST_GLOBAL_HASHSIZE 503 /* global nodes hash table size */ #define LST_NODE_HASHSIZE 239 /* node hash table (for batch or group) */ -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 16:16:02 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 12:16:02 -0400 Subject: [lustre-devel] [PATCH v2 2/2] staging: lustre: selftest: convert wire protocol to use struct In-Reply-To: <1460477762-14167-1-git-send-email-jsimmons@infradead.org> References: <1460477762-14167-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460477762-14167-3-git-send-email-jsimmons@infradead.org> Change all the wire protocol typedefs to proper structures Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 22 ++-- drivers/staging/lustre/lnet/selftest/conrpc.c | 44 +++--- drivers/staging/lustre/lnet/selftest/console.c | 10 +- drivers/staging/lustre/lnet/selftest/framework.c | 54 ++++---- drivers/staging/lustre/lnet/selftest/ping_test.c | 10 +- drivers/staging/lustre/lnet/selftest/rpc.c | 6 +- drivers/staging/lustre/lnet/selftest/rpc.h | 150 +++++++++++----------- drivers/staging/lustre/lnet/selftest/selftest.h | 13 +- 8 files changed, 155 insertions(+), 154 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index 7f539f9..a63d86c 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -81,7 +81,7 @@ brw_client_init(struct sfw_test_instance *tsi) LASSERT(tsi->tsi_is_client); if (!(sn->sn_features & LST_FEAT_BULK_LEN)) { - test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0; + struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0; opc = breq->blk_opc; flags = breq->blk_flags; @@ -92,7 +92,7 @@ brw_client_init(struct sfw_test_instance *tsi) */ len = npg * PAGE_SIZE; } else { - test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; + struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1; /* * I should never get this step if it's unknown feature @@ -261,7 +261,7 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu, struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct srpc_client_rpc *rpc; - srpc_brw_reqst_t *req; + struct srpc_brw_reqst *req; int flags; int npg; int len; @@ -272,14 +272,14 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu, LASSERT(bulk); if (!(sn->sn_features & LST_FEAT_BULK_LEN)) { - test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0; + struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0; opc = breq->blk_opc; flags = breq->blk_flags; npg = breq->blk_npg; len = npg * PAGE_SIZE; } else { - test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1; + struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1; /* * I should never get this step if it's unknown feature @@ -319,8 +319,8 @@ brw_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct srpc_msg *msg = &rpc->crpc_replymsg; - srpc_brw_reply_t *reply = &msg->msg_body.brw_reply; - srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; + struct srpc_brw_reply *reply = &msg->msg_body.brw_reply; + struct srpc_brw_reqst *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst; LASSERT(sn); @@ -382,8 +382,8 @@ static int brw_bulk_ready(struct srpc_server_rpc *rpc, int status) { __u64 magic = BRW_MAGIC; - srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply; - srpc_brw_reqst_t *reqst; + struct srpc_brw_reply *reply = &rpc->srpc_replymsg.msg_body.brw_reply; + struct srpc_brw_reqst *reqst; struct srpc_msg *reqstmsg; LASSERT(rpc->srpc_bulk); @@ -420,8 +420,8 @@ brw_server_handle(struct srpc_server_rpc *rpc) struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_msg *replymsg = &rpc->srpc_replymsg; struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; - srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply; - srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst; + struct srpc_brw_reply *reply = &replymsg->msg_body.brw_reply; + struct srpc_brw_reqst *reqst = &reqstmsg->msg_body.brw_reqst; int npg; int rc; diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c index bc96ef8..6f68758 100644 --- a/drivers/staging/lustre/lnet/selftest/conrpc.c +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c @@ -390,7 +390,7 @@ lstcon_rpc_get_reply(struct lstcon_rpc *crpc, struct srpc_msg **msgpp) { struct lstcon_node *nd = crpc->crp_node; struct srpc_client_rpc *rpc = crpc->crp_rpc; - srpc_generic_reply_t *rep; + struct srpc_generic_reply *rep; LASSERT(nd && rpc); LASSERT(crpc->crp_stamp); @@ -473,7 +473,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, struct list_head tmp; struct list_head __user *next; lstcon_rpc_ent_t *ent; - srpc_generic_reply_t *rep; + struct srpc_generic_reply *rep; struct lstcon_rpc *crpc; struct srpc_msg *msg; struct lstcon_node *nd; @@ -520,7 +520,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, continue; /* RPC is done */ - rep = (srpc_generic_reply_t *)&msg->msg_body.reply; + rep = (struct srpc_generic_reply *)&msg->msg_body.reply; if (copy_to_user(&ent->rpe_sid, &rep->sid, sizeof(lst_sid_t)) || copy_to_user(&ent->rpe_fwk_errno, &rep->status, @@ -595,8 +595,8 @@ int lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, struct lstcon_rpc **crpc) { - srpc_mksn_reqst_t *msrq; - srpc_rmsn_reqst_t *rsrq; + struct srpc_mksn_reqst *msrq; + struct srpc_rmsn_reqst *rsrq; int rc; switch (transop) { @@ -633,7 +633,7 @@ lstcon_sesrpc_prep(struct lstcon_node *nd, int transop, int lstcon_dbgrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc **crpc) { - srpc_debug_reqst_t *drq; + struct srpc_debug_reqst *drq; int rc; rc = lstcon_rpc_prep(nd, SRPC_SERVICE_DEBUG, feats, 0, 0, crpc); @@ -653,7 +653,7 @@ lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, struct lstcon_tsb_hdr *tsb, struct lstcon_rpc **crpc) { struct lstcon_batch *batch; - srpc_batch_reqst_t *brq; + struct srpc_batch_reqst *brq; int rc; rc = lstcon_rpc_prep(nd, SRPC_SERVICE_BATCH, feats, 0, 0, crpc); @@ -684,7 +684,7 @@ lstcon_batrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, int lstcon_statrpc_prep(struct lstcon_node *nd, unsigned feats, struct lstcon_rpc **crpc) { - srpc_stat_reqst_t *srq; + struct srpc_stat_reqst *srq; int rc; rc = lstcon_rpc_prep(nd, SRPC_SERVICE_QUERY_STAT, feats, 0, 0, crpc); @@ -769,9 +769,9 @@ lstcon_dstnodes_prep(struct lstcon_group *grp, int idx, } static int -lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req) +lstcon_pingrpc_prep(lst_test_ping_param_t *param, struct srpc_test_reqst *req) { - test_ping_req_t *prq = &req->tsr_u.ping; + struct test_ping_req *prq = &req->tsr_u.ping; prq->png_size = param->png_size; prq->png_flags = param->png_flags; @@ -780,9 +780,9 @@ lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req) } static int -lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) +lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, struct srpc_test_reqst *req) { - test_bulk_req_t *brq = &req->tsr_u.bulk_v0; + struct test_bulk_req *brq = &req->tsr_u.bulk_v0; brq->blk_opc = param->blk_opc; brq->blk_npg = (param->blk_size + PAGE_SIZE - 1) / @@ -793,9 +793,9 @@ lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) } static int -lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req) +lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, struct srpc_test_reqst *req) { - test_bulk_req_v1_t *brq = &req->tsr_u.bulk_v1; + struct test_bulk_req_v1 *brq = &req->tsr_u.bulk_v1; brq->blk_opc = param->blk_opc; brq->blk_flags = param->blk_flags; @@ -811,7 +811,7 @@ lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats, { struct lstcon_group *sgrp = test->tes_src_grp; struct lstcon_group *dgrp = test->tes_dst_grp; - srpc_test_reqst_t *trq; + struct srpc_test_reqst *trq; struct srpc_bulk *bulk; int i; int npg = 0; @@ -918,7 +918,7 @@ static int lstcon_sesnew_stat_reply(struct lstcon_rpc_trans *trans, struct lstcon_node *nd, struct srpc_msg *reply) { - srpc_mksn_reply_t *mksn_rep = &reply->msg_body.mksn_reply; + struct srpc_mksn_reply *mksn_rep = &reply->msg_body.mksn_reply; int status = mksn_rep->mksn_status; if (!status && @@ -965,11 +965,11 @@ void lstcon_rpc_stat_reply(struct lstcon_rpc_trans *trans, struct srpc_msg *msg, struct lstcon_node *nd, lstcon_trans_stat_t *stat) { - srpc_rmsn_reply_t *rmsn_rep; - srpc_debug_reply_t *dbg_rep; - srpc_batch_reply_t *bat_rep; - srpc_test_reply_t *test_rep; - srpc_stat_reply_t *stat_rep; + struct srpc_rmsn_reply *rmsn_rep; + struct srpc_debug_reply *dbg_rep; + struct srpc_batch_reply *bat_rep; + struct srpc_test_reply *test_rep; + struct srpc_stat_reply *stat_rep; int rc = 0; switch (trans->tas_opc) { @@ -1173,7 +1173,7 @@ lstcon_rpc_pinger(void *arg) struct lstcon_rpc_trans *trans; struct lstcon_rpc *crpc; struct srpc_msg *rep; - srpc_debug_reqst_t *drq; + struct srpc_debug_reqst *drq; struct lstcon_ndlink *ndl; struct lstcon_node *nd; int intv; diff --git a/drivers/staging/lustre/lnet/selftest/console.c b/drivers/staging/lustre/lnet/selftest/console.c index 6568e8e..a03e52d 100644 --- a/drivers/staging/lustre/lnet/selftest/console.c +++ b/drivers/staging/lustre/lnet/selftest/console.c @@ -373,7 +373,7 @@ static int lstcon_sesrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { - srpc_debug_reply_t *rep; + struct srpc_debug_reply *rep; switch (transop) { case LST_TRANS_SESNEW: @@ -1386,7 +1386,7 @@ static int lstcon_tsbrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { - srpc_batch_reply_t *rep = &msg->msg_body.bat_reply; + struct srpc_batch_reply *rep = &msg->msg_body.bat_reply; LASSERT(transop == LST_TRANS_TSBCLIQRY || transop == LST_TRANS_TSBSRVQRY); @@ -1465,7 +1465,7 @@ static int lstcon_statrpc_readent(int transop, struct srpc_msg *msg, lstcon_rpc_ent_t __user *ent_up) { - srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; + struct srpc_stat_reply *rep = &msg->msg_body.stat_reply; sfw_counters_t __user *sfwk_stat; srpc_counters_t __user *srpc_stat; lnet_counters_t __user *lnet_stat; @@ -1907,8 +1907,8 @@ lstcon_acceptor_handle(struct srpc_server_rpc *rpc) { struct srpc_msg *rep = &rpc->srpc_replymsg; struct srpc_msg *req = &rpc->srpc_reqstbuf->buf_msg; - srpc_join_reqst_t *jreq = &req->msg_body.join_reqst; - srpc_join_reply_t *jrep = &rep->msg_body.join_reply; + struct srpc_join_reqst *jreq = &req->msg_body.join_reqst; + struct srpc_join_reply *jrep = &rep->msg_body.join_reply; struct lstcon_group *grp = NULL; struct lstcon_ndlink *ndl; int rc = 0; diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index ef3cc82..30e4f71 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -361,7 +361,7 @@ sfw_bid2batch(lst_bid_t bid) } static int -sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) +sfw_get_stats(struct srpc_stat_reqst *request, struct srpc_stat_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; sfw_counters_t *cnt = &reply->str_fw; @@ -402,7 +402,7 @@ sfw_get_stats(srpc_stat_reqst_t *request, srpc_stat_reply_t *reply) } int -sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) +sfw_make_session(struct srpc_mksn_reqst *request, struct srpc_mksn_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; struct srpc_msg *msg = container_of(request, struct srpc_msg, @@ -473,7 +473,7 @@ sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply) } static int -sfw_remove_session(srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) +sfw_remove_session(struct srpc_rmsn_reqst *request, struct srpc_rmsn_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; @@ -505,7 +505,7 @@ sfw_remove_session(srpc_rmsn_reqst_t *request, srpc_rmsn_reply_t *reply) } static int -sfw_debug_session(srpc_debug_reqst_t *request, srpc_debug_reply_t *reply) +sfw_debug_session(struct srpc_debug_reqst *request, struct srpc_debug_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; @@ -687,7 +687,7 @@ sfw_destroy_session(struct sfw_session *sn) static void sfw_unpack_addtest_req(struct srpc_msg *msg) { - srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; + struct srpc_test_reqst *req = &msg->msg_body.tes_reqst; LASSERT(msg->msg_type == SRPC_MSG_TEST_REQST); LASSERT(req->tsr_is_client); @@ -699,14 +699,14 @@ sfw_unpack_addtest_req(struct srpc_msg *msg) if (req->tsr_service == SRPC_SERVICE_BRW) { if (!(msg->msg_ses_feats & LST_FEAT_BULK_LEN)) { - test_bulk_req_t *bulk = &req->tsr_u.bulk_v0; + struct test_bulk_req *bulk = &req->tsr_u.bulk_v0; __swab32s(&bulk->blk_opc); __swab32s(&bulk->blk_npg); __swab32s(&bulk->blk_flags); } else { - test_bulk_req_v1_t *bulk = &req->tsr_u.bulk_v1; + struct test_bulk_req_v1 *bulk = &req->tsr_u.bulk_v1; __swab16s(&bulk->blk_opc); __swab16s(&bulk->blk_flags); @@ -718,7 +718,7 @@ sfw_unpack_addtest_req(struct srpc_msg *msg) } if (req->tsr_service == SRPC_SERVICE_PING) { - test_ping_req_t *ping = &req->tsr_u.ping; + struct test_ping_req *ping = &req->tsr_u.ping; __swab32s(&ping->png_size); __swab32s(&ping->png_flags); @@ -732,7 +732,7 @@ static int sfw_add_test_instance(struct sfw_batch *tsb, struct srpc_server_rpc *rpc) { struct srpc_msg *msg = &rpc->srpc_reqstbuf->buf_msg; - srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; + struct srpc_test_reqst *req = &msg->msg_body.tes_reqst; struct srpc_bulk *bk = rpc->srpc_bulk; int ndest = req->tsr_ndest; struct sfw_test_unit *tsu; @@ -1068,7 +1068,7 @@ sfw_stop_batch(struct sfw_batch *tsb, int force) } static int -sfw_query_batch(struct sfw_batch *tsb, int testidx, srpc_batch_reply_t *reply) +sfw_query_batch(struct sfw_batch *tsb, int testidx, struct srpc_batch_reply *reply) { struct sfw_test_instance *tsi; @@ -1116,8 +1116,8 @@ static int sfw_add_test(struct srpc_server_rpc *rpc) { struct sfw_session *sn = sfw_data.fw_session; - srpc_test_reply_t *reply = &rpc->srpc_replymsg.msg_body.tes_reply; - srpc_test_reqst_t *request; + struct srpc_test_reply *reply = &rpc->srpc_replymsg.msg_body.tes_reply; + struct srpc_test_reqst *request; int rc; struct sfw_batch *bat; @@ -1183,7 +1183,7 @@ sfw_add_test(struct srpc_server_rpc *rpc) } static int -sfw_control_batch(srpc_batch_reqst_t *request, srpc_batch_reply_t *reply) +sfw_control_batch(struct srpc_batch_reqst *request, struct srpc_batch_reply *reply) { struct sfw_session *sn = sfw_data.fw_session; int rc = 0; @@ -1424,7 +1424,7 @@ sfw_unpack_message(struct srpc_msg *msg) LASSERT(msg->msg_magic == __swab32(SRPC_MSG_MAGIC)); if (msg->msg_type == SRPC_MSG_STAT_REQST) { - srpc_stat_reqst_t *req = &msg->msg_body.stat_reqst; + struct srpc_stat_reqst *req = &msg->msg_body.stat_reqst; __swab32s(&req->str_type); __swab64s(&req->str_rpyid); @@ -1433,7 +1433,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_STAT_REPLY) { - srpc_stat_reply_t *rep = &msg->msg_body.stat_reply; + struct srpc_stat_reply *rep = &msg->msg_body.stat_reply; __swab32s(&rep->str_status); sfw_unpack_sid(rep->str_sid); @@ -1444,7 +1444,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_MKSN_REQST) { - srpc_mksn_reqst_t *req = &msg->msg_body.mksn_reqst; + struct srpc_mksn_reqst *req = &msg->msg_body.mksn_reqst; __swab64s(&req->mksn_rpyid); __swab32s(&req->mksn_force); @@ -1453,7 +1453,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_MKSN_REPLY) { - srpc_mksn_reply_t *rep = &msg->msg_body.mksn_reply; + struct srpc_mksn_reply *rep = &msg->msg_body.mksn_reply; __swab32s(&rep->mksn_status); __swab32s(&rep->mksn_timeout); @@ -1462,7 +1462,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_RMSN_REQST) { - srpc_rmsn_reqst_t *req = &msg->msg_body.rmsn_reqst; + struct srpc_rmsn_reqst *req = &msg->msg_body.rmsn_reqst; __swab64s(&req->rmsn_rpyid); sfw_unpack_sid(req->rmsn_sid); @@ -1470,7 +1470,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_RMSN_REPLY) { - srpc_rmsn_reply_t *rep = &msg->msg_body.rmsn_reply; + struct srpc_rmsn_reply *rep = &msg->msg_body.rmsn_reply; __swab32s(&rep->rmsn_status); sfw_unpack_sid(rep->rmsn_sid); @@ -1478,7 +1478,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_DEBUG_REQST) { - srpc_debug_reqst_t *req = &msg->msg_body.dbg_reqst; + struct srpc_debug_reqst *req = &msg->msg_body.dbg_reqst; __swab64s(&req->dbg_rpyid); __swab32s(&req->dbg_flags); @@ -1487,7 +1487,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_DEBUG_REPLY) { - srpc_debug_reply_t *rep = &msg->msg_body.dbg_reply; + struct srpc_debug_reply *rep = &msg->msg_body.dbg_reply; __swab32s(&rep->dbg_nbatch); __swab32s(&rep->dbg_timeout); @@ -1496,7 +1496,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_BATCH_REQST) { - srpc_batch_reqst_t *req = &msg->msg_body.bat_reqst; + struct srpc_batch_reqst *req = &msg->msg_body.bat_reqst; __swab32s(&req->bar_opc); __swab64s(&req->bar_rpyid); @@ -1508,7 +1508,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_BATCH_REPLY) { - srpc_batch_reply_t *rep = &msg->msg_body.bat_reply; + struct srpc_batch_reply *rep = &msg->msg_body.bat_reply; __swab32s(&rep->bar_status); sfw_unpack_sid(rep->bar_sid); @@ -1516,7 +1516,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_TEST_REQST) { - srpc_test_reqst_t *req = &msg->msg_body.tes_reqst; + struct srpc_test_reqst *req = &msg->msg_body.tes_reqst; __swab64s(&req->tsr_rpyid); __swab64s(&req->tsr_bulkid); @@ -1530,7 +1530,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_TEST_REPLY) { - srpc_test_reply_t *rep = &msg->msg_body.tes_reply; + struct srpc_test_reply *rep = &msg->msg_body.tes_reply; __swab32s(&rep->tsr_status); sfw_unpack_sid(rep->tsr_sid); @@ -1538,7 +1538,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_JOIN_REQST) { - srpc_join_reqst_t *req = &msg->msg_body.join_reqst; + struct srpc_join_reqst *req = &msg->msg_body.join_reqst; __swab64s(&req->join_rpyid); sfw_unpack_sid(req->join_sid); @@ -1546,7 +1546,7 @@ sfw_unpack_message(struct srpc_msg *msg) } if (msg->msg_type == SRPC_MSG_JOIN_REPLY) { - srpc_join_reply_t *rep = &msg->msg_body.join_reply; + struct srpc_join_reply *rep = &msg->msg_body.join_reply; __swab32s(&rep->join_status); __swab32s(&rep->join_timeout); diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c index 8a9d7a4..ad26fe9 100644 --- a/drivers/staging/lustre/lnet/selftest/ping_test.c +++ b/drivers/staging/lustre/lnet/selftest/ping_test.c @@ -89,7 +89,7 @@ static int ping_client_prep_rpc(struct sfw_test_unit *tsu, lnet_process_id_t dest, struct srpc_client_rpc **rpc) { - srpc_ping_reqst_t *req; + struct srpc_ping_reqst *req; struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct timespec64 ts; @@ -122,8 +122,8 @@ ping_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) { struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; - srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; - srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply; + struct srpc_ping_reqst *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst; + struct srpc_ping_reply *reply = &rpc->crpc_replymsg.msg_body.ping_reply; struct timespec64 ts; LASSERT(sn); @@ -173,8 +173,8 @@ ping_server_handle(struct srpc_server_rpc *rpc) struct srpc_service *sv = rpc->srpc_scd->scd_svc; struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg; struct srpc_msg *replymsg = &rpc->srpc_replymsg; - srpc_ping_reqst_t *req = &reqstmsg->msg_body.ping_reqst; - srpc_ping_reply_t *rep = &rpc->srpc_replymsg.msg_body.ping_reply; + struct srpc_ping_reqst *req = &reqstmsg->msg_body.ping_reqst; + struct srpc_ping_reply *rep = &rpc->srpc_replymsg.msg_body.ping_reply; LASSERT(sv->sv_id == SRPC_SERVICE_PING); diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 561e28c..3c45a7c 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -997,7 +997,7 @@ srpc_handle_rpc(struct swi_workitem *wi) LBUG(); case SWI_STATE_NEWBORN: { struct srpc_msg *msg; - srpc_generic_reply_t *reply; + struct srpc_generic_reply *reply; msg = &rpc->srpc_reqstbuf->buf_msg; reply = &rpc->srpc_replymsg.msg_body.reply; @@ -1238,7 +1238,7 @@ srpc_send_rpc(struct swi_workitem *wi) wi->swi_state = SWI_STATE_REQUEST_SENT; /* perhaps more events, fall thru */ case SWI_STATE_REQUEST_SENT: { - srpc_msg_type_t type = srpc_service2reply(rpc->crpc_service); + enum srpc_msg_type type = srpc_service2reply(rpc->crpc_service); if (!rpc->crpc_replyev.ev_fired) break; @@ -1417,7 +1417,7 @@ srpc_lnet_ev_handler(lnet_event_t *ev) struct srpc_buffer *buffer; struct srpc_service *sv; struct srpc_msg *msg; - srpc_msg_type_t type; + enum srpc_msg_type type; LASSERT(!in_interrupt()); diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index fdf881f..c9b904c 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -44,7 +44,7 @@ * * XXX: *REPLY == *REQST + 1 */ -typedef enum { +enum srpc_msg_type { SRPC_MSG_MKSN_REQST = 0, SRPC_MSG_MKSN_REPLY = 1, SRPC_MSG_RMSN_REQST = 2, @@ -63,7 +63,7 @@ typedef enum { SRPC_MSG_PING_REPLY = 15, SRPC_MSG_JOIN_REQST = 16, SRPC_MSG_JOIN_REPLY = 17, -} srpc_msg_type_t; +}; /* CAVEAT EMPTOR: * All srpc_*_reqst_t's 1st field must be matchbits of reply buffer, @@ -72,122 +72,122 @@ typedef enum { * All srpc_*_reply_t's 1st field must be a __u32 status, and 2nd field * session id if needed. */ -typedef struct { +struct srpc_generic_reqst { __u64 rpyid; /* reply buffer matchbits */ __u64 bulkid; /* bulk buffer matchbits */ -} WIRE_ATTR srpc_generic_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_generic_reply { __u32 status; lst_sid_t sid; -} WIRE_ATTR srpc_generic_reply_t; +} WIRE_ATTR; /* FRAMEWORK RPCs */ -typedef struct { +struct srpc_mksn_reqst { __u64 mksn_rpyid; /* reply buffer matchbits */ lst_sid_t mksn_sid; /* session id */ __u32 mksn_force; /* use brute force */ char mksn_name[LST_NAME_SIZE]; -} WIRE_ATTR srpc_mksn_reqst_t; /* make session request */ +} WIRE_ATTR; /* make session request */ -typedef struct { +struct srpc_mksn_reply { __u32 mksn_status; /* session status */ lst_sid_t mksn_sid; /* session id */ __u32 mksn_timeout; /* session timeout */ char mksn_name[LST_NAME_SIZE]; -} WIRE_ATTR srpc_mksn_reply_t; /* make session reply */ +} WIRE_ATTR; /* make session reply */ -typedef struct { +struct srpc_rmsn_reqst { __u64 rmsn_rpyid; /* reply buffer matchbits */ lst_sid_t rmsn_sid; /* session id */ -} WIRE_ATTR srpc_rmsn_reqst_t; /* remove session request */ +} WIRE_ATTR; /* remove session request */ -typedef struct { +struct srpc_rmsn_reply { __u32 rmsn_status; lst_sid_t rmsn_sid; /* session id */ -} WIRE_ATTR srpc_rmsn_reply_t; /* remove session reply */ +} WIRE_ATTR; /* remove session reply */ -typedef struct { +struct srpc_join_reqst { __u64 join_rpyid; /* reply buffer matchbits */ lst_sid_t join_sid; /* session id to join */ char join_group[LST_NAME_SIZE]; /* group name */ -} WIRE_ATTR srpc_join_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_join_reply { __u32 join_status; /* returned status */ lst_sid_t join_sid; /* session id */ __u32 join_timeout; /* # seconds' inactivity to * expire */ char join_session[LST_NAME_SIZE]; /* session name */ -} WIRE_ATTR srpc_join_reply_t; +} WIRE_ATTR; -typedef struct { +struct srpc_debug_reqst { __u64 dbg_rpyid; /* reply buffer matchbits */ lst_sid_t dbg_sid; /* session id */ __u32 dbg_flags; /* bitmap of debug */ -} WIRE_ATTR srpc_debug_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_debug_reply { __u32 dbg_status; /* returned code */ lst_sid_t dbg_sid; /* session id */ __u32 dbg_timeout; /* session timeout */ __u32 dbg_nbatch; /* # of batches in the node */ char dbg_name[LST_NAME_SIZE]; /* session name */ -} WIRE_ATTR srpc_debug_reply_t; +} WIRE_ATTR; #define SRPC_BATCH_OPC_RUN 1 #define SRPC_BATCH_OPC_STOP 2 #define SRPC_BATCH_OPC_QUERY 3 -typedef struct { +struct srpc_batch_reqst { __u64 bar_rpyid; /* reply buffer matchbits */ lst_sid_t bar_sid; /* session id */ lst_bid_t bar_bid; /* batch id */ __u32 bar_opc; /* create/start/stop batch */ __u32 bar_testidx; /* index of test */ __u32 bar_arg; /* parameters */ -} WIRE_ATTR srpc_batch_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_batch_reply { __u32 bar_status; /* status of request */ lst_sid_t bar_sid; /* session id */ __u32 bar_active; /* # of active tests in batch/test */ __u32 bar_time; /* remained time */ -} WIRE_ATTR srpc_batch_reply_t; +} WIRE_ATTR; -typedef struct { +struct srpc_stat_reqst { __u64 str_rpyid; /* reply buffer matchbits */ lst_sid_t str_sid; /* session id */ __u32 str_type; /* type of stat */ -} WIRE_ATTR srpc_stat_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_stat_reply { __u32 str_status; lst_sid_t str_sid; sfw_counters_t str_fw; srpc_counters_t str_rpc; lnet_counters_t str_lnet; -} WIRE_ATTR srpc_stat_reply_t; +} WIRE_ATTR; -typedef struct { +struct test_bulk_req { __u32 blk_opc; /* bulk operation code */ __u32 blk_npg; /* # of pages */ __u32 blk_flags; /* reserved flags */ -} WIRE_ATTR test_bulk_req_t; +} WIRE_ATTR; -typedef struct { +struct test_bulk_req_v1 { __u16 blk_opc; /* bulk operation code */ __u16 blk_flags; /* data check flags */ __u32 blk_len; /* data length */ __u32 blk_offset; /* reserved: offset */ -} WIRE_ATTR test_bulk_req_v1_t; +} WIRE_ATTR; -typedef struct { +struct test_ping_req { __u32 png_size; /* size of ping message */ __u32 png_flags; /* reserved flags */ -} WIRE_ATTR test_ping_req_t; +} WIRE_ATTR; -typedef struct { +struct srpc_test_reqst { __u64 tsr_rpyid; /* reply buffer matchbits */ __u64 tsr_bulkid; /* bulk buffer matchbits */ lst_sid_t tsr_sid; /* session id */ @@ -201,43 +201,43 @@ typedef struct { __u32 tsr_ndest; /* # of dest nodes */ union { - test_ping_req_t ping; - test_bulk_req_t bulk_v0; - test_bulk_req_v1_t bulk_v1; - } tsr_u; -} WIRE_ATTR srpc_test_reqst_t; + struct test_ping_req ping; + struct test_bulk_req bulk_v0; + struct test_bulk_req_v1 bulk_v1; + } tsr_u; +} WIRE_ATTR; -typedef struct { +struct srpc_test_reply { __u32 tsr_status; /* returned code */ lst_sid_t tsr_sid; -} WIRE_ATTR srpc_test_reply_t; +} WIRE_ATTR; /* TEST RPCs */ -typedef struct { +struct srpc_ping_reqst { __u64 pnr_rpyid; __u32 pnr_magic; __u32 pnr_seq; __u64 pnr_time_sec; __u64 pnr_time_usec; -} WIRE_ATTR srpc_ping_reqst_t; +} WIRE_ATTR; -typedef struct { +struct srpc_ping_reply { __u32 pnr_status; __u32 pnr_magic; __u32 pnr_seq; -} WIRE_ATTR srpc_ping_reply_t; +} WIRE_ATTR; -typedef struct { +struct srpc_brw_reqst { __u64 brw_rpyid; /* reply buffer matchbits */ __u64 brw_bulkid; /* bulk buffer matchbits */ __u32 brw_rw; /* read or write */ __u32 brw_len; /* bulk data len */ __u32 brw_flags; /* bulk data patterns */ -} WIRE_ATTR srpc_brw_reqst_t; /* bulk r/w request */ +} WIRE_ATTR; /* bulk r/w request */ -typedef struct { +struct srpc_brw_reply { __u32 brw_status; -} WIRE_ATTR srpc_brw_reply_t; /* bulk r/w reply */ +} WIRE_ATTR; /* bulk r/w reply */ #define SRPC_MSG_MAGIC 0xeeb0f00d #define SRPC_MSG_VERSION 1 @@ -245,33 +245,33 @@ typedef struct { struct srpc_msg { __u32 msg_magic; /* magic number */ __u32 msg_version; /* message version number */ - __u32 msg_type; /* type of message body: srpc_msg_type_t */ + __u32 msg_type; /* type of message body: srpc_msg_type */ __u32 msg_reserved0; __u32 msg_reserved1; __u32 msg_ses_feats; /* test session features */ union { - srpc_generic_reqst_t reqst; - srpc_generic_reply_t reply; - - srpc_mksn_reqst_t mksn_reqst; - srpc_mksn_reply_t mksn_reply; - srpc_rmsn_reqst_t rmsn_reqst; - srpc_rmsn_reply_t rmsn_reply; - srpc_debug_reqst_t dbg_reqst; - srpc_debug_reply_t dbg_reply; - srpc_batch_reqst_t bat_reqst; - srpc_batch_reply_t bat_reply; - srpc_stat_reqst_t stat_reqst; - srpc_stat_reply_t stat_reply; - srpc_test_reqst_t tes_reqst; - srpc_test_reply_t tes_reply; - srpc_join_reqst_t join_reqst; - srpc_join_reply_t join_reply; - - srpc_ping_reqst_t ping_reqst; - srpc_ping_reply_t ping_reply; - srpc_brw_reqst_t brw_reqst; - srpc_brw_reply_t brw_reply; + struct srpc_generic_reqst reqst; + struct srpc_generic_reply reply; + + struct srpc_mksn_reqst mksn_reqst; + struct srpc_mksn_reply mksn_reply; + struct srpc_rmsn_reqst rmsn_reqst; + struct srpc_rmsn_reply rmsn_reply; + struct srpc_debug_reqst dbg_reqst; + struct srpc_debug_reply dbg_reply; + struct srpc_batch_reqst bat_reqst; + struct srpc_batch_reply bat_reply; + struct srpc_stat_reqst stat_reqst; + struct srpc_stat_reply stat_reply; + struct srpc_test_reqst tes_reqst; + struct srpc_test_reply tes_reply; + struct srpc_join_reqst join_reqst; + struct srpc_join_reply join_reply; + + struct srpc_ping_reqst ping_reqst; + struct srpc_ping_reply ping_reply; + struct srpc_brw_reqst brw_reqst; + struct srpc_brw_reply brw_reply; } msg_body; } WIRE_ATTR; diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h index 1dac777..4eac1c9 100644 --- a/drivers/staging/lustre/lnet/selftest/selftest.h +++ b/drivers/staging/lustre/lnet/selftest/selftest.h @@ -93,7 +93,7 @@ struct sfw_test_instance; /* all reply/bulk RDMAs go to this portal */ #define SRPC_RDMA_PORTAL 52 -static inline srpc_msg_type_t +static inline enum srpc_msg_type srpc_service2request(int service) { switch (service) { @@ -128,7 +128,7 @@ srpc_service2request(int service) } } -static inline srpc_msg_type_t +static inline enum srpc_msg_type srpc_service2reply(int service) { return srpc_service2request(service) + 1; @@ -385,9 +385,9 @@ struct sfw_test_instance { struct list_head tsi_active_rpcs; /* active rpcs */ union { - test_ping_req_t ping; /* ping parameter */ - test_bulk_req_t bulk_v0; /* bulk parameter */ - test_bulk_req_v1_t bulk_v1; /* bulk v1 parameter */ + struct test_ping_req ping; /* ping parameter */ + struct test_bulk_req bulk_v0; /* bulk parameter */ + struct test_bulk_req_v1 bulk_v1; /* bulk v1 parameter */ } tsi_u; }; @@ -428,7 +428,8 @@ void sfw_free_pages(struct srpc_server_rpc *rpc); void sfw_add_bulk_page(struct srpc_bulk *bk, struct page *pg, int i); int sfw_alloc_pages(struct srpc_server_rpc *rpc, int cpt, int npages, int len, int sink); -int sfw_make_session(srpc_mksn_reqst_t *request, srpc_mksn_reply_t *reply); +int sfw_make_session(struct srpc_mksn_reqst *request, + struct srpc_mksn_reply *reply); struct srpc_client_rpc * srpc_create_client_rpc(lnet_process_id_t peer, int service, -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 17:17:12 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 18:17:12 +0100 (BST) Subject: [lustre-devel] [PATCH] staging: lustre: libcfs: Fix libcfs_ioctl() prototype. In-Reply-To: <1460459149-20699-1-git-send-email-lexa@cfotr.com> References: <1460459149-20699-1-git-send-email-lexa@cfotr.com> Message-ID: > Fix libcfs_ioctl() prototype according to its definition in > libcfs/module.c. > > Signed-off-by: Aleksei Fedotov Acked-by: James Simmons > --- > drivers/staging/lustre/include/linux/libcfs/libcfs.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h > index 9158c61..4141afb 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h > @@ -106,7 +106,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand); > int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, > const struct libcfs_ioctl_hdr __user *uparam); > int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data); > -int libcfs_ioctl(unsigned long cmd, void *arg); > +int libcfs_ioctl(unsigned long cmd, void __user *arg); > > /* container_of depends on "likely" which is defined in libcfs_private.h */ > static inline void *__container_of(void *ptr, unsigned long shift) > -- > 2.5.5 > > From jsimmons at infradead.org Tue Apr 12 17:21:03 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 18:21:03 +0100 (BST) Subject: [lustre-devel] [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set In-Reply-To: <20160412035445.GA27982@kroah.com> References: <1459820223-24754-1-git-send-email-jsimmons@infradead.org> <1459820223-24754-19-git-send-email-jsimmons@infradead.org> <20160412035445.GA27982@kroah.com> Message-ID: > Some of this series didn't apply, due to merge issues with 4.6-rc3. Can > you rebase and resend the remaining patches? This patch conflicts with a patch landed from Oleg which is a better solution for this bug. We can drop this patch. > > thanks, > > greg k-h > > On Mon, Apr 04, 2016 at 09:37:03PM -0400, James Simmons wrote: > > When Lustre is in a read or write system call and receives a > > SIGALRM, it will return EINTR if interrupted in osc_enter_cache. > > This prevents the system call from being restarted if > > SA_RESTART is set in the handler. > > > > This patch changes behavior in this location to return ERESTARTSYS > > when a signal arrives during the call to l_wait_event. > > > > Signed-off-by: Patrick Farrell > > Signed-off-by: James Simmons > > ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581 > > Reviewed-on: http://review.whamcloud.com/7002 > > Reviewed-by: Rahul Deshmukh > > Reviewed-by: Cory Spitz > > Reviewed-by: Andreas Dilger > > Signed-off-by: James Simmons > > --- > > drivers/staging/lustre/lustre/osc/osc_cache.c | 13 ++++++++++++- > > 1 files changed, 12 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > > index f09b89d..956d57b 100644 > > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > > @@ -1626,11 +1626,22 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, > > > > /* l_wait_event is interrupted by signal, or timed out */ > > if (rc < 0) { > > - if (rc == -ETIMEDOUT) { > > + switch (rc) { > > + case -ETIMEDOUT: > > OSC_DUMP_GRANT(D_ERROR, cli, > > "try to reserve %d.\n", bytes); > > osc_extent_tree_dump(D_ERROR, osc); > > rc = -EDQUOT; > > + break; > > + case -EINTR: > > + /* Ensures restartability - LU-3581 */ > > + rc = -ERESTARTSYS; > > + break; > > + default: > > + CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d\n", > > + cli->cl_import->imp_obd->obd_name, > > + &ocw, rc); > > + break; > > } > > list_del_init(&ocw.ocw_entry); > > goto out; > > -- > > 1.7.1 > From jsimmons at infradead.org Tue Apr 12 20:14:00 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:00 -0400 Subject: [lustre-devel] [PATCH v2 00/16] staging : lustre : rest of missing patches from 2.5.0 release Message-ID: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> This is the last collection of missing fixes present in the Lustre 2.5.0 release. Once these are merged the upstream client will be equal to the pre-2.6 lustre version since the major of clio cleanups from that time frame have already landed. changelog: v1) Based on 4.6-rc1. v2) Rebased for 4.6-rc3. Patch for lloop was dropped. Updated to handle PAGE_CACHE_* changes. Andrew Perepechko (3): staging: lustre: llite: variable rename in namei.c staging: lustre: llite: speedup in unlink/rmdir staging: lustre: lprocfs: implement log2 using bitops Andriy Skulysh (1): staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY Bobi Jam (1): staging: lustre: obd: MDT mount fails on MDS w/o MGS on it Bruno Faccini (3): staging: lustre: ldlm: Fix a race during FLock handling staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance staging: lustre: lov: return minimal FIEMAP for released files Jinshan Xiong (3): staging: lustre: llite: error setting max_cache_mb at mount time staging: lustre: llite: Truncate to restore file staging: lustre: osc: osc_extent_wait() shouldn't be interruptible John L. Hammond (2): staging: lustre: hsm: permission checks for HSM ioctl operations staging: lustre: hsm: don't use real suppgid Niu Yawei (1): staging: lustre: clio: incorrect assertions in 'enable-invariants' Sebastien Buisson (1): staging: lustre: osc: fix race issues thanks to oap_lock Swapnil Pimpale (1): staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init() drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 15 +++-- drivers/staging/lustre/lustre/llite/dir.c | 3 + drivers/staging/lustre/lustre/llite/file.c | 5 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 60 +++++++++---------- drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 +- drivers/staging/lustre/lustre/llite/namei.c | 65 ++++++++++---------- drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 21 ++++++ drivers/staging/lustre/lustre/lov/lov_request.c | 7 ++- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 17 +++-- drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 5 +- .../lustre/lustre/obdclass/lprocfs_status.c | 6 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 13 +++-- drivers/staging/lustre/lustre/osc/osc_cache.c | 10 +++- drivers/staging/lustre/lustre/osc/osc_io.c | 2 + drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 5 +- 19 files changed, 155 insertions(+), 99 deletions(-) From jsimmons at infradead.org Tue Apr 12 20:14:03 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:03 -0400 Subject: [lustre-devel] [PATCH v2 03/16] staging: lustre: ldlm: Fix a race during FLock handling In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-4-git-send-email-jsimmons@infradead.org> From: Bruno Faccini Protect against race where lock could have been just destroyed due to overlap, in ldlm_process_flock_lock(). Easy reproducer is BULL's NFS Locktests in pthread mode. (http://nfsv4.bullopensource.org/tools/tests/locktest.php) Signed-off-by: Bruno Faccini Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1126 Reviewed-on: http://review.whamcloud.com/7134 Reviewed-by: Oleg Drokin Reviewed-by: John L. Hammond Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 3f97e1c..5102d78 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -520,11 +520,6 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) granted: OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT, 10); - if (lock->l_flags & LDLM_FL_DESTROYED) { - LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed"); - return 0; - } - if (lock->l_flags & LDLM_FL_FAILED) { LDLM_DEBUG(lock, "client-side enqueue waking up: failed"); return -EIO; @@ -534,6 +529,16 @@ granted: lock_res_and_lock(lock); + /* + * Protect against race where lock could have been just destroyed + * due to overlap in ldlm_process_flock_lock(). + */ + if (lock->l_flags & LDLM_FL_DESTROYED) { + unlock_res_and_lock(lock); + LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed"); + return 0; + } + /* ldlm_lock_enqueue() has already placed lock on the granted list. */ list_del_init(&lock->l_res_link); -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:01 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:01 -0400 Subject: [lustre-devel] [PATCH v2 01/16] staging: lustre: osc: fix race issues thanks to oap_lock In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-2-git-send-email-jsimmons@infradead.org> From: Sebastien Buisson Fix 'data race condition' defects found by Coverity version 6.5.0: Data race condition (MISSING_LOCK) Accessing variable without holding lock. Elsewhere, this variable is accessed with lock held. This patch is dedicated to code fragments involving oap_lock. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744 Reviewed-on: http://review.whamcloud.com/6572 Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_cache.c | 8 ++++++++ drivers/staging/lustre/lustre/osc/osc_io.c | 2 ++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index ef68821..a5743b4 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1147,7 +1147,9 @@ static int osc_extent_make_ready(const struct lu_env *env, last->oap_count = osc_refresh_count(env, last, OBD_BRW_WRITE); LASSERT(last->oap_count > 0); LASSERT(last->oap_page_off + last->oap_count <= PAGE_SIZE); + spin_lock(&last->oap_lock); last->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&last->oap_lock); } /* for the rest of pages, we don't need to call osf_refresh_count() @@ -1156,7 +1158,9 @@ static int osc_extent_make_ready(const struct lu_env *env, list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { if (!(oap->oap_async_flags & ASYNC_COUNT_STABLE)) { oap->oap_count = PAGE_SIZE - oap->oap_page_off; + spin_lock(&last->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&last->oap_lock); } } @@ -2328,6 +2332,10 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, oap->oap_cmd = cmd; oap->oap_page_off = ops->ops_from; oap->oap_count = ops->ops_to - ops->ops_from; + /* + * No need to hold a lock here, + * since this page is not in any list yet. + */ oap->oap_async_flags = 0; oap->oap_brw_flags = brw_flags; diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index c1efcb3..39c3930 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -168,8 +168,10 @@ static int osc_io_submit(const struct lu_env *env, } cl_page_list_move(qout, qin, page); + spin_lock(&oap->oap_lock); oap->oap_async_flags = ASYNC_URGENT|ASYNC_READY; oap->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&oap->oap_lock); osc_page_submit(env, opg, crt, brw_flags); list_add_tail(&oap->oap_pending_item, &list); -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:05 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:05 -0400 Subject: [lustre-devel] [PATCH v2 05/16] staging: lustre: llite: variable rename in namei.c In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-6-git-send-email-jsimmons@infradead.org> From: Andrew Perepechko With the patch 6648 a fee variables were renamed. We do these renames in broken out patch to the fix obvious. Signed-off-by: Andrew Perepechko Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473 Xyratex-bug-id: MRP-1027 Reviewed-on: http://review.whamcloud.com/6648 Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/namei.c | 52 +++++++++++++------------- 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 8561707..73e61cf 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -929,23 +929,23 @@ out: * is any lock existing. They will recycle dentries and inodes based upon locks * too. b=20433 */ -static int ll_unlink(struct inode *dir, struct dentry *dentry) +static int ll_unlink(struct inode *dir, struct dentry *dchild) { struct ptlrpc_request *request = NULL; struct md_op_data *op_data; int rc; CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", - dentry, dir->i_ino, dir->i_generation, dir); + dchild, dir->i_ino, dir->i_generation, dir); op_data = ll_prep_md_op_data(NULL, dir, NULL, - dentry->d_name.name, - dentry->d_name.len, + dchild->d_name.name, + dchild->d_name.len, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dentry, &op_data->op_fid3); + ll_get_child_fid(dchild, &op_data->op_fid3); op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -979,23 +979,23 @@ static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) return err; } -static int ll_rmdir(struct inode *dir, struct dentry *dentry) +static int ll_rmdir(struct inode *dir, struct dentry *dchild) { struct ptlrpc_request *request = NULL; struct md_op_data *op_data; int rc; CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", - dentry, dir->i_ino, dir->i_generation, dir); + dchild, dir->i_ino, dir->i_generation, dir); op_data = ll_prep_md_op_data(NULL, dir, NULL, - dentry->d_name.name, - dentry->d_name.len, + dchild->d_name.name, + dchild->d_name.len, S_IFDIR, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dentry, &op_data->op_fid3); + ll_get_child_fid(dchild, &op_data->op_fid3); op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -1058,42 +1058,42 @@ out: return err; } -static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, - struct inode *new_dir, struct dentry *new_dentry) +static int ll_rename(struct inode *src, struct dentry *src_dchild, + struct inode *tgt, struct dentry *tgt_dchild) { struct ptlrpc_request *request = NULL; - struct ll_sb_info *sbi = ll_i2sbi(old_dir); + struct ll_sb_info *sbi = ll_i2sbi(src); struct md_op_data *op_data; int err; CDEBUG(D_VFSTRACE, "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd,tgt_dir=%lu/%u(%p)\n", - old_dentry, old_dir->i_ino, old_dir->i_generation, old_dir, - new_dentry, new_dir->i_ino, new_dir->i_generation, new_dir); + src_dchild, src->i_ino, src->i_generation, src, + tgt_dchild, tgt->i_ino, tgt->i_generation, tgt); - op_data = ll_prep_md_op_data(NULL, old_dir, new_dir, NULL, 0, 0, + op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(old_dentry, &op_data->op_fid3); - ll_get_child_fid(new_dentry, &op_data->op_fid4); + ll_get_child_fid(src_dchild, &op_data->op_fid3); + ll_get_child_fid(tgt_dchild, &op_data->op_fid4); err = md_rename(sbi->ll_md_exp, op_data, - old_dentry->d_name.name, - old_dentry->d_name.len, - new_dentry->d_name.name, - new_dentry->d_name.len, &request); + src_dchild->d_name.name, + src_dchild->d_name.len, + tgt_dchild->d_name.name, + tgt_dchild->d_name.len, &request); ll_finish_md_op_data(op_data); if (!err) { - ll_update_times(request, old_dir); - ll_update_times(request, new_dir); + ll_update_times(request, src); + ll_update_times(request, tgt); ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1); - err = ll_objects_destroy(request, old_dir); + err = ll_objects_destroy(request, src); } ptlrpc_req_finished(request); if (!err) - d_move(old_dentry, new_dentry); + d_move(src_dchild, tgt_dchild); return err; } -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:06 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:06 -0400 Subject: [lustre-devel] [PATCH v2 06/16] staging: lustre: llite: speedup in unlink/rmdir In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-7-git-send-email-jsimmons@infradead.org> From: Andrew Perepechko Assume dchild argument is fully initialized in ->unlink and ->rmdir callbacks, so additional lookup for ELC is not needed. Signed-off-by: Andrew Perepechko Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473 Xyratex-bug-id: MRP-1027 Reviewed-on: http://review.whamcloud.com/6648 Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/namei.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 73e61cf..9fa862b 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -847,12 +847,6 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, return rc; } -static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid) -{ - if (d_really_is_positive(child)) - *fid = *ll_inode2fid(d_inode(child)); -} - int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) { struct mdt_body *body; @@ -945,7 +939,9 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild) if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dchild, &op_data->op_fid3); + if (dchild && dchild->d_inode) + op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); + op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -995,7 +991,9 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild) if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(dchild, &op_data->op_fid3); + if (dchild && dchild->d_inode) + op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); + op_data->op_fid2 = op_data->op_fid3; rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); ll_finish_md_op_data(op_data); @@ -1076,8 +1074,11 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, if (IS_ERR(op_data)) return PTR_ERR(op_data); - ll_get_child_fid(src_dchild, &op_data->op_fid3); - ll_get_child_fid(tgt_dchild, &op_data->op_fid4); + if (src_dchild && src_dchild->d_inode) + op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode); + if (tgt_dchild && tgt_dchild->d_inode) + op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode); + err = md_rename(sbi->ll_md_exp, op_data, src_dchild->d_name.name, src_dchild->d_name.len, -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:02 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:02 -0400 Subject: [lustre-devel] [PATCH v2 02/16] staging: lustre: clio: incorrect assertions in 'enable-invariants' In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-3-git-send-email-jsimmons@infradead.org> From: Niu Yawei Fixed several incorrect assumptions in 'enable-invariants'. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3521 Reviewed-on: http://review.whamcloud.com/6832 Reviewed-by: Bobi Jam Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/cl_page.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 39095e7..b754f51 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -498,7 +498,7 @@ void cl_page_disown0(const struct lu_env *env, state = pg->cp_state; PINVRNT(env, pg, state == CPS_OWNED || state == CPS_FREEING); - PINVRNT(env, pg, cl_page_invariant(pg)); + PINVRNT(env, pg, cl_page_invariant(pg) || state == CPS_FREEING); cl_page_owner_clear(pg); if (state == CPS_OWNED) @@ -670,7 +670,8 @@ EXPORT_SYMBOL(cl_page_unassume); void cl_page_disown(const struct lu_env *env, struct cl_io *io, struct cl_page *pg) { - PINVRNT(env, pg, cl_page_is_owned(pg, io)); + PINVRNT(env, pg, cl_page_is_owned(pg, io) || + pg->cp_state == CPS_FREEING); io = cl_io_top(io); cl_page_disown0(env, io, pg); -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:08 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:08 -0400 Subject: [lustre-devel] [PATCH v2 08/16] staging: lustre: obd: MDT mount fails on MDS w/o MGS on it In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-9-git-send-email-jsimmons@infradead.org> From: Bobi Jam If we specify multiple --mgsnode for a MDT, when we start MDS upon it while MGS is no the other node, the MGC import connection will always select the local nid (which is one of the candidate mgsnode) since it think its the closest connection. This patch treats further --mgsnode nids as failover nids, so that multiple import connections are added for the MGC import. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3829 Reviewed-on: http://review.whamcloud.com/7509 Reviewed-by: Liang Zhen Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index d3e28a3..9474aa9 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -307,7 +307,8 @@ int lustre_start_mgc(struct super_block *sb) while (class_parse_nid(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid, NULL, NULL, NULL); - i++; + if (!rc) + i++; /* Stop at the first failover nid */ if (*ptr == ':') break; @@ -345,16 +346,18 @@ int lustre_start_mgc(struct super_block *sb) sprintf(niduuid, "%s_%x", mgcname, i); j = 0; while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) { - j++; - rc = do_lcfg(mgcname, nid, - LCFG_ADD_UUID, niduuid, NULL, NULL, NULL); + rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid, + NULL, NULL, NULL); + if (!rc) + ++j; if (*ptr == ':') break; } if (j > 0) { rc = do_lcfg(mgcname, 0, LCFG_ADD_CONN, niduuid, NULL, NULL, NULL); - i++; + if (!rc) + i++; } else { /* at ":/fsname" */ break; -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:04 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:04 -0400 Subject: [lustre-devel] [PATCH v2 04/16] staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-5-git-send-email-jsimmons@infradead.org> From: Bruno Faccini Follow-on to patch introduced to fix LU-2665 ticket (Gerrit Change at http://review.whamcloud.com/6415 with Change-Id: I8faa331712abeadee46eabe111ee1c23a05840d5). Original patch introduced regressions against POSIX test suite (fcntl.18/fcntl.35 tests in LSB-VSX POSIX test suite at http://www.opengroup.org/testing/linux-test/lsb-vsx.html), so the idea is to only resend F_UNLCKs to have both LU-2665 bug and POSIX test suite happy. Signed-off-by: Bruno Faccini Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3701 Reviewed-on: http://review.whamcloud.com/7453 Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 958a164..01b6d77 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -869,7 +869,9 @@ resend: * (explicits or automatically generated by Kernel to clean * current FLocks upon exit) that can't be trashed */ - if ((rc == -EINTR) || (rc == -ETIMEDOUT)) + if (((rc == -EINTR) || (rc == -ETIMEDOUT)) && + (einfo->ei_type == LDLM_FLOCK) && + (einfo->ei_mode == LCK_NL)) goto resend; return rc; } -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:07 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:07 -0400 Subject: [lustre-devel] [PATCH v2 07/16] staging: lustre: llite: error setting max_cache_mb at mount time In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-8-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong The root cause is that when max_cache_mb conf parameter is applied, the client isn't connected to the OST yet so that sbi->ll_dt_exp is NULL. However, it's not necessary to shrink the cache memory in this case so success should be returned. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3676 Reviewed-on: http://review.whamcloud.com/7194 Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index d99d8c3..b085879 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -461,8 +461,8 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file, break; if (!sbi->ll_dt_exp) { /* being initialized */ - rc = -ENODEV; - break; + rc = 0; + goto out; } /* difficult - have to ask OSCs to drop LRU slots. */ -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:12 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:12 -0400 Subject: [lustre-devel] [PATCH v2 12/16] staging: lustre: lprocfs: implement log2 using bitops In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-13-git-send-email-jsimmons@infradead.org> From: Andrew Perepechko This patch implements log2 using fls. Signed-off-by: Andrew Perepechko Reviewed-by: Alexander Boyko Reviewed-by: alexander_zarochentsev at xyratex.com Reviewed-by: Vitaly Fertman Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3496 Xyratex-bug-id: MRP-999 Reviewed-on: http://review.whamcloud.com/6757 Reviewed-by: John L. Hammond Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/obdclass/lprocfs_status.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 9824c88..b2f309d 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -1472,10 +1472,10 @@ EXPORT_SYMBOL(lprocfs_oh_tally); void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) { - unsigned int val; + unsigned int val = 0; - for (val = 0; ((1 << val) < value) && (val <= OBD_HIST_MAX); val++) - ; + if (likely(value != 0)) + val = min(fls(value - 1), OBD_HIST_MAX); lprocfs_oh_tally(oh, val); } -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:11 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:11 -0400 Subject: [lustre-devel] [PATCH v2 11/16] staging: lustre: osc: osc_extent_wait() shouldn't be interruptible In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-12-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Otherwise it will hit the assertion at cl_lock.c: cl_lock.c:1967:discard_cb()) ASSERTION( (!(page->cp_type == CPT_CACHEABLE) || (!PageWriteback(cl_page_vmpage(env, page)))) ) failed: This is because in osc_lock_flush() we have to make sure the IO is finished before discarding the pages. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2779 Reviewed-on: http://review.whamcloud.com/5419 Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index a5743b4..9723197 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -965,7 +965,7 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, "%s: wait ext to %d timedout, recovery in progress?\n", osc_export(obj)->exp_obd->obd_name, state); - lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); + lwi = LWI_INTR(NULL, NULL); rc = l_wait_event(ext->oe_waitq, extent_wait_cb(ext, state), &lwi); } -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:14 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:14 -0400 Subject: [lustre-devel] [PATCH v2 14/16] staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-15-git-send-email-jsimmons@infradead.org> From: Andriy Skulysh Patch for LU-631 which was landed before the upstream merge broke OBD_STATFS_NODELAY behaviour. It adds unnecessary delay while running df command with inactive OSTs. We shouldn't try to recover connection to OST in this case. Signed-off-by: Andriy Skulysh Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4010 Reviewed-on: http://review.whamcloud.com/7762 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_request.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 7178a02..475ca2f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -716,12 +716,15 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, struct lov_request *req; if (!lov->lov_tgts[i] || - (!lov_check_and_wait_active(lov, i) && - (oinfo->oi_flags & OBD_STATFS_NODELAY))) { + (oinfo->oi_flags & OBD_STATFS_NODELAY && + !lov->lov_tgts[i]->ltd_active)) { CDEBUG(D_HA, "lov idx %d inactive\n", i); continue; } + if (!lov->lov_tgts[i]->ltd_active) + lov_check_and_wait_active(lov, i); + /* skip targets that have been explicitly disabled by the * administrator */ -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:13 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:13 -0400 Subject: [lustre-devel] [PATCH v2 13/16] staging: lustre: lov: return minimal FIEMAP for released files In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-14-git-send-email-jsimmons@infradead.org> From: Bruno Faccini Since st_blocks = NULL is returned for released files, FIEMAP should at least return a minimal mapping to make users aware that file contains data but it is not immediately available. This will make coreutils and tools such tar happy and have them presume file is sparse. Also, add a new test_228 in sanity-hsm to verify it works for "[cp,tar] --sparse" commands. Also fix a LBUG ("lov_fiemap()) ASSERTION( fm_local ) failed") likely to occur when no-object/ENOMEM conditions and also now when released. Signed-off-by: Bruno Faccini Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3864 Reviewed-on: http://review.whamcloud.com/7584 Reviewed-by: Andreas Dilger Reviewed-by: Aurelien Degremont Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_obd.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 1a9e3e8..9b72671 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -1733,6 +1733,27 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, unsigned int buffer_size = FIEMAP_BUFFER_SIZE; if (!lsm_has_objects(lsm)) { + if (lsm && lsm_is_released(lsm) && (fm_key->fiemap.fm_start < + fm_key->oa.o_size)) { + /* + * released file, return a minimal FIEMAP if + * request fits in file-size. + */ + fiemap->fm_mapped_extents = 1; + fiemap->fm_extents[0].fe_logical = + fm_key->fiemap.fm_start; + if (fm_key->fiemap.fm_start + fm_key->fiemap.fm_length < + fm_key->oa.o_size) { + fiemap->fm_extents[0].fe_length = + fm_key->fiemap.fm_length; + } else { + fiemap->fm_extents[0].fe_length = + fm_key->oa.o_size - fm_key->fiemap.fm_start; + fiemap->fm_extents[0].fe_flags |= + (FIEMAP_EXTENT_UNKNOWN | + FIEMAP_EXTENT_LAST); + } + } rc = 0; goto out; } -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:09 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:09 -0400 Subject: [lustre-devel] [PATCH v2 09/16] staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init() In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-10-git-send-email-jsimmons@infradead.org> From: Swapnil Pimpale This patch has the following: 1) Fix for the return value from ptlrpcd_init(). It will now return a correct status instead of returning zero always. 2) ptlrpcd_addref() should not increment ptlrpcd_users on error. 3) Added code in a mdc_setup() and mgc_setup() to test the return value of ptlrpcd_addref() and return on error. Signed-off-by: Swapnil Pimpale Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3808 Reviewed-on: http://review.whamcloud.com/7522 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 9 ++++++--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 5 ++++- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 6023c2c..5f1ac58 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2314,12 +2314,14 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) return -ENOMEM; mdc_init_rpc_lock(cli->cl_rpc_lock); - ptlrpcd_addref(); + rc = ptlrpcd_addref(); + if (rc < 0) + goto err_rpc_lock; cli->cl_close_lock = kzalloc(sizeof(*cli->cl_close_lock), GFP_NOFS); if (!cli->cl_close_lock) { rc = -ENOMEM; - goto err_rpc_lock; + goto err_ptlrpcd_decref; } mdc_init_rpc_lock(cli->cl_close_lock); @@ -2345,9 +2347,10 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) err_close_lock: kfree(cli->cl_close_lock); +err_ptlrpcd_decref: + ptlrpcd_decref(); err_rpc_lock: kfree(cli->cl_rpc_lock); - ptlrpcd_decref(); return rc; } diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 3924b09..0f75040 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -734,7 +734,9 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) struct task_struct *task; int rc; - ptlrpcd_addref(); + rc = ptlrpcd_addref(); + if (rc < 0) + goto err_noref; rc = client_obd_setup(obd, lcfg); if (rc) @@ -773,6 +775,7 @@ err_cleanup: client_obd_cleanup(obd); err_decref: ptlrpcd_decref(); +err_noref: return rc; } diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index dbc3376..76a355a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -909,8 +909,11 @@ int ptlrpcd_addref(void) int rc = 0; mutex_lock(&ptlrpcd_mutex); - if (++ptlrpcd_users == 1) + if (++ptlrpcd_users == 1) { rc = ptlrpcd_init(); + if (rc < 0) + ptlrpcd_users--; + } mutex_unlock(&ptlrpcd_mutex); return rc; } -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:10 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:10 -0400 Subject: [lustre-devel] [PATCH v2 10/16] staging: lustre: llite: Truncate to restore file In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-11-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Truncate up is safe so it won't trigger restore. Copy optimization for truncate down - only copy the part under truncate length. If a file is truncated to zero usually it'll be followed by write so I choose to restore the file and set correct stripe information. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3817 Reviewed-on: http://review.whamcloud.com/7505 Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Henri Doreau Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 5 +- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 60 +++++++++---------- drivers/staging/lustre/lustre/llite/vvp_io.c | 5 +- 4 files changed, 35 insertions(+), 37 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 9b553d2..24fa24b 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3621,7 +3621,7 @@ again: /** * This function send a restore request to the MDT */ -int ll_layout_restore(struct inode *inode) +int ll_layout_restore(struct inode *inode, loff_t offset, __u64 length) { struct hsm_user_request *hur; int len, rc; @@ -3637,7 +3637,8 @@ int ll_layout_restore(struct inode *inode) hur->hur_request.hr_flags = 0; memcpy(&hur->hur_user_item[0].hui_fid, &ll_i2info(inode)->lli_fid, sizeof(hur->hur_user_item[0].hui_fid)); - hur->hur_user_item[0].hui_extent.length = -1; + hur->hur_user_item[0].hui_extent.offset = offset; + hur->hur_user_item[0].hui_extent.length = length; hur->hur_request.hr_itemcount = 1; rc = obd_iocontrol(LL_IOC_HSM_REQUEST, ll_i2sbi(inode)->ll_md_exp, len, hur, NULL); diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 2a11664..22e9989 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1377,7 +1377,7 @@ enum { int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf); int ll_layout_refresh(struct inode *inode, __u32 *gen); -int ll_layout_restore(struct inode *inode); +int ll_layout_restore(struct inode *inode, loff_t start, __u64 length); int ll_xattr_init(void); void ll_xattr_fini(void); diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index b0948a7..9f338b1 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1266,14 +1266,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime), (s64)ktime_get_real_seconds()); - /* If we are changing file size, file content is modified, flag it. */ - if (attr->ia_valid & ATTR_SIZE) { - attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; - spin_lock(&lli->lli_lock); - lli->lli_flags |= LLIF_DATA_MODIFIED; - spin_unlock(&lli->lli_lock); - } - /* We always do an MDS RPC, even if we're only changing the size; * only the MDS knows whether truncate() should fail with -ETXTBUSY */ @@ -1285,13 +1277,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) if (!S_ISDIR(inode->i_mode)) inode_unlock(inode); - memcpy(&op_data->op_attr, attr, sizeof(*attr)); - - /* Open epoch for truncate. */ - if (exp_connect_som(ll_i2mdexp(inode)) && - (attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET))) - op_data->op_flags = MF_EPOCH_OPEN; - /* truncate on a released file must failed with -ENODATA, * so size must not be set on MDS for released file * but other attributes must be set @@ -1305,29 +1290,40 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) if (lsm && lsm->lsm_pattern & LOV_PATTERN_F_RELEASED) file_is_released = true; ccc_inode_lsm_put(inode, lsm); + + if (!hsm_import && attr->ia_valid & ATTR_SIZE) { + if (file_is_released) { + rc = ll_layout_restore(inode, 0, attr->ia_size); + if (rc < 0) + goto out; + + file_is_released = false; + ll_layout_refresh(inode, &gen); + } + + /* + * If we are changing file size, file content is + * modified, flag it. + */ + attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; + spin_lock(&lli->lli_lock); + lli->lli_flags |= LLIF_DATA_MODIFIED; + spin_unlock(&lli->lli_lock); + op_data->op_bias |= MDS_DATA_MODIFIED; + } } - /* if not in HSM import mode, clear size attr for released file - * we clear the attribute send to MDT in op_data, not the original - * received from caller in attr which is used later to - * decide return code - */ - if (file_is_released && (attr->ia_valid & ATTR_SIZE) && !hsm_import) - op_data->op_attr.ia_valid &= ~ATTR_SIZE; + memcpy(&op_data->op_attr, attr, sizeof(*attr)); + + /* Open epoch for truncate. */ + if (exp_connect_som(ll_i2mdexp(inode)) && !hsm_import && + (attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET))) + op_data->op_flags = MF_EPOCH_OPEN; rc = ll_md_setattr(dentry, op_data, &mod); if (rc) goto out; - /* truncate failed (only when non HSM import), others succeed */ - if (file_is_released) { - if ((attr->ia_valid & ATTR_SIZE) && !hsm_import) - rc = -ENODATA; - else - rc = 0; - goto out; - } - /* RPC to MDT is sent, cancel data modification flag */ if (op_data->op_bias & MDS_DATA_MODIFIED) { spin_lock(&lli->lli_lock); @@ -1336,7 +1332,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) } ll_ioepoch_open(lli, op_data->op_ioepoch); - if (!S_ISREG(inode->i_mode)) { + if (!S_ISREG(inode->i_mode) || file_is_released) { rc = 0; goto out; } diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 26dfbf1..5bf9592 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -294,6 +294,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) struct cl_io *io = ios->cis_io; struct cl_object *obj = io->ci_obj; struct vvp_io *vio = cl2vvp_io(env, ios); + struct inode *inode = vvp_object_inode(obj); CLOBINVRNT(env, obj, vvp_object_invariant(obj)); @@ -309,7 +310,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) /* file was detected release, we need to restore it * before finishing the io */ - rc = ll_layout_restore(vvp_object_inode(obj)); + rc = ll_layout_restore(inode, 0, OBD_OBJECT_EOF); /* if restore registration failed, no restart, * we will return -ENODATA */ @@ -335,7 +336,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) __u32 gen = 0; /* check layout version */ - ll_layout_refresh(vvp_object_inode(obj), &gen); + ll_layout_refresh(inode, &gen); io->ci_need_restart = vio->vui_layout_gen != gen; if (io->ci_need_restart) { CDEBUG(D_VFSTRACE, -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:15 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:15 -0400 Subject: [lustre-devel] [PATCH v2 15/16] staging: lustre: hsm: permission checks for HSM ioctl operations In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-16-git-send-email-jsimmons@infradead.org> From: John L. Hammond In the LL_IOC_HSM_CT_START case of ll_dir_ioctl() require CAP_SYS_ADMIN, since the local handler for this ioctl may modify the global KUC table. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866 Reviewed-on: http://review.whamcloud.com/7565 Reviewed-by: Aurelien Degremont Reviewed-by: Faccini Bruno Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 2f0873e..ca4d5eb 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1845,6 +1845,9 @@ out_quotactl: return rc; } case LL_IOC_HSM_CT_START: + if (!capable(CFS_CAP_SYS_ADMIN)) + return -EPERM; + rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg, sizeof(struct lustre_kernelcomm)); return rc; -- 1.7.1 From jsimmons at infradead.org Tue Apr 12 20:14:16 2016 From: jsimmons at infradead.org (James Simmons) Date: Tue, 12 Apr 2016 16:14:16 -0400 Subject: [lustre-devel] [PATCH v2 16/16] staging: lustre: hsm: don't use real suppgid In-Reply-To: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> References: <1460492056-31792-1-git-send-email-jsimmons@infradead.org> Message-ID: <1460492056-31792-17-git-send-email-jsimmons@infradead.org> From: John L. Hammond In the MDC HSM handlers that do not pack a real suppgid, use -1 rather than 0 for the suppgid in mdt_body. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866 Reviewed-on: http://review.whamcloud.com/7565 Reviewed-by: Aurelien Degremont Reviewed-by: Faccini Bruno Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 5f1ac58..46e3a75 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -1169,7 +1169,7 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp, goto out; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); /* Copy hsm_progress struct */ req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS); @@ -1203,7 +1203,7 @@ static int mdc_ioc_hsm_ct_register(struct obd_import *imp, __u32 archives) goto out; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); /* Copy hsm_progress struct */ archive_mask = req_capsule_client_get(&req->rq_pill, @@ -1278,7 +1278,7 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp) goto out; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); ptlrpc_request_set_replen(req); @@ -1395,7 +1395,7 @@ static int mdc_ioc_hsm_request(struct obd_export *exp, return rc; } - mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0); + mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0); /* Copy hsm_request struct */ req_hr = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_REQUEST); -- 1.7.1 From green at linuxhacker.ru Wed Apr 13 01:11:07 2016 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Tue, 12 Apr 2016 21:11:07 -0400 Subject: [lustre-devel] [PATCH 0/2] Couple of lustre cleanups Message-ID: <1460509869-3288664-1-git-send-email-green@linuxhacker.ru> From: Oleg Drokin These are rebased cleanups from before - style fixes and suppressign a spurious message. Bobi Jam (1): staging/lustre/llite: suppress non active IO error message Oleg Drokin (1): staging/lustre: Fix blank line after/before {/} style drivers/staging/lustre/lustre/fld/fld_request.c | 1 - drivers/staging/lustre/lustre/include/lu_object.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 1 - drivers/staging/lustre/lustre/llite/dir.c | 2 -- drivers/staging/lustre/lustre/llite/lproc_llite.c | 1 - drivers/staging/lustre/lustre/llite/rw.c | 11 ++--------- drivers/staging/lustre/lustre/llite/xattr.c | 1 - drivers/staging/lustre/lustre/llite/xattr_cache.c | 1 - drivers/staging/lustre/lustre/lov/lov_io.c | 1 - drivers/staging/lustre/lustre/lov/lov_obd.c | 1 - drivers/staging/lustre/lustre/lov/lov_pack.c | 1 - drivers/staging/lustre/lustre/lov/lov_request.c | 1 - drivers/staging/lustre/lustre/lov/lovsub_object.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_lib.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_locks.c | 1 - drivers/staging/lustre/lustre/mgc/mgc_request.c | 1 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 - drivers/staging/lustre/lustre/obdclass/genops.c | 1 - drivers/staging/lustre/lustre/obdclass/llog.c | 1 - drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 -- drivers/staging/lustre/lustre/obdclass/obd_config.c | 1 - drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 -- drivers/staging/lustre/lustre/osc/osc_cache.c | 1 - drivers/staging/lustre/lustre/osc/osc_io.c | 1 - drivers/staging/lustre/lustre/osc/osc_page.c | 1 - drivers/staging/lustre/lustre/osc/osc_request.c | 1 - drivers/staging/lustre/lustre/ptlrpc/client.c | 1 - drivers/staging/lustre/lustre/ptlrpc/events.c | 1 - drivers/staging/lustre/lustre/ptlrpc/import.c | 3 --- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 - drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 3 --- 34 files changed, 2 insertions(+), 49 deletions(-) -- 2.1.0 From green at linuxhacker.ru Wed Apr 13 01:11:09 2016 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Tue, 12 Apr 2016 21:11:09 -0400 Subject: [lustre-devel] [PATCH 2/2] staging/lustre/llite: suppress non active IO error message In-Reply-To: <1460509869-3288664-1-git-send-email-green@linuxhacker.ru> References: <1460509869-3288664-1-git-send-email-green@linuxhacker.ru> Message-ID: <1460509869-3288664-3-git-send-email-green@linuxhacker.ru> From: Bobi Jam Current CLIO does not support fadvise, suppress the error message. Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/9658 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4717 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/rw.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index fee319c..4ddf8b3 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -111,16 +111,9 @@ struct ll_cl_context *ll_cl_init(struct file *file, struct page *vmpage) vio = vvp_env_io(env); io = vio->vui_cl.cis_io; lcc->lcc_io = io; - if (!io) { - struct inode *inode = file_inode(file); - - CERROR("%s: " DFID " no active IO, please file a ticket.\n", - ll_get_fsname(inode->i_sb, NULL, 0), - PFID(ll_inode2fid(inode))); - dump_stack(); - + if (!io) result = -EIO; - } + if (result == 0 && vmpage) { struct cl_page *page; -- 2.1.0 From green at linuxhacker.ru Wed Apr 13 01:11:08 2016 From: green at linuxhacker.ru (green at linuxhacker.ru) Date: Tue, 12 Apr 2016 21:11:08 -0400 Subject: [lustre-devel] [PATCH 1/2] staging/lustre: Fix blank line after/before {/} style In-Reply-To: <1460509869-3288664-1-git-send-email-green@linuxhacker.ru> References: <1460509869-3288664-1-git-send-email-green@linuxhacker.ru> Message-ID: <1460509869-3288664-2-git-send-email-green@linuxhacker.ru> From: Oleg Drokin This patch fixes all checkpatch occurences of CHECK: Blank lines aren't necessary after an open brace '{' CHECK: Blank lines aren't necessary before a close brace '}' in Lustre code. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/fld/fld_request.c | 1 - drivers/staging/lustre/lustre/include/lu_object.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 1 - drivers/staging/lustre/lustre/llite/dir.c | 2 -- drivers/staging/lustre/lustre/llite/lproc_llite.c | 1 - drivers/staging/lustre/lustre/llite/xattr.c | 1 - drivers/staging/lustre/lustre/llite/xattr_cache.c | 1 - drivers/staging/lustre/lustre/lov/lov_io.c | 1 - drivers/staging/lustre/lustre/lov/lov_obd.c | 1 - drivers/staging/lustre/lustre/lov/lov_pack.c | 1 - drivers/staging/lustre/lustre/lov/lov_request.c | 1 - drivers/staging/lustre/lustre/lov/lovsub_object.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_lib.c | 1 - drivers/staging/lustre/lustre/mdc/mdc_locks.c | 1 - drivers/staging/lustre/lustre/mgc/mgc_request.c | 1 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 1 - drivers/staging/lustre/lustre/obdclass/genops.c | 1 - drivers/staging/lustre/lustre/obdclass/llog.c | 1 - drivers/staging/lustre/lustre/obdclass/lu_object.c | 2 -- drivers/staging/lustre/lustre/obdclass/obd_config.c | 1 - drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 -- drivers/staging/lustre/lustre/osc/osc_cache.c | 1 - drivers/staging/lustre/lustre/osc/osc_io.c | 1 - drivers/staging/lustre/lustre/osc/osc_page.c | 1 - drivers/staging/lustre/lustre/osc/osc_request.c | 1 - drivers/staging/lustre/lustre/ptlrpc/client.c | 1 - drivers/staging/lustre/lustre/ptlrpc/events.c | 1 - drivers/staging/lustre/lustre/ptlrpc/import.c | 3 --- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 - drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 3 --- 33 files changed, 40 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 2dfdb51..64c387e 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -95,7 +95,6 @@ static void fld_exit_request(struct client_obd *cli) spin_lock(&cli->cl_loi_list_lock); cli->cl_r_in_flight--; list_for_each_safe(l, tmp, &cli->cl_cache_waiters) { - if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) { /* No free request slots anymore */ break; diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 0f70acd..b5b0c81 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -198,7 +198,6 @@ typedef int (*lu_printer_t)(const struct lu_env *env, * Operations specific for particular lu_object. */ struct lu_object_operations { - /** * Allocate lower-layer parts of the object by calling * lu_device_operations::ldo_object_alloc() of the corresponding diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 9e58b1c..bc951c0 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -429,7 +429,6 @@ err_ldlm: ldlm_put_ref(); err: return rc; - } EXPORT_SYMBOL(client_obd_setup); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 3f9b8526..6c27b23 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -810,7 +810,6 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) } else if (!lock->l_readers && !lock->l_writers && !(lock->l_flags & LDLM_FL_NO_LRU) && !(lock->l_flags & LDLM_FL_BL_AST)) { - LDLM_DEBUG(lock, "add lock into lru list"); /* If this is a client-side namespace and this was the last diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 880efdc..861e4be 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -1803,7 +1803,6 @@ static void ldlm_namespace_foreach(struct ldlm_namespace *ns, cfs_hash_for_each_nolock(ns->ns_rs_hash, ldlm_res_iter_helper, &helper); - } /* non-blocking function to manipulate a lock whose cb_data is being put away. diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 2f0873e..1d5366b 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1059,7 +1059,6 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) /* hpk_errval must be >= 0 */ hpk.hpk_errval = EBUSY; } - } progress: @@ -1388,7 +1387,6 @@ out_free: lmv_out_free: obd_ioctl_freedata(buf, len); return rc; - } case LL_IOC_LOV_SETSTRIPE: { struct lov_user_md_v3 lumv3; diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index d99d8c3..4a9f669 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -254,7 +254,6 @@ static ssize_t max_read_ahead_mb_store(struct kobject *kobj, pages_number *= 1 << (20 - PAGE_SHIFT); /* MB -> pages */ if (pages_number > totalram_pages / 2) { - CERROR("can't set file readahead more than %lu MB\n", totalram_pages >> (20 - PAGE_SHIFT + 1)); /*1/2 of RAM*/ return -ERANGE; diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 9f6fcfe..43b2d08 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -339,7 +339,6 @@ int ll_getxattr_common(struct inode *inode, const char *name, */ if (xattr_type == XATTR_ACL_ACCESS_T && !(sbi->ll_flags & LL_SBI_RMT_CLIENT)) { - struct posix_acl *acl; spin_lock(&lli->lli_lock); diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 3480ce2..d7e17ab 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -229,7 +229,6 @@ static int ll_xattr_cache_valid(struct ll_inode_info *lli) */ static int ll_xattr_cache_destroy_locked(struct ll_inode_info *lli) { - if (!ll_xattr_cache_valid(lli)) return 0; diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index da4784b..86cb3f8 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -442,7 +442,6 @@ static int lov_io_rw_iter_init(const struct lu_env *env, /* fast path for common case. */ if (lio->lis_nr_subios != 1 && !cl_io_is_append(io)) { - lov_do_div64(start, ssize); next = (start + 1) * ssize; if (next <= start * ssize) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 1a9e3e8..6d02914 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -964,7 +964,6 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, CERROR("Unknown command: %d\n", lcfg->lcfg_command); rc = -EINVAL; goto out; - } } out: diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index d983a30..0215ea5 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -136,7 +136,6 @@ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, CERROR("bad mem LOV MAGIC: 0x%08X != 0x%08X nor 0x%08X\n", lmm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3); return -EINVAL; - } if (lsm) { diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 7178a02..8226ab2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -235,7 +235,6 @@ out: if (tmp_oa) kmem_cache_free(obdo_cachep, tmp_oa); return rc; - } int lov_fini_getattr_set(struct lov_request_set *set) diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index 3f51f0d..bcaae1e 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -71,7 +71,6 @@ int lovsub_object_init(const struct lu_env *env, struct lu_object *obj, result = -ENOMEM; } return result; - } static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index 53cd56f..856c54e 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -438,7 +438,6 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags, char *tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME); LOGL0(op_data->op_name, op_data->op_namelen, tmp); - } } diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 958a164..9e970ab 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -963,7 +963,6 @@ static int mdc_finish_intent_lock(struct obd_export *exp, if (fid_is_sane(&op_data->op_fid2) && it->it_create_mode & M_CHECK_STALE && it->it_op != IT_GETATTR) { - /* Also: did we find the same inode? */ /* sever can return one of two fids: * op_fid2 - new allocated fid - if file is created. diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 3924b09..0c3bd16 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1720,7 +1720,6 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf) CERROR("Unknown command: %d\n", lcfg->lcfg_command); rc = -EINVAL; goto out; - } } out: diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 799e558..a3c7e7b 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -335,7 +335,6 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) err = 0; goto out; } - } if (data->ioc_dev == OBD_DEV_BY_DEVNAME) { diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index cf97b8f0..d95f11d 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -604,7 +604,6 @@ int obd_init_caches(void) out: obd_cleanup_caches(); return -ENOMEM; - } /* map connection to client */ diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index 992573e..79194d8 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -265,7 +265,6 @@ repeat: for (rec = (struct llog_rec_hdr *)buf; (char *)rec < buf + LLOG_CHUNK_SIZE; rec = (struct llog_rec_hdr *)((char *)rec + rec->lrh_len)) { - CDEBUG(D_OTHER, "processing rec 0x%p type %#x\n", rec, rec->lrh_type); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index 990e939..e043857 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -104,7 +104,6 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o) if (!cfs_hash_bd_dec_and_lock(site->ls_obj_hash, &bd, &top->loh_ref)) { if (lu_object_is_dying(top)) { - /* * somebody may be waiting for this, currently only * used for cl_object, see cl_object_put_last(). @@ -358,7 +357,6 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr) if (count > 0 && --count == 0) break; - } cfs_hash_bd_unlock(s->ls_obj_hash, &bd, 1); cond_resched(); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 5395e99..318a2e3 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -961,7 +961,6 @@ int class_process_config(struct lustre_cfg *lcfg) default: { err = obd_process_config(obd, sizeof(*lcfg), lcfg); goto out; - } } out: diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index b271895..6aa6d86 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -1354,7 +1354,6 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, for (i = 0, pgp = pga, off = offset; i < npages; i++, pgp++, off += PAGE_SIZE) { - LASSERT(!pgp->pg); /* for cleanup */ rc = -ENOMEM; @@ -1831,7 +1830,6 @@ static int __init obdecho_init(void) static void /*__exit*/ obdecho_exit(void) { echo_client_exit(); - } MODULE_AUTHOR("OpenSFS, Inc. "); diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index ef68821..de8c825 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1820,7 +1820,6 @@ static void osc_process_ar(struct osc_async_rc *ar, __u64 xid, ar->ar_force_sync = 1; ar->ar_min_xid = ptlrpc_sample_next_xid(); return; - } if (ar->ar_force_sync && (xid >= ar->ar_min_xid)) diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index c1efcb3..9d67fca2 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -782,7 +782,6 @@ static void osc_req_attr_set(const struct lu_env *env, oa->o_valid |= OBD_MD_FLID; } if (flags & OBD_MD_FLHANDLE) { - clerq = slice->crs_req; LASSERT(!list_empty(&clerq->crq_pages)); apage = container_of(clerq->crq_pages.next, diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index b55f467..5ec5508 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -759,7 +759,6 @@ static int osc_lru_reserve(const struct lu_env *env, struct osc_object *obj, LASSERT(atomic_read(cli->cl_lru_left) >= 0); while (!atomic_add_unless(cli->cl_lru_left, -1, 0)) { - /* run out of LRU spaces, try to drop some by itself */ rc = osc_lru_reclaim(cli); if (rc < 0) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 4d0f831..e5794fb 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -837,7 +837,6 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, spin_unlock(&cli->cl_loi_list_lock); CDEBUG(D_CACHE, "dirty: %llu undirty: %u dropped %u grant: %llu\n", oa->o_dirty, oa->o_undirty, oa->o_dropped, oa->o_grant); - } void osc_update_next_shrink(struct client_obd *cli) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index e02d95d1..4b7912a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1082,7 +1082,6 @@ static int ptlrpc_console_allow(struct ptlrpc_request *req) */ if ((lustre_handle_is_used(&req->rq_import->imp_remote_handle)) && (opc == OST_CONNECT || opc == MDS_CONNECT || opc == MGS_CONNECT)) { - /* Suppress timed out reconnect requests */ if (req->rq_timedout) return 0; diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 47be21a..fdcde9b 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -69,7 +69,6 @@ void request_out_callback(lnet_event_t *ev) req->rq_req_unlink = 0; if (ev->type == LNET_EVENT_UNLINK || ev->status != 0) { - /* Failed send: make it seem like the reply timed out, just * like failing sends in client.c does currently... */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index cd94fed..bf7b9d2 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -1001,7 +1001,6 @@ finish: return 0; } } else { - spin_lock(&imp->imp_lock); list_del(&imp->imp_conn_current->oic_item); list_add(&imp->imp_conn_current->oic_item, &imp->imp_conn_list); @@ -1370,7 +1369,6 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) if (rc) goto out; } - } if (imp->imp_state == LUSTRE_IMP_REPLAY_WAIT) { @@ -1453,7 +1451,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) back_to_sleep, LWI_ON_SIGNAL_NOOP, NULL); rc = l_wait_event(imp->imp_recovery_waitq, !ptlrpc_import_in_recovery(imp), &lwi); - } spin_lock(&imp->imp_lock); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index a35b56e..6dba4ee 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -1321,6 +1321,5 @@ int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, up_read(&obd->u.cli.cl_sem); return count; - } EXPORT_SYMBOL(lprocfs_wr_pinger_recov); diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 710fb80..99ff6e8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -1038,7 +1038,6 @@ static int nrs_policy_unregister_locked(struct ptlrpc_nrs_pol_desc *desc) LASSERT(mutex_is_locked(&ptlrpc_all_services_mutex)); list_for_each_entry(svc, &ptlrpc_all_services, srv_list) { - if (!nrs_policy_compatible(svc, desc) || unlikely(svc->srv_is_stopping)) continue; diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 492d63f..811acf6 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -1160,7 +1160,6 @@ __u32 lustre_msg_get_timeout(struct lustre_msg *msg) if (!pb) { CERROR("invalid msg %p: no ptlrpc body!\n", msg); return 0; - } return pb->pb_timeout; } @@ -1179,7 +1178,6 @@ __u32 lustre_msg_get_service_time(struct lustre_msg *msg) if (!pb) { CERROR("invalid msg %p: no ptlrpc body!\n", msg); return 0; - } return pb->pb_service_time; } @@ -1572,7 +1570,6 @@ static void lustre_swab_obdo(struct obdo *o) CLASSERT(offsetof(typeof(*o), o_padding_4) != 0); CLASSERT(offsetof(typeof(*o), o_padding_5) != 0); CLASSERT(offsetof(typeof(*o), o_padding_6) != 0); - } void lustre_swab_obd_statfs(struct obd_statfs *os) -- 2.1.0 From simmonsja at ornl.gov Wed Apr 13 18:18:56 2016 From: simmonsja at ornl.gov (Simmons, James A.) Date: Wed, 13 Apr 2016 18:18:56 +0000 Subject: [lustre-devel] Staging: lustre: Make lustre_profile_list static In-Reply-To: <1460495314-31976-1-git-send-email-iban.rodriguez@ono.com> References: <1460495314-31976-1-git-send-email-iban.rodriguez@ono.com> Message-ID: >Variable lustre_profile_list is only used inside obd_config.c, >better make it static > >Signed-off-by: Iban Rodriguez Acked-by: James Simmons >--- > drivers/staging/lustre/lustre/obdclass/obd_config.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 5395e994deab..8d484633b83a 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -606,7 +606,7 @@ static int class_del_conn(struct obd_device *obd, struct lustre_cfg *lcfg) return rc; } -LIST_HEAD(lustre_profile_list); +static LIST_HEAD(lustre_profile_list); struct lustre_profile *class_get_profile(const char *prof) { -- 1.9.1 _______________________________________________ devel mailing list devel at linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel From thcrowe at iu.edu Wed Apr 13 20:45:54 2016 From: thcrowe at iu.edu (Crowe, Tom) Date: Wed, 13 Apr 2016 20:45:54 +0000 Subject: [lustre-devel] LMT 3.2 - MDT display Message-ID: Greetings, After seeing a presentation at LUG16 (http://cdn.opensfs.org/wp-content/uploads/2016/04/LUG2016D1_LMT-Only-a-Flesh-Wound_Faaland.pdf), I was excited to try the updated version of LMT (3.2) as it appeared detailed MDT/MDS information is included in ltop output. I have successfully built and installed LMT 3.2, but there is no display of MDT info. Wondering how I might troubleshoot this further. Everything is working, its just not giving me the MDT/MDS info as I expected it might. Thanks, Tom Crowe -------------- next part -------------- An HTML attachment was scrubbed... URL: From faaland1 at llnl.gov Wed Apr 13 21:22:25 2016 From: faaland1 at llnl.gov (Faaland, Olaf P.) Date: Wed, 13 Apr 2016 21:22:25 +0000 Subject: [lustre-devel] LMT 3.2 - MDT display In-Reply-To: References: Message-ID: <43111FD6D3DBA74A9134F6C11536F04ACBE2D75D@PRDEXMBX-08.the-lab.llnl.gov> Hi Tim, It sounds like maybe you see the summary and the OST list, but not the MDT list. The ltop display has 3 different components: [ summary ] [ mdt list ] [ ost list ] The summary at the top has all the fields displayed in the mdt list; so if you have only 1 MDT, then it doesn't waste the screen space used by an MDT list, and just shows [summary] [ ost list ] Does that explain it? thanks, Olaf P. Faaland Livermore Computing phone : 925-422-2263 ________________________________ From: lustre-devel [lustre-devel-bounces at lists.lustre.org] on behalf of Crowe, Tom [thcrowe at iu.edu] Sent: Wednesday, April 13, 2016 1:45 PM To: lustre-devel at lists.lustre.org Subject: [lustre-devel] LMT 3.2 - MDT display Greetings, After seeing a presentation at LUG16 (http://cdn.opensfs.org/wp-content/uploads/2016/04/LUG2016D1_LMT-Only-a-Flesh-Wound_Faaland.pdf), I was excited to try the updated version of LMT (3.2) as it appeared detailed MDT/MDS information is included in ltop output. I have successfully built and installed LMT 3.2, but there is no display of MDT info. Wondering how I might troubleshoot this further. Everything is working, its just not giving me the MDT/MDS info as I expected it might. Thanks, Tom Crowe -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom.leiming at gmail.com Thu Apr 14 12:02:18 2016 From: tom.leiming at gmail.com (Ming Lei) Date: Thu, 14 Apr 2016 20:02:18 +0800 Subject: [lustre-devel] [PATCH v1 00/27] block: cleanup direct access to .bi_vcnt & .bi_io_vec Message-ID: <1460635375-28282-1-git-send-email-tom.leiming@gmail.com> Hi Guys, It is always not a good practice to access bio->bi_vcnt and bio->bi_io_vec from drivers directly. Also this kind of direct access will cause trouble when converting to multipage bvecs because currently drivers may suppose one bvec always include one page, and use the two fields to figure out how to handle pages. Even the actual meaning of the two fields arn't change from block subsystem's view, but it may change from driver or fs's view, so this patchset takes a conservative approach to cleanup direct access to the two fields for avoiding regressions. The 1st patch introduces the following 3 bio helpers which can be used inside drivers for avoiding direct access to .bi_vcnt and .bi_io_vec. bio_pages() bio_get_base_vec() bio_set_vec_table() bio_pages() can be easy to convert to multipage bvecs. For bio_get_base_vec() and bio_set_vec_table(), they are often used during initializing a new bio or in case of single bvec bio. With the two new helpers, it becomes quite easy to audit access to .bi_io_vec and .bi_vcnt. Most of the other patches use the 3 helpers to clean up most of direct access to .bi_vcnt and .bi_io_vec from drivers, except for MD and btrfs, which two subsystems will be handled with different way in future. For btrfs, its direct access to .bi_vcnt & .bi_io_vec need to be cleanuped and audited that there isn't issue once converting to multipage bvecs. For raid(md), given its usage is quite complicated, we can just not enable multipage bvecs for raid queue until all its usage are cleaned up and audited. So it won't be a blocker for multipage bvecs. Also bio_add_page() is used in floppy, dm-crypt and fs/logfs to avoiding direct access to .bi_vcnt & .bi_io_vec. The patchset can be found in the following tree: https://github.com/ming1/linux/tree/v4.6-rc-block-next-mpbvecs-cleanup.v1 V1: - add Reviewed-by - remove bio_is_full() helper because target can find it via the return value of bio_add_pc_page() (9/27) - add comment on another two uses of bio_get_base_vec() (16/27) - rebased on latest for-next branch of block tree Ming Lei (27): block: bio: introduce 3 helpers for cleanup block: drbd: use bio_get_base_vec() to retrieve the 1st bvec block: drbd: remove impossible failure handling block: loop: use bio_get_base_vec() to retrive bvec table block: pktcdvd: use bio_get_base_vec() to retrive bvec table block: floppy: use bio_set_vec_table() block: floppy: use bio_add_page() staging: lustre: avoid to use bio->bi_vcnt directly target: avoid to access .bi_vcnt directly bcache: debug: avoid to access .bi_io_vec directly bcache: io.c: use bio_set_vec_table bcache: journal.c: use bio_set_vec_table() bcache: movinggc: use bio_set_vec_table() bcache: writeback: use bio_set_vec_table() bcache: super: use bio_set_vec_table() bcache: super: use bio_get_base_vec dm: crypt: use bio_add_page() dm: dm-io.c: use bio_get_base_vec() dm: dm.c: replace 'bio->bi_vcnt == 1' with !bio_multiple_segments dm: dm-bufio.c: use bio_set_vec_table() fs: logfs: use bio_set_vec_table() fs: logfs: convert to bio_add_page() in sync_request() fs: logfs: use bio_add_page() in __bdev_writeseg() fs: logfs: use bio_add_page() in do_erase() fs: logfs: remove unnecesary check kernel/power/swap.c: use bio_get_base_vec() mm: page_io.c: use bio_get_base_vec() drivers/block/drbd/drbd_bitmap.c | 4 +- drivers/block/drbd/drbd_receiver.c | 14 +--- drivers/block/floppy.c | 9 +-- drivers/block/loop.c | 5 +- drivers/block/pktcdvd.c | 3 +- drivers/md/bcache/debug.c | 11 ++- drivers/md/bcache/io.c | 3 +- drivers/md/bcache/journal.c | 3 +- drivers/md/bcache/movinggc.c | 6 +- drivers/md/bcache/super.c | 33 ++++++--- drivers/md/bcache/writeback.c | 4 +- drivers/md/dm-bufio.c | 3 +- drivers/md/dm-crypt.c | 8 +-- drivers/md/dm-io.c | 7 +- drivers/md/dm.c | 3 +- drivers/staging/lustre/lustre/llite/lloop.c | 9 +-- drivers/target/target_core_pscsi.c | 8 +-- fs/logfs/dev_bdev.c | 107 +++++++++++----------------- include/linux/bio.h | 21 ++++++ kernel/power/swap.c | 10 ++- mm/page_io.c | 18 ++++- 21 files changed, 155 insertions(+), 134 deletions(-) Thanks, Ming -- 1.9.1 From tom.leiming at gmail.com Thu Apr 14 12:02:26 2016 From: tom.leiming at gmail.com (Ming Lei) Date: Thu, 14 Apr 2016 20:02:26 +0800 Subject: [lustre-devel] [PATCH v1 08/27] staging: lustre: avoid to use bio->bi_vcnt directly In-Reply-To: <1460635375-28282-1-git-send-email-tom.leiming@gmail.com> References: <1460635375-28282-1-git-send-email-tom.leiming@gmail.com> Message-ID: <1460635375-28282-9-git-send-email-tom.leiming@gmail.com> Acked-by: Greg Kroah-Hartman Signed-off-by: Ming Lei --- drivers/staging/lustre/lustre/llite/lloop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index f169c0d..c7bdc2f 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -302,19 +302,20 @@ static unsigned int loop_get_bio(struct lloop_device *lo, struct bio **req) } /* TODO: need to split the bio, too bad. */ - LASSERT(first->bi_vcnt <= LLOOP_MAX_SEGMENTS); + LASSERT(bio_pages(first) <= LLOOP_MAX_SEGMENTS); rw = first->bi_rw; bio = &lo->lo_bio; while (*bio && (*bio)->bi_rw == rw) { + unsigned curr_cnt = bio_pages(*bio); CDEBUG(D_INFO, "bio sector %llu size %u count %u vcnt%u\n", (unsigned long long)(*bio)->bi_iter.bi_sector, (*bio)->bi_iter.bi_size, - page_count, (*bio)->bi_vcnt); - if (page_count + (*bio)->bi_vcnt > LLOOP_MAX_SEGMENTS) + page_count, curr_cnt); + if (page_count + curr_cnt > LLOOP_MAX_SEGMENTS) break; - page_count += (*bio)->bi_vcnt; + page_count += curr_cnt; count++; bio = &(*bio)->bi_next; } -- 1.9.1 From oleg.drokin at intel.com Thu Apr 21 01:44:58 2016 From: oleg.drokin at intel.com (Drokin, Oleg) Date: Thu, 21 Apr 2016 01:44:58 +0000 Subject: [lustre-devel] new tag 2.8.52 Message-ID: <7D2CE7D8-883E-4B77-A02E-2D8750A78572@intel.com> Hello! I just tagged a new 2.8.52 in the master branch of the opensfs tree. Here's the changelog: Alex Zhuravlev (3): LU-7408 target: comment as per inspection LU-7355 osd: supress useless warning about many credits LU-7772 llog: do not destroy llog twice Alexander Boyko (2): LU-7928 mdd: wrong params order at mdd_declare_rename LU-7156 mdd: add changelog_size to procfs Amir Shehata (1): LU-7101 lnet: per NI map-on-demand value Andrew Perepechko (1): LU-7925 llite: avoid clearing i_nlink for inodes in use Ben Evans (1): LU-6401 headers: move seq_range.h to correct directory Bob Glossman (3): LU-6163 kernel: use do_div64() for 64 bit divides LU-7907 kernel: kernel update RHEL 6.7 [2.6.32-573.22.1.el6] LU-7967 kernel: kernel update RHEL7.2 [3.10.0-327.13.1.el7] Christopher J. Morrone (2): LU-7962 build: Support builds w/ weak module ZFS LU-7699 build: Eliminate lustre_build_version.h Dmitry Eremin (5): LU-7887 lbuild: use "make rpms" for building Lustre RPMs LU-7968 lbuild: Fix reuse signature calculation LU-7936 utils: fix resource lost LU-7979 o2iblnd: fix free of IS_ERR pointer LU-7220 llog: fix fd lost and correct error reporting Emoly Liu (1): LU-7055 osd: move dput() out of osd_ost_fini()'s rwlock Fan Yong (1): LU-4182 tests: enable sanity-scrub test_15 under DNE mode Giuseppe Di Natale (1): LU-7060 ldev: Added MGS NID substitution to ldev Gregoire Pichon (1): LU-7965 utils: fix stack corruption in mkfs.lustre Hongchao Zhang (1): LU-7428 test: commit the label change to disk James Simmons (3): LU-6215 lprocfs: handle seq_printf api change LU-6245 libcfs: fix racey module handling LU-6245 libcfs: remove libcfs userland time abstraction Jinshan Xiong (1): LU-7990 rpc: increase bulk size Lai Siyao (1): LU-28 fileset: add fileset mount support Li Xi (1): LU-4931 ladvise: Add feature of giving file access advices Mike Shuey (1): LU-4423 lnet: remove LNET_MUTEX_LOCK macro Oleg Drokin (1): New version 2.8.52 Ryan Haasken (1): LU-7796 utils: print error with valueless lctl set_param Shivani Bhardwaj (1): LU-4423 lnet: Drop unnecessary wrapper function srpc_post_active_rqtbuf Vitaly Osipov (1): LU-4423 lnet: remove memset(0) after LIBCFS_ALLOC Yang Sheng (2): LU-7759 utils: build mount.lustre with libmount LU-6601 osp: update obd status while osp status changed From dan.carpenter at oracle.com Wed Apr 27 12:28:47 2016 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Wed, 27 Apr 2016 15:28:47 +0300 Subject: [lustre-devel] staging: add Lustre file system client support Message-ID: <20160427122846.GA6441@mwanda> Hello Lustre devs, The patch d7e09d0397e8: "staging: add Lustre file system client support" from May 2, 2013, leads to the following Parfait warning. Parfait is an Oracle static analysis tool. If there is a patch from this could you give credit to Lidza Louina ? drivers/staging/lustre/lustre/ldlm/interval_tree.c 399 void interval_erase(struct interval_node *node, 400 struct interval_node **root) 401 { 402 struct interval_node *child, *parent; 403 int color; 404 405 LASSERT(interval_is_intree(node)); 406 node->in_intree = 0; 407 if (!node->in_left) { 408 child = node->in_right; 409 } else if (!node->in_right) { 410 child = node->in_left; 411 } else { /* Both left and right child are not NULL */ 412 struct interval_node *old = node; 413 414 node = interval_next(node); ^^^^^^^^^^^^^^^^^^^^^^^^^^ It looks like interval_next() can return NULL. 415 child = node->in_right; 416 parent = node->in_parent; 417 color = node->in_color; 418 Here is the interval_next() function: drivers/staging/lustre/lustre/ldlm/interval_tree.c 111 static struct interval_node *interval_next(struct interval_node *node) 112 { 113 if (!node) 114 return NULL; 115 if (node->in_right) 116 return interval_first(node->in_right); 117 while (node->in_parent && node_is_right_child(node)) ^^^^^^^^^^^^^^^ We assume that ->in_parent can be NULL here. Is that actually possible? 118 node = node->in_parent; 119 return node->in_parent; 120 } regards, dan carpenter From jsimmons at infradead.org Wed Apr 27 22:20:54 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:54 -0400 Subject: [lustre-devel] [PATCH 02/15] staging: lustre: llite: NFS reexport issue In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-3-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Suppress erroneous/confusing messages when NFS is out of sync and requests old data. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4050 Reviewed-on: http://review.whamcloud.com/7850 Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_nfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index 193aab8..2c26815 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -119,7 +119,7 @@ struct inode *search_inode_for_lustre(struct super_block *sb, rc = md_getattr(sbi->ll_md_exp, op_data, &req); kfree(op_data); if (rc) { - CERROR("can't get object attrs, fid "DFID", rc %d\n", + CDEBUG(D_INFO, "can't get object attrs, fid "DFID", rc %d\n", PFID(fid), rc); return ERR_PTR(rc); } -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:20:52 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:52 -0400 Subject: [lustre-devel] [PATCH 00/15] patches missing from lustre 2.5.51 Message-ID: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> This is the collection of bug fixes and code cleanup that are missing from the upstream client that exist with lustre version 2.5.51. Andreas Dilger (1): staging: lustre: ptlrpc: quiet warning for 2.1/2.5 connections Bruce Korb (4): staging: lustre: ldlm: use accessor macros for l_flags staging: lustre: ldlm: clean up l_flags staging: lustre: ldlm: remove code wireshark handling staging: lustre: ldlm: update comments about ldlm l_flags Dmitry Eremin (2): staging: lustre: llite: NFS reexport issue staging: lustre: lmv: kernel crash due to misconfigured MDT James Nunez (1): staging: lustre: llite: Replace printing of i_ino with ll_inode2fid() Jinshan Xiong (1): staging: lustre: llite: reset writeback index in ll_writepages Niu Yawei (1): staging: lustre: clio: add debug message in osc_completion() Prakash Surya (3): staging: lustre: osc: Track and limit "unstable" pages staging: lustre: osc: Track number of "unstable" pages per osc staging: lustre: osc: Use SOFT_SYNC to urge server commit Sebastien Buisson (1): staging: lustre: mgc: fix 'error handling' issues Wang Di (1): staging: lustre: obdclass: add LCT_SERVER_SESSION for server session drivers/staging/lustre/lustre/include/cl_object.h | 10 ++ drivers/staging/lustre/lustre/include/lu_object.h | 4 + .../lustre/lustre/include/lustre/lustre_idl.h | 5 + .../lustre/lustre/include/lustre_dlm_flags.h | 120 ++-------------- drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- drivers/staging/lustre/lustre/include/obd.h | 3 +- drivers/staging/lustre/lustre/include/obd_class.h | 2 +- .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ldlm/l_lock.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 11 +- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 7 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 96 ++++++------- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++-- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 34 ++--- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 +- drivers/staging/lustre/lustre/llite/dcache.c | 15 +-- drivers/staging/lustre/lustre/llite/dir.c | 23 ++-- drivers/staging/lustre/lustre/llite/file.c | 76 +++++----- drivers/staging/lustre/lustre/llite/llite_close.c | 40 +++--- .../staging/lustre/lustre/llite/llite_internal.h | 16 ++- drivers/staging/lustre/lustre/llite/llite_lib.c | 60 +++++--- drivers/staging/lustre/lustre/llite/llite_mmap.c | 6 +- drivers/staging/lustre/lustre/llite/llite_nfs.c | 16 ++- drivers/staging/lustre/lustre/llite/lproc_llite.c | 18 +++ drivers/staging/lustre/lustre/llite/namei.c | 78 +++++------ drivers/staging/lustre/lustre/llite/rw.c | 5 +- drivers/staging/lustre/lustre/llite/rw26.c | 5 +- drivers/staging/lustre/lustre/llite/statahead.c | 17 +-- drivers/staging/lustre/lustre/llite/symlink.c | 10 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 5 +- drivers/staging/lustre/lustre/llite/xattr.c | 20 ++-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 151 ++++++++++++-------- drivers/staging/lustre/lustre/mgc/mgc_request.c | 6 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 + drivers/staging/lustre/lustre/osc/lproc_osc.c | 18 +++ drivers/staging/lustre/lustre/osc/osc_cache.c | 142 ++++++++++++++++-- drivers/staging/lustre/lustre/osc/osc_internal.h | 4 + drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- drivers/staging/lustre/lustre/osc/osc_page.c | 29 ++++ drivers/staging/lustre/lustre/osc/osc_request.c | 31 ++++- drivers/staging/lustre/lustre/ptlrpc/import.c | 11 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 6 + 45 files changed, 682 insertions(+), 479 deletions(-) From jsimmons at infradead.org Wed Apr 27 22:20:56 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:56 -0400 Subject: [lustre-devel] [PATCH 04/15] staging: lustre: lmv: kernel crash due to misconfigured MDT In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-5-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin There are few places with access to lmv->tgts[] without check for NULL. Usually it may happens when MDT configured starting from index 1 instead of 0. For example: mkfs.lustre --reformat --mgs --mdt --index=1 /dev/sdd1 Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4098 Reviewed-on: http://review.whamcloud.com/7941 Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 151 ++++++++++++++++---------- 1 files changed, 93 insertions(+), 58 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 2f6457f..9e31f6b 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -132,8 +132,9 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, struct obd_uuid *uuid, static struct obd_uuid *lmv_get_uuid(struct obd_export *exp) { struct lmv_obd *lmv = &exp->exp_obd->u.lmv; + struct lmv_tgt_desc *tgt = lmv->tgts[0]; - return obd_get_uuid(lmv->tgts[0]->ltd_exp); + return tgt ? obd_get_uuid(tgt->ltd_exp) : NULL; } static int lmv_notify(struct obd_device *obd, struct obd_device *watched, @@ -249,7 +250,6 @@ static int lmv_connect(const struct lu_env *env, static void lmv_set_timeouts(struct obd_device *obd) { - struct lmv_tgt_desc *tgt; struct lmv_obd *lmv; int i; @@ -261,8 +261,10 @@ static void lmv_set_timeouts(struct obd_device *obd) return; for (i = 0; i < lmv->desc.ld_tgt_count; i++) { + struct lmv_tgt_desc *tgt = lmv->tgts[i]; + tgt = lmv->tgts[i]; - if (!tgt || !tgt->ltd_exp || tgt->ltd_active == 0) + if (!tgt || !tgt->ltd_exp || !tgt->ltd_active) continue; obd_set_info_async(NULL, tgt->ltd_exp, sizeof(KEY_INTERMDS), @@ -302,13 +304,14 @@ static int lmv_init_ea_size(struct obd_export *exp, int easize, return 0; for (i = 0; i < lmv->desc.ld_tgt_count; i++) { - if (!lmv->tgts[i] || !lmv->tgts[i]->ltd_exp || - lmv->tgts[i]->ltd_active == 0) { + struct lmv_tgt_desc *tgt = lmv->tgts[i]; + + if (!tgt || !tgt->ltd_exp || !tgt->ltd_active) { CWARN("%s: NULL export for %d\n", obd->obd_name, i); continue; } - rc = md_init_ea_size(lmv->tgts[i]->ltd_exp, easize, def_easize, + rc = md_init_ea_size(tgt->ltd_exp, easize, def_easize, cookiesize, def_cookiesize); if (rc) { CERROR("%s: obd_init_ea_size() failed on MDT target %d: rc = %d\n", @@ -534,6 +537,15 @@ int lmv_check_connect(struct obd_device *obd) return -EINVAL; } + LASSERT(lmv->tgts); + + if (!lmv->tgts[0]) { + mutex_unlock(&lmv->lmv_init_mutex); + CERROR("%s: no target configured for index 0.\n", + obd->obd_name); + return -EINVAL; + } + CDEBUG(D_CONFIG, "Time to connect %s to %s\n", lmv->cluuid.uuid, obd->obd_name); @@ -796,6 +808,11 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len, /* unregister request (call from llapi_hsm_copytool_fini) */ for (i = 0; i < lmv->desc.ld_tgt_count; i++) { + struct lmv_tgt_desc *tgt = lmv->tgts[i]; + + if (!tgt || !tgt->ltd_exp) + continue; + /* best effort: try to clean as much as possible * (continue on error) */ @@ -825,20 +842,28 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, * except if it because of inactive target. */ for (i = 0; i < lmv->desc.ld_tgt_count; i++) { - err = obd_iocontrol(cmd, lmv->tgts[i]->ltd_exp, len, lk, uarg); + struct lmv_tgt_desc *tgt = lmv->tgts[i]; + + if (!tgt || !tgt->ltd_exp) + continue; + + err = obd_iocontrol(cmd, tgt->ltd_exp, len, lk, uarg); if (err) { - if (lmv->tgts[i]->ltd_active) { + if (tgt->ltd_active) { /* permanent error */ CERROR("error: iocontrol MDC %s on MDTidx %d cmd %x: err = %d\n", - lmv->tgts[i]->ltd_uuid.uuid, - i, cmd, err); + tgt->ltd_uuid.uuid, i, cmd, err); rc = err; lk->lk_flags |= LK_FLG_STOP; /* unregister from previous MDS */ - for (j = 0; j < i; j++) - obd_iocontrol(cmd, - lmv->tgts[j]->ltd_exp, - len, lk, uarg); + for (j = 0; j < i; j++) { + tgt = lmv->tgts[j]; + + if (!tgt || !tgt->ltd_exp) + continue; + obd_iocontrol(cmd, tgt->ltd_exp, len, + lk, uarg); + } return rc; } /* else: transient error. @@ -877,6 +902,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, { struct obd_device *obddev = class_exp2obd(exp); struct lmv_obd *lmv = &obddev->u.lmv; + struct lmv_tgt_desc *tgt = NULL; int i = 0; int rc = 0; int set = 0; @@ -896,10 +922,11 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, if (index >= count) return -ENODEV; - if (!lmv->tgts[index] || lmv->tgts[index]->ltd_active == 0) + tgt = lmv->tgts[index]; + if (!tgt || !tgt->ltd_active) return -ENODATA; - mdc_obd = class_exp2obd(lmv->tgts[index]->ltd_exp); + mdc_obd = class_exp2obd(tgt->ltd_exp); if (!mdc_obd) return -EINVAL; @@ -909,7 +936,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, (int)sizeof(struct obd_uuid)))) return -EFAULT; - rc = obd_statfs(NULL, lmv->tgts[index]->ltd_exp, &stat_buf, + rc = obd_statfs(NULL, tgt->ltd_exp, &stat_buf, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); if (rc) @@ -922,7 +949,6 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, } case OBD_IOC_QUOTACTL: { struct if_quotactl *qctl = karg; - struct lmv_tgt_desc *tgt = NULL; struct obd_quotactl *oqctl; if (qctl->qc_valid == QC_MDTIDX) { @@ -975,18 +1001,18 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, if (icc->icc_mdtindex >= count) return -ENODEV; - if (!lmv->tgts[icc->icc_mdtindex] || - !lmv->tgts[icc->icc_mdtindex]->ltd_exp || - lmv->tgts[icc->icc_mdtindex]->ltd_active == 0) + tgt = lmv->tgts[icc->icc_mdtindex]; + if (!tgt || !tgt->ltd_exp || !tgt->ltd_active) return -ENODEV; - rc = obd_iocontrol(cmd, lmv->tgts[icc->icc_mdtindex]->ltd_exp, - sizeof(*icc), icc, NULL); + rc = obd_iocontrol(cmd, tgt->ltd_exp, sizeof(*icc), icc, NULL); break; } case LL_IOC_GET_CONNECT_FLAGS: { - if (!lmv->tgts[0]) + tgt = lmv->tgts[0]; + + if (!tgt || !tgt->ltd_exp) return -ENODATA; - rc = obd_iocontrol(cmd, lmv->tgts[0]->ltd_exp, len, karg, uarg); + rc = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg); break; } case OBD_IOC_FID2PATH: { @@ -997,7 +1023,6 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, case LL_IOC_HSM_STATE_SET: case LL_IOC_HSM_ACTION: { struct md_op_data *op_data = karg; - struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, &op_data->op_fid1); if (IS_ERR(tgt)) @@ -1011,7 +1036,6 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, } case LL_IOC_HSM_PROGRESS: { const struct hsm_progress_kernel *hpk = karg; - struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, &hpk->hpk_fid); if (IS_ERR(tgt)) @@ -1021,7 +1045,6 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, } case LL_IOC_HSM_REQUEST: { struct hsm_user_request *hur = karg; - struct lmv_tgt_desc *tgt; unsigned int reqcount = hur->hur_request.hr_itemcount; if (reqcount == 0) @@ -1044,7 +1067,11 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, int rc1; struct hsm_user_request *req; - nr = lmv_hsm_req_count(lmv, hur, lmv->tgts[i]); + tgt = lmv->tgts[i]; + if (!tgt || !tgt->ltd_exp) + continue; + + nr = lmv_hsm_req_count(lmv, hur, tgt); if (nr == 0) /* nothing for this MDS */ continue; @@ -1056,10 +1083,10 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, if (!req) return -ENOMEM; - lmv_hsm_req_build(lmv, hur, lmv->tgts[i], req); + lmv_hsm_req_build(lmv, hur, tgt, req); - rc1 = obd_iocontrol(cmd, lmv->tgts[i]->ltd_exp, - reqlen, req, uarg); + rc1 = obd_iocontrol(cmd, tgt->ltd_exp, reqlen, + req, uarg); if (rc1 != 0 && rc == 0) rc = rc1; kvfree(req); @@ -1103,22 +1130,21 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, struct obd_device *mdc_obd; int err; - if (!lmv->tgts[i] || !lmv->tgts[i]->ltd_exp) + tgt = lmv->tgts[i]; + if (!tgt || !tgt->ltd_exp) continue; /* ll_umount_begin() sets force flag but for lmv, not * mdc. Let's pass it through */ - mdc_obd = class_exp2obd(lmv->tgts[i]->ltd_exp); + mdc_obd = class_exp2obd(tgt->ltd_exp); mdc_obd->obd_force = obddev->obd_force; - err = obd_iocontrol(cmd, lmv->tgts[i]->ltd_exp, len, - karg, uarg); + err = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg); if (err == -ENODATA && cmd == OBD_IOC_POLL_QUOTACHECK) { return err; } else if (err) { - if (lmv->tgts[i]->ltd_active) { + if (tgt->ltd_active) { CERROR("error: iocontrol MDC %s on MDTidx %d cmd %x: err = %d\n", - lmv->tgts[i]->ltd_uuid.uuid, - i, cmd, err); + tgt->ltd_uuid.uuid, i, cmd, err); if (!rc) rc = err; } @@ -2269,7 +2295,6 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp, lmv = &obd->u.lmv; if (keylen >= strlen("remote_flag") && !strcmp(key, "remote_flag")) { - struct lmv_tgt_desc *tgt; int i; rc = lmv_check_connect(obd); @@ -2278,7 +2303,8 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp, LASSERT(*vallen == sizeof(__u32)); for (i = 0; i < lmv->desc.ld_tgt_count; i++) { - tgt = lmv->tgts[i]; + struct lmv_tgt_desc *tgt = lmv->tgts[i]; + /* * All tgts should be connected when this gets called. */ @@ -2467,12 +2493,13 @@ static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid, LASSERT(fid); for (i = 0; i < lmv->desc.ld_tgt_count; i++) { - if (!lmv->tgts[i] || !lmv->tgts[i]->ltd_exp || - lmv->tgts[i]->ltd_active == 0) + struct lmv_tgt_desc *tgt = lmv->tgts[i]; + + if (!tgt || !tgt->ltd_exp || !tgt->ltd_active) continue; - err = md_cancel_unused(lmv->tgts[i]->ltd_exp, fid, - policy, mode, flags, opaque); + err = md_cancel_unused(tgt->ltd_exp, fid, policy, mode, flags, + opaque); if (!rc) rc = err; } @@ -2483,9 +2510,13 @@ static int lmv_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, __u64 *bits) { struct lmv_obd *lmv = &exp->exp_obd->u.lmv; + struct lmv_tgt_desc *tgt = lmv->tgts[0]; int rc; - rc = md_set_lock_data(lmv->tgts[0]->ltd_exp, lockh, data, bits); + if (!tgt || !tgt->ltd_exp) + return -EINVAL; + + rc = md_set_lock_data(tgt->ltd_exp, lockh, data, bits); return rc; } @@ -2510,12 +2541,13 @@ static enum ldlm_mode lmv_lock_match(struct obd_export *exp, __u64 flags, * one fid was created in. */ for (i = 0; i < lmv->desc.ld_tgt_count; i++) { - if (!lmv->tgts[i] || !lmv->tgts[i]->ltd_exp || - lmv->tgts[i]->ltd_active == 0) + struct lmv_tgt_desc *tgt = lmv->tgts[i]; + + if (!tgt || !tgt->ltd_exp || !tgt->ltd_active) continue; - rc = md_lock_match(lmv->tgts[i]->ltd_exp, flags, fid, - type, policy, mode, lockh); + rc = md_lock_match(tgt->ltd_exp, flags, fid, type, policy, mode, + lockh); if (rc) return rc; } @@ -2530,18 +2562,24 @@ static int lmv_get_lustre_md(struct obd_export *exp, struct lustre_md *md) { struct lmv_obd *lmv = &exp->exp_obd->u.lmv; + struct lmv_tgt_desc *tgt = lmv->tgts[0]; - return md_get_lustre_md(lmv->tgts[0]->ltd_exp, req, dt_exp, md_exp, md); + if (!tgt || !tgt->ltd_exp) + return -EINVAL; + return md_get_lustre_md(tgt->ltd_exp, req, dt_exp, md_exp, md); } static int lmv_free_lustre_md(struct obd_export *exp, struct lustre_md *md) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt = lmv->tgts[0]; if (md->mea) obd_free_memmd(exp, (void *)&md->mea); - return md_free_lustre_md(lmv->tgts[0]->ltd_exp, md); + if (!tgt || !tgt->ltd_exp) + return -EINVAL; + return md_free_lustre_md(tgt->ltd_exp, md); } static int lmv_set_open_replay_data(struct obd_export *exp, @@ -2650,7 +2688,8 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp, int rc = 0, i; __u64 curspace, curinodes; - if (!lmv->desc.ld_tgt_count || !tgt->ltd_active) { + if (!tgt || !tgt->ltd_exp || !tgt->ltd_active || + !lmv->desc.ld_tgt_count) { CERROR("master lmv inactive\n"); return -EIO; } @@ -2666,12 +2705,8 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp, tgt = lmv->tgts[i]; - if (!tgt || !tgt->ltd_exp || tgt->ltd_active == 0) + if (!tgt || !tgt->ltd_exp || !tgt->ltd_active) continue; - if (!tgt->ltd_active) { - CDEBUG(D_HA, "mdt %d is inactive.\n", i); - continue; - } err = obd_quotactl(tgt->ltd_exp, oqctl); if (err) { -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:02 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:02 -0400 Subject: [lustre-devel] [PATCH 10/15] staging: lustre: clio: add debug message in osc_completion() In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-11-git-send-email-jsimmons@infradead.org> From: Niu Yawei Replace LASSERT with LASSERTF in osc_completion, thus we can get more info when the LASSERT is triggered. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3843 Reviewed-on: http://review.whamcloud.com/7494 Reviewed-by: Bobi Jam Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index dccd309..de28e42 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1333,8 +1333,10 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, int srvlock; cmd &= ~OBD_BRW_NOQUOTA; - LASSERT(equi(page->cp_state == CPS_PAGEIN, cmd == OBD_BRW_READ)); - LASSERT(equi(page->cp_state == CPS_PAGEOUT, cmd == OBD_BRW_WRITE)); + LASSERTF(equi(page->cp_state == CPS_PAGEIN, cmd == OBD_BRW_READ), + "cp_state:%u, cmd:%d\n", page->cp_state, cmd); + LASSERTF(equi(page->cp_state == CPS_PAGEOUT, cmd == OBD_BRW_WRITE), + "cp_state:%u, cmd:%d\n", page->cp_state, cmd); LASSERT(opg->ops_transfer_pinned); /* -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:04 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:04 -0400 Subject: [lustre-devel] [PATCH 12/15] staging: lustre: osc: Track and limit "unstable" pages In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-13-git-send-email-jsimmons@infradead.org> From: Prakash Surya This change adds a global counter to track the number of "unstable" pages held by a given client, along with per file system counters. An "unstable" page is defined as a page which has been sent to the server as part of a bulk request, but is uncommitted to stable storage. In addition to simply tracking the unstable pages, they now also count towards the maximum number of "pinned" pages on the system at any given time. Thus, a client will now be bound on the number of dirty and unstable pages it can pin in memory. Previously only dirty pages were accounted for in this limit. In addition to tracking the number of unstable pages in Lustre, the NR_UNSTABLE_NFS memory zone is also incremented and decremented for easy monitoring using the "NFS_Unstable:" field in /proc/meminfo. This field is also used internally by the kernel to limit the total amount of unstable pages on the system. The motivation for this change is twofold. First, the client must not allow itself to disconnect from an OST while still holding unstable pages. Otherwise, these unstable pages can get lost due to an OST failure, and replay is not possible due to the disconnect via unmount. Secondly, the client needs a mechanism to prevent it from allocating too much of its available RAM to unreclaimable pages pinned by the ptlrpc layer. If this case occurs, out of memory events can trigger as a side effect, which we need to avoid. The current number of unstable pages accounted for on a per file system granularity is exported by the unstable_stats proc file, contained under each file system's llite namespace. An example of retrieving this information is below: $ lctl get_param llite.*.unstable_stats Signed-off-by: Prakash Surya Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2139 Reviewed-on: http://review.whamcloud.com/6284 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 10 ++ drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- drivers/staging/lustre/lustre/include/obd.h | 2 +- .../staging/lustre/lustre/include/obd_support.h | 1 + .../staging/lustre/lustre/llite/llite_internal.h | 6 + drivers/staging/lustre/lustre/llite/llite_lib.c | 20 ++++- drivers/staging/lustre/lustre/llite/lproc_llite.c | 18 ++++ drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 + drivers/staging/lustre/lustre/osc/osc_cache.c | 99 +++++++++++++++++++- drivers/staging/lustre/lustre/osc/osc_internal.h | 3 + drivers/staging/lustre/lustre/osc/osc_request.c | 28 +++++- 11 files changed, 182 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 918be65..587a236 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -2351,6 +2351,16 @@ struct cl_client_cache { * Lock to protect ccc_lru list */ spinlock_t ccc_lru_lock; + /** + * # of unstable pages for this mount point + */ + atomic_t ccc_unstable_nr; + /** + * Waitq for awaiting unstable pages to reach zero. + * Used at umounting time and signaled on BRW commit + */ + wait_queue_head_t ccc_unstable_waitq; + }; /** @} cl_page */ diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 69586a5..a7973d5 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1327,7 +1327,9 @@ struct ptlrpc_request { /* allow the req to be sent if the import is in recovery * status */ - rq_allow_replay:1; + rq_allow_replay:1, + /* bulk request, sent to server, but uncommitted */ + rq_unstable:1; unsigned int rq_nr_resend; diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index e97e25b..3f24a5b 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -477,7 +477,7 @@ struct lov_obd { struct dentry *lov_pool_debugfs_entry; enum lustre_sec_part lov_sp_me; - /* Cached LRU pages from upper layer */ + /* Cached LRU and unstable data from upper layer */ void *lov_cache; struct rw_semaphore lov_notify_lock; diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index f8ee3a3..c7267b7 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -58,6 +58,7 @@ extern int at_early_margin; extern int at_extra; extern unsigned int obd_sync_filter; extern unsigned int obd_max_dirty_pages; +extern atomic_t obd_unstable_pages; extern atomic_t obd_dirty_pages; extern atomic_t obd_dirty_transit_pages; extern char obd_jobid_var[]; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 2c6ae05..59e8ab1 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -491,6 +491,12 @@ struct ll_sb_info { struct lprocfs_stats *ll_stats; /* lprocfs stats counter */ + /* + * Used to track "unstable" pages on a client, and maintain a + * LRU list of clean pages. An "unstable" page is defined as + * any page which is sent to a server as part of a bulk request, + * but is uncommitted to stable storage. + */ struct cl_client_cache ll_cache; struct lprocfs_stats *ll_ra_stats; diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 55cddc7..8d88d4c 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -87,13 +87,16 @@ static struct ll_sb_info *ll_init_sbi(struct super_block *sb) pages = si.totalram - si.totalhigh; lru_page_max = pages / 2; - /* initialize lru data */ + /* initialize ll_cache data */ atomic_set(&sbi->ll_cache.ccc_users, 0); sbi->ll_cache.ccc_lru_max = lru_page_max; atomic_set(&sbi->ll_cache.ccc_lru_left, lru_page_max); spin_lock_init(&sbi->ll_cache.ccc_lru_lock); INIT_LIST_HEAD(&sbi->ll_cache.ccc_lru); + atomic_set(&sbi->ll_cache.ccc_unstable_nr, 0); + init_waitqueue_head(&sbi->ll_cache.ccc_unstable_waitq); + sbi->ll_ra_info.ra_max_pages_per_file = min(pages / 32, SBI_DEFAULT_READAHEAD_MAX); sbi->ll_ra_info.ra_max_pages = sbi->ll_ra_info.ra_max_pages_per_file; @@ -946,7 +949,7 @@ void ll_put_super(struct super_block *sb) struct lustre_sb_info *lsi = s2lsi(sb); struct ll_sb_info *sbi = ll_s2sbi(sb); char *profilenm = get_profile_name(sb); - int next, force = 1; + int ccc_count, next, force = 1, rc = 0; CDEBUG(D_VFSTRACE, "VFS Op: sb %p - %s\n", sb, profilenm); @@ -962,6 +965,19 @@ void ll_put_super(struct super_block *sb) force = obd->obd_force; } + /* Wait for unstable pages to be committed to stable storage */ + if (!force) { + struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); + + rc = l_wait_event(sbi->ll_cache.ccc_unstable_waitq, + !atomic_read(&sbi->ll_cache.ccc_unstable_nr), + &lwi); + } + + ccc_count = atomic_read(&sbi->ll_cache.ccc_unstable_nr); + if (!force && rc != -EINTR) + LASSERTF(!ccc_count, "count: %i\n", ccc_count); + /* We need to set force before the lov_disconnect in * lustre_common_put_super, since l_d cleans up osc's as well. */ diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 501b93b..55d62eb 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -824,6 +824,23 @@ static ssize_t xattr_cache_store(struct kobject *kobj, } LUSTRE_RW_ATTR(xattr_cache); +static ssize_t unstable_stats_show(struct kobject *kobj, + struct attribute *attr, + char *buf) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kobj); + struct cl_client_cache *cache = &sbi->ll_cache; + int pages, mb; + + pages = atomic_read(&cache->ccc_unstable_nr); + mb = (pages * PAGE_SIZE) >> 20; + + return sprintf(buf, "unstable_pages: %8d\n" + "unstable_mb: %8d\n", pages, mb); +} +LUSTRE_RO_ATTR(unstable_stats); + static struct lprocfs_vars lprocfs_llite_obd_vars[] = { /* { "mntpt_path", ll_rd_path, 0, 0 }, */ { "site", &ll_site_stats_fops, NULL, 0 }, @@ -859,6 +876,7 @@ static struct attribute *llite_attrs[] = { &lustre_attr_max_easize.attr, &lustre_attr_default_easize.attr, &lustre_attr_xattr_cache.attr, + &lustre_attr_unstable_stats.attr, NULL, }; diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index a3c7e7b..f48816a 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -60,6 +60,8 @@ unsigned int obd_dump_on_eviction; EXPORT_SYMBOL(obd_dump_on_eviction); unsigned int obd_max_dirty_pages = 256; EXPORT_SYMBOL(obd_max_dirty_pages); +atomic_t obd_unstable_pages; +EXPORT_SYMBOL(obd_unstable_pages); atomic_t obd_dirty_pages; EXPORT_SYMBOL(obd_dirty_pages); unsigned int obd_timeout = OBD_TIMEOUT_DEFAULT; /* seconds */ diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index de28e42..5cd8eef 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1388,11 +1388,13 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, #define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do { \ struct client_obd *__tmp = (cli); \ CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %d/%d " \ - "dropped: %ld avail: %ld, reserved: %ld, flight: %d } " \ - "lru {in list: %d, left: %d, waiters: %d }" fmt, \ + "unstable_pages: %d/%d dropped: %ld avail: %ld, " \ + "reserved: %ld, flight: %d } lru {in list: %d, " \ + "left: %d, waiters: %d }" fmt, \ __tmp->cl_import->imp_obd->obd_name, \ __tmp->cl_dirty, __tmp->cl_dirty_max, \ atomic_read(&obd_dirty_pages), obd_max_dirty_pages, \ + atomic_read(&obd_unstable_pages), obd_max_dirty_pages, \ __tmp->cl_lost_grant, __tmp->cl_avail_grant, \ __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, \ atomic_read(&__tmp->cl_lru_in_list), \ @@ -1544,7 +1546,8 @@ static int osc_enter_cache_try(struct client_obd *cli, return 0; if (cli->cl_dirty + PAGE_SIZE <= cli->cl_dirty_max && - atomic_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) { + atomic_read(&obd_unstable_pages) + 1 + + atomic_read(&obd_dirty_pages) <= obd_max_dirty_pages) { osc_consume_write_grant(cli, &oap->oap_brw_page); if (transient) { cli->cl_dirty_transit += PAGE_SIZE; @@ -1672,8 +1675,8 @@ void osc_wake_cache_waiters(struct client_obd *cli) ocw->ocw_rc = -EDQUOT; /* we can't dirty more */ if ((cli->cl_dirty + PAGE_SIZE > cli->cl_dirty_max) || - (atomic_read(&obd_dirty_pages) + 1 > - obd_max_dirty_pages)) { + (atomic_read(&obd_unstable_pages) + 1 + + atomic_read(&obd_dirty_pages) > obd_max_dirty_pages)) { CDEBUG(D_CACHE, "no dirty room: dirty: %ld osc max %ld, sys max %d\n", cli->cl_dirty, cli->cl_dirty_max, obd_max_dirty_pages); @@ -1844,6 +1847,89 @@ static void osc_process_ar(struct osc_async_rc *ar, __u64 xid, ar->ar_force_sync = 0; } +/** + * Performs "unstable" page accounting. This function balances the + * increment operations performed in osc_inc_unstable_pages. It is + * registered as the RPC request callback, and is executed when the + * bulk RPC is committed on the server. Thus at this point, the pages + * involved in the bulk transfer are no longer considered unstable. + */ +void osc_dec_unstable_pages(struct ptlrpc_request *req) +{ + struct client_obd *cli = &req->rq_import->imp_obd->u.cli; + struct ptlrpc_bulk_desc *desc = req->rq_bulk; + int page_count = desc->bd_iov_count; + int i; + + /* No unstable page tracking */ + if (!cli->cl_cache) + return; + + LASSERT(page_count >= 0); + + for (i = 0; i < page_count; i++) + dec_zone_page_state(desc->bd_iov[i].kiov_page, NR_UNSTABLE_NFS); + + atomic_sub(page_count, &cli->cl_cache->ccc_unstable_nr); + LASSERT(atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0); + + atomic_sub(page_count, &obd_unstable_pages); + LASSERT(atomic_read(&obd_unstable_pages) >= 0); + + spin_lock(&req->rq_lock); + req->rq_committed = 1; + req->rq_unstable = 0; + spin_unlock(&req->rq_lock); + + wake_up_all(&cli->cl_cache->ccc_unstable_waitq); +} + +/* "unstable" page accounting. See: osc_dec_unstable_pages. */ +void osc_inc_unstable_pages(struct ptlrpc_request *req) +{ + struct client_obd *cli = &req->rq_import->imp_obd->u.cli; + struct ptlrpc_bulk_desc *desc = req->rq_bulk; + long page_count = desc->bd_iov_count; + int i; + + /* No unstable page tracking */ + if (!cli->cl_cache) + return; + + LASSERT(page_count >= 0); + + for (i = 0; i < page_count; i++) + inc_zone_page_state(desc->bd_iov[i].kiov_page, NR_UNSTABLE_NFS); + + LASSERT(atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0); + atomic_add(page_count, &cli->cl_cache->ccc_unstable_nr); + + LASSERT(atomic_read(&obd_unstable_pages) >= 0); + atomic_add(page_count, &obd_unstable_pages); + + spin_lock(&req->rq_lock); + + /* + * If the request has already been committed (i.e. brw_commit + * called via rq_commit_cb), we need to undo the unstable page + * increments we just performed because rq_commit_cb wont be + * called again. Otherwise, just set the commit callback so the + * unstable page accounting is properly updated when the request + * is committed + */ + if (req->rq_committed) { + /* Drop lock before calling osc_dec_unstable_pages */ + spin_unlock(&req->rq_lock); + osc_dec_unstable_pages(req); + spin_lock(&req->rq_lock); + } else { + req->rq_unstable = 1; + req->rq_commit_cb = osc_dec_unstable_pages; + } + + spin_unlock(&req->rq_lock); +} + /* this must be called holding the loi list lock to give coverage to exit_cache, * async_flag maintenance, and oap_request */ @@ -1855,6 +1941,9 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, __u64 xid = 0; if (oap->oap_request) { + if (!rc) + osc_inc_unstable_pages(oap->oap_request); + xid = ptlrpc_req_xid(oap->oap_request); ptlrpc_req_finished(oap->oap_request); oap->oap_request = NULL; diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index cf9f8b7..39e6138 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -200,6 +200,9 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp, int osc_quotacheck(struct obd_device *unused, struct obd_export *exp, struct obd_quotactl *oqctl); int osc_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk); +void osc_inc_unstable_pages(struct ptlrpc_request *req); +void osc_dec_unstable_pages(struct ptlrpc_request *req); + struct ldlm_lock *osc_dlmlock_at_pgoff(const struct lu_env *env, struct osc_object *obj, pgoff_t index, int pending, int canceling); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index e5794fb..e8a80eb 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -809,14 +809,17 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, CERROR("dirty %lu - %lu > dirty_max %lu\n", cli->cl_dirty, cli->cl_dirty_transit, cli->cl_dirty_max); oa->o_undirty = 0; - } else if (unlikely(atomic_read(&obd_dirty_pages) - + } else if (unlikely(atomic_read(&obd_unstable_pages) + + atomic_read(&obd_dirty_pages) - atomic_read(&obd_dirty_transit_pages) > (long)(obd_max_dirty_pages + 1))) { /* The atomic_read() allowing the atomic_inc() are * not covered by a lock thus they may safely race and trip * this CERROR() unless we add in a small fudge factor (+1). */ - CERROR("dirty %d - %d > system dirty_max %d\n", + CERROR("%s: dirty %d + %d - %d > system dirty_max %d\n", + cli->cl_import->imp_obd->obd_name, + atomic_read(&obd_unstable_pages), atomic_read(&obd_dirty_pages), atomic_read(&obd_dirty_transit_pages), obd_max_dirty_pages); @@ -1655,6 +1658,7 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, aa->aa_resends++; new_req->rq_interpret_reply = request->rq_interpret_reply; new_req->rq_async_args = request->rq_async_args; + new_req->rq_commit_cb = request->rq_commit_cb; /* cap resend delay to the current request timeout, this is similar to * what ptlrpc does (see after_reply()) */ @@ -1843,6 +1847,25 @@ static int brw_interpret(const struct lu_env *env, return rc; } +static void brw_commit(struct ptlrpc_request *req) +{ + spin_lock(&req->rq_lock); + /* + * If osc_inc_unstable_pages (via osc_extent_finish) races with + * this called via the rq_commit_cb, I need to ensure + * osc_dec_unstable_pages is still called. Otherwise unstable + * pages may be leaked. + */ + if (req->rq_unstable) { + spin_unlock(&req->rq_lock); + osc_dec_unstable_pages(req); + spin_lock(&req->rq_lock); + } else { + req->rq_committed = 1; + } + spin_unlock(&req->rq_lock); +} + /** * Build an RPC by the list of extent @ext_list. The caller must ensure * that the total pages in this list are NOT over max pages per RPC. @@ -1962,6 +1985,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, goto out; } + req->rq_commit_cb = brw_commit; req->rq_interpret_reply = brw_interpret; if (mem_tight != 0) -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:06 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:06 -0400 Subject: [lustre-devel] [PATCH 14/15] staging: lustre: osc: Use SOFT_SYNC to urge server commit In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-15-git-send-email-jsimmons@infradead.org> From: Prakash Surya This change adds a BRW page flag, OBD_BRW_SOFT_SYNC. This flag is intended to urge a server to commit a client's unstable pages to stable storage. A client will add this flag to any BRW requests while it is in a state where it has "many" unstable pages pinned in its cache. The server, upon receiving a page with this flag set, *should* begin an async commit. The idea being that, with the proactive async commit, the client's pinned unstable pages will transition into a stable state faster than they would have otherwise. Although, the server side portion of this agreement is still unimplemented, so the OBD_BRW_SOFT_SYNC flag will currently fall on deaf ears. Signed-off-by: Prakash Surya Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2139 Reviewed-on: http://review.whamcloud.com/4375 Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre/lustre_idl.h | 5 +++ drivers/staging/lustre/lustre/osc/osc_cache.c | 3 ++ drivers/staging/lustre/lustre/osc/osc_internal.h | 1 + drivers/staging/lustre/lustre/osc/osc_page.c | 29 ++++++++++++++++++++ drivers/staging/lustre/lustre/osc/osc_request.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 6 ++++ 6 files changed, 46 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index c3565bf..26819ee 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1734,6 +1734,11 @@ void lustre_swab_obd_statfs(struct obd_statfs *os); #define OBD_BRW_MEMALLOC 0x800 /* Client runs in the "kswapd" context */ #define OBD_BRW_OVER_USRQUOTA 0x1000 /* Running out of user quota */ #define OBD_BRW_OVER_GRPQUOTA 0x2000 /* Running out of group quota */ +#define OBD_BRW_SOFT_SYNC 0x4000 /* This flag notifies the server + * that the client is running low on + * space for unstable pages; asking + * it to sync quickly + */ #define OBD_OBJECT_EOF 0xffffffffffffffffULL diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 7d1c2c5..5a14bea 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2437,6 +2437,9 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, return rc; } + if (osc_over_unstable_soft_limit(cli)) + brw_flags |= OBD_BRW_SOFT_SYNC; + oap->oap_cmd = cmd; oap->oap_page_off = ops->ops_from; oap->oap_count = ops->ops_to - ops->ops_from; diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 39e6138..7fad827 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -202,6 +202,7 @@ int osc_quotacheck(struct obd_device *unused, struct obd_export *exp, int osc_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk); void osc_inc_unstable_pages(struct ptlrpc_request *req); void osc_dec_unstable_pages(struct ptlrpc_request *req); +int osc_over_unstable_soft_limit(struct client_obd *cli); struct ldlm_lock *osc_dlmlock_at_pgoff(const struct lu_env *env, struct osc_object *obj, pgoff_t index, diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 5ec5508..c29c2ea 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -346,6 +346,32 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, return result; } +int osc_over_unstable_soft_limit(struct client_obd *cli) +{ + long obd_upages, obd_dpages, osc_upages; + + /* Can't check cli->cl_unstable_count, therefore, no soft limit */ + if (!cli) + return 0; + + obd_upages = atomic_read(&obd_unstable_pages); + obd_dpages = atomic_read(&obd_dirty_pages); + + osc_upages = atomic_read(&cli->cl_unstable_count); + + /* + * obd_max_dirty_pages is the max number of (dirty + unstable) + * pages allowed at any given time. To simulate an unstable page + * only limit, we subtract the current number of dirty pages + * from this max. This difference is roughly the amount of pages + * currently available for unstable pages. Thus, the soft limit + * is half of that difference. Check osc_upages to ensure we don't + * set SOFT_SYNC for OSCs without any outstanding unstable pages. + */ + return osc_upages && + obd_upages >= (obd_max_dirty_pages - obd_dpages) / 2; +} + /** * Helper function called by osc_io_submit() for every page in an immediate * transfer (i.e., transferred synchronously). @@ -369,6 +395,9 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, oap->oap_count = opg->ops_to - opg->ops_from; oap->oap_brw_flags = brw_flags | OBD_BRW_SYNC; + if (osc_over_unstable_soft_limit(oap->oap_cli)) + oap->oap_brw_flags |= OBD_BRW_SOFT_SYNC; + if (!client_is_remote(osc_export(obj)) && capable(CFS_CAP_SYS_RESOURCE)) { oap->oap_brw_flags |= OBD_BRW_NOQUOTA; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index e8a80eb..df06f4f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1147,7 +1147,8 @@ static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2) { if (p1->flag != p2->flag) { unsigned mask = ~(OBD_BRW_FROM_GRANT | OBD_BRW_NOCACHE | - OBD_BRW_SYNC | OBD_BRW_ASYNC|OBD_BRW_NOQUOTA); + OBD_BRW_SYNC | OBD_BRW_ASYNC | + OBD_BRW_NOQUOTA | OBD_BRW_SOFT_SYNC); /* warn if we try to combine flags that we don't know to be * safe to combine diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 3ffd2d9..87555e4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -1639,6 +1639,12 @@ void lustre_assert_wire_constants(void) OBD_BRW_ASYNC); LASSERTF(OBD_BRW_MEMALLOC == 0x800, "found 0x%.8x\n", OBD_BRW_MEMALLOC); + LASSERTF(OBD_BRW_OVER_USRQUOTA == 0x1000, "found 0x%.8x\n", + OBD_BRW_OVER_USRQUOTA); + LASSERTF(OBD_BRW_OVER_GRPQUOTA == 0x2000, "found 0x%.8x\n", + OBD_BRW_OVER_GRPQUOTA); + LASSERTF(OBD_BRW_SOFT_SYNC == 0x4000, "found 0x%.8x\n", + OBD_BRW_SOFT_SYNC); /* Checks for struct ost_body */ LASSERTF((int)sizeof(struct ost_body) == 208, "found %lld\n", -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:20:53 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:53 -0400 Subject: [lustre-devel] [PATCH 01/15] staging: lustre: llite: reset writeback index in ll_writepages In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-2-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Otherwise after one round the writeback index will become beyond the file size and ->writepages() turns into an empty operation. Also, a safety guard is added to limit the wait time for grant to 10 minutes(take recovery into consideration) at maximum in the osc_enter_cache() function. Otherwise, EDQUOT will be returned to the applications to start sync write. Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3416 Reviewed-on: http://review.whamcloud.com/6554 Reviewed-by: Bobi Jam Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/rw.c | 5 ++- drivers/staging/lustre/lustre/osc/osc_cache.c | 32 +++++++++++++++++------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 4ddf8b3..3363977 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -1105,8 +1105,9 @@ int ll_writepages(struct address_space *mapping, struct writeback_control *wbc) if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) { if (end == OBD_OBJECT_EOF) - end = i_size_read(inode); - mapping->writeback_index = (end >> PAGE_SHIFT) + 1; + mapping->writeback_index = 0; + else + mapping->writeback_index = (end >> PAGE_SHIFT) + 1; } return result; } diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 43d8bcc..dccd309 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1383,15 +1383,19 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, return 0; } -#define OSC_DUMP_GRANT(cli, fmt, args...) do { \ +#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do { \ struct client_obd *__tmp = (cli); \ - CDEBUG(D_CACHE, "%s: { dirty: %ld/%ld dirty_pages: %d/%d " \ - "dropped: %ld avail: %ld, reserved: %ld, flight: %d } " fmt, \ + CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %d/%d " \ + "dropped: %ld avail: %ld, reserved: %ld, flight: %d } " \ + "lru {in list: %d, left: %d, waiters: %d }" fmt, \ __tmp->cl_import->imp_obd->obd_name, \ __tmp->cl_dirty, __tmp->cl_dirty_max, \ atomic_read(&obd_dirty_pages), obd_max_dirty_pages, \ __tmp->cl_lost_grant, __tmp->cl_avail_grant, \ - __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, ##args); \ + __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, \ + atomic_read(&__tmp->cl_lru_in_list), \ + atomic_read(&__tmp->cl_lru_busy), \ + atomic_read(&__tmp->cl_lru_shrinkers), ##args); \ } while (0) /* caller must hold loi_list_lock */ @@ -1531,7 +1535,7 @@ static int osc_enter_cache_try(struct client_obd *cli, { int rc; - OSC_DUMP_GRANT(cli, "need:%d.\n", bytes); + OSC_DUMP_GRANT(D_CACHE, cli, "need:%d.\n", bytes); rc = osc_reserve_grant(cli, bytes); if (rc < 0) @@ -1576,10 +1580,11 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, struct osc_object *osc = oap->oap_obj; struct lov_oinfo *loi = osc->oo_oinfo; struct osc_cache_waiter ocw; - struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); + struct l_wait_info lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(600), NULL, + LWI_ON_SIGNAL_NOOP, NULL); int rc = -EDQUOT; - OSC_DUMP_GRANT(cli, "need:%d.\n", bytes); + OSC_DUMP_GRANT(D_CACHE, cli, "need:%d.\n", bytes); spin_lock(&cli->cl_loi_list_lock); @@ -1623,8 +1628,15 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, spin_lock(&cli->cl_loi_list_lock); - /* l_wait_event is interrupted by signal */ + /* l_wait_event is interrupted by signal, or timed out */ if (rc < 0) { + if (rc == -ETIMEDOUT) { + OSC_DUMP_GRANT(D_ERROR, cli, + "try to reserve %d.\n", bytes); + osc_extent_tree_dump(D_ERROR, osc); + rc = -EDQUOT; + } + list_del_init(&ocw.ocw_entry); goto out; } @@ -1641,7 +1653,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, } out: spin_unlock(&cli->cl_loi_list_lock); - OSC_DUMP_GRANT(cli, "returned %d.\n", rc); + OSC_DUMP_GRANT(D_CACHE, cli, "returned %d.\n", rc); return rc; } @@ -3014,7 +3026,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, result = rc; } - OSC_IO_DEBUG(obj, "cache page out.\n"); + OSC_IO_DEBUG(obj, "pageout [%lu, %lu], %d.\n", start, end, result); return result; } -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:20:57 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:57 -0400 Subject: [lustre-devel] [PATCH 05/15] staging: lustre: ldlm: use accessor macros for l_flags In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-6-git-send-email-jsimmons@infradead.org> From: Bruce Korb Convert most of the ldlm lock's l_flags references from direct bit twiddling to using bit specific macros. A few multi-bit operations are left as an exercise for the reader. The changes are mostly in ldlm, but also in llite, osc and quota. Also add a multi-bit (mask) test. Signed-off-by: Bruce Korb Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906 Reviewed-by: Keith Mannthey Reviewed-on: http://review.whamcloud.com/7963 Reviewed-by: Doug Oucharek Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre_dlm_flags.h | 3 + drivers/staging/lustre/lustre/ldlm/l_lock.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 11 +-- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 7 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 95 ++++++++++---------- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 26 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 32 +++---- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 12 ++-- drivers/staging/lustre/lustre/llite/dcache.c | 7 +- drivers/staging/lustre/lustre/llite/file.c | 6 +- drivers/staging/lustre/lustre/llite/namei.c | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 2 +- 13 files changed, 102 insertions(+), 109 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index 7f2ba2f..aff0904 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -381,6 +381,9 @@ /** test for ldlm_lock flag bit set */ #define LDLM_TEST_FLAG(_l, _b) (((_l)->l_flags & (_b)) != 0) +/** multi-bit test: are any of mask bits set? */ +#define LDLM_HAVE_MASK(_l, _m) ((_l)->l_flags & LDLM_FL_##_m##_MASK) + /** set a ldlm_lock flag bit */ #define LDLM_SET_FLAG(_l, _b) ((_l)->l_flags |= (_b)) diff --git a/drivers/staging/lustre/lustre/ldlm/l_lock.c b/drivers/staging/lustre/lustre/ldlm/l_lock.c index e5d1344..621323f 100644 --- a/drivers/staging/lustre/lustre/ldlm/l_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/l_lock.c @@ -54,7 +54,7 @@ struct ldlm_resource *lock_res_and_lock(struct ldlm_lock *lock) lock_res(lock->l_resource); - lock->l_flags |= LDLM_FL_RES_LOCKED; + ldlm_set_res_locked(lock); return lock->l_resource; } EXPORT_SYMBOL(lock_res_and_lock); @@ -65,7 +65,7 @@ EXPORT_SYMBOL(lock_res_and_lock); void unlock_res_and_lock(struct ldlm_lock *lock) { /* on server-side resource of lock doesn't change */ - lock->l_flags &= ~LDLM_FL_RES_LOCKED; + ldlm_clear_res_locked(lock); unlock_res(lock->l_resource); spin_unlock(&lock->l_lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index a803e20..cf1f178 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -75,12 +75,12 @@ __u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms) * just after we finish and take our lock into account in its * calculation of the kms */ - lock->l_flags |= LDLM_FL_KMS_IGNORE; + ldlm_set_kms_ignore(lock); list_for_each(tmp, &res->lr_granted) { lck = list_entry(tmp, struct ldlm_lock, l_res_link); - if (lck->l_flags & LDLM_FL_KMS_IGNORE) + if (ldlm_is_kms_ignore(lck)) continue; if (lck->l_policy_data.l_extent.end >= old_kms) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 5102d78..349bfcc 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -101,8 +101,7 @@ ldlm_flock_destroy(struct ldlm_lock *lock, enum ldlm_mode mode, __u64 flags) LASSERT(hlist_unhashed(&lock->l_exp_flock_hash)); list_del_init(&lock->l_res_link); - if (flags == LDLM_FL_WAIT_NOREPROC && - !(lock->l_flags & LDLM_FL_FAILED)) { + if (flags == LDLM_FL_WAIT_NOREPROC && !ldlm_is_failed(lock)) { /* client side - set a flag to prevent sending a CANCEL */ lock->l_flags |= LDLM_FL_LOCAL_ONLY | LDLM_FL_CBPENDING; @@ -436,7 +435,7 @@ ldlm_flock_interrupted_wait(void *data) lock_res_and_lock(lock); /* client side - set flag to prevent lock from being put on LRU list */ - lock->l_flags |= LDLM_FL_CBPENDING; + ldlm_set_cbpending(lock); unlock_res_and_lock(lock); } @@ -520,7 +519,7 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) granted: OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT, 10); - if (lock->l_flags & LDLM_FL_FAILED) { + if (ldlm_is_failed(lock)) { LDLM_DEBUG(lock, "client-side enqueue waking up: failed"); return -EIO; } @@ -533,7 +532,7 @@ granted: * Protect against race where lock could have been just destroyed * due to overlap in ldlm_process_flock_lock(). */ - if (lock->l_flags & LDLM_FL_DESTROYED) { + if (ldlm_is_destroyed(lock)) { unlock_res_and_lock(lock); LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed"); return 0; @@ -542,7 +541,7 @@ granted: /* ldlm_lock_enqueue() has already placed lock on the granted list. */ list_del_init(&lock->l_res_link); - if (lock->l_flags & LDLM_FL_FLOCK_DEADLOCK) { + if (ldlm_is_flock_deadlock(lock)) { LDLM_DEBUG(lock, "client-side enqueue deadlock received"); rc = -EDEADLK; } else if (flags & LDLM_FL_TEST_LOCK) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index ba643e6..32f227f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -305,9 +305,10 @@ static inline int is_granted_or_cancelled(struct ldlm_lock *lock) int ret = 0; lock_res_and_lock(lock); - if (((lock->l_req_mode == lock->l_granted_mode) && - !(lock->l_flags & LDLM_FL_CP_REQD)) || - (lock->l_flags & (LDLM_FL_FAILED | LDLM_FL_CANCEL))) + if ((lock->l_req_mode == lock->l_granted_mode) && + !ldlm_is_cp_reqd(lock)) + ret = 1; + else if (ldlm_is_failed(lock) || ldlm_is_cancel(lock)) ret = 1; unlock_res_and_lock(lock); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 6c27b23..bff94ea 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -185,7 +185,7 @@ void ldlm_lock_put(struct ldlm_lock *lock) "final lock_put on destroyed lock, freeing it."); res = lock->l_resource; - LASSERT(lock->l_flags & LDLM_FL_DESTROYED); + LASSERT(ldlm_is_destroyed(lock)); LASSERT(list_empty(&lock->l_res_link)); LASSERT(list_empty(&lock->l_pending_chain)); @@ -262,8 +262,7 @@ static void ldlm_lock_add_to_lru_nolock(struct ldlm_lock *lock) LASSERT(list_empty(&lock->l_lru)); LASSERT(lock->l_resource->lr_type != LDLM_FLOCK); list_add_tail(&lock->l_lru, &ns->ns_unused_list); - if (lock->l_flags & LDLM_FL_SKIPPED) - lock->l_flags &= ~LDLM_FL_SKIPPED; + ldlm_clear_skipped(lock); LASSERT(ns->ns_nr_unused >= 0); ns->ns_nr_unused++; } @@ -328,11 +327,11 @@ static int ldlm_lock_destroy_internal(struct ldlm_lock *lock) LBUG(); } - if (lock->l_flags & LDLM_FL_DESTROYED) { + if (ldlm_is_destroyed(lock)) { LASSERT(list_empty(&lock->l_lru)); return 0; } - lock->l_flags |= LDLM_FL_DESTROYED; + ldlm_set_destroyed(lock); if (lock->l_export && lock->l_export->exp_lock_hash) { /* NB: it's safe to call cfs_hash_del() even lock isn't @@ -554,7 +553,7 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle, /* It's unlikely but possible that someone marked the lock as * destroyed after we did handle2object on it */ - if (flags == 0 && ((lock->l_flags & LDLM_FL_DESTROYED) == 0)) { + if (flags == 0 && !ldlm_is_destroyed(lock)) { lu_ref_add(&lock->l_reference, "handle", current); return lock; } @@ -564,21 +563,22 @@ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle, LASSERT(lock->l_resource); lu_ref_add_atomic(&lock->l_reference, "handle", current); - if (unlikely(lock->l_flags & LDLM_FL_DESTROYED)) { + if (unlikely(ldlm_is_destroyed(lock))) { unlock_res_and_lock(lock); CDEBUG(D_INFO, "lock already destroyed: lock %p\n", lock); LDLM_LOCK_PUT(lock); return NULL; } - if (flags && (lock->l_flags & flags)) { - unlock_res_and_lock(lock); - LDLM_LOCK_PUT(lock); - return NULL; - } + if (flags) { + if (lock->l_flags & flags) { + unlock_res_and_lock(lock); + LDLM_LOCK_PUT(lock); + return NULL; + } - if (flags) lock->l_flags |= flags; + } unlock_res_and_lock(lock); return lock; @@ -609,14 +609,14 @@ EXPORT_SYMBOL(ldlm_lock2desc); static void ldlm_add_bl_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, struct list_head *work_list) { - if ((lock->l_flags & LDLM_FL_AST_SENT) == 0) { + if (!ldlm_is_ast_sent(lock)) { LDLM_DEBUG(lock, "lock incompatible; sending blocking AST."); - lock->l_flags |= LDLM_FL_AST_SENT; + ldlm_set_ast_sent(lock); /* If the enqueuing client said so, tell the AST recipient to * discard dirty data, rather than writing back. */ - if (new->l_flags & LDLM_FL_AST_DISCARD_DATA) - lock->l_flags |= LDLM_FL_DISCARD_DATA; + if (ldlm_is_ast_discard_data(new)) + ldlm_set_discard_data(lock); LASSERT(list_empty(&lock->l_bl_ast)); list_add(&lock->l_bl_ast, work_list); LDLM_LOCK_GET(lock); @@ -631,8 +631,8 @@ static void ldlm_add_bl_work_item(struct ldlm_lock *lock, struct ldlm_lock *new, static void ldlm_add_cp_work_item(struct ldlm_lock *lock, struct list_head *work_list) { - if ((lock->l_flags & LDLM_FL_CP_REQD) == 0) { - lock->l_flags |= LDLM_FL_CP_REQD; + if (!ldlm_is_cp_reqd(lock)) { + ldlm_set_cp_reqd(lock); LDLM_DEBUG(lock, "lock granted; sending completion AST."); LASSERT(list_empty(&lock->l_cp_ast)); list_add(&lock->l_cp_ast, work_list); @@ -714,7 +714,7 @@ int ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode) if (lock) { lock_res_and_lock(lock); if (lock->l_readers != 0 || lock->l_writers != 0 || - !(lock->l_flags & LDLM_FL_CBPENDING)) { + !ldlm_is_cbpending(lock)) { ldlm_lock_addref_internal_nolock(lock, mode); result = 0; } @@ -780,17 +780,17 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) ldlm_lock_decref_internal_nolock(lock, mode); - if (lock->l_flags & LDLM_FL_LOCAL && + if (ldlm_is_local(lock) && !lock->l_readers && !lock->l_writers) { /* If this is a local lock on a server namespace and this was * the last reference, cancel the lock. */ CDEBUG(D_INFO, "forcing cancel of local lock\n"); - lock->l_flags |= LDLM_FL_CBPENDING; + ldlm_set_cbpending(lock); } if (!lock->l_readers && !lock->l_writers && - (lock->l_flags & LDLM_FL_CBPENDING)) { + ldlm_is_cbpending(lock)) { /* If we received a blocked AST and this was the last reference, * run the callback. */ @@ -801,15 +801,14 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) ldlm_lock_remove_from_lru(lock); unlock_res_and_lock(lock); - if (lock->l_flags & LDLM_FL_FAIL_LOC) + if (ldlm_is_fail_loc(lock)) OBD_RACE(OBD_FAIL_LDLM_CP_BL_RACE); - if ((lock->l_flags & LDLM_FL_ATOMIC_CB) || + if (ldlm_is_atomic_cb(lock) || ldlm_bl_to_thread_lock(ns, NULL, lock) != 0) ldlm_handle_bl_callback(ns, NULL, lock); } else if (!lock->l_readers && !lock->l_writers && - !(lock->l_flags & LDLM_FL_NO_LRU) && - !(lock->l_flags & LDLM_FL_BL_AST)) { + !ldlm_is_no_lru(lock) && !ldlm_is_bl_ast(lock)) { LDLM_DEBUG(lock, "add lock into lru list"); /* If this is a client-side namespace and this was the last @@ -818,7 +817,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode) ldlm_lock_add_to_lru(lock); unlock_res_and_lock(lock); - if (lock->l_flags & LDLM_FL_FAIL_LOC) + if (ldlm_is_fail_loc(lock)) OBD_RACE(OBD_FAIL_LDLM_CP_BL_RACE); /* Call ldlm_cancel_lru() only if EARLY_CANCEL and LRU RESIZE @@ -862,7 +861,7 @@ void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode) LDLM_DEBUG(lock, "ldlm_lock_decref(%s)", ldlm_lockname[mode]); lock_res_and_lock(lock); - lock->l_flags |= LDLM_FL_CBPENDING; + ldlm_set_cbpending(lock); unlock_res_and_lock(lock); ldlm_lock_decref_internal(lock, mode); LDLM_LOCK_PUT(lock); @@ -980,7 +979,7 @@ static void ldlm_granted_list_add_lock(struct ldlm_lock *lock, ldlm_resource_dump(D_INFO, res); LDLM_DEBUG(lock, "About to add lock:"); - if (lock->l_flags & LDLM_FL_DESTROYED) { + if (ldlm_is_destroyed(lock)) { CDEBUG(D_OTHER, "Lock destroyed, not adding to resource\n"); return; } @@ -1082,10 +1081,9 @@ static struct ldlm_lock *search_queue(struct list_head *queue, * whose parents already hold a lock so forward progress * can still happen. */ - if (lock->l_flags & LDLM_FL_CBPENDING && - !(flags & LDLM_FL_CBPENDING)) + if (ldlm_is_cbpending(lock) && !(flags & LDLM_FL_CBPENDING)) continue; - if (!unref && lock->l_flags & LDLM_FL_CBPENDING && + if (!unref && ldlm_is_cbpending(lock) && lock->l_readers == 0 && lock->l_writers == 0) continue; @@ -1114,11 +1112,10 @@ static struct ldlm_lock *search_queue(struct list_head *queue, policy->l_inodebits.bits)) continue; - if (!unref && (lock->l_flags & LDLM_FL_GONE_MASK)) + if (!unref && LDLM_HAVE_MASK(lock, GONE)) continue; - if ((flags & LDLM_FL_LOCAL_ONLY) && - !(lock->l_flags & LDLM_FL_LOCAL)) + if ((flags & LDLM_FL_LOCAL_ONLY) && !ldlm_is_local(lock)) continue; if (flags & LDLM_FL_TEST_LOCK) { @@ -1152,7 +1149,7 @@ EXPORT_SYMBOL(ldlm_lock_fail_match_locked); */ void ldlm_lock_allow_match_locked(struct ldlm_lock *lock) { - lock->l_flags |= LDLM_FL_LVB_READY; + ldlm_set_lvb_ready(lock); wake_up_all(&lock->l_waitq); } EXPORT_SYMBOL(ldlm_lock_allow_match_locked); @@ -1253,8 +1250,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, if (lock) { ldlm_lock2handle(lock, lockh); - if ((flags & LDLM_FL_LVB_READY) && - (!(lock->l_flags & LDLM_FL_LVB_READY))) { + if ((flags & LDLM_FL_LVB_READY) && !ldlm_is_lvb_ready(lock)) { __u64 wait_flags = LDLM_FL_LVB_READY | LDLM_FL_DESTROYED | LDLM_FL_FAIL_NOTIFIED; struct l_wait_info lwi; @@ -1281,7 +1277,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, l_wait_event(lock->l_waitq, lock->l_flags & wait_flags, &lwi); - if (!(lock->l_flags & LDLM_FL_LVB_READY)) { + if (!ldlm_is_lvb_ready(lock)) { if (flags & LDLM_FL_TEST_LOCK) LDLM_LOCK_RELEASE(lock); else @@ -1335,10 +1331,10 @@ enum ldlm_mode ldlm_revalidate_lock_handle(struct lustre_handle *lockh, lock = ldlm_handle2lock(lockh); if (lock) { lock_res_and_lock(lock); - if (lock->l_flags & LDLM_FL_GONE_MASK) + if (LDLM_HAVE_MASK(lock, GONE)) goto out; - if (lock->l_flags & LDLM_FL_CBPENDING && + if (ldlm_is_cbpending(lock) && lock->l_readers == 0 && lock->l_writers == 0) goto out; @@ -1552,7 +1548,8 @@ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, /* Some flags from the enqueue want to make it into the AST, via the * lock's l_flags. */ - lock->l_flags |= *flags & LDLM_FL_AST_DISCARD_DATA; + if (*flags & LDLM_FL_AST_DISCARD_DATA) + ldlm_set_ast_discard_data(lock); /* * This distinction between local lock trees is very important; a client @@ -1591,7 +1588,7 @@ ldlm_work_bl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) lock_res_and_lock(lock); list_del_init(&lock->l_bl_ast); - LASSERT(lock->l_flags & LDLM_FL_AST_SENT); + LASSERT(ldlm_is_ast_sent(lock)); LASSERT(lock->l_bl_ast_run == 0); LASSERT(lock->l_blocking_lock); lock->l_bl_ast_run++; @@ -1638,12 +1635,12 @@ ldlm_work_cp_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) /* nobody should touch l_cp_ast */ lock_res_and_lock(lock); list_del_init(&lock->l_cp_ast); - LASSERT(lock->l_flags & LDLM_FL_CP_REQD); + LASSERT(ldlm_is_cp_reqd(lock)); /* save l_completion_ast since it can be changed by * mds_intent_policy(), see bug 14225 */ completion_callback = lock->l_completion_ast; - lock->l_flags &= ~LDLM_FL_CP_REQD; + ldlm_clear_cp_reqd(lock); unlock_res_and_lock(lock); if (completion_callback) @@ -1788,8 +1785,8 @@ out: void ldlm_cancel_callback(struct ldlm_lock *lock) { check_res_locked(lock->l_resource); - if (!(lock->l_flags & LDLM_FL_CANCEL)) { - lock->l_flags |= LDLM_FL_CANCEL; + if (!ldlm_is_cancel(lock)) { + ldlm_set_cancel(lock); if (lock->l_blocking_ast) { unlock_res_and_lock(lock); lock->l_blocking_ast(lock, NULL, lock->l_ast_data, @@ -1799,7 +1796,7 @@ void ldlm_cancel_callback(struct ldlm_lock *lock) LDLM_DEBUG(lock, "no blocking ast"); } } - lock->l_flags |= LDLM_FL_BL_DONE; + ldlm_set_bl_done(lock); } /** diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index ebe9042..024185b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -124,10 +124,10 @@ void ldlm_handle_bl_callback(struct ldlm_namespace *ns, LDLM_DEBUG(lock, "client blocking AST callback handler"); lock_res_and_lock(lock); - lock->l_flags |= LDLM_FL_CBPENDING; + ldlm_set_cbpending(lock); - if (lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) - lock->l_flags |= LDLM_FL_CANCEL; + if (ldlm_is_cancel_on_block(lock)) + ldlm_set_cancel(lock); do_ast = !lock->l_readers && !lock->l_writers; unlock_res_and_lock(lock); @@ -172,7 +172,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req, set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(to); if (lock->l_granted_mode == lock->l_req_mode || - lock->l_flags & LDLM_FL_DESTROYED) + ldlm_is_destroyed(lock)) break; } } @@ -215,7 +215,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req, } lock_res_and_lock(lock); - if ((lock->l_flags & LDLM_FL_DESTROYED) || + if (ldlm_is_destroyed(lock) || lock->l_granted_mode == lock->l_req_mode) { /* bug 11300: the lock has already been granted */ unlock_res_and_lock(lock); @@ -291,7 +291,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req, out: if (rc < 0) { lock_res_and_lock(lock); - lock->l_flags |= LDLM_FL_FAILED; + ldlm_set_failed(lock); unlock_res_and_lock(lock); wake_up(&lock->l_waitq); } @@ -360,8 +360,7 @@ static int __ldlm_bl_to_thread(struct ldlm_bl_work_item *blwi, struct ldlm_bl_pool *blp = ldlm_state->ldlm_bl_pool; spin_lock(&blp->blp_lock); - if (blwi->blwi_lock && - blwi->blwi_lock->l_flags & LDLM_FL_DISCARD_DATA) { + if (blwi->blwi_lock && ldlm_is_discard_data(blwi->blwi_lock)) { /* add LDLM_FL_DISCARD_DATA requests to the priority list */ list_add_tail(&blwi->blwi_entry, &blp->blp_prio_list); } else { @@ -626,7 +625,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) return 0; } - if ((lock->l_flags & LDLM_FL_FAIL_LOC) && + if (ldlm_is_fail_loc(lock) && lustre_msg_get_opc(req->rq_reqmsg) == LDLM_BL_CALLBACK) OBD_RACE(OBD_FAIL_LDLM_CP_BL_RACE); @@ -640,9 +639,8 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) * we can tell the server we have no lock. Otherwise, we * should send cancel after dropping the cache. */ - if (((lock->l_flags & LDLM_FL_CANCELING) && - (lock->l_flags & LDLM_FL_BL_DONE)) || - (lock->l_flags & LDLM_FL_FAILED)) { + if ((ldlm_is_canceling(lock) && ldlm_is_bl_done(lock)) || + ldlm_is_failed(lock)) { LDLM_DEBUG(lock, "callback on lock %#llx - lock disappeared\n", dlm_req->lock_handle[0].cookie); unlock_res_and_lock(lock); @@ -656,7 +654,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) * Let ldlm_cancel_lru() be fast. */ ldlm_lock_remove_from_lru(lock); - lock->l_flags |= LDLM_FL_BL_AST; + ldlm_set_bl_ast(lock); } unlock_res_and_lock(lock); @@ -674,7 +672,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) case LDLM_BL_CALLBACK: CDEBUG(D_INODE, "blocking ast\n"); req_capsule_extend(&req->rq_pill, &RQF_LDLM_BL_CALLBACK); - if (!(lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK)) { + if (!ldlm_is_cancel_on_block(lock)) { rc = ldlm_callback_reply(req, 0); if (req->rq_no_reply || rc) ldlm_callback_errmsg(req, "Normal process", rc, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 861e4be..0e4ab2c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -153,7 +153,7 @@ static int ldlm_completion_tail(struct ldlm_lock *lock) long delay; int result; - if (lock->l_flags & (LDLM_FL_DESTROYED | LDLM_FL_FAILED)) { + if (ldlm_is_destroyed(lock) || ldlm_is_failed(lock)) { LDLM_DEBUG(lock, "client-side enqueue: destroyed"); result = -EIO; } else { @@ -252,7 +252,7 @@ noreproc: lwd.lwd_lock = lock; - if (lock->l_flags & LDLM_FL_NO_TIMEOUT) { + if (ldlm_is_no_timeout(lock)) { LDLM_DEBUG(lock, "waiting indefinitely because of NO_TIMEOUT"); lwi = LWI_INTR(interrupted_completion_wait, &lwd); } else { @@ -269,7 +269,7 @@ noreproc: if (OBD_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST, OBD_FAIL_LDLM_CP_BL_RACE | OBD_FAIL_ONCE)) { - lock->l_flags |= LDLM_FL_FAIL_LOC; + ldlm_set_fail_loc(lock); rc = -EINTR; } else { /* Go to sleep until the lock is granted or cancelled. */ @@ -296,7 +296,7 @@ static void failed_lock_cleanup(struct ldlm_namespace *ns, lock_res_and_lock(lock); /* Check that lock is not granted or failed, we might race. */ if ((lock->l_req_mode != lock->l_granted_mode) && - !(lock->l_flags & LDLM_FL_FAILED)) { + !ldlm_is_failed(lock)) { /* Make sure that this lock will not be found by raced * bl_ast and -EINVAL reply is sent to server anyways. * bug 17645 @@ -821,12 +821,11 @@ static __u64 ldlm_cli_cancel_local(struct ldlm_lock *lock) LDLM_DEBUG(lock, "client-side cancel"); /* Set this flag to prevent others from getting new references*/ lock_res_and_lock(lock); - lock->l_flags |= LDLM_FL_CBPENDING; + ldlm_set_cbpending(lock); local_only = !!(lock->l_flags & (LDLM_FL_LOCAL_ONLY|LDLM_FL_CANCEL_ON_BLOCK)); ldlm_cancel_callback(lock); - rc = (lock->l_flags & LDLM_FL_BL_AST) ? - LDLM_FL_BL_AST : LDLM_FL_CANCELING; + rc = ldlm_is_bl_ast(lock) ? LDLM_FL_BL_AST : LDLM_FL_CANCELING; unlock_res_and_lock(lock); if (local_only) { @@ -1150,7 +1149,7 @@ ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns, struct ldlm_lock *lock, default: result = LDLM_POLICY_SKIP_LOCK; lock_res_and_lock(lock); - lock->l_flags |= LDLM_FL_SKIPPED; + ldlm_set_skipped(lock); unlock_res_and_lock(lock); break; } @@ -1381,9 +1380,9 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, list_for_each_entry_safe(lock, next, &ns->ns_unused_list, l_lru) { /* No locks which got blocking requests. */ - LASSERT(!(lock->l_flags & LDLM_FL_BL_AST)); + LASSERT(!ldlm_is_bl_ast(lock)); - if (no_wait && lock->l_flags & LDLM_FL_SKIPPED) + if (no_wait && ldlm_is_skipped(lock)) /* already processed */ continue; @@ -1394,7 +1393,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, /* Somebody is already doing CANCEL. No need for this * lock in LRU, do not traverse it again. */ - if (!(lock->l_flags & LDLM_FL_CANCELING)) + if (!ldlm_is_canceling(lock)) break; ldlm_lock_remove_from_lru_nolock(lock); @@ -1437,7 +1436,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, lock_res_and_lock(lock); /* Check flags again under the lock. */ - if ((lock->l_flags & LDLM_FL_CANCELING) || + if (ldlm_is_canceling(lock) || (ldlm_lock_remove_from_lru_check(lock, last_use) == 0)) { /* Another thread is removing lock from LRU, or * somebody is already doing CANCEL, or there @@ -1461,7 +1460,7 @@ static int ldlm_prepare_lru_list(struct ldlm_namespace *ns, * where while we are doing cancel here, server is also * silently cancelling this lock. */ - lock->l_flags &= ~LDLM_FL_CANCEL_ON_BLOCK; + ldlm_clear_cancel_on_block(lock); /* Setting the CBPENDING flag is a little misleading, * but prevents an important race; namely, once @@ -1558,8 +1557,7 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res, /* If somebody is already doing CANCEL, or blocking AST came, * skip this lock. */ - if (lock->l_flags & LDLM_FL_BL_AST || - lock->l_flags & LDLM_FL_CANCELING) + if (ldlm_is_bl_ast(lock) || ldlm_is_canceling(lock)) continue; if (lockmode_compat(lock->l_granted_mode, mode)) @@ -1918,7 +1916,7 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock) int flags; /* Bug 11974: Do not replay a lock which is actively being canceled */ - if (lock->l_flags & LDLM_FL_CANCELING) { + if (ldlm_is_canceling(lock)) { LDLM_DEBUG(lock, "Not replaying canceled lock:"); return 0; } @@ -1927,7 +1925,7 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock) * server might have long dropped it, but notification of that event was * lost by network. (and server granted conflicting lock already) */ - if (lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) { + if (ldlm_is_cancel_on_block(lock)) { LDLM_DEBUG(lock, "Not replaying reply-less lock:"); ldlm_lock_cancel(lock); return 0; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 242a664..475fabb 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -758,12 +758,12 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, list_for_each(tmp, q) { lock = list_entry(tmp, struct ldlm_lock, l_res_link); - if (lock->l_flags & LDLM_FL_CLEANED) { + if (ldlm_is_cleaned(lock)) { lock = NULL; continue; } LDLM_LOCK_GET(lock); - lock->l_flags |= LDLM_FL_CLEANED; + ldlm_set_cleaned(lock); break; } @@ -775,13 +775,13 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, /* Set CBPENDING so nothing in the cancellation path * can match this lock. */ - lock->l_flags |= LDLM_FL_CBPENDING; - lock->l_flags |= LDLM_FL_FAILED; + ldlm_set_cbpending(lock); + ldlm_set_failed(lock); lock->l_flags |= flags; /* ... without sending a CANCEL message for local_only. */ if (local_only) - lock->l_flags |= LDLM_FL_LOCAL_ONLY; + ldlm_set_local_only(lock); if (local_only && (lock->l_readers || lock->l_writers)) { /* This is a little bit gross, but much better than the @@ -1275,7 +1275,7 @@ void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head, LDLM_DEBUG(lock, "About to add this lock:\n"); - if (lock->l_flags & LDLM_FL_DESTROYED) { + if (ldlm_is_destroyed(lock)) { CDEBUG(D_OTHER, "Lock destroyed, not adding to resource\n"); return; } diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index dd1c827..5596b13 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -108,11 +108,8 @@ static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry, static inline int return_if_equal(struct ldlm_lock *lock, void *data) { - if ((lock->l_flags & - (LDLM_FL_CANCELING | LDLM_FL_DISCARD_DATA)) == - (LDLM_FL_CANCELING | LDLM_FL_DISCARD_DATA)) - return LDLM_ITER_CONTINUE; - return LDLM_ITER_STOP; + return (ldlm_is_canceling(lock) && ldlm_is_discard_data(lock)) ? + LDLM_ITER_CONTINUE : LDLM_ITER_STOP; } /* find any ldlm lock of the inode in mdc and lov diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 24fa24b..18e0fec 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3355,10 +3355,10 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock) int rc; CDEBUG(D_INODE, DFID" LVB_READY=%d l_lvb_data=%p l_lvb_len=%d\n", - PFID(ll_inode2fid(inode)), !!(lock->l_flags & LDLM_FL_LVB_READY), + PFID(ll_inode2fid(inode)), ldlm_is_lvb_ready(lock), lock->l_lvb_data, lock->l_lvb_len); - if (lock->l_lvb_data && (lock->l_flags & LDLM_FL_LVB_READY)) + if (lock->l_lvb_data && ldlm_is_lvb_ready(lock)) return 0; /* if layout lock was granted right away, the layout is returned @@ -3442,7 +3442,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, md_set_lock_data(sbi->ll_md_exp, &lockh->cookie, inode, NULL); lock_res_and_lock(lock); - lvb_ready = !!(lock->l_flags & LDLM_FL_LVB_READY); + lvb_ready = ldlm_is_lvb_ready(lock); unlock_res_and_lock(lock); /* checking lvb_ready is racy but this is okay. The worst case is * that multi processes may configure the file on the same time. diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 9fa862b..cf4ad93 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -190,7 +190,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, break; /* Invalidate all dentries associated with this inode */ - LASSERT(lock->l_flags & LDLM_FL_CANCELING); + LASSERT(ldlm_is_canceling(lock)); if (!fid_res_name_eq(ll_inode2fid(inode), &lock->l_resource->lr_name)) { diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 7ea6489..16f9cd9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -120,7 +120,7 @@ static int osc_lock_invariant(struct osc_lock *ols) * ast. */ if (!ergo(olock && ols->ols_state < OLS_CANCELLED, - ((olock->l_flags & LDLM_FL_DESTROYED) == 0))) + !ldlm_is_destroyed(olock))) return 0; if (!ergo(ols->ols_state == OLS_GRANTED, -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:20:58 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:58 -0400 Subject: [lustre-devel] [PATCH 06/15] staging: lustre: ldlm: clean up l_flags In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-7-git-send-email-jsimmons@infradead.org> From: Bruce Korb Remove the now obsolete LDLM_AST_FLAGS and LDLM_INHERIT_FLAGS defines. Remove the obsolete LDLM_FL_HIDE_LOCK_MASK define. Rename "local_only" mask to "off_wire" since it is confusingly similar to a flag that (I think) means, "do not copy this lock over the wire." Signed-off-by: Bruce Korb Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906 Reviewed-by: Keith Mannthey Reviewed-on: http://review.whamcloud.com/7963 Reviewed-by: Doug Oucharek Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre_dlm_flags.h | 16 ++-------------- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index aff0904..62d3b31 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -37,17 +37,11 @@ /** l_flags bits marked as "gone" bits */ #define LDLM_FL_GONE_MASK 0x0006004000000000ULL -/** l_flags bits marked as "hide_lock" bits */ -#define LDLM_FL_HIDE_LOCK_MASK 0x0000206400000000ULL - /** l_flags bits marked as "inherit" bits */ #define LDLM_FL_INHERIT_MASK 0x0000000000800000ULL -/** l_flags bits marked as "local_only" bits */ -#define LDLM_FL_LOCAL_ONLY_MASK 0x00FFFFFF00000000ULL - -/** l_flags bits marked as "on_wire" bits */ -#define LDLM_FL_ON_WIRE_MASK 0x00000000C08F932FULL +/** l_flags bits marked as "off_wire" bits */ +#define LDLM_FL_OFF_WIRE_MASK 0x00FFFFFF00000000ULL /** extent, mode, or resource changed */ #define LDLM_FL_LOCK_CHANGED 0x0000000000000001ULL /* bit 0 */ @@ -390,12 +384,6 @@ /** clear a ldlm_lock flag bit */ #define LDLM_CLEAR_FLAG(_l, _b) ((_l)->l_flags &= ~(_b)) -/** Mask of flags inherited from parent lock when doing intents. */ -#define LDLM_INHERIT_FLAGS LDLM_FL_INHERIT_MASK - -/** Mask of Flags sent in AST lock_flags to map into the receiving lock. */ -#define LDLM_AST_FLAGS LDLM_FL_AST_MASK - /** @} subgroup */ /** @} group */ #ifdef WIRESHARK_COMPILE diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 024185b..ab739f0 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -632,7 +632,7 @@ static int ldlm_callback_handler(struct ptlrpc_request *req) /* Copy hints/flags (e.g. LDLM_FL_DISCARD_DATA) from AST. */ lock_res_and_lock(lock); lock->l_flags |= ldlm_flags_from_wire(dlm_req->lock_flags & - LDLM_AST_FLAGS); + LDLM_FL_AST_MASK); if (lustre_msg_get_opc(req->rq_reqmsg) == LDLM_BL_CALLBACK) { /* If somebody cancels lock and cache is already dropped, * or lock is failed before cp_ast received on client, diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 0e4ab2c..107314e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -421,7 +421,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, *flags = ldlm_flags_from_wire(reply->lock_flags); lock->l_flags |= ldlm_flags_from_wire(reply->lock_flags & - LDLM_INHERIT_FLAGS); + LDLM_FL_INHERIT_MASK); /* move NO_TIMEOUT flag to the lock to force ldlm_lock_match() * to wait with no timeout as well */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:07 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:07 -0400 Subject: [lustre-devel] [PATCH 15/15] staging: lustre: ptlrpc: quiet warning for 2.1/2.5 connections In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-16-git-send-email-jsimmons@infradead.org> From: Andreas Dilger The Lustre 2.5.4 client will print a warning about connections with 2.1.3 servers, yet they are still supposed to be interoperable. Increase the window of warning to be up to Lustre 2.5.50, since we do not intend to allow interoperability between 2.1 and 2.6 systems. This was from the time when major releases like Lustre 1.4 and 1.8 were many years apart would have no chance for interoperation. Only print this message once per client, to avoid flooding the console for connections to many servers or frequent network reconnections. Server versions should all be nearly the same in any case. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2528 Reviewed-on: http://review.whamcloud.com/7916 Reviewed-by: Bob Glossman Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/import.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index bf7b9d2..a4f7544 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -1001,6 +1001,8 @@ finish: return 0; } } else { + static bool warned; + spin_lock(&imp->imp_lock); list_del(&imp->imp_conn_current->oic_item); list_add(&imp->imp_conn_current->oic_item, &imp->imp_conn_list); @@ -1020,7 +1022,7 @@ finish: goto out; } - if ((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) && + if (!warned && (ocd->ocd_connect_flags & OBD_CONNECT_VERSION) && (ocd->ocd_version > LUSTRE_VERSION_CODE + LUSTRE_VERSION_OFFSET_WARN || ocd->ocd_version < LUSTRE_VERSION_CODE - @@ -1028,10 +1030,8 @@ finish: /* Sigh, some compilers do not like #ifdef in the middle * of macro arguments */ - const char *older = "older. Consider upgrading server or downgrading client" - ; - const char *newer = "newer than client version. Consider upgrading client" - ; + const char *older = "older than client. Consider upgrading server"; + const char *newer = "newer than client. Consider recompiling application"; LCONSOLE_WARN("Server %s version (%d.%d.%d.%d) is much %s (%s)\n", obd2cli_tgt(imp->imp_obd), @@ -1041,6 +1041,7 @@ finish: OBD_OCD_VERSION_FIX(ocd->ocd_version), ocd->ocd_version > LUSTRE_VERSION_CODE ? newer : older, LUSTRE_VERSION_STRING); + warned = true; } #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0) -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:20:55 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:55 -0400 Subject: [lustre-devel] [PATCH 03/15] staging: lustre: obdclass: add LCT_SERVER_SESSION for server session In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-4-git-send-email-jsimmons@infradead.org> From: Wang Di Add LCT_SERVER_SESSION for server session, and separate the server session flag from LCT_SESSION, so to avoid allocating session info for client stack for each server request, if client and server are on the same node. Signed-off-by: Wang Di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3806 Reviewed-on: http://review.whamcloud.com/7412 Reviewed-by: John L. Hammond Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lu_object.h | 4 ++++ drivers/staging/lustre/lustre/include/obd_class.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index b5b0c81..a27e76f 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -1006,6 +1006,10 @@ enum lu_context_tag { */ LCT_LOCAL = 1 << 7, /** + * session for server thread + **/ + LCT_SERVER_SESSION = BIT(8), + /** * Set when at least one of keys, having values in this context has * non-NULL lu_context_key::lct_exit() method. This is used to * optimize lu_context_exit() call. diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 40f7a23..32863bc 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -477,7 +477,7 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg) struct lu_context session_ctx; struct lu_env env; - lu_context_init(&session_ctx, LCT_SESSION); + lu_context_init(&session_ctx, LCT_SESSION | LCT_SERVER_SESSION); session_ctx.lc_thread = NULL; lu_context_enter(&session_ctx); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 1bbd1d3..fc2632f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1649,7 +1649,8 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, at_get(&svcpt->scp_at_estimate)); } - rc = lu_context_init(&request->rq_session, LCT_SESSION | LCT_NOREF); + rc = lu_context_init(&request->rq_session, LCT_SERVER_SESSION | + LCT_NOREF); if (rc) { CERROR("Failure to initialize session: %d\n", rc); goto out_req; -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:20:59 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:20:59 -0400 Subject: [lustre-devel] [PATCH 07/15] staging: lustre: ldlm: remove code wireshark handling In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-8-git-send-email-jsimmons@infradead.org> From: Bruce Korb Wireshark output moved to userland file "lustre_dlm_flags_wshark.c" and only bits that can actually appear "on the wire" are emitted. The user land "packet-lustre.c" code that references these bits now gets emitted into that file. e.g. the "local_only" bit is never put on the wire, so references to it in wireshark are gone. Signed-off-by: Bruce Korb Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906 Reviewed-by: Keith Mannthey Reviewed-on: http://review.whamcloud.com/7963 Reviewed-by: Doug Oucharek Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre_dlm_flags.h | 87 +------------------- 1 files changed, 1 insertions(+), 86 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index 62d3b31..1eb0cc4 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -386,90 +386,5 @@ /** @} subgroup */ /** @} group */ -#ifdef WIRESHARK_COMPILE -static int hf_lustre_ldlm_fl_lock_changed = -1; -static int hf_lustre_ldlm_fl_block_granted = -1; -static int hf_lustre_ldlm_fl_block_conv = -1; -static int hf_lustre_ldlm_fl_block_wait = -1; -static int hf_lustre_ldlm_fl_ast_sent = -1; -static int hf_lustre_ldlm_fl_replay = -1; -static int hf_lustre_ldlm_fl_intent_only = -1; -static int hf_lustre_ldlm_fl_has_intent = -1; -static int hf_lustre_ldlm_fl_flock_deadlock = -1; -static int hf_lustre_ldlm_fl_discard_data = -1; -static int hf_lustre_ldlm_fl_no_timeout = -1; -static int hf_lustre_ldlm_fl_block_nowait = -1; -static int hf_lustre_ldlm_fl_test_lock = -1; -static int hf_lustre_ldlm_fl_cancel_on_block = -1; -static int hf_lustre_ldlm_fl_deny_on_contention = -1; -static int hf_lustre_ldlm_fl_ast_discard_data = -1; -static int hf_lustre_ldlm_fl_fail_loc = -1; -static int hf_lustre_ldlm_fl_skipped = -1; -static int hf_lustre_ldlm_fl_cbpending = -1; -static int hf_lustre_ldlm_fl_wait_noreproc = -1; -static int hf_lustre_ldlm_fl_cancel = -1; -static int hf_lustre_ldlm_fl_local_only = -1; -static int hf_lustre_ldlm_fl_failed = -1; -static int hf_lustre_ldlm_fl_canceling = -1; -static int hf_lustre_ldlm_fl_local = -1; -static int hf_lustre_ldlm_fl_lvb_ready = -1; -static int hf_lustre_ldlm_fl_kms_ignore = -1; -static int hf_lustre_ldlm_fl_cp_reqd = -1; -static int hf_lustre_ldlm_fl_cleaned = -1; -static int hf_lustre_ldlm_fl_atomic_cb = -1; -static int hf_lustre_ldlm_fl_bl_ast = -1; -static int hf_lustre_ldlm_fl_bl_done = -1; -static int hf_lustre_ldlm_fl_no_lru = -1; -static int hf_lustre_ldlm_fl_fail_notified = -1; -static int hf_lustre_ldlm_fl_destroyed = -1; -static int hf_lustre_ldlm_fl_server_lock = -1; -static int hf_lustre_ldlm_fl_res_locked = -1; -static int hf_lustre_ldlm_fl_waited = -1; -static int hf_lustre_ldlm_fl_ns_srv = -1; -static int hf_lustre_ldlm_fl_excl = -1; - -const value_string lustre_ldlm_flags_vals[] = { - {LDLM_FL_LOCK_CHANGED, "LDLM_FL_LOCK_CHANGED"}, - {LDLM_FL_BLOCK_GRANTED, "LDLM_FL_BLOCK_GRANTED"}, - {LDLM_FL_BLOCK_CONV, "LDLM_FL_BLOCK_CONV"}, - {LDLM_FL_BLOCK_WAIT, "LDLM_FL_BLOCK_WAIT"}, - {LDLM_FL_AST_SENT, "LDLM_FL_AST_SENT"}, - {LDLM_FL_REPLAY, "LDLM_FL_REPLAY"}, - {LDLM_FL_INTENT_ONLY, "LDLM_FL_INTENT_ONLY"}, - {LDLM_FL_HAS_INTENT, "LDLM_FL_HAS_INTENT"}, - {LDLM_FL_FLOCK_DEADLOCK, "LDLM_FL_FLOCK_DEADLOCK"}, - {LDLM_FL_DISCARD_DATA, "LDLM_FL_DISCARD_DATA"}, - {LDLM_FL_NO_TIMEOUT, "LDLM_FL_NO_TIMEOUT"}, - {LDLM_FL_BLOCK_NOWAIT, "LDLM_FL_BLOCK_NOWAIT"}, - {LDLM_FL_TEST_LOCK, "LDLM_FL_TEST_LOCK"}, - {LDLM_FL_CANCEL_ON_BLOCK, "LDLM_FL_CANCEL_ON_BLOCK"}, - {LDLM_FL_DENY_ON_CONTENTION, "LDLM_FL_DENY_ON_CONTENTION"}, - {LDLM_FL_AST_DISCARD_DATA, "LDLM_FL_AST_DISCARD_DATA"}, - {LDLM_FL_FAIL_LOC, "LDLM_FL_FAIL_LOC"}, - {LDLM_FL_SKIPPED, "LDLM_FL_SKIPPED"}, - {LDLM_FL_CBPENDING, "LDLM_FL_CBPENDING"}, - {LDLM_FL_WAIT_NOREPROC, "LDLM_FL_WAIT_NOREPROC"}, - {LDLM_FL_CANCEL, "LDLM_FL_CANCEL"}, - {LDLM_FL_LOCAL_ONLY, "LDLM_FL_LOCAL_ONLY"}, - {LDLM_FL_FAILED, "LDLM_FL_FAILED"}, - {LDLM_FL_CANCELING, "LDLM_FL_CANCELING"}, - {LDLM_FL_LOCAL, "LDLM_FL_LOCAL"}, - {LDLM_FL_LVB_READY, "LDLM_FL_LVB_READY"}, - {LDLM_FL_KMS_IGNORE, "LDLM_FL_KMS_IGNORE"}, - {LDLM_FL_CP_REQD, "LDLM_FL_CP_REQD"}, - {LDLM_FL_CLEANED, "LDLM_FL_CLEANED"}, - {LDLM_FL_ATOMIC_CB, "LDLM_FL_ATOMIC_CB"}, - {LDLM_FL_BL_AST, "LDLM_FL_BL_AST"}, - {LDLM_FL_BL_DONE, "LDLM_FL_BL_DONE"}, - {LDLM_FL_NO_LRU, "LDLM_FL_NO_LRU"}, - {LDLM_FL_FAIL_NOTIFIED, "LDLM_FL_FAIL_NOTIFIED"}, - {LDLM_FL_DESTROYED, "LDLM_FL_DESTROYED"}, - {LDLM_FL_SERVER_LOCK, "LDLM_FL_SERVER_LOCK"}, - {LDLM_FL_RES_LOCKED, "LDLM_FL_RES_LOCKED"}, - {LDLM_FL_WAITED, "LDLM_FL_WAITED"}, - {LDLM_FL_NS_SRV, "LDLM_FL_NS_SRV"}, - {LDLM_FL_EXCL, "LDLM_FL_EXCL"}, - { 0, NULL } -}; -#endif /* WIRESHARK_COMPILE */ + #endif /* LDLM_ALL_FLAGS_MASK */ -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:00 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:00 -0400 Subject: [lustre-devel] [PATCH 08/15] staging: lustre: ldlm: update comments about ldlm l_flags In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-9-git-send-email-jsimmons@infradead.org> From: Bruce Korb Add and update documentation about some of the ldlm l_flags. Signed-off-by: Bruce Korb Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906 Reviewed-by: Keith Mannthey Reviewed-on: http://review.whamcloud.com/7963 Reviewed-by: Doug Oucharek Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre_dlm_flags.h | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index 1eb0cc4..e7e0c21 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -198,7 +198,7 @@ #define ldlm_set_cancel(_l) LDLM_SET_FLAG((_l), 1ULL << 36) #define ldlm_clear_cancel(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 36) -/** whatever it might mean */ +/** whatever it might mean -- never transmitted? */ #define LDLM_FL_LOCAL_ONLY 0x0000002000000000ULL /* bit 37 */ #define ldlm_is_local_only(_l) LDLM_TEST_FLAG((_l), 1ULL << 37) #define ldlm_set_local_only(_l) LDLM_SET_FLAG((_l), 1ULL << 37) @@ -281,18 +281,18 @@ * has canceled this lock and is waiting for rpc_lock which is taken by * the first operation. LDLM_FL_BL_AST is set by ldlm_callback_handler() in * the lock to prevent the Early Lock Cancel (ELC) code from cancelling it. - * - * LDLM_FL_BL_DONE is to be set by ldlm_cancel_callback() when lock cache is - * dropped to let ldlm_callback_handler() return EINVAL to the server. It - * is used when ELC RPC is already prepared and is waiting for rpc_lock, - * too late to send a separate CANCEL RPC. */ #define LDLM_FL_BL_AST 0x0000400000000000ULL /* bit 46 */ #define ldlm_is_bl_ast(_l) LDLM_TEST_FLAG((_l), 1ULL << 46) #define ldlm_set_bl_ast(_l) LDLM_SET_FLAG((_l), 1ULL << 46) #define ldlm_clear_bl_ast(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 46) -/** whatever it might mean */ +/** + * Set by ldlm_cancel_callback() when lock cache is dropped to let + * ldlm_callback_handler() return EINVAL to the server. It is used when + * ELC RPC is already prepared and is waiting for rpc_lock, too late to + * send a separate CANCEL RPC. + */ #define LDLM_FL_BL_DONE 0x0000800000000000ULL /* bit 47 */ #define ldlm_is_bl_done(_l) LDLM_TEST_FLAG((_l), 1ULL << 47) #define ldlm_set_bl_done(_l) LDLM_SET_FLAG((_l), 1ULL << 47) -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:01 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:01 -0400 Subject: [lustre-devel] [PATCH 09/15] staging: lustre: llite: Replace printing of i_ino with ll_inode2fid() In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-10-git-send-email-jsimmons@infradead.org> From: James Nunez The printing of i_ino/i_generation in llite messages is not nearly so useful as printing the full inode FID, since i_ino is a "compressed" version of the FID and there may be duplicate values for i_ino in some cases (especially if running on a 32-bit client). All instances of printing i_ino/i_generation are replaced with the FID using ll_inode2fid(). All instances, except for one, of printing just i_ino was replaced by printing the FID. In all CERROR lines touched by the i_ino replacements, the device name or fsname was added at the beginning of the message if it did not already exist. Signed-off-by: James Nunez Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3491 Reviewed-on: http://review.whamcloud.com/6848 Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dcache.c | 8 +- drivers/staging/lustre/lustre/llite/dir.c | 23 +++--- drivers/staging/lustre/lustre/llite/file.c | 70 +++++++++--------- drivers/staging/lustre/lustre/llite/llite_close.c | 40 ++++++----- .../staging/lustre/lustre/llite/llite_internal.h | 10 +-- drivers/staging/lustre/lustre/llite/llite_lib.c | 40 ++++++----- drivers/staging/lustre/lustre/llite/llite_mmap.c | 6 +- drivers/staging/lustre/lustre/llite/llite_nfs.c | 14 +++-- drivers/staging/lustre/lustre/llite/namei.c | 76 +++++++++----------- drivers/staging/lustre/lustre/llite/rw26.c | 5 +- drivers/staging/lustre/lustre/llite/statahead.c | 17 ++--- drivers/staging/lustre/lustre/llite/symlink.c | 10 ++- drivers/staging/lustre/lustre/llite/vvp_dev.c | 5 +- drivers/staging/lustre/lustre/llite/xattr.c | 20 +++--- 14 files changed, 174 insertions(+), 170 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 5596b13..1b6f82a 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -250,8 +250,8 @@ void ll_invalidate_aliases(struct inode *inode) { struct dentry *dentry; - CDEBUG(D_INODE, "marking dentries for ino %lu/%u(%p) invalid\n", - inode->i_ino, inode->i_generation, inode); + CDEBUG(D_INODE, "marking dentries for ino "DFID"(%p) invalid\n", + PFID(ll_inode2fid(inode)), inode); ll_lock_dcache(inode); hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { @@ -286,8 +286,8 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode) if (it->d.lustre.it_lock_mode && inode) { struct ll_sb_info *sbi = ll_i2sbi(inode); - CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n", - inode, inode->i_ino, inode->i_generation); + CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"(%p)\n", + PFID(ll_inode2fid(inode)), inode); ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL); } diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index b457c28..9463da2 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -158,8 +158,8 @@ static int ll_dir_filler(void *_hash, struct page *page0) int i; int rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) hash %llu\n", - inode->i_ino, inode->i_generation, inode, hash); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p) hash %llu\n", + PFID(ll_inode2fid(inode)), inode, hash); LASSERT(max_pages > 0 && max_pages <= MD_MAX_BRW_PAGES); @@ -372,8 +372,8 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash, return ERR_PTR(rc); } - CDEBUG(D_INODE, "setting lr_lvb_inode to inode %p (%lu/%u)\n", - dir, dir->i_ino, dir->i_generation); + CDEBUG(D_INODE, "setting lr_lvb_inode to inode "DFID"(%p)\n", + PFID(ll_inode2fid(dir)), dir); md_set_lock_data(ll_i2sbi(dir)->ll_md_exp, &it.d.lustre.it_lock_handle, dir, NULL); } else { @@ -616,9 +616,9 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) int api32 = ll_need_32bit_api(sbi); int rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) pos %lu/%llu 32bit_api %d\n", - inode->i_ino, inode->i_generation, - inode, (unsigned long)pos, i_size_read(inode), api32); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p) pos %lu/%llu 32bit_api %d\n", + PFID(ll_inode2fid(inode)), inode, (unsigned long)pos, + i_size_read(inode), api32); if (pos == MDS_DIR_END_OFF) { /* @@ -828,9 +828,8 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, rc = md_getattr(sbi->ll_md_exp, op_data, &req); ll_finish_md_op_data(op_data); if (rc < 0) { - CDEBUG(D_INFO, "md_getattr failed on inode %lu/%u: rc %d\n", - inode->i_ino, - inode->i_generation, rc); + CDEBUG(D_INFO, "md_getattr failed on inode "DFID": rc %d\n", + PFID(ll_inode2fid(inode)), rc); goto out; } @@ -1267,8 +1266,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct obd_ioctl_data *data; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), cmd=%#x\n", - inode->i_ino, inode->i_generation, inode, cmd); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), cmd=%#x\n", + PFID(ll_inode2fid(inode)), inode, cmd); /* asm-ppc{,64} declares TCGETS, et. al. as type 't' not 'T' */ if (_IOC_TYPE(cmd) == 'T' || _IOC_TYPE(cmd) == 't') /* tty ioctls */ diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 18e0fec..a8de10e 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -170,13 +170,15 @@ static int ll_close_inode_openhandle(struct obd_export *md_exp, */ rc = ll_som_update(inode, op_data); if (rc) { - CERROR("inode %lu mdc Size-on-MDS update failed: rc = %d\n", - inode->i_ino, rc); + CERROR("%s: inode "DFID" mdc Size-on-MDS update failed: rc = %d\n", + ll_i2mdexp(inode)->exp_obd->obd_name, + PFID(ll_inode2fid(inode)), rc); rc = 0; } } else if (rc) { - CERROR("inode %lu mdc close failed: rc = %d\n", - inode->i_ino, rc); + CERROR("%s: inode "DFID" mdc close failed: rc = %d\n", + ll_i2mdexp(inode)->exp_obd->obd_name, + PFID(ll_inode2fid(inode)), rc); } /* DATA_MODIFIED flag was successfully sent on close, cancel data @@ -343,8 +345,8 @@ int ll_file_release(struct inode *inode, struct file *file) struct ll_inode_info *lli = ll_i2info(inode); int rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + PFID(ll_inode2fid(inode)), inode); #ifdef CONFIG_FS_POSIX_ACL if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) { @@ -543,8 +545,8 @@ int ll_file_open(struct inode *inode, struct file *file) struct ll_file_data *fd; int rc = 0, opendir_set = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), flags %o\n", inode->i_ino, - inode->i_generation, inode, file->f_flags); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), flags %o\n", + PFID(ll_inode2fid(inode)), inode, file->f_flags); it = file->private_data; /* XXX: compat macro */ file->private_data = NULL; /* prevent ll_local_open assertion */ @@ -1383,8 +1385,8 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, lsm = ccc_inode_lsm_get(inode); if (lsm) { ccc_inode_lsm_put(inode, lsm); - CDEBUG(D_IOCTL, "stripe already exists for ino %lu\n", - inode->i_ino); + CDEBUG(D_IOCTL, "stripe already exists for inode "DFID"\n", + PFID(ll_inode2fid(inode))); rc = -EEXIST; goto out; } @@ -2248,8 +2250,8 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int flags, rc; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),cmd=%x\n", inode->i_ino, - inode->i_generation, inode, cmd); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p),cmd=%x\n", + PFID(ll_inode2fid(inode)), inode, cmd); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_IOCTL, 1); /* asm-ppc{,64} declares TCGETS, et. al. as type 't' not 'T' */ @@ -2557,9 +2559,8 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : (origin == SEEK_CUR) ? file->f_pos : 0); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), to=%llu=%#llx(%d)\n", - inode->i_ino, inode->i_generation, inode, retval, retval, - origin); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), to=%llu=%#llx(%d)\n", + PFID(ll_inode2fid(inode)), inode, retval, retval, origin); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LLSEEK, 1); if (origin == SEEK_END || origin == SEEK_HOLE || origin == SEEK_DATA) { @@ -2654,8 +2655,8 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) struct ptlrpc_request *req; int rc, err; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + PFID(ll_inode2fid(inode)), inode); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FSYNC, 1); rc = filemap_write_and_wait_range(inode->i_mapping, start, end); @@ -2713,8 +2714,8 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) int rc; int rc2 = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu file_lock=%p\n", - inode->i_ino, file_lock); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID" file_lock=%p\n", + PFID(ll_inode2fid(inode)), file_lock); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FLOCK, 1); @@ -2797,9 +2798,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) if (IS_ERR(op_data)) return PTR_ERR(op_data); - CDEBUG(D_DLMTRACE, "inode=%lu, pid=%u, flags=%#llx, mode=%u, start=%llu, end=%llu\n", - inode->i_ino, flock.l_flock.pid, flags, einfo.ei_mode, - flock.l_flock.start, flock.l_flock.end); + CDEBUG(D_DLMTRACE, "inode="DFID", pid=%u, flags=%#llx, mode=%u, start=%llu, end=%llu\n", + PFID(ll_inode2fid(inode)), flock.l_flock.pid, flags, + einfo.ei_mode, flock.l_flock.start, flock.l_flock.end); rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL, op_data, &lockh, &flock, 0, NULL /* req */, flags); @@ -2921,8 +2922,8 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) struct obd_export *exp; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%pd\n", - inode->i_ino, inode->i_generation, inode, dentry); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p),name=%pd\n", + PFID(ll_inode2fid(inode)), inode, dentry); exp = ll_i2mdexp(inode); @@ -3144,8 +3145,8 @@ int ll_inode_permission(struct inode *inode, int mask) return rc; } - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), inode mode %x mask %o\n", - inode->i_ino, inode->i_generation, inode, inode->i_mode, mask); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), inode mode %x mask %o\n", + PFID(ll_inode2fid(inode)), inode, inode->i_mode, mask); if (ll_i2sbi(inode)->ll_flags & LL_SBI_RMT_CLIENT) return lustre_check_remote_perm(inode, mask); @@ -3435,8 +3436,8 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, LASSERT(lock); LASSERT(ldlm_has_layout(lock)); - LDLM_DEBUG(lock, "File %p/"DFID" being reconfigured: %d", - inode, PFID(&lli->lli_fid), reconf); + LDLM_DEBUG(lock, "File "DFID"(%p) being reconfigured: %d", + PFID(&lli->lli_fid), inode, reconf); /* in case this is a caching lock and reinstate with new inode */ md_set_lock_data(sbi->ll_md_exp, &lockh->cookie, inode, NULL); @@ -3507,9 +3508,9 @@ out: /* wait for IO to complete if it's still being used. */ if (wait_layout) { - CDEBUG(D_INODE, "%s: %p/" DFID " wait for layout reconf.\n", + CDEBUG(D_INODE, "%s: "DFID"(%p) wait for layout reconf\n", ll_get_fsname(inode->i_sb, NULL, 0), - inode, PFID(&lli->lli_fid)); + PFID(&lli->lli_fid), inode); memset(&conf, 0, sizeof(conf)); conf.coc_opc = OBJECT_CONF_WAIT; @@ -3518,7 +3519,8 @@ out: if (rc == 0) rc = -EAGAIN; - CDEBUG(D_INODE, "file: " DFID " waiting layout return: %d.\n", + CDEBUG(D_INODE, "%s: file="DFID" waiting layout return: %d.\n", + ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), rc); } return rc; @@ -3591,9 +3593,9 @@ again: it.it_op = IT_LAYOUT; lockh.cookie = 0ULL; - LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file %p/" DFID "", - ll_get_fsname(inode->i_sb, NULL, 0), inode, - PFID(&lli->lli_fid)); + LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file "DFID"(%p)", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(&lli->lli_fid), inode); rc = md_enqueue(sbi->ll_md_exp, &einfo, &it, op_data, &lockh, NULL, 0, NULL, 0); diff --git a/drivers/staging/lustre/lustre/llite/llite_close.c b/drivers/staging/lustre/lustre/llite/llite_close.c index 92b73ef..2df551d 100644 --- a/drivers/staging/lustre/lustre/llite/llite_close.c +++ b/drivers/staging/lustre/lustre/llite/llite_close.c @@ -90,15 +90,15 @@ void ll_queue_done_writing(struct inode *inode, unsigned long flags) struct ll_close_queue *lcq = ll_i2sbi(inode)->ll_lcq; if (lli->lli_flags & LLIF_MDS_SIZE_LOCK) - CWARN("ino %lu/%u(flags %u) som valid it just after recovery\n", - inode->i_ino, inode->i_generation, - lli->lli_flags); + CWARN("%s: file "DFID"(flags %u) Size-on-MDS valid, done writing allowed and no diry pages\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), lli->lli_flags); /* DONE_WRITING is allowed and inode has no dirty page. */ spin_lock(&lcq->lcq_lock); LASSERT(list_empty(&lli->lli_close_list)); - CDEBUG(D_INODE, "adding inode %lu/%u to close list\n", - inode->i_ino, inode->i_generation); + CDEBUG(D_INODE, "adding inode "DFID" to close list\n", + PFID(ll_inode2fid(inode))); list_add_tail(&lli->lli_close_list, &lcq->lcq_head); /* Avoid a concurrent insertion into the close thread queue: @@ -124,9 +124,9 @@ void ll_done_writing_attr(struct inode *inode, struct md_op_data *op_data) op_data->op_flags |= MF_SOM_CHANGE; /* Check if Size-on-MDS attributes are valid. */ if (lli->lli_flags & LLIF_MDS_SIZE_LOCK) - CERROR("ino %lu/%u(flags %u) som valid it just after recovery\n", - inode->i_ino, inode->i_generation, - lli->lli_flags); + CERROR("%s: inode "DFID"(flags %u) MDS holds lock on Size-on-MDS attributes\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), lli->lli_flags); if (!cl_local_size(inode)) { /* Send Size-on-MDS Attributes if valid. */ @@ -221,9 +221,9 @@ int ll_som_update(struct inode *inode, struct md_op_data *op_data) LASSERT(op_data); if (lli->lli_flags & LLIF_MDS_SIZE_LOCK) - CERROR("ino %lu/%u(flags %u) som valid it just after recovery\n", - inode->i_ino, inode->i_generation, - lli->lli_flags); + CERROR("%s: inode "DFID"(flags %u) MDS holds lock on Size-on-MDS attributes\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), lli->lli_flags); oa = kmem_cache_zalloc(obdo_cachep, GFP_NOFS); if (!oa) { @@ -241,9 +241,9 @@ int ll_som_update(struct inode *inode, struct md_op_data *op_data) if (rc) { oa->o_valid = 0; if (rc != -ENOENT) - CERROR("inode_getattr failed (%d): unable to send a Size-on-MDS attribute update for inode %lu/%u\n", - rc, inode->i_ino, - inode->i_generation); + CERROR("%s: inode_getattr failed - unable to send a Size-on-MDS attribute update for inode "DFID": rc = %d\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), rc); } else { CDEBUG(D_INODE, "Size-on-MDS update on "DFID"\n", PFID(&lli->lli_fid)); @@ -302,9 +302,11 @@ static void ll_done_writing(struct inode *inode) * OSTs and send setattr to back to MDS. */ rc = ll_som_update(inode, op_data); - else if (rc) - CERROR("inode %lu mdc done_writing failed: rc = %d\n", - inode->i_ino, rc); + else if (rc) { + CERROR("%s: inode "DFID" mdc done_writing failed: rc = %d\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), rc); + } out: ll_finish_md_op_data(op_data); if (och) { @@ -349,8 +351,8 @@ static int ll_close_thread(void *arg) break; inode = ll_info2i(lli); - CDEBUG(D_INFO, "done_writing for inode %lu/%u\n", - inode->i_ino, inode->i_generation); + CDEBUG(D_INFO, "done_writing for inode "DFID"\n", + PFID(ll_inode2fid(inode))); ll_done_writing(inode); iput(inode); } diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 22e9989..2c6ae05 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1288,18 +1288,16 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, */ if (it->d.lustre.it_remote_lock_mode) { handle.cookie = it->d.lustre.it_remote_lock_handle; - CDEBUG(D_DLMTRACE, "setting l_data to inode %p(%lu/%u) for remote lock %#llx\n", - inode, - inode->i_ino, inode->i_generation, + CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"%p for remote lock %#llx\n", + PFID(ll_inode2fid(inode)), inode, handle.cookie); md_set_lock_data(exp, &handle.cookie, inode, NULL); } handle.cookie = it->d.lustre.it_lock_handle; - CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u) for lock %#llx\n", - inode, inode->i_ino, - inode->i_generation, handle.cookie); + CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"%p for lock %#llx\n", + PFID(ll_inode2fid(inode)), inode, handle.cookie); md_set_lock_data(exp, &handle.cookie, inode, &it->d.lustre.it_lock_bits); diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 9f338b1..55cddc7 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1033,8 +1033,8 @@ void ll_clear_inode(struct inode *inode) struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + PFID(ll_inode2fid(inode)), inode); if (S_ISDIR(inode->i_mode)) { /* these should have been cleared in ll_file_release */ @@ -1181,9 +1181,11 @@ static int ll_setattr_done_writing(struct inode *inode, * from OSTs and send setattr to back to MDS. */ rc = ll_som_update(inode, op_data); - else if (rc) - CERROR("inode %lu mdc truncate failed: rc = %d\n", - inode->i_ino, rc); + else if (rc) { + CERROR("%s: inode "DFID" mdc truncate failed: rc = %d\n", + ll_i2sbi(inode)->ll_md_exp->exp_obd->obd_name, + PFID(ll_inode2fid(inode)), rc); + } return rc; } @@ -1211,12 +1213,9 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) bool file_is_released = false; int rc = 0, rc1 = 0; - CDEBUG(D_VFSTRACE, - "%s: setattr inode %p/fid:" DFID - " from %llu to %llu, valid %x, hsm_import %d\n", - ll_get_fsname(inode->i_sb, NULL, 0), inode, - PFID(&lli->lli_fid), i_size_read(inode), attr->ia_size, - attr->ia_valid, hsm_import); + CDEBUG(D_VFSTRACE, "%s: setattr inode "DFID"(%p) from %llu to %llu, valid %x, hsm_import %d\n", + ll_get_fsname(inode->i_sb, NULL, 0), PFID(&lli->lli_fid), inode, + i_size_read(inode), attr->ia_size, attr->ia_valid, hsm_import); if (attr->ia_valid & ATTR_SIZE) { /* Check new size against VFS/VM file size limit and rlimit */ @@ -1590,10 +1589,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) /* FID shouldn't be changed! */ if (fid_is_sane(&lli->lli_fid)) { LASSERTF(lu_fid_eq(&lli->lli_fid, &body->fid1), - "Trying to change FID "DFID - " to the "DFID", inode %lu/%u(%p)\n", + "Trying to change FID "DFID" to the "DFID", inode "DFID"(%p)\n", PFID(&lli->lli_fid), PFID(&body->fid1), - inode->i_ino, inode->i_generation, inode); + PFID(ll_inode2fid(inode)), inode); } else { lli->lli_fid = body->fid1; } @@ -1620,8 +1618,10 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) if (lli->lli_flags & (LLIF_DONE_WRITING | LLIF_EPOCH_PENDING | LLIF_SOM_DIRTY)) { - CERROR("ino %lu flags %u still has size authority! do not trust the size got from MDS\n", - inode->i_ino, lli->lli_flags); + CERROR("%s: inode "DFID" flags %u still has size authority! do not trust the size got from MDS\n", + sbi->ll_md_exp->exp_obd->obd_name, + PFID(ll_inode2fid(inode)), + lli->lli_flags); } else { /* Use old size assignment to avoid * deadlock bz14138 & bz14326 @@ -1713,8 +1713,8 @@ void ll_delete_inode(struct inode *inode) spin_lock_irq(&inode->i_data.tree_lock); spin_unlock_irq(&inode->i_data.tree_lock); LASSERTF(inode->i_data.nrpages == 0, - "inode=%lu/%u(%p) nrpages=%lu, see http://jira.whamcloud.com/browse/LU-118\n", - inode->i_ino, inode->i_generation, inode, + "inode="DFID"(%p) nrpages=%lu, see http://jira.whamcloud.com/browse/LU-118\n", + PFID(ll_inode2fid(inode)), inode, inode->i_data.nrpages); } /* Workaround end */ @@ -1745,7 +1745,9 @@ int ll_iocontrol(struct inode *inode, struct file *file, rc = md_getattr(sbi->ll_md_exp, op_data, &req); ll_finish_md_op_data(op_data); if (rc) { - CERROR("failure %d inode %lu\n", rc, inode->i_ino); + CERROR("%s: failure inode "DFID": rc = %d\n", + sbi->ll_md_exp->exp_obd->obd_name, + PFID(ll_inode2fid(inode)), rc); return -abs(rc); } diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index 4f6697a..88ef1ca 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -394,9 +394,11 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) result = ll_page_mkwrite0(vma, vmf->page, &retry); if (!printed && ++count > 16) { - CWARN("app(%s): the page %lu of file %lu is under heavy contention.\n", + const struct dentry *de = vma->vm_file->f_path.dentry; + + CWARN("app(%s): the page %lu of file "DFID" is under heavy contention\n", current->comm, vmf->pgoff, - file_inode(vma->vm_file)->i_ino); + PFID(ll_inode2fid(de->d_inode))); printed = true; } } while (retry); diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index 2c26815..61cb5ff 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -191,8 +191,9 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen, int fileid_len = sizeof(struct lustre_nfs_fid) / 4; struct lustre_nfs_fid *nfs_fid = (void *)fh; - CDEBUG(D_INFO, "encoding for (%lu," DFID ") maxlen=%d minlen=%d\n", - inode->i_ino, PFID(ll_inode2fid(inode)), *plen, fileid_len); + CDEBUG(D_INFO, "%s: encoding for ("DFID") maxlen=%d minlen=%d\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), *plen, fileid_len); if (*plen < fileid_len) { *plen = fileid_len; @@ -298,8 +299,9 @@ static struct dentry *ll_get_parent(struct dentry *dchild) sbi = ll_s2sbi(dir->i_sb); - CDEBUG(D_INFO, "getting parent for (%lu," DFID ")\n", - dir->i_ino, PFID(ll_inode2fid(dir))); + CDEBUG(D_INFO, "%s: getting parent for ("DFID")\n", + ll_get_fsname(dir->i_sb, NULL, 0), + PFID(ll_inode2fid(dir))); rc = ll_get_default_mdsize(sbi, &lmmsize); if (rc != 0) @@ -314,7 +316,9 @@ static struct dentry *ll_get_parent(struct dentry *dchild) rc = md_getattr_name(sbi->ll_md_exp, op_data, &req); ll_finish_md_op_data(op_data); if (rc) { - CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino); + CERROR("%s: failure inode "DFID" get parent: rc = %d\n", + ll_get_fsname(dir->i_sb, NULL, 0), + PFID(ll_inode2fid(dir)), rc); return ERR_PTR(rc); } body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index cf4ad93..5eba0eb 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -133,9 +133,9 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, } } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) { ll_update_inode(inode, md); + CDEBUG(D_VFSTRACE, "got inode: "DFID"(%p)\n", + PFID(&md->body->fid1), inode); } - CDEBUG(D_VFSTRACE, "got inode: %p for "DFID"\n", - inode, PFID(&md->body->fid1)); } return inode; } @@ -257,8 +257,8 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, } if ((bits & MDS_INODELOCK_UPDATE) && S_ISDIR(inode->i_mode)) { - CDEBUG(D_INODE, "invalidating inode %lu\n", - inode->i_ino); + CDEBUG(D_INODE, "invalidating inode "DFID"\n", + PFID(ll_inode2fid(inode))); truncate_inode_pages(inode->i_mapping, 0); ll_invalidate_negative_children(inode); } @@ -478,9 +478,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) return ERR_PTR(-ENAMETOOLONG); - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),intent=%s\n", - dentry, parent->i_ino, - parent->i_generation, parent, LL_IT2STR(it)); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),intent=%s\n", + dentry, PFID(ll_inode2fid(parent)), parent, LL_IT2STR(it)); if (d_mountpoint(dentry)) CERROR("Tell Peter, lookup on mtpt, it %s\n", LL_IT2STR(it)); @@ -555,9 +554,8 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, struct lookup_intent *itp, it = { .it_op = IT_GETATTR }; struct dentry *de; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),flags=%u\n", - dentry, parent->i_ino, - parent->i_generation, parent, flags); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),flags=%u\n", + dentry, PFID(ll_inode2fid(parent)), parent, flags); /* Optimize away (CREATE && !OPEN). Let .create handle the race. */ if ((flags & LOOKUP_CREATE) && !(flags & LOOKUP_OPEN)) @@ -588,10 +586,9 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, long long lookup_flags = LOOKUP_OPEN; int rc = 0; - CDEBUG(D_VFSTRACE, - "VFS Op:name=%pd,dir=%lu/%u(%p),file %p,open_flags %x,mode %x opened %d\n", - dentry, dir->i_ino, - dir->i_generation, dir, file, open_flags, mode, *opened); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),file %p,open_flags %x,mode %x opened %d\n", + dentry, PFID(ll_inode2fid(dir)), dir, file, open_flags, mode, + *opened); it = kzalloc(sizeof(*it), GFP_NOFS); if (!it) @@ -682,8 +679,8 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it) * lock on the inode. Since we finally have an inode pointer, * stuff it in the lock. */ - CDEBUG(D_DLMTRACE, "setting l_ast_data to inode %p (%lu/%u)\n", - inode, inode->i_ino, inode->i_generation); + CDEBUG(D_DLMTRACE, "setting l_ast_data to inode "DFID"(%p)\n", + PFID(ll_inode2fid(dir)), inode); ll_set_lock_data(sbi->ll_md_exp, inode, it, NULL); out: ptlrpc_req_finished(request); @@ -710,9 +707,8 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode, struct inode *inode; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),intent=%s\n", - dentry, dir->i_ino, - dir->i_generation, dir, LL_IT2STR(it)); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), intent=%s\n", + dentry, PFID(ll_inode2fid(dir)), dir, LL_IT2STR(it)); rc = it_open_error(DISP_OPEN_CREATE, it); if (rc) @@ -735,8 +731,9 @@ static void ll_update_times(struct ptlrpc_request *request, LASSERT(body); if (body->valid & OBD_MD_FLMTIME && body->mtime > LTIME_S(inode->i_mtime)) { - CDEBUG(D_INODE, "setting ino %lu mtime from %lu to %llu\n", - inode->i_ino, LTIME_S(inode->i_mtime), body->mtime); + CDEBUG(D_INODE, "setting fid "DFID" mtime from %lu to %llu\n", + PFID(ll_inode2fid(inode)), LTIME_S(inode->i_mtime), + body->mtime); LTIME_S(inode->i_mtime) = body->mtime; } if (body->valid & OBD_MD_FLCTIME && @@ -793,9 +790,9 @@ static int ll_mknod(struct inode *dir, struct dentry *dchild, { int err; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p) mode %o dev %x\n", - dchild, dir->i_ino, dir->i_generation, dir, - mode, old_encode_dev(rdev)); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p) mode %o dev %x\n", + dchild, PFID(ll_inode2fid(dir)), dir, mode, + old_encode_dev(rdev)); if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) mode &= ~current_umask(); @@ -833,9 +830,8 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, { int rc; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),flags=%u, excl=%d\n", - dentry, dir->i_ino, - dir->i_generation, dir, mode, want_excl); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p), flags=%u, excl=%d\n", + dentry, PFID(ll_inode2fid(dir)), dir, mode, want_excl); rc = ll_mknod(dir, dentry, mode, 0); @@ -961,8 +957,8 @@ static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) { int err; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", - dentry, dir->i_ino, dir->i_generation, dir); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir"DFID"(%p)\n", + dentry, PFID(ll_inode2fid(dir)), dir); if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) mode &= ~current_umask(); @@ -981,8 +977,8 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild) struct md_op_data *op_data; int rc; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n", - dchild, dir->i_ino, dir->i_generation, dir); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p)\n", + dchild, PFID(ll_inode2fid(dir)), dir); op_data = ll_prep_md_op_data(NULL, dir, NULL, dchild->d_name.name, @@ -1011,9 +1007,8 @@ static int ll_symlink(struct inode *dir, struct dentry *dentry, { int err; - CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),target=%.*s\n", - dentry, dir->i_ino, dir->i_generation, - dir, 3000, oldname); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir="DFID"(%p),target=%.*s\n", + dentry, PFID(ll_inode2fid(dir)), dir, 3000, oldname); err = ll_new_node(dir, dentry, oldname, S_IFLNK | S_IRWXUGO, 0, LUSTRE_OPC_SYMLINK); @@ -1033,10 +1028,9 @@ static int ll_link(struct dentry *old_dentry, struct inode *dir, struct md_op_data *op_data; int err; - CDEBUG(D_VFSTRACE, - "VFS Op: inode=%lu/%u(%p), dir=%lu/%u(%p), target=%pd\n", - src->i_ino, src->i_generation, src, dir->i_ino, - dir->i_generation, dir, new_dentry); + CDEBUG(D_VFSTRACE, "VFS Op: inode="DFID"(%p), dir="DFID"(%p), target=%pd\n", + PFID(ll_inode2fid(src)), src, PFID(ll_inode2fid(dir)), dir, + new_dentry); op_data = ll_prep_md_op_data(NULL, src, dir, new_dentry->d_name.name, new_dentry->d_name.len, @@ -1065,9 +1059,9 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, int err; CDEBUG(D_VFSTRACE, - "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd,tgt_dir=%lu/%u(%p)\n", - src_dchild, src->i_ino, src->i_generation, src, - tgt_dchild, tgt->i_ino, tgt->i_generation, tgt); + "VFS Op:oldname=%pd, src_dir="DFID"(%p), newname=%pd, tgt_dir="DFID"(%p)\n", + src_dchild, PFID(ll_inode2fid(src)), src, + tgt_dchild, PFID(ll_inode2fid(tgt)), tgt); op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index cad6aa9..a740c7a 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -365,9 +365,8 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter, if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK)) return -EINVAL; - CDEBUG(D_VFSTRACE, - "VFS Op:inode=%lu/%u(%p), size=%zd (max %lu), offset=%lld=%llx, pages %zd (max %lu)\n", - inode->i_ino, inode->i_generation, inode, count, MAX_DIO_SIZE, + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), size=%zd (max %lu), offset=%lld=%llx, pages %zd (max %lu)\n", + PFID(ll_inode2fid(inode)), inode, count, MAX_DIO_SIZE, file_offset, file_offset, count >> PAGE_SHIFT, MAX_DIO_SIZE >> PAGE_SHIFT); diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 99ffd15..6322f88 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -661,8 +661,9 @@ static void ll_post_statahead(struct ll_statahead_info *sai) if (rc) goto out; - CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n", - child, child->i_ino, child->i_generation); + CDEBUG(D_DLMTRACE, "%s: setting l_data to inode "DFID"%p\n", + ll_get_fsname(child->i_sb, NULL, 0), + PFID(ll_inode2fid(child)), child); ll_set_lock_data(ll_i2sbi(dir)->ll_md_exp, child, it, NULL); entry->se_inode = child; @@ -1591,13 +1592,11 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, *dentryp = alias; } else if (d_inode(*dentryp) != inode) { /* revalidate, but inode is recreated */ - CDEBUG(D_READA, - "stale dentry %pd inode %lu/%u, statahead inode %lu/%u\n", - *dentryp, - d_inode(*dentryp)->i_ino, - d_inode(*dentryp)->i_generation, - inode->i_ino, - inode->i_generation); + CDEBUG(D_READA, "%s: stale dentry %pd inode "DFID", statahead inode "DFID"\n", + ll_get_fsname(d_inode(*dentryp)->i_sb, NULL, 0), + *dentryp, + PFID(ll_inode2fid(d_inode(*dentryp))), + PFID(ll_inode2fid(inode))); ll_sai_unplug(sai, entry); return -ESTALE; } else { diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index 46d03ea..3fc736c 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c @@ -77,7 +77,9 @@ static int ll_readlink_internal(struct inode *inode, ll_finish_md_op_data(op_data); if (rc) { if (rc != -ENOENT) - CERROR("inode %lu: rc = %d\n", inode->i_ino, rc); + CERROR("%s: inode "DFID": rc = %d\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), rc); goto failed; } @@ -90,8 +92,10 @@ static int ll_readlink_internal(struct inode *inode, LASSERT(symlen != 0); if (body->eadatasize != symlen) { - CERROR("inode %lu: symlink length %d not expected %d\n", - inode->i_ino, body->eadatasize - 1, symlen - 1); + CERROR("%s: inode "DFID": symlink length %d not expected %d\n", + ll_get_fsname(inode->i_sb, NULL, 0), + PFID(ll_inode2fid(inode)), body->eadatasize - 1, + symlen - 1); rc = -EPROTO; goto failed; } diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 644a31f..47101de 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -532,15 +532,14 @@ static void vvp_pgcache_page_show(const struct lu_env *env, vpg = cl2vvp_page(cl_page_at(page, &vvp_device_type)); vmpage = vpg->vpg_page; - seq_printf(seq, " %5i | %p %p %s %s %s %s | %p %lu/%u(%p) %lu %u [", + seq_printf(seq, " %5i | %p %p %s %s %s %s | %p "DFID"(%p) %lu %u [", 0 /* gen */, vpg, page, "none", vpg->vpg_write_queued ? "wq" : "- ", vpg->vpg_defer_uptodate ? "du" : "- ", PageWriteback(vmpage) ? "wb" : "-", - vmpage, vmpage->mapping->host->i_ino, - vmpage->mapping->host->i_generation, + vmpage, PFID(ll_inode2fid(vmpage->mapping->host)), vmpage->mapping->host, vmpage->index, page_count(vmpage)); has_flags = 0; diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 43b2d08..6f2e6c3 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -219,8 +219,8 @@ int ll_setxattr(struct dentry *dentry, const char *name, LASSERT(inode); LASSERT(name); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), xattr %s\n", - inode->i_ino, inode->i_generation, inode, name); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n", + PFID(ll_inode2fid(inode)), inode, name); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_SETXATTR, 1); @@ -273,8 +273,8 @@ int ll_removexattr(struct dentry *dentry, const char *name) LASSERT(inode); LASSERT(name); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), xattr %s\n", - inode->i_ino, inode->i_generation, inode, name); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n", + PFID(ll_inode2fid(inode)), inode, name); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REMOVEXATTR, 1); return ll_setxattr_common(inode, name, NULL, 0, 0, @@ -293,8 +293,8 @@ int ll_getxattr_common(struct inode *inode, const char *name, struct rmtacl_ctl_entry *rce = NULL; struct ll_inode_info *lli = ll_i2info(inode); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", - inode->i_ino, inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + PFID(ll_inode2fid(inode)), inode); /* listxattr have slightly different behavior from of ext3: * without 'user_xattr' ext3 will list all xattr names but @@ -458,8 +458,8 @@ ssize_t ll_getxattr(struct dentry *dentry, const char *name, LASSERT(inode); LASSERT(name); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), xattr %s\n", - inode->i_ino, inode->i_generation, inode, name); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n", + PFID(ll_inode2fid(inode)), inode, name); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR, 1); @@ -553,8 +553,8 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size) LASSERT(inode); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", - inode->i_ino, inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", + PFID(ll_inode2fid(inode)), inode); ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LISTXATTR, 1); -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:03 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:03 -0400 Subject: [lustre-devel] [PATCH 11/15] staging: lustre: mgc: fix 'error handling' issues In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-12-git-send-email-jsimmons@infradead.org> From: Sebastien Buisson Fix 'error handling' issues found by Coverity version 6.6.1: Unchecked return value (CHECKED_RETURN) Calling function without checking return value. Argument cannot be negative (NEGATIVE_RETURNS) Negative value used as argument to a function expecting a positive value. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4055 Reviewed-on: http://review.whamcloud.com/7842 Reviewed-by: Dmitry Eremin Reviewed-by: James Nunez Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 933f6f6..2311a43 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -502,8 +502,12 @@ static void do_requeue(struct config_llog_data *cld) */ down_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem); if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) { + int rc; + CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname); - mgc_process_log(cld->cld_mgcexp->exp_obd, cld); + rc = mgc_process_log(cld->cld_mgcexp->exp_obd, cld); + if (rc && rc != -ENOENT) + CERROR("failed processing log: %d\n", rc); } else { CDEBUG(D_MGC, "disconnecting, won't update log %s\n", cld->cld_logname); -- 1.7.1 From jsimmons at infradead.org Wed Apr 27 22:21:05 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 18:21:05 -0400 Subject: [lustre-devel] [PATCH 13/15] staging: lustre: osc: Track number of "unstable" pages per osc In-Reply-To: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461795667-29035-14-git-send-email-jsimmons@infradead.org> From: Prakash Surya This change adds simple accounting hooks for "unstable" pages on a per OSC basis. Now, in addition to the per filesystem tracking, each OSC will maintain a running total of its unstable pages. These counters are exported through the proc interface, and can be read using the lctl command. For example: # Read number of unstable pages contained by each OSC lctl get_param osc.*.unstable_stats The motivation for this change is in anticipation of implementing a "soft sync" functionality, urging servers to commit these unstable pages to stable storage. The per OSC accounting allows a client to limit the soft sync request to only the OSCs which have outstanding unstable pages. Signed-off-by: Prakash Surya Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2139 Reviewed-on: http://review.whamcloud.com/4374 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 + drivers/staging/lustre/lustre/osc/lproc_osc.c | 18 ++++++++++++++++++ drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ++++++ 4 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 3f24a5b..d0c0c26 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -325,6 +325,7 @@ struct client_obd { atomic_t cl_lru_in_list; struct list_head cl_lru_list; /* lru page list */ spinlock_t cl_lru_list_lock; /* page list protector */ + atomic_t cl_unstable_count; /* number of in flight destroy rpcs is limited to max_rpcs_in_flight */ atomic_t cl_destroy_in_flight; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index bc951c0..32486b2 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -334,6 +334,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) atomic_set(&cli->cl_lru_in_list, 0); INIT_LIST_HEAD(&cli->cl_lru_list); spin_lock_init(&cli->cl_lru_list_lock); + atomic_set(&cli->cl_unstable_count, 0); init_waitqueue_head(&cli->cl_destroy_waitq); atomic_set(&cli->cl_destroy_in_flight, 0); diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 6e57f53..33a1132 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -593,6 +593,23 @@ static ssize_t max_pages_per_rpc_store(struct kobject *kobj, } LUSTRE_RW_ATTR(max_pages_per_rpc); +static ssize_t unstable_stats_show(struct kobject *kobj, + struct attribute *attr, + char *buf) +{ + struct obd_device *dev = container_of(kobj, struct obd_device, + obd_kobj); + struct client_obd *cli = &dev->u.cli; + int pages, mb; + + pages = atomic_read(&cli->cl_unstable_count); + mb = (pages * PAGE_SIZE) >> 20; + + return sprintf(buf, "unstable_pages: %8d\n" + "unstable_mb: %8d\n", pages, mb); +} +LUSTRE_RO_ATTR(unstable_stats); + LPROC_SEQ_FOPS_RO_TYPE(osc, connect_flags); LPROC_SEQ_FOPS_RO_TYPE(osc, server_uuid); LPROC_SEQ_FOPS_RO_TYPE(osc, conn_uuid); @@ -802,6 +819,7 @@ static struct attribute *osc_attrs[] = { &lustre_attr_max_pages_per_rpc.attr, &lustre_attr_max_rpcs_in_flight.attr, &lustre_attr_resend_count.attr, + &lustre_attr_unstable_stats.attr, NULL, }; diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 5cd8eef..7d1c2c5 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1873,6 +1873,9 @@ void osc_dec_unstable_pages(struct ptlrpc_request *req) atomic_sub(page_count, &cli->cl_cache->ccc_unstable_nr); LASSERT(atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0); + atomic_sub(page_count, &cli->cl_unstable_count); + LASSERT(atomic_read(&cli->cl_unstable_count) >= 0); + atomic_sub(page_count, &obd_unstable_pages); LASSERT(atomic_read(&obd_unstable_pages) >= 0); @@ -1904,6 +1907,9 @@ void osc_inc_unstable_pages(struct ptlrpc_request *req) LASSERT(atomic_read(&cli->cl_cache->ccc_unstable_nr) >= 0); atomic_add(page_count, &cli->cl_cache->ccc_unstable_nr); + LASSERT(atomic_read(&cli->cl_unstable_count) >= 0); + atomic_add(page_count, &cli->cl_unstable_count); + LASSERT(atomic_read(&obd_unstable_pages) >= 0); atomic_add(page_count, &obd_unstable_pages); -- 1.7.1 From jsimmons at infradead.org Thu Apr 28 01:37:12 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:12 -0400 Subject: [lustre-devel] [PATCH 03/12] staging: lustre: ptlrpc: use unified handler for OST requests In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-4-git-send-email-jsimmons@infradead.org> From: Mikhail Pershin Switch OST/OFD request processing to the unified request handle. Signed-off-by: Mikhail Pershin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467 Reviewed-on: http://review.whamcloud.com/7130 Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Signed-off-by: James Simmons --- .../staging/lustre/lustre/include/lustre_req_layout.h | 2 +- drivers/staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ptlrpc/layout.c | 16 +++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index b2e67fc..b0bc751 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -199,7 +199,7 @@ extern struct req_format RQF_OST_BRW_READ; extern struct req_format RQF_OST_BRW_WRITE; extern struct req_format RQF_OST_STATFS; extern struct req_format RQF_OST_SET_GRANT_INFO; -extern struct req_format RQF_OST_GET_INFO_GENERIC; +extern struct req_format RQF_OST_GET_INFO; extern struct req_format RQF_OST_GET_INFO_LAST_ID; extern struct req_format RQF_OST_GET_INFO_LAST_FID; extern struct req_format RQF_OST_SET_INFO_LAST_FID; diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index c7267b7..2aaa343 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -290,6 +290,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_OST_ENOINO 0x229 #define OBD_FAIL_OST_DQACQ_NET 0x230 #define OBD_FAIL_OST_STATFS_EINPROGRESS 0x231 +#define OBD_FAIL_OST_SET_INFO_NET 0x232 #define OBD_FAIL_LDLM 0x300 #define OBD_FAIL_LDLM_NAMESPACE_NEW 0x301 diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 5b06901..ccc1f3e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -566,7 +566,7 @@ static const struct req_msg_field *ost_get_info_generic_server[] = { static const struct req_msg_field *ost_get_info_generic_client[] = { &RMF_PTLRPC_BODY, - &RMF_SETINFO_KEY + &RMF_GETINFO_KEY }; static const struct req_msg_field *ost_get_last_id_server[] = { @@ -574,6 +574,12 @@ static const struct req_msg_field *ost_get_last_id_server[] = { &RMF_OBD_ID }; +static const struct req_msg_field *ost_get_last_fid_client[] = { + &RMF_PTLRPC_BODY, + &RMF_GETINFO_KEY, + &RMF_FID, +}; + static const struct req_msg_field *ost_get_last_fid_server[] = { &RMF_PTLRPC_BODY, &RMF_FID, @@ -696,7 +702,7 @@ static struct req_format *req_formats[] = { &RQF_OST_BRW_WRITE, &RQF_OST_STATFS, &RQF_OST_SET_GRANT_INFO, - &RQF_OST_GET_INFO_GENERIC, + &RQF_OST_GET_INFO, &RQF_OST_GET_INFO_LAST_ID, &RQF_OST_GET_INFO_LAST_FID, &RQF_OST_SET_INFO_LAST_FID, @@ -1519,10 +1525,10 @@ struct req_format RQF_OST_SET_GRANT_INFO = ost_body_only); EXPORT_SYMBOL(RQF_OST_SET_GRANT_INFO); -struct req_format RQF_OST_GET_INFO_GENERIC = +struct req_format RQF_OST_GET_INFO = DEFINE_REQ_FMT0("OST_GET_INFO", ost_get_info_generic_client, ost_get_info_generic_server); -EXPORT_SYMBOL(RQF_OST_GET_INFO_GENERIC); +EXPORT_SYMBOL(RQF_OST_GET_INFO); struct req_format RQF_OST_GET_INFO_LAST_ID = DEFINE_REQ_FMT0("OST_GET_INFO_LAST_ID", ost_get_info_generic_client, @@ -1530,7 +1536,7 @@ struct req_format RQF_OST_GET_INFO_LAST_ID = EXPORT_SYMBOL(RQF_OST_GET_INFO_LAST_ID); struct req_format RQF_OST_GET_INFO_LAST_FID = - DEFINE_REQ_FMT0("OST_GET_INFO_LAST_FID", obd_set_info_client, + DEFINE_REQ_FMT0("OST_GET_INFO_LAST_FID", ost_get_last_fid_client, ost_get_last_fid_server); EXPORT_SYMBOL(RQF_OST_GET_INFO_LAST_FID); -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:11 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:11 -0400 Subject: [lustre-devel] [PATCH 02/12] staging: lustre: obd: add newline for dumped config record In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-3-git-send-email-jsimmons@infradead.org> From: Amir Shehata The function class_config_parse_rec() parses the llog record and places it into a buffer to be returned. That buffer needs to end with a newline which is currently missing. Signed-off-by: Amir Shehata Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2149 Reviewed-on: http://review.whamcloud.com/4254 Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/obd_config.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 084af1a..e60ef4a 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1350,6 +1350,7 @@ static int class_config_parse_rec(struct llog_rec_hdr *rec, char *buf, lustre_cfg_string(lcfg, i)); } } + ptr += snprintf(ptr, end - ptr, "\n"); /* return consumed bytes */ rc = ptr - buf; return rc; -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:13 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:13 -0400 Subject: [lustre-devel] [PATCH 04/12] staging: lustre: ldlm: check all errors during ldlm_debugfs_setup() In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-5-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Fix ignoring errors from ldebugfs_add_vars() function. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3885 Reviewed-on: http://review.whamcloud.com/8115 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 475fabb..e99c89c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -124,9 +124,15 @@ int ldlm_debugfs_setup(void) } rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL); + if (rc) { + CERROR("LProcFS failed in ldlm-init\n"); + goto err_svc; + } return 0; +err_svc: + ldebugfs_remove(&ldlm_svc_debugfs_dir); err_ns: ldebugfs_remove(&ldlm_ns_debugfs_dir); err_type: -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:19 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:19 -0400 Subject: [lustre-devel] [PATCH 10/12] staging: lustre: llog: we don't need vfsmount In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-11-git-send-email-jsimmons@infradead.org> From: Lai Siyao The patch for LU-3286 removed vfsmount instances used on the server side. Since this is server side only we can remove it from the upstream client. Signed-off-by: Lai Siyao Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3286 Reviewed-on: http://review.whamcloud.com/8286 Reviewed-by: Alex Zhuravlev Reviewed-by: Mike Pershin Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre_disk.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h index 95fd360..b36821f 100644 --- a/drivers/staging/lustre/lustre/include/lustre_disk.h +++ b/drivers/staging/lustre/lustre/include/lustre_disk.h @@ -130,7 +130,6 @@ struct lustre_sb_info { struct lustre_mount_data *lsi_lmd; /* mount command info */ struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */ struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/ - struct vfsmount *lsi_srv_mnt; /* the one server mount */ atomic_t lsi_mounts; /* references to the srv_mnt */ char lsi_svname[MTI_NAME_MAXLEN]; char lsi_osd_obdname[64]; @@ -158,7 +157,6 @@ struct lustre_sb_info { struct lustre_mount_info { char *lmi_name; struct super_block *lmi_sb; - struct vfsmount *lmi_mnt; struct list_head lmi_list_chain; }; -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:15 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:15 -0400 Subject: [lustre-devel] [PATCH 06/12] staging: lustre: fid: add a connect flag for open by FID In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-7-git-send-email-jsimmons@infradead.org> From: Lai Siyao Add OBD_CONNECT_OPEN_BY_FID for open by FID, if MDS supports this, for open by FID, it won't retry with name if object with the FID doesn't exist; while if client supports this, client won't pack name in open request if FID is known. Signed-off-by: Lai Siyao Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544 Reviewed-on: http://review.whamcloud.com/8093 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 3 +++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 26819ee..0ef540a 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1257,6 +1257,9 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); #define OBD_CONNECT_PINGLESS 0x4000000000000ULL/* pings not required */ #define OBD_CONNECT_FLOCK_DEAD 0x8000000000000ULL/* flock deadlock detection */ #define OBD_CONNECT_DISP_STRIPE 0x10000000000000ULL/*create stripe disposition*/ +#define OBD_CONNECT_OPEN_BY_FID 0x20000000000000ULL /* open by fid won't pack + * name in request + */ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 87555e4..308b6b96 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -1069,6 +1069,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT_PINGLESS); LASSERTF(OBD_CONNECT_FLOCK_DEAD == 0x8000000000000ULL, "found 0x%.16llxULL\n", OBD_CONNECT_FLOCK_DEAD); + LASSERTF(OBD_CONNECT_OPEN_BY_FID == 0x20000000000000ULL, + "found 0x%.16llxULL\n", OBD_CONNECT_OPEN_BY_FID); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n", -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:09 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:09 -0400 Subject: [lustre-devel] [PATCH 00/12] staging: lustre: add patches from lustre 2.5.52 version Message-ID: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Assortment of bug fixes that are present in the 2.5.52 version of lustre that is missing in the upstream client. Amir Shehata (2): staging: lustre: obd: remove newline from LCONSOLE string staging: lustre: obd: add newline for dumped config record Andreas Dilger (1): staging: lustre: llite: debugging for ll_file_open LASSERT Andriy Skulysh (1): staging: lustre: libcfs: Fix NUMA emulated mode Dmitry Eremin (2): staging: lustre: ldlm: check all errors during ldlm_debugfs_setup() staging: lustre: llite: fixup return value ll_direct_IO_26 Lai Siyao (2): staging: lustre: fid: add a connect flag for open by FID staging: lustre: llog: we don't need vfsmount Mikhail Pershin (2): staging: lustre: ptlrpc: use unified handler for OST requests staging: lustre: ptlrpc: initialize request session early Swapnil Pimpale (2): staging: lustre: obd: cleanup client import if client_obd_setup fails staging: lustre: llite: check ret of ll_prep_md_op_data in ll_dir_filler .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 9 +++- .../lustre/lustre/include/lustre/lustre_idl.h | 3 ++ .../staging/lustre/lustre/include/lustre_disk.h | 2 - .../lustre/lustre/include/lustre_req_layout.h | 2 +- .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 6 +++ drivers/staging/lustre/lustre/llite/dir.c | 7 ++- drivers/staging/lustre/lustre/llite/file.c | 4 +- drivers/staging/lustre/lustre/llite/rw26.c | 2 +- .../staging/lustre/lustre/obdclass/obd_config.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 16 +++++-- drivers/staging/lustre/lustre/ptlrpc/service.c | 53 +++++++++++++--------- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 + 14 files changed, 74 insertions(+), 37 deletions(-) -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:14 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:14 -0400 Subject: [lustre-devel] [PATCH 05/12] staging: lustre: obd: cleanup client import if client_obd_setup fails In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-6-git-send-email-jsimmons@infradead.org> From: Swapnil Pimpale client_obd_setup() allocates an obd_import which should be cleaned up if there is any failure afterwards in callers of client_obd_setup(). This patch fixes the bug in osc_setup(), mgc_setup(), mdc_setup() and lwp_setup(). The fix is to call obd_cleanup_client_import() before calling client_obd_cleanup() in case of an error. Signed-off-by: Swapnil Pimpale Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3810 Reviewed-on: http://review.whamcloud.com/7561 Reviewed-by: John L. Hammond Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 932aef2..00c93f3 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -439,6 +439,7 @@ int client_obd_cleanup(struct obd_device *obddev) ldlm_namespace_free_post(obddev->obd_namespace); obddev->obd_namespace = NULL; + obd_cleanup_client_import(obddev); LASSERT(!obddev->u.cli.cl_import); ldlm_put_ref(); -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:17 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:17 -0400 Subject: [lustre-devel] [PATCH 08/12] staging: lustre: llite: debugging for ll_file_open LASSERT In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-9-git-send-email-jsimmons@infradead.org> From: Andreas Dilger Add debugging for LASSERTF(it_disposition(it, DISP_ENQ_OPEN_REF) in ll_file_open(), since this is a rarely hit failure under racer, and it would be useful to get more information if this is hit again. Print the full intent disposition, as well as the status, in case Oleg's earlier comment about bailing out on any error is actually the case here. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1993 Reviewed-on: http://review.whamcloud.com/6250 Reviewed-by: Bob Glossman Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index a8de10e..f47f2ac 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -679,7 +679,9 @@ restart: if (rc) goto out_och_free; - LASSERT(it_disposition(it, DISP_ENQ_OPEN_REF)); + LASSERTF(it_disposition(it, DISP_ENQ_OPEN_REF), + "inode %p: disposition %x, status %d\n", inode, + it_disposition(it, ~0), it->d.lustre.it_status); rc = ll_local_open(file, it, fd, *och_p); if (rc) -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:20 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:20 -0400 Subject: [lustre-devel] [PATCH 11/12] staging: lustre: ptlrpc: initialize request session early In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-12-git-send-email-jsimmons@infradead.org> From: Mikhail Pershin Initialize request session early to make it available in high-priority handlers Signed-off-by: Mikhail Pershin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467 Reviewed-on: http://review.whamcloud.com/7350 Reviewed-by: Alex Zhuravlev Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/service.c | 53 +++++++++++++++----------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index fc2632f..17c7b97 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -838,6 +838,11 @@ static void ptlrpc_server_finish_request(struct ptlrpc_service_part *svcpt, { ptlrpc_server_hpreq_fini(req); + if (req->rq_session.lc_thread) { + lu_context_exit(&req->rq_session); + lu_context_fini(&req->rq_session); + } + ptlrpc_server_drop_request(req); } @@ -1579,6 +1584,21 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt, } req->rq_svc_thread = thread; + if (thread) { + /* initialize request session, it is needed for request + * processing by target + */ + rc = lu_context_init(&req->rq_session, + LCT_SERVER_SESSION | LCT_NOREF); + if (rc) { + CERROR("%s: failure to initialize session: rc = %d\n", + thread->t_name, rc); + goto err_req; + } + req->rq_session.lc_thread = thread; + lu_context_enter(&req->rq_session); + req->rq_svc_thread->t_env->le_ses = &req->rq_session; + } ptlrpc_at_add_timed(req); @@ -1612,7 +1632,6 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, struct timespec64 arrived; unsigned long timediff_usecs; unsigned long arrived_usecs; - int rc; int fail_opc = 0; request = ptlrpc_server_request_get(svcpt, false); @@ -1649,22 +1668,6 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, at_get(&svcpt->scp_at_estimate)); } - rc = lu_context_init(&request->rq_session, LCT_SERVER_SESSION | - LCT_NOREF); - if (rc) { - CERROR("Failure to initialize session: %d\n", rc); - goto out_req; - } - request->rq_session.lc_thread = thread; - request->rq_session.lc_cookie = 0x5; - lu_context_enter(&request->rq_session); - - CDEBUG(D_NET, "got req %llu\n", request->rq_xid); - - request->rq_svc_thread = thread; - if (thread) - request->rq_svc_thread->t_env->le_ses = &request->rq_session; - if (likely(request->rq_export)) { if (unlikely(ptlrpc_check_req(request))) goto put_conn; @@ -1696,14 +1699,21 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, if (lustre_msg_get_opc(request->rq_reqmsg) != OBD_PING) CFS_FAIL_TIMEOUT_MS(OBD_FAIL_PTLRPC_PAUSE_REQ, cfs_fail_val); - rc = svc->srv_ops.so_req_handler(request); + CDEBUG(D_NET, "got req %llu\n", request->rq_xid); + + /* re-assign request and sesson thread to the current one */ + request->rq_svc_thread = thread; + if (thread) { + LASSERT(request->rq_session.lc_thread); + request->rq_session.lc_thread = thread; + request->rq_session.lc_cookie = 0x55; + thread->t_env->le_ses = &request->rq_session; + } + svc->srv_ops.so_req_handler(request); ptlrpc_rqphase_move(request, RQ_PHASE_COMPLETE); put_conn: - lu_context_exit(&request->rq_session); - lu_context_fini(&request->rq_session); - if (unlikely(ktime_get_real_seconds() > request->rq_deadline)) { DEBUG_REQ(D_WARNING, request, "Request took longer than estimated (%lld:%llds); " @@ -1757,7 +1767,6 @@ put_conn: request->rq_arrival_time.tv_sec); } -out_req: ptlrpc_server_finish_active_request(svcpt, request); return 1; -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:18 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:18 -0400 Subject: [lustre-devel] [PATCH 09/12] staging: lustre: llite: check ret of ll_prep_md_op_data in ll_dir_filler In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-10-git-send-email-jsimmons@infradead.org> From: Swapnil Pimpale ll_dir_filler() now checks the returned pointer from ll_prep_md_op_data() using IS_ERR() Signed-off-by: Swapnil Pimpale Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4082 Reviewed-on: http://review.whamcloud.com/8073 Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 09d3297..56aa7de 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -163,6 +163,11 @@ static int ll_dir_filler(void *_hash, struct page *page0) LASSERT(max_pages > 0 && max_pages <= MD_MAX_BRW_PAGES); + op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0, + LUSTRE_OPC_ANY, NULL); + if (IS_ERR(op_data)) + return PTR_ERR(op_data); + page_pool = kcalloc(max_pages, sizeof(page), GFP_NOFS); if (page_pool) { page_pool[0] = page0; @@ -177,8 +182,6 @@ static int ll_dir_filler(void *_hash, struct page *page0) page_pool[npages] = page; } - op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0, - LUSTRE_OPC_ANY, NULL); op_data->op_npages = npages; op_data->op_offset = hash; rc = md_readpage(exp, op_data, page_pool, &request); -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:21 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:21 -0400 Subject: [lustre-devel] [PATCH 12/12] staging: lustre: llite: fixup return value ll_direct_IO_26 In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-13-git-send-email-jsimmons@infradead.org> From: Dmitry Eremin Return the correct values from ll_direct_IO_26. Signed-off-by: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4069 Reviewed-on: http://review.whamcloud.com/8080 Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-Off-by: James Simmons --- drivers/staging/lustre/lustre/llite/rw26.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index a740c7a..9341189 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -446,7 +446,7 @@ out: } cl_env_put(env, &refcheck); - return tot_bytes ? : result; + return tot_bytes ? tot_bytes : result; } /** -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:16 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:16 -0400 Subject: [lustre-devel] [PATCH 07/12] staging: lustre: libcfs: Fix NUMA emulated mode In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-8-git-send-email-jsimmons@infradead.org> From: Andriy Skulysh Kernel commit c1c3443c9c5e9be92641029ed229a41563e44506 assigns all allowed cpus to emulated node. End cpt initialization loop when all CPUs are assigned. Signed-off-by: Andriy Skulysh Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3992 Reviewed-on: http://review.whamcloud.com/7724 Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 389fb9e..b52518c5 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -755,8 +755,13 @@ cfs_cpt_table_create(int ncpt) struct cfs_cpu_partition *part; int n; - if (cpt >= ncpt) - goto failed; + /* + * Each emulated NUMA node has all allowed CPUs in + * the mask. + * End loop when all partitions have assigned CPUs. + */ + if (cpt == ncpt) + break; part = &cptab->ctb_parts[cpt]; -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 01:37:10 2016 From: jsimmons at infradead.org (James Simmons) Date: Wed, 27 Apr 2016 21:37:10 -0400 Subject: [lustre-devel] [PATCH 01/12] staging: lustre: obd: remove newline from LCONSOLE string In-Reply-To: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> References: <1461807441-3210-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461807441-3210-2-git-send-email-jsimmons@infradead.org> From: Amir Shehata Remove the newline from the LCONSOLE debug macro in the function class_config_dump_handler(). Signed-off-by: Amir Shehata Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2149 Reviewed-on: http://review.whamcloud.com/4254 Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/obd_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 5395e99..084af1a 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1368,7 +1368,7 @@ int class_config_dump_handler(const struct lu_env *env, if (rec->lrh_type == OBD_CFG_REC) { class_config_parse_rec(rec, outstr, 256); - LCONSOLE(D_WARNING, " %s\n", outstr); + LCONSOLE(D_WARNING, " %s", outstr); } else { LCONSOLE(D_WARNING, "unhandled lrh_type: %#x\n", rec->lrh_type); rc = -EINVAL; -- 2.7.4 From dan.carpenter at oracle.com Thu Apr 28 08:19:07 2016 From: dan.carpenter at oracle.com (Dan Carpenter) Date: Thu, 28 Apr 2016 11:19:07 +0300 Subject: [lustre-devel] [PATCH 05/15] staging: lustre: ldlm: use accessor macros for l_flags In-Reply-To: <5721425D.5050606@gmail.com> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> <1461795667-29035-6-git-send-email-jsimmons@infradead.org> <5721425D.5050606@gmail.com> Message-ID: <20160428081907.GN4298@mwanda> On Wed, Apr 27, 2016 at 03:51:09PM -0700, Bruce Korb wrote: > Wow! I remember this stuff, even if from 3 years ago. Feels like a > lifetime. Is this patch being applied to official Linux, hence this > message? Xyratex collapsed, shed a mess of employees and sold the > remnant to Seagate. Consequently, I don't really follow Lustre any > more. Sorry. Hi Bruce, o/ Yeah. James is pushing all that stuff to the vanilla kernel. regards, dan carpenter From jsimmons at infradead.org Thu Apr 28 16:07:30 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:30 -0400 Subject: [lustre-devel] [PATCH 0/8] staging : lustre : missing fixes for lustre 2.5.53 Message-ID: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> This next set of patches covers what is in the upstream client that is present in lustre 2.5.53 Alexander Boyko (1): staging: lustre: brw: added OBDO short io flag Andreas Dilger (1): staging: lustre: llite: quiet overly verbose info message Emoly Liu (2): staging: lustre: obd: add case LCFG_PARAM to osd_process_config staging: lustre: debugfs: improve osc/mdc "imports" connect data John L. Hammond (1): staging: lustre: echo: remove echo_env_info() regions from echo_client.c Oleg Drokin (1): staging: lustre: debug: initialize debug_msg_data if needed Sebastien Buisson (1): staging: lustre: ldlm: dont always check max_pages_per_rpc alignement wang di (1): staging: lustre: fld: add local fldb to each target drivers/staging/lustre/lustre/fid/fid_request.c | 5 +- drivers/staging/lustre/lustre/fld/fld_internal.h | 9 +-- drivers/staging/lustre/lustre/fld/fld_request.c | 79 +++++++++++++++------- drivers/staging/lustre/lustre/include/cl_object.h | 6 +- drivers/staging/lustre/lustre/include/lu_object.h | 6 +- .../lustre/lustre/include/lustre/lustre_idl.h | 20 +++++- .../staging/lustre/lustre/include/lustre_param.h | 1 + .../lustre/lustre/include/lustre_req_layout.h | 1 + .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 6 ++ drivers/staging/lustre/lustre/llite/llite_lib.c | 4 +- .../lustre/lustre/obdclass/lprocfs_status.c | 63 +++++++++++++++-- .../staging/lustre/lustre/obdclass/obd_config.c | 20 +++--- .../staging/lustre/lustre/obdecho/echo_client.c | 2 - drivers/staging/lustre/lustre/ptlrpc/layout.c | 15 ++++ .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 + drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 4 +- 17 files changed, 176 insertions(+), 67 deletions(-) -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:31 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:31 -0400 Subject: [lustre-devel] [PATCH 1/8] staging: lustre: debug: initialize debug_msg_data if needed In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-2-git-send-email-jsimmons@infradead.org> From: Oleg Drokin initialize the libcfs_debug_msg_data only if needed Signed-off-by: Oleg Drokin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1408 Reviewed-on: http://review.whamcloud.com/8338 Reviewed-by: Jinshan Xiong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 6 ++---- drivers/staging/lustre/lustre/include/lu_object.h | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 587a236..d4c33dd 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -1041,9 +1041,8 @@ struct cl_page_operations { */ #define CL_PAGE_DEBUG(mask, env, page, format, ...) \ do { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ - \ if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ cl_page_print(env, &msgdata, lu_cdebug_printer, page); \ CDEBUG(mask, format, ## __VA_ARGS__); \ } \ @@ -1054,9 +1053,8 @@ do { \ */ #define CL_PAGE_HEADER(mask, env, page, format, ...) \ do { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ - \ if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ cl_page_header_print(env, &msgdata, lu_cdebug_printer, page); \ CDEBUG(mask, format, ## __VA_ARGS__); \ } \ diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index dad757f..41c45ff 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -781,9 +781,8 @@ int lu_cdebug_printer(const struct lu_env *env, */ #define LU_OBJECT_DEBUG(mask, env, object, format, ...) \ do { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ - \ if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ lu_object_print(env, &msgdata, lu_cdebug_printer, object);\ CDEBUG(mask, format, ## __VA_ARGS__); \ } \ @@ -794,9 +793,8 @@ do { \ */ #define LU_OBJECT_HEADER(mask, env, object, format, ...) \ do { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ - \ if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ lu_object_header_print(env, &msgdata, lu_cdebug_printer,\ (object)->lo_header); \ lu_cdebug_printer(env, &msgdata, "\n"); \ -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:32 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:32 -0400 Subject: [lustre-devel] [PATCH 2/8] staging: lustre: echo: remove echo_env_info() regions from echo_client.c In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-3-git-send-email-jsimmons@infradead.org> From: "John L. Hammond" This function declartion is not needed so remove it. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/5580 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index b271895..1225944 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -163,8 +163,6 @@ static int cl_echo_object_put(struct echo_object *eco); static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, struct page **pages, int npages, int async); -static struct echo_thread_info *echo_env_info(const struct lu_env *env); - struct echo_thread_info { struct echo_object_conf eti_conf; struct lustre_md eti_md; -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:37 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:37 -0400 Subject: [lustre-devel] [PATCH 7/8] staging: lustre: debugfs: improve osc/mdc "imports" connect data In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-8-git-send-email-jsimmons@infradead.org> From: Emoly Liu Improve /sys/debug/fs/lustre/{osc,mdc}/*/import files to print the struct obd_connect_data data fields as "connect_data:" in addition to the "connect_flags:" field. Signed-off-by: Emoly Liu Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3386 Reviewed-on: http://review.whamcloud.com/6588 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: John L. Hammond Signed-off-by: James Simmons --- .../lustre/lustre/obdclass/lprocfs_status.c | 63 +++++++++++++++++++--- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index b2f309d..5a1eae1 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -49,7 +49,7 @@ static const char * const obd_connect_names[] = { "read_only", "lov_index", - "unused", + "connect_from_mds", "write_grant", "server_lock", "version", @@ -122,6 +122,56 @@ int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep) } EXPORT_SYMBOL(obd_connect_flags2str); +static void obd_connect_data_seqprint(struct seq_file *m, + struct obd_connect_data *ocd) +{ + int flags; + + LASSERT(ocd); + flags = ocd->ocd_connect_flags; + + seq_printf(m, " connect_data:\n" + " flags: %llx\n" + " instance: %u\n", + ocd->ocd_connect_flags, + ocd->ocd_instance); + if (flags & OBD_CONNECT_VERSION) + seq_printf(m, " target_version: %u.%u.%u.%u\n", + OBD_OCD_VERSION_MAJOR(ocd->ocd_version), + OBD_OCD_VERSION_MINOR(ocd->ocd_version), + OBD_OCD_VERSION_PATCH(ocd->ocd_version), + OBD_OCD_VERSION_FIX(ocd->ocd_version)); + if (flags & OBD_CONNECT_MDS) + seq_printf(m, " mdt_index: %d\n", ocd->ocd_group); + if (flags & OBD_CONNECT_GRANT) + seq_printf(m, " initial_grant: %d\n", ocd->ocd_grant); + if (flags & OBD_CONNECT_INDEX) + seq_printf(m, " target_index: %u\n", ocd->ocd_index); + if (flags & OBD_CONNECT_BRW_SIZE) + seq_printf(m, " max_brw_size: %d\n", ocd->ocd_brw_size); + if (flags & OBD_CONNECT_IBITS) + seq_printf(m, " ibits_known: %llx\n", + ocd->ocd_ibits_known); + if (flags & OBD_CONNECT_GRANT_PARAM) + seq_printf(m, " grant_block_size: %d\n" + " grant_inode_size: %d\n" + " grant_extent_overhead: %d\n", + ocd->ocd_blocksize, + ocd->ocd_inodespace, + ocd->ocd_grant_extent); + if (flags & OBD_CONNECT_TRANSNO) + seq_printf(m, " first_transno: %llx\n", + ocd->ocd_transno); + if (flags & OBD_CONNECT_CKSUM) + seq_printf(m, " cksum_types: %#x\n", + ocd->ocd_cksum_types); + if (flags & OBD_CONNECT_MAX_EASIZE) + seq_printf(m, " max_easize: %d\n", ocd->ocd_max_easize); + if (flags & OBD_CONNECT_MAXBYTES) + seq_printf(m, " max_object_bytes: %llx\n", + ocd->ocd_maxbytes); +} + int lprocfs_read_frac_helper(char *buffer, unsigned long count, long val, int mult) { @@ -624,6 +674,7 @@ int lprocfs_rd_import(struct seq_file *m, void *data) struct obd_device *obd = data; struct obd_import *imp; struct obd_import_conn *conn; + struct obd_connect_data *ocd; int j; int k; int rw = 0; @@ -635,9 +686,9 @@ int lprocfs_rd_import(struct seq_file *m, void *data) return rc; imp = obd->u.cli.cl_import; + ocd = &imp->imp_connect_data; - seq_printf(m, - "import:\n" + seq_printf(m, "import:\n" " name: %s\n" " target: %s\n" " state: %s\n" @@ -649,9 +700,9 @@ int lprocfs_rd_import(struct seq_file *m, void *data) imp->imp_connect_data.ocd_instance); obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags, ", "); - seq_printf(m, - " ]\n" - " import_flags: [ "); + seq_printf(m, " ]\n"); + obd_connect_data_seqprint(m, ocd); + seq_printf(m, " import_flags: [ "); obd_import_flags2str(imp, m); seq_printf(m, -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:35 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:35 -0400 Subject: [lustre-devel] [PATCH 5/8] staging: lustre: ldlm: dont always check max_pages_per_rpc alignement In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-6-git-send-email-jsimmons@infradead.org> From: Sebastien Buisson If connection is not established yet, cli->cl_chunkbits is uninitilized so we cannot use it to check max_pages_per_rpc alignment. Signed-off-by: Sebastien Buisson Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4379 Reviewed-on: http://review.whamcloud.com/8558 Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Reviewed-by: Emoly Liu Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 00c93f3..a80569c 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -356,6 +356,12 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) cli->cl_max_pages_per_rpc = min_t(int, PTLRPC_MAX_BRW_PAGES, LNET_MTU >> PAGE_SHIFT); + /* + * set cl_chunkbits default value to PAGE_CACHE_SHIFT, + * it will be updated at OSC connection time. + */ + cli->cl_chunkbits = PAGE_SHIFT; + if (!strcmp(name, LUSTRE_MDC_NAME)) { cli->cl_max_rpcs_in_flight = MDC_MAX_RIF_DEFAULT; } else if (totalram_pages >> (20 - PAGE_SHIFT) <= 128 /* MB */) { -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:38 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:38 -0400 Subject: [lustre-devel] [PATCH 8/8] staging: lustre: llite: quiet overly verbose info message In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-9-git-send-email-jsimmons@infradead.org> From: Andreas Dilger The client doesn't need to print a message for every client mount that the layout lock feature is enabled. This can be found at runtime via the "import" proc file. I also noticed that deleting OST objects logs into the debug log with D_HA status, which is enabled by default. Move this over to D_INODE so it doesn't fill the OST debug logs. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1095 Reviewed-on: http://review.whamcloud.com/7918 Reviewed-by: Bob Glossman Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_lib.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 8d88d4c..64be2c1 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -331,10 +331,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, else sbi->ll_md_brw_size = PAGE_SIZE; - if (data->ocd_connect_flags & OBD_CONNECT_LAYOUTLOCK) { - LCONSOLE_INFO("Layout lock feature supported.\n"); + if (data->ocd_connect_flags & OBD_CONNECT_LAYOUTLOCK) sbi->ll_flags |= LL_SBI_LAYOUT_LOCK; - } if (data->ocd_ibits_known & MDS_INODELOCK_XATTR) { if (!(data->ocd_connect_flags & OBD_CONNECT_MAX_EASIZE)) { -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:34 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:34 -0400 Subject: [lustre-devel] [PATCH 4/8] staging: lustre: fld: add local fldb to each target In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-5-git-send-email-jsimmons@infradead.org> From: wang di Add local FLDB to each MDT, so OSD/OUT can check whether FID is remote by looking up local FLDB, i.e. no need send RPC to MDT0. This is just the client part of the work. Signed-off-by: wang di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4076 Reviewed-on: http://review.whamcloud.com/7884 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/fid/fid_request.c | 5 +- drivers/staging/lustre/lustre/fld/fld_internal.h | 9 +-- drivers/staging/lustre/lustre/fld/fld_request.c | 79 +++++++++++++++------- .../lustre/lustre/include/lustre/lustre_idl.h | 19 +++++- .../lustre/lustre/include/lustre_req_layout.h | 1 + .../staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/ptlrpc/layout.c | 15 ++++ .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 + drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 4 +- 9 files changed, 95 insertions(+), 39 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 39269c3..32e4d95 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -66,6 +66,7 @@ static int seq_client_rpc(struct lu_client_seq *seq, unsigned int debug_mask; int rc; + LASSERT(exp && !IS_ERR(exp)); req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_SEQ_QUERY, LUSTRE_MDS_VERSION, SEQ_QUERY); if (!req) @@ -110,10 +111,10 @@ static int seq_client_rpc(struct lu_client_seq *seq, ptlrpc_at_set_req_timeout(req); - if (seq->lcs_type == LUSTRE_SEQ_METADATA) + if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA) mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); rc = ptlrpc_queue_wait(req); - if (seq->lcs_type == LUSTRE_SEQ_METADATA) + if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA) mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); if (rc) goto out_req; diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index e8a3caf..75d6a48 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -101,12 +101,6 @@ struct fld_cache { unsigned int fci_no_shrink:1; }; -enum fld_op { - FLD_CREATE = 0, - FLD_DELETE = 1, - FLD_LOOKUP = 2 -}; - enum { /* 4M of FLD cache will not hurt client a lot. */ FLD_SERVER_CACHE_SIZE = (4 * 0x100000), @@ -126,7 +120,8 @@ enum { extern struct lu_fld_hash fld_hash[]; int fld_client_rpc(struct obd_export *exp, - struct lu_seq_range *range, __u32 fld_op); + struct lu_seq_range *range, __u32 fld_op, + struct ptlrpc_request **reqp); extern struct lprocfs_vars fld_client_debugfs_list[]; diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 2dfdb51..8150a90 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -392,55 +392,82 @@ void fld_client_fini(struct lu_client_fld *fld) EXPORT_SYMBOL(fld_client_fini); int fld_client_rpc(struct obd_export *exp, - struct lu_seq_range *range, __u32 fld_op) + struct lu_seq_range *range, __u32 fld_op, + struct ptlrpc_request **reqp) { - struct ptlrpc_request *req; + struct ptlrpc_request *req = NULL; struct lu_seq_range *prange; __u32 *op; - int rc; + int rc = 0; struct obd_import *imp; LASSERT(exp); imp = class_exp2cliimp(exp); - req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_QUERY, LUSTRE_MDS_VERSION, - FLD_QUERY); - if (!req) - return -ENOMEM; - - op = req_capsule_client_get(&req->rq_pill, &RMF_FLD_OPC); - *op = fld_op; + switch (fld_op) { + case FLD_QUERY: + req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_QUERY, + LUSTRE_MDS_VERSION, FLD_QUERY); + if (!req) + return -ENOMEM; + + /* + * XXX: only needed when talking to old server(< 2.6), it should + * be removed when < 2.6 server is not supported + */ + op = req_capsule_client_get(&req->rq_pill, &RMF_FLD_OPC); + *op = FLD_LOOKUP; + + if (imp->imp_connect_flags_orig & OBD_CONNECT_MDS_MDS) + req->rq_allow_replay = 1; + break; + case FLD_READ: + req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_READ, + LUSTRE_MDS_VERSION, FLD_READ); + if (!req) + return -ENOMEM; + + req_capsule_set_size(&req->rq_pill, &RMF_GENERIC_DATA, + RCL_SERVER, PAGE_SIZE); + break; + default: + rc = -EINVAL; + break; + } + if (rc) + return rc; prange = req_capsule_client_get(&req->rq_pill, &RMF_FLD_MDFLD); *prange = *range; - ptlrpc_request_set_replen(req); req->rq_request_portal = FLD_REQUEST_PORTAL; req->rq_reply_portal = MDC_REPLY_PORTAL; ptlrpc_at_set_req_timeout(req); - if (fld_op == FLD_LOOKUP && - imp->imp_connect_flags_orig & OBD_CONNECT_MDS_MDS) - req->rq_allow_replay = 1; - - if (fld_op != FLD_LOOKUP) - mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); fld_enter_request(&exp->exp_obd->u.cli); rc = ptlrpc_queue_wait(req); fld_exit_request(&exp->exp_obd->u.cli); - if (fld_op != FLD_LOOKUP) - mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL); if (rc) goto out_req; - prange = req_capsule_server_get(&req->rq_pill, &RMF_FLD_MDFLD); - if (!prange) { - rc = -EFAULT; - goto out_req; + if (fld_op == FLD_QUERY) { + prange = req_capsule_server_get(&req->rq_pill, &RMF_FLD_MDFLD); + if (!prange) { + rc = -EFAULT; + goto out_req; + } + *range = *prange; } - *range = *prange; + out_req: - ptlrpc_req_finished(req); + if (rc || !reqp) { + ptlrpc_req_finished(req); + req = NULL; + } + + if (reqp) + *reqp = req; + return rc; } @@ -468,7 +495,7 @@ int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds, res.lsr_start = seq; fld_range_set_type(&res, flags); - rc = fld_client_rpc(target->ft_exp, &res, FLD_LOOKUP); + rc = fld_client_rpc(target->ft_exp, &res, FLD_QUERY, NULL); if (rc == 0) { *mds = res.lsr_index; diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 9185ed2..a70545a 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -183,6 +183,12 @@ struct lu_seq_range { __u32 lsr_flags; }; +struct lu_seq_range_array { + __u32 lsra_count; + __u32 lsra_padding; + struct lu_seq_range lsra_lsr[0]; +}; + #define LU_SEQ_RANGE_MDT 0x0 #define LU_SEQ_RANGE_OST 0x1 #define LU_SEQ_RANGE_ANY 0x3 @@ -2447,6 +2453,7 @@ struct mdt_rec_reint { void lustre_swab_mdt_rec_reint(struct mdt_rec_reint *rr); +/* lmv structures */ struct lmv_desc { __u32 ld_tgt_count; /* how many MDS's */ __u32 ld_active_tgt_count; /* how many active */ @@ -2471,7 +2478,6 @@ struct lmv_stripe_md { struct lu_fid mea_ids[0]; }; -/* lmv structures */ #define MEA_MAGIC_LAST_CHAR 0xb2221ca1 #define MEA_MAGIC_ALL_CHARS 0xb222a11c #define MEA_MAGIC_HASH_SEGMENT 0xb222a11b @@ -2481,9 +2487,10 @@ struct lmv_stripe_md { #define MAX_HASH_HIGHEST_BIT 0x1000000000000000ULL enum fld_rpc_opc { - FLD_QUERY = 900, + FLD_QUERY = 900, + FLD_READ = 901, FLD_LAST_OPC, - FLD_FIRST_OPC = FLD_QUERY + FLD_FIRST_OPC = FLD_QUERY }; enum seq_rpc_opc { @@ -2497,6 +2504,12 @@ enum seq_op { SEQ_ALLOC_META = 1 }; +enum fld_op { + FLD_CREATE = 0, + FLD_DELETE = 1, + FLD_LOOKUP = 2, +}; + /* * LOV data structures */ diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index b0bc751..0aac439 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -137,6 +137,7 @@ extern struct req_format RQF_MGS_CONFIG_READ; /* fid/fld req_format */ extern struct req_format RQF_SEQ_QUERY; extern struct req_format RQF_FLD_QUERY; +extern struct req_format RQF_FLD_READ; /* MDS req_format */ extern struct req_format RQF_MDS_CONNECT; extern struct req_format RQF_MDS_DISCONNECT; diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index 2aaa343..1358af1 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -428,6 +428,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_FLD 0x1100 #define OBD_FAIL_FLD_QUERY_NET 0x1101 +#define OBD_FAIL_FLD_READ_NET 0x1102 #define OBD_FAIL_SEC_CTX 0x1200 #define OBD_FAIL_SEC_CTX_INIT_NET 0x1201 diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index ccc1f3e..c0ecd16 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -160,6 +160,16 @@ static const struct req_msg_field *fld_query_server[] = { &RMF_FLD_MDFLD }; +static const struct req_msg_field *fld_read_client[] = { + &RMF_PTLRPC_BODY, + &RMF_FLD_MDFLD +}; + +static const struct req_msg_field *fld_read_server[] = { + &RMF_PTLRPC_BODY, + &RMF_GENERIC_DATA +}; + static const struct req_msg_field *mds_getattr_name_client[] = { &RMF_PTLRPC_BODY, &RMF_MDT_BODY, @@ -649,6 +659,7 @@ static struct req_format *req_formats[] = { &RQF_MGS_CONFIG_READ, &RQF_SEQ_QUERY, &RQF_FLD_QUERY, + &RQF_FLD_READ, &RQF_MDS_CONNECT, &RQF_MDS_DISCONNECT, &RQF_MDS_GET_INFO, @@ -1168,6 +1179,10 @@ struct req_format RQF_FLD_QUERY = DEFINE_REQ_FMT0("FLD_QUERY", fld_query_client, fld_query_server); EXPORT_SYMBOL(RQF_FLD_QUERY); +struct req_format RQF_FLD_READ = + DEFINE_REQ_FMT0("FLD_READ", fld_read_client, fld_read_server); +EXPORT_SYMBOL(RQF_FLD_READ); + struct req_format RQF_LOG_CANCEL = DEFINE_REQ_FMT0("OBD_LOG_CANCEL", log_cancel_client, empty); EXPORT_SYMBOL(RQF_LOG_CANCEL); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index a35b56e..1204201 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -131,6 +131,7 @@ static struct ll_rpc_opcode { { SEC_CTX_INIT_CONT, "sec_ctx_init_cont" }, { SEC_CTX_FINI, "sec_ctx_fini" }, { FLD_QUERY, "fld_query" }, + { FLD_READ, "fld_read" }, }; static struct ll_eopcode { diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 308b6b96..aacc810 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -276,7 +276,9 @@ void lustre_assert_wire_constants(void) (long long)FLD_QUERY); LASSERTF(FLD_FIRST_OPC == 900, "found %lld\n", (long long)FLD_FIRST_OPC); - LASSERTF(FLD_LAST_OPC == 901, "found %lld\n", + LASSERTF(FLD_READ == 901, "found %lld\n", + (long long)FLD_READ); + LASSERTF(FLD_LAST_OPC == 902, "found %lld\n", (long long)FLD_LAST_OPC); LASSERTF(SEQ_QUERY == 700, "found %lld\n", (long long)SEQ_QUERY); -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:33 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:33 -0400 Subject: [lustre-devel] [PATCH 3/8] staging: lustre: brw: added OBDO short io flag In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-4-git-send-email-jsimmons@infradead.org> From: Alexander Boyko To prevent collisions with any future flags needed in features written against this branch. Signed-off-by: Alexander Boyko Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1757 Xyratex-bug-id: MRP-1460 Reviewed-on: http://review.whamcloud.com/8182 Reviewed-by: Andreas Dilger Reviewed-by: Vitaly Fertman Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 0ef540a..9185ed2 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1433,6 +1433,7 @@ enum obdo_flags { OBD_FL_RECOV_RESEND = 0x00080000, /* recoverable resent */ OBD_FL_NOSPC_BLK = 0x00100000, /* no more block space on OST */ OBD_FL_FLUSH = 0x00200000, /* flush pages on the OST */ + OBD_FL_SHORT_IO = 0x00400000, /* short io request */ /* Note that while these checksum values are currently separate bits, * in 2.x we can actually allow all values from 1-31 if we wanted. -- 2.7.4 From jsimmons at infradead.org Thu Apr 28 16:07:36 2016 From: jsimmons at infradead.org (James Simmons) Date: Thu, 28 Apr 2016 12:07:36 -0400 Subject: [lustre-devel] [PATCH 6/8] staging: lustre: obd: add case LCFG_PARAM to osd_process_config In-Reply-To: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> References: <1461859658-22200-1-git-send-email-jsimmons@infradead.org> Message-ID: <1461859658-22200-7-git-send-email-jsimmons@infradead.org> From: Emoly Liu Some proc parameters were moved from ofd to osd module and only their symlinks were kept in ofd for interoperability/compatibility. To process this kind of config params passed by ofd, this patch is to do the following fixes: - since these parameters are not included by the static lprocfs var list, a pre-check is added for them to avoid "unknown param" error message confuses the uses. If they are matched in this check, they will be passed to the osd directly. - improve the error messages in class_process_proc_param() and class_process_proc_seq_param() a little. Signed-off-by: Emoly Liu Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4221 Reviewed-on: http://review.whamcloud.com/8238 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/lustre_param.h | 1 + drivers/staging/lustre/lustre/obdclass/obd_config.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_param.h b/drivers/staging/lustre/lustre/include/lustre_param.h index 383fe6f..a42cf90 100644 --- a/drivers/staging/lustre/lustre/include/lustre_param.h +++ b/drivers/staging/lustre/lustre/include/lustre_param.h @@ -89,6 +89,7 @@ int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh); /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */ #define PARAM_OST "ost." +#define PARAM_OSD "osd." #define PARAM_OSC "osc." #define PARAM_MDT "mdt." #define PARAM_MDD "mdd." diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index e60ef4a..72ee1cb 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1001,7 +1001,13 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, for (i = 1; i < lcfg->lcfg_bufcount; i++) { key = lustre_cfg_buf(lcfg, i); /* Strip off prefix */ - class_match_param(key, prefix, &key); + if (class_match_param(key, prefix, &key)) { + /* + * If the prefix doesn't match, return error so we + * can pass it down the stack + */ + return -ENOSYS; + } sval = strchr(key, '='); if (!sval || (*(sval + 1) == 0)) { CERROR("Can't parse param %s (missing '=')\n", key); @@ -1034,18 +1040,14 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, j++; } if (!matched) { - /* If the prefix doesn't match, return error so we - * can pass it down the stack - */ - if (strnchr(key, keylen, '.')) - return -ENOSYS; - CERROR("%s: unknown param %s\n", + CERROR("%.*s: %s unknown param %s\n", + (int)strlen(prefix) - 1, prefix, (char *)lustre_cfg_string(lcfg, 0), key); /* rc = -EINVAL; continue parsing other params */ skip++; } else if (rc < 0) { - CERROR("writing proc entry %s err %d\n", - var->name, rc); + CERROR("%s: error writing proc entry '%s': rc = %d\n", + prefix, var->name, rc); rc = 0; } else { CDEBUG(D_CONFIG, "%s.%.*s: Set parameter %.*s=%s\n", -- 2.7.4 From bruce.korb at gmail.com Wed Apr 27 22:51:09 2016 From: bruce.korb at gmail.com (Bruce Korb) Date: Wed, 27 Apr 2016 15:51:09 -0700 Subject: [lustre-devel] [PATCH 05/15] staging: lustre: ldlm: use accessor macros for l_flags In-Reply-To: <1461795667-29035-6-git-send-email-jsimmons@infradead.org> References: <1461795667-29035-1-git-send-email-jsimmons@infradead.org> <1461795667-29035-6-git-send-email-jsimmons@infradead.org> Message-ID: <5721425D.5050606@gmail.com> Wow! I remember this stuff, even if from 3 years ago. Feels like a lifetime. Is this patch being applied to official Linux, hence this message? Xyratex collapsed, shed a mess of employees and sold the remnant to Seagate. Consequently, I don't really follow Lustre any more. Sorry. On 04/27/16 15:20, James Simmons wrote: > From: Bruce Korb > > Convert most of the ldlm lock's l_flags references from direct > bit twiddling to using bit specific macros. A few multi-bit > operations are left as an exercise for the reader. > > The changes are mostly in ldlm, but also in llite, osc and quota. > Also add a multi-bit (mask) test. > > Signed-off-by: Bruce Korb > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2906 > Reviewed-by: Keith Mannthey > Reviewed-on: http://review.whamcloud.com/7963 > Reviewed-by: Doug Oucharek > Reviewed-by: Andreas Dilger > Signed-off-by: James Simmons > --- > .../lustre/lustre/include/lustre_dlm_flags.h | 3 +