From 2cb7eb3bb65398368fc934e6cc4483ee6c331d45 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 7 Feb 2020 15:01:49 -0700 Subject: [PATCH] LU-13131 osc: remove redundant osc_list() helper The osc_list() helper function is the same as list_empty_marker(), and we don't need both. Remove osc_list() from the code. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I07d2a519906f52fca8c95613a14ad7389a3ebbe5 Reviewed-on: https://review.whamcloud.com/37479 Tested-by: jenkins Reviewed-by: Neil Brown Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- lustre/osc/osc_cache.c | 5 ---- lustre/osc/osc_internal.h | 8 +++--- lustre/osc/osc_page.c | 73 ++++++++++++++++++++++------------------------- 3 files changed, 38 insertions(+), 48 deletions(-) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 8122fd1..9e345c1 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -94,11 +94,6 @@ static inline char *ext_flags(struct osc_extent *ext, char *flags) return flags; } -static inline char list_empty_marker(struct list_head *list) -{ - return list_empty(list) ? '-' : '+'; -} - #define EXTSTR "[%lu -> %lu/%lu]" #define EXTPARA(ext) (ext)->oe_start, (ext)->oe_end, (ext)->oe_max_end static const char *oes_strings[] = { diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index 8dbd593..e08d893 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -142,10 +142,10 @@ static inline char *cli_name(struct client_obd *cli) return cli->cl_import->imp_obd->obd_name; } -#ifndef min_t -#define min_t(type,x,y) \ - ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; }) -#endif +static inline char list_empty_marker(struct list_head *list) +{ + return list_empty(list) ? '-' : '+'; +} struct osc_async_args { struct obd_info *aa_oi; diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index eabe5fd..dc62fcd 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -111,11 +111,6 @@ void osc_index2policy(union ldlm_policy_data *policy, policy->l_extent.end = cl_offset(obj, end + 1) - 1; } -static const char *osc_list(struct list_head *head) -{ - return list_empty(head) ? "-" : "+"; -} - static inline s64 osc_submit_duration(struct osc_page *opg) { if (ktime_to_ns(opg->ops_submit_time) == 0) @@ -125,52 +120,52 @@ static inline s64 osc_submit_duration(struct osc_page *opg) } static int osc_page_print(const struct lu_env *env, - const struct cl_page_slice *slice, - void *cookie, lu_printer_t printer) + const struct cl_page_slice *slice, + void *cookie, lu_printer_t printer) { - struct osc_page *opg = cl2osc_page(slice); - struct osc_async_page *oap = &opg->ops_oap; - struct osc_object *obj = cl2osc(slice->cpl_obj); - struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; + struct osc_page *opg = cl2osc_page(slice); + struct osc_async_page *oap = &opg->ops_oap; + struct osc_object *obj = cl2osc(slice->cpl_obj); + struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; return (*printer)(env, cookie, LUSTRE_OSC_NAME"-page@%p %lu: " - "1< %#x %d %u %s %s > " + "1< %#x %d %u %c %c > " "2< %lld %u %u %#x %#x | %p %p %p > " "3< %d %lld %d > " - "4< %d %d %d %lu %s | %s %s %s %s > " - "5< %s %s %s %s | %d %s | %d %s %s>\n", + "4< %d %d %d %lu %c | %c %c %c %c > " + "5< %c %c %c %c | %d %c | %d %c %c>\n", opg, osc_index(opg), - /* 1 */ - oap->oap_magic, oap->oap_cmd, - oap->oap_interrupted, - osc_list(&oap->oap_pending_item), - osc_list(&oap->oap_rpc_item), - /* 2 */ - oap->oap_obj_off, oap->oap_page_off, oap->oap_count, - oap->oap_async_flags, oap->oap_brw_flags, + /* 1 */ + oap->oap_magic, oap->oap_cmd, + oap->oap_interrupted, + list_empty_marker(&oap->oap_pending_item), + list_empty_marker(&oap->oap_rpc_item), + /* 2 */ + oap->oap_obj_off, oap->oap_page_off, oap->oap_count, + oap->oap_async_flags, oap->oap_brw_flags, oap->oap_request, oap->oap_cli, obj, /* 3 */ opg->ops_transfer_pinned, osc_submit_duration(opg), opg->ops_srvlock, - /* 4 */ - cli->cl_r_in_flight, cli->cl_w_in_flight, - cli->cl_max_rpcs_in_flight, - cli->cl_avail_grant, - osc_list(&cli->cl_cache_waiters), - osc_list(&cli->cl_loi_ready_list), - osc_list(&cli->cl_loi_hp_ready_list), - osc_list(&cli->cl_loi_write_list), - osc_list(&cli->cl_loi_read_list), - /* 5 */ - osc_list(&obj->oo_ready_item), - osc_list(&obj->oo_hp_ready_item), - osc_list(&obj->oo_write_item), - osc_list(&obj->oo_read_item), + /* 4 */ + cli->cl_r_in_flight, cli->cl_w_in_flight, + cli->cl_max_rpcs_in_flight, + cli->cl_avail_grant, + list_empty_marker(&cli->cl_cache_waiters), + list_empty_marker(&cli->cl_loi_ready_list), + list_empty_marker(&cli->cl_loi_hp_ready_list), + list_empty_marker(&cli->cl_loi_write_list), + list_empty_marker(&cli->cl_loi_read_list), + /* 5 */ + list_empty_marker(&obj->oo_ready_item), + list_empty_marker(&obj->oo_hp_ready_item), + list_empty_marker(&obj->oo_write_item), + list_empty_marker(&obj->oo_read_item), atomic_read(&obj->oo_nr_reads), - osc_list(&obj->oo_reading_exts), + list_empty_marker(&obj->oo_reading_exts), atomic_read(&obj->oo_nr_writes), - osc_list(&obj->oo_hp_exts), - osc_list(&obj->oo_urgent_exts)); + list_empty_marker(&obj->oo_hp_exts), + list_empty_marker(&obj->oo_urgent_exts)); } static void osc_page_delete(const struct lu_env *env, -- 1.8.3.1