From: Qian Yingjin Date: Wed, 11 Sep 2024 03:06:40 +0000 (+0800) Subject: LU-17190 osc: account DIO in flight using server-side locking X-Git-Tag: 2.16.51~196 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F25%2F56325%2F3;p=fs%2Flustre-release.git LU-17190 osc: account DIO in flight using server-side locking Add accounting for DIO (using server-side DLM extent locking) in flight. We can see from osc.*.rpc_stats to judge whether all I/O RPC slots, which are limit by @max_rpcs_in_flight, are used out by DIOs. Change-Id: I3d2c6e607d19037bb399c2bceb50e64826263469 Signed-off-by: Qian Yingjin Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56325 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Shaun Tancheff Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index bd34311..345327e 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -247,6 +247,8 @@ struct client_obd { struct list_head cl_loi_read_list; __u32 cl_r_in_flight; __u32 cl_w_in_flight; + /* The count of direct I/Os (using server-side locking) in flight */ + __u32 cl_d_in_flight; /* just a sum of the loi/lop pending numbers to be exported by /proc */ atomic_t cl_pending_w_pages; atomic_t cl_pending_r_pages; diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 26fb2cd..692b412 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -392,6 +392,7 @@ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg) atomic_set(&cli->cl_pending_r_pages, 0); cli->cl_r_in_flight = 0; cli->cl_w_in_flight = 0; + cli->cl_d_in_flight = 0; cli->cl_stats_init = ktime_get_real(); spin_lock_init(&cli->cl_read_rpc_hist.oh_lock); diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 5f6e2cc..dbe715d 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -780,6 +780,8 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v) cli->cl_r_in_flight); seq_printf(seq, "write RPCs in flight: %d\n", cli->cl_w_in_flight); + seq_printf(seq, "DIO RPCs in flight: %d\n", + cli->cl_d_in_flight); seq_printf(seq, "pending write pages: %d\n", atomic_read(&cli->cl_pending_w_pages)); seq_printf(seq, "pending read pages: %d\n", diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 4126678..69bf928 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2572,6 +2572,7 @@ static int brw_interpret(const struct lu_env *env, struct osc_extent *ext; struct osc_extent *tmp; struct lov_oinfo *loi; + bool srvlock = false; ENTRY; @@ -2612,6 +2613,7 @@ static int brw_interpret(const struct lu_env *env, last = brw_page2oap(aa->aa_ppga[aa->aa_page_count - 1]); obj = osc2cl(ext->oe_obj); loi = cl2osc(obj)->oo_oinfo; + srvlock = oap2osc_page(last)->ops_srvlock; if (rc == 0) { struct obdo *oa = aa->aa_oa; @@ -2708,6 +2710,8 @@ static int brw_interpret(const struct lu_env *env, cli->cl_w_in_flight--; else cli->cl_r_in_flight--; + if (srvlock) + cli->cl_d_in_flight--; osc_wake_cache_waiters(cli); spin_unlock(&cli->cl_loi_list_lock); @@ -2758,6 +2762,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, int page_count = 0; bool soft_sync = false; bool ndelay = false; + bool srvlock = false; int grant = 0; int i, rc; __u32 layout_version = 0; @@ -2833,6 +2838,8 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, } if (ext->oe_ndelay) ndelay = true; + if (ext->oe_srvlock) + srvlock = true; } /* first page in the list */ @@ -2911,10 +2918,13 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, lprocfs_oh_tally_log2(&cli->cl_write_offset_hist, starting_offset + 1); } + if (srvlock) + cli->cl_d_in_flight++; spin_unlock(&cli->cl_loi_list_lock); - DEBUG_REQ(D_INODE, req, "%d pages, aa %p, now %ur/%uw in flight", - page_count, aa, cli->cl_r_in_flight, cli->cl_w_in_flight); + DEBUG_REQ(D_INODE, req, "%d pages, aa %p, now %ur/%uw/%ud in flight", + page_count, aa, cli->cl_r_in_flight, cli->cl_w_in_flight, + cli->cl_d_in_flight); if (libcfs_debug & D_IOTRACE) { struct lu_fid fid; @@ -2922,10 +2932,11 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, fid.f_oid = crattr->cra_oa->o_parent_oid; fid.f_ver = crattr->cra_oa->o_parent_ver; CDEBUG(D_IOTRACE, - DFID": %d %s pages, start %lld, end %lld, now %ur/%uw in flight\n", + DFID": %d %s pages, start %lld, end %lld, now %ur/%uw/%ud in flight\n", PFID(&fid), page_count, cmd == OBD_BRW_READ ? "read" : "write", starting_offset, - ending_offset, cli->cl_r_in_flight, cli->cl_w_in_flight); + ending_offset, cli->cl_r_in_flight, cli->cl_w_in_flight, + cli->cl_d_in_flight); } CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_IO, cfs_fail_val);