Whamcloud - gitweb
LU-10467 target: remove lwi arg from target_bulk_io 69/35969/7
authorMr NeilBrown <neilb@suse.com>
Fri, 23 Aug 2019 07:28:47 +0000 (17:28 +1000)
committerOleg Drokin <green@whamcloud.com>
Mon, 30 Sep 2019 23:12:09 +0000 (23:12 +0000)
The callers of target_bulk_io() pass in an lwi pointer but never put
any information into it or take any information out of it.  Also
target_bulk_io() always re-initializes the struct before using it, so
it doesn't communicate info from one call to the next.

All that this achieves it to make stack usage slightly less
in the few cases where the lwi pointer is tti_wait_info in
struct tgt_thread_info.  That is not worth it, and a future
patch will remove the use of the struct completely.

So make lwi local to target_bulk_io, and remove it from
all callers.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.com>
Change-Id: Ib6039006d0168393abf3995877acde2d7c796b1f
Reviewed-on: https://review.whamcloud.com/35969
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_lib.h
lustre/ldlm/ldlm_lib.c
lustre/mgs/mgs_nids.c
lustre/ptlrpc/nodemap_storage.c
lustre/target/out_handler.c
lustre/target/tgt_handler.c
lustre/target/tgt_internal.h

index bf370a3..a8ac55a 100644 (file)
@@ -79,8 +79,7 @@ void target_stop_recovery_thread(struct obd_device *obd);
 void target_cleanup_recovery(struct obd_device *obd);
 int target_queue_recovery_request(struct ptlrpc_request *req,
                                   struct obd_device *obd);
-int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc,
-                   struct l_wait_info *lwi);
+int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc);
 #endif
 
 int target_pack_pool_reply(struct ptlrpc_request *req);
index 4b0a016..4581df0 100644 (file)
@@ -3308,22 +3308,22 @@ static inline const char *bulk2type(struct ptlrpc_request *req)
        return "UNKNOWN";
 }
 
-int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc,
-                  struct l_wait_info *lwi)
+int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc)
 {
        struct ptlrpc_request *req = desc->bd_req;
        time64_t start = ktime_get_real_seconds();
        time64_t deadline;
+       struct l_wait_info lwi;
        int rc = 0;
 
        ENTRY;
 
        /* If there is eviction in progress, wait for it to finish. */
        if (unlikely(atomic_read(&exp->exp_obd->obd_evict_inprogress))) {
-               *lwi = LWI_INTR(NULL, NULL);
+               lwi = LWI_INTR(NULL, NULL);
                rc = l_wait_event(exp->exp_obd->obd_evict_inprogress_waitq,
                                  !atomic_read(&exp->exp_obd->obd_evict_inprogress),
-                                 lwi);
+                                 &lwi);
        }
 
        /* Check if client was evicted or reconnected already. */
@@ -3365,15 +3365,15 @@ int target_bulk_io(struct obd_export *exp, struct ptlrpc_bulk_desc *desc,
                                       1 : cfs_time_seconds(timeoutl);
                time64_t rq_deadline;
 
-               *lwi = LWI_TIMEOUT_INTERVAL(timeout_jiffies,
-                                           cfs_time_seconds(1),
-                                           target_bulk_timeout, desc);
+               lwi = LWI_TIMEOUT_INTERVAL(timeout_jiffies,
+                                          cfs_time_seconds(1),
+                                          target_bulk_timeout, desc);
                rc = l_wait_event(desc->bd_waitq,
                                  !ptlrpc_server_bulk_active(desc) ||
                                  exp->exp_failed ||
                                  exp->exp_conn_cnt >
                                  lustre_msg_get_conn_cnt(req->rq_reqmsg),
-                                 lwi);
+                                 &lwi);
                LASSERT(rc == 0 || rc == -ETIMEDOUT);
                /* Wait again if we changed rq_deadline. */
                rq_deadline = READ_ONCE(req->rq_deadline);
index 6add08e..b285e1f 100644 (file)
@@ -602,7 +602,6 @@ int mgs_get_ir_logs(struct ptlrpc_request *req)
        struct mgs_config_body *body;
        struct mgs_config_res *res;
        struct ptlrpc_bulk_desc *desc;
-       struct l_wait_info lwi;
        char fsname[16];
        long bufsize;
        int unit_size;
@@ -672,7 +671,7 @@ int mgs_get_ir_logs(struct ptlrpc_request *req)
                bytes -= PAGE_SIZE;
        }
 
-       rc = target_bulk_io(req->rq_export, desc, &lwi);
+       rc = target_bulk_io(req->rq_export, desc);
        ptlrpc_free_bulk(desc);
 
        GOTO(out, rc);
index 55e46ee..1b522a1 100644 (file)
@@ -1466,7 +1466,6 @@ int nodemap_get_config_req(struct obd_device *mgs_obd,
        struct lu_rdpg rdpg;
        struct idx_info nodemap_ii;
        struct ptlrpc_bulk_desc *desc;
-       struct l_wait_info lwi;
        struct tg_export_data *rqexp_ted = &req->rq_export->exp_target_data;
        int i;
        int page_count;
@@ -1534,7 +1533,7 @@ int nodemap_get_config_req(struct obd_device *mgs_obd,
                bytes -= PAGE_SIZE;
        }
 
-       rc = target_bulk_io(req->rq_export, desc, &lwi);
+       rc = target_bulk_io(req->rq_export, desc);
        ptlrpc_free_bulk(desc);
 
 out:
index f3ec5a7..edb8906 100644 (file)
@@ -966,7 +966,6 @@ int out_handle(struct tgt_session_info *tsi)
        struct object_update            *update;
        struct object_update_reply      *reply;
        struct ptlrpc_bulk_desc         *desc = NULL;
-       struct l_wait_info              lwi;
        void                            **update_bufs;
        int                             current_batchid = -1;
        __u32                           update_buf_count;
@@ -1039,7 +1038,7 @@ int out_handle(struct tgt_session_info *tsi)
                if (rc != 0)
                        GOTO(out_free, rc = err_serious(rc));
 
-               rc = target_bulk_io(pill->rc_req->rq_export, desc, &lwi);
+               rc = target_bulk_io(pill->rc_req->rq_export, desc);
                if (rc < 0)
                        GOTO(out_free, rc = err_serious(rc));
        }
index f75bcfa..d9d5a81 100644 (file)
@@ -1061,11 +1061,9 @@ int tgt_obd_log_cancel(struct tgt_session_info *tsi)
 
 int tgt_send_buffer(struct tgt_session_info *tsi, struct lu_rdbuf *rdbuf)
 {
-       struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
        struct ptlrpc_request   *req = tgt_ses_req(tsi);
        struct obd_export       *exp = req->rq_export;
        struct ptlrpc_bulk_desc *desc;
-       struct l_wait_info      *lwi = &tti->tti_u.update.tti_wait_info;
        int                      i;
        int                      rc;
 
@@ -1082,7 +1080,7 @@ int tgt_send_buffer(struct tgt_session_info *tsi, struct lu_rdbuf *rdbuf)
                                        rdbuf->rb_bufs[i].lb_buf,
                                        rdbuf->rb_bufs[i].lb_len);
 
-       rc = target_bulk_io(exp, desc, lwi);
+       rc = target_bulk_io(exp, desc);
        ptlrpc_free_bulk(desc);
        RETURN(rc);
 }
@@ -1090,11 +1088,9 @@ EXPORT_SYMBOL(tgt_send_buffer);
 
 int tgt_sendpage(struct tgt_session_info *tsi, struct lu_rdpg *rdpg, int nob)
 {
-       struct tgt_thread_info  *tti = tgt_th_info(tsi->tsi_env);
        struct ptlrpc_request   *req = tgt_ses_req(tsi);
        struct obd_export       *exp = req->rq_export;
        struct ptlrpc_bulk_desc *desc;
-       struct l_wait_info      *lwi = &tti->tti_u.rdpg.tti_wait_info;
        int                      tmpcount;
        int                      tmpsize;
        int                      i;
@@ -1123,7 +1119,7 @@ int tgt_sendpage(struct tgt_session_info *tsi, struct lu_rdpg *rdpg, int nob)
        }
 
        LASSERT(desc->bd_nob == nob);
-       rc = target_bulk_io(exp, desc, lwi);
+       rc = target_bulk_io(exp, desc);
        ptlrpc_free_bulk(desc);
        RETURN(rc);
 }
@@ -2334,7 +2330,7 @@ int tgt_brw_read(struct tgt_session_info *tsi)
                                                   RCL_SERVER);
                        rc = rc > 0 ? 0 : rc;
                } else if (!CFS_FAIL_PRECHECK(OBD_FAIL_PTLRPC_CLIENT_BULK_CB2)) {
-                       rc = target_bulk_io(exp, desc, &lwi);
+                       rc = target_bulk_io(exp, desc);
                }
                no_reply = rc != 0;
        } else {
@@ -2380,7 +2376,7 @@ out_lock:
 
                lwi1 = LWI_TIMEOUT_INTR(cfs_time_seconds(3), NULL, NULL, NULL);
                l_wait_event(waitq, 0, &lwi1);
-               target_bulk_io(exp, desc, &lwi);
+               target_bulk_io(exp, desc);
                ptlrpc_free_bulk(desc);
        }
 
@@ -2470,7 +2466,6 @@ int tgt_brw_write(struct tgt_session_info *tsi)
        struct niobuf_local     *local_nb;
        struct obd_ioobj        *ioo;
        struct ost_body         *body, *repbody;
-       struct l_wait_info       lwi;
        struct lustre_handle     lockh = {0};
        __u32                   *rcs;
        int                      objcount, niocount, npages;
@@ -2625,7 +2620,7 @@ int tgt_brw_write(struct tgt_session_info *tsi)
                if (rc != 0)
                        GOTO(skip_transfer, rc);
 
-               rc = target_bulk_io(exp, desc, &lwi);
+               rc = target_bulk_io(exp, desc);
        }
 
        no_reply = rc != 0;
index ac7c3c1..91617b1 100644 (file)
@@ -72,8 +72,6 @@ struct tgt_thread_info {
                struct {
                        /* for tgt_readpage()      */
                        struct lu_rdpg     tti_rdpg;
-                       /* for tgt_sendpage()      */
-                       struct l_wait_info tti_wait_info;
                } rdpg;
                struct {
                        struct dt_object_format    tti_update_dof;
@@ -82,7 +80,6 @@ struct tgt_thread_info {
                        int                        tti_update_reply_index;
                        struct obdo                tti_obdo;
                        struct dt_object           *tti_dt_object;
-                       struct l_wait_info tti_wait_info;
                } update;
                struct obd_statfs osfs; /* for obd_statfs() in OFD/MDT */
        } tti_u;