From ef01e035b3307e20e25ad623b8e2a955462a5a32 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Wed, 24 May 2023 16:29:40 +0000 Subject: [PATCH] LU-12610 osc: remove OBD_ -> CFS_ macros Remove OBD macros that are simply redefinitions of CFS macros. Also, convert some spaces to tabs. Test-Parameters: trivial Signed-off-by: Timothy Day Signed-off-by: Ben Evans Change-Id: Icb4f25f51515d833fed2c05581288cde719c1d08 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51124 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/osc/osc_cache.c | 4 +-- lustre/osc/osc_io.c | 2 +- lustre/osc/osc_lock.c | 8 ++--- lustre/osc/osc_request.c | 84 +++++++++++++++++++++++++----------------------- 4 files changed, 50 insertions(+), 48 deletions(-) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 90be051..9710fdc 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1573,7 +1573,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, /* force the caller to try sync io. this can jump the list * of queued writes and create a discontiguous rpc stream */ - if (OBD_FAIL_CHECK(OBD_FAIL_OSC_NO_GRANT) || + if (CFS_FAIL_CHECK(OBD_FAIL_OSC_NO_GRANT) || cli->cl_dirty_max_pages == 0 || cli->cl_ar.ar_force_sync || loi->loi_ar.ar_force_sync) { OSC_DUMP_GRANT(D_CACHE, cli, "forced sync i/o\n"); @@ -3116,7 +3116,7 @@ bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, if (!res) break; - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_SLOW_PAGE_EVICT, + CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_SLOW_PAGE_EVICT, cfs_fail_val ?: 20); if (io->ci_type == CIT_MISC && diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index fa11066..327e69d 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -916,7 +916,7 @@ int osc_io_write_start(const struct lu_env *env, int rc = 0; ENTRY; - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1); + CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1); cl_object_attr_lock(obj); attr->cat_mtime = attr->cat_ctime = ktime_get_real_seconds(); rc = cl_object_attr_update(env, obj, attr, CAT_MTIME | CAT_CTIME); diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 8ed9766..38e6ade 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -416,7 +416,7 @@ static int osc_dlm_blocking_ast0(const struct lu_env *env, unlock_res_and_lock(dlmlock); - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_CANCEL, 5); + CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_CANCEL, 5); /* if l_ast_data is NULL, the dlmlock was enqueued by AGL or * the object has been destroyed. */ @@ -589,7 +589,7 @@ int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) dlmlock = NULL; if (obj == NULL && res->lr_type == LDLM_EXTENT) { - if (OBD_FAIL_CHECK(OBD_FAIL_OSC_NO_SIZE_DATA)) + if (CFS_FAIL_CHECK(OBD_FAIL_OSC_NO_SIZE_DATA)) break; lock_res(res); @@ -1032,8 +1032,8 @@ enqueue_base: if (osc_lock_is_lockless(oscl)) { oio->oi_lockless = 1; } else if (!async) { - if (OBD_FAIL_PRECHECK(OBD_FAIL_PTLRPC_IDLE_RACE)) { - OBD_RACE(OBD_FAIL_PTLRPC_IDLE_RACE); + if (CFS_FAIL_PRECHECK(OBD_FAIL_PTLRPC_IDLE_RACE)) { + CFS_RACE(OBD_FAIL_PTLRPC_IDLE_RACE); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(cfs_time_seconds(1) / 2); } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 32190a5..ad3c4c6 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1233,7 +1233,7 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob, /* corrupt the data before we compute the checksum, to * simulate an OST->client data error */ if (unlikely(i == 0 && opc == OST_READ && - OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE))) { + CFS_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE))) { unsigned char *ptr = kmap(pga[i]->pg); memcpy(ptr + off, "bad1", min_t(typeof(nob), 4, nob)); @@ -1281,7 +1281,7 @@ out_hash: /* For sending we only compute the wrong checksum instead * of corrupting the data so it is still correct on a redo */ if (opc == OST_WRITE && - OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_SEND)) + CFS_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_SEND)) cksum++; *check_sum = cksum; @@ -1322,7 +1322,7 @@ static int osc_checksum_bulk(int nob, size_t pg_count, /* corrupt the data before we compute the checksum, to * simulate an OST->client data error */ if (i == 0 && opc == OST_READ && - OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE)) { + CFS_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE)) { unsigned char *ptr = kmap(pga[i]->pg); int off = pga[i]->off & ~PAGE_MASK; @@ -1345,7 +1345,7 @@ static int osc_checksum_bulk(int nob, size_t pg_count, /* For sending we only compute the wrong checksum instead * of corrupting the data so it is still correct on a redo */ - if (opc == OST_WRITE && OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_SEND)) + if (opc == OST_WRITE && CFS_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_SEND)) (*cksum)++; return 0; @@ -1528,9 +1528,9 @@ osc_brw_prep_request(int cmd, struct client_obd *cli, struct obdo *oa, if (clpage->cp_type == CPT_TRANSIENT) directio = true; } - if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ)) + if (CFS_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ)) RETURN(-ENOMEM); /* Recoverable */ - if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ2)) + if (CFS_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ2)) RETURN(-EINVAL); /* Fatal */ if ((cmd & OBD_BRW_WRITE) != 0) { @@ -1791,7 +1791,7 @@ no_bulk: if (inode && IS_ENCRYPTED(inode) && llcrypt_has_encryption_key(inode) && - !OBD_FAIL_CHECK(OBD_FAIL_LFSCK_NO_ENCFLAG)) { + !CFS_FAIL_CHECK(OBD_FAIL_LFSCK_NO_ENCFLAG)) { if ((body->oa.o_valid & OBD_MD_FLFLAGS) == 0) { body->oa.o_valid |= OBD_MD_FLFLAGS; body->oa.o_flags = 0; @@ -2825,7 +2825,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, cmd == OBD_BRW_READ ? "read" : "write", starting_offset, ending_offset, cli->cl_r_in_flight, cli->cl_w_in_flight); } - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_IO, cfs_fail_val); + CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_IO, cfs_fail_val); ptlrpcd_add_req(req); rc = 0; @@ -2972,10 +2972,10 @@ int osc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req, ldlm_lock_addref(lockh, mode); /* Let cl_lock_state_wait fail with -ERESTARTSYS to unuse sublocks. */ - OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_HANG, 2); + CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_HANG, 2); /* Let CP AST to grant the lock first. */ - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 1); + CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 1); if (aa->oa_speculative) { LASSERT(aa->oa_lvb == NULL); @@ -2991,7 +2991,7 @@ int osc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req, rc = osc_enqueue_fini(req, aa->oa_upcall, aa->oa_cookie, lockh, mode, aa->oa_flags, aa->oa_speculative, rc); - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_CANCEL_RACE, 10); + CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_CANCEL_RACE, 10); ldlm_lock_decref(lockh, mode); LDLM_LOCK_PUT(lock); @@ -3145,7 +3145,7 @@ int osc_match_base(const struct lu_env *env, struct obd_export *exp, enum ldlm_mode rc; ENTRY; - if (OBD_FAIL_CHECK(OBD_FAIL_OSC_MATCH)) + if (CFS_FAIL_CHECK(OBD_FAIL_OSC_MATCH)) RETURN(-EIO); /* Filesystem lock extents are extended to page boundaries so that @@ -3401,31 +3401,31 @@ int osc_set_info_async(const struct lu_env *env, struct obd_export *exp, u32 keylen, void *key, u32 vallen, void *val, struct ptlrpc_request_set *set) { - struct ptlrpc_request *req; - struct obd_device *obd = exp->exp_obd; - struct obd_import *imp = class_exp2cliimp(exp); - char *tmp; - int rc; - ENTRY; + struct ptlrpc_request *req; + struct obd_device *obd = exp->exp_obd; + struct obd_import *imp = class_exp2cliimp(exp); + char *tmp; + int rc; + ENTRY; - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_SHUTDOWN, 10); + CFS_FAIL_TIMEOUT(OBD_FAIL_OSC_SHUTDOWN, 10); - if (KEY_IS(KEY_CHECKSUM)) { - if (vallen != sizeof(int)) - RETURN(-EINVAL); - exp->exp_obd->u.cli.cl_checksum = (*(int *)val) ? 1 : 0; - RETURN(0); - } + if (KEY_IS(KEY_CHECKSUM)) { + if (vallen != sizeof(int)) + RETURN(-EINVAL); + exp->exp_obd->u.cli.cl_checksum = (*(int *)val) ? 1 : 0; + RETURN(0); + } - if (KEY_IS(KEY_SPTLRPC_CONF)) { - sptlrpc_conf_client_adapt(obd); - RETURN(0); - } + if (KEY_IS(KEY_SPTLRPC_CONF)) { + sptlrpc_conf_client_adapt(obd); + RETURN(0); + } - if (KEY_IS(KEY_FLUSH_CTX)) { - sptlrpc_import_flush_my_ctx(imp); - RETURN(0); - } + if (KEY_IS(KEY_FLUSH_CTX)) { + sptlrpc_import_flush_my_ctx(imp); + RETURN(0); + } if (KEY_IS(KEY_CACHE_LRU_SHRINK)) { struct client_obd *cli = &obd->u.cli; @@ -3437,15 +3437,17 @@ int osc_set_info_async(const struct lu_env *env, struct obd_export *exp, RETURN(0); } - if (!set && !KEY_IS(KEY_GRANT_SHRINK)) - RETURN(-EINVAL); + if (!set && !KEY_IS(KEY_GRANT_SHRINK)) + RETURN(-EINVAL); - /* We pass all other commands directly to OST. Since nobody calls osc - methods directly and everybody is supposed to go through LOV, we - assume lov checked invalid values for us. - The only recognised values so far are evict_by_nid and mds_conn. - Even if something bad goes through, we'd get a -EINVAL from OST - anyway. */ + /* + * We pass all other commands directly to OST. Since nobody calls osc + * methods directly and everybody is supposed to go through LOV, we + * assume lov checked invalid values for us. + * The only recognised values so far are evict_by_nid and mds_conn. + * Even if something bad goes through, we'd get a -EINVAL from OST + * anyway. + */ req = ptlrpc_request_alloc(imp, KEY_IS(KEY_GRANT_SHRINK) ? &RQF_OST_SET_GRANT_INFO : -- 1.8.3.1