From 511ea5850f2553d14891aeda7972d0526c67a3af Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Fri, 11 May 2018 12:04:02 -0500 Subject: [PATCH] LU-11014 mdc: remove obsolete intent opcodes In enum ldlm_intent_flags, remove the obsolete constants IT_UNLINK, IT_TRUNC, IT_EXEC, IT_PIN, IT_SETXATTR. Remove any handling code for these opcodes. Signed-off-by: John L. Hammond Change-Id: I66f20e4c881cb77a481805a148a33f1c2daa5f0c Reviewed-on: https://review.whamcloud.com/32361 Reviewed-by: Fan Yong Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- lustre/include/lustre_req_layout.h | 1 - lustre/include/obd.h | 4 +-- lustre/include/uapi/linux/lustre/lustre_idl.h | 14 ++++----- lustre/ldlm/ldlm_lock.c | 2 -- lustre/mdc/mdc_locks.c | 45 ++------------------------- lustre/ptlrpc/layout.c | 15 --------- lustre/ptlrpc/nrs_tbf.c | 2 -- lustre/ptlrpc/wiretest.c | 10 ------ lustre/utils/wirecheck.c | 5 --- lustre/utils/wiretest.c | 10 ------ 10 files changed, 11 insertions(+), 97 deletions(-) diff --git a/lustre/include/lustre_req_layout.h b/lustre/include/lustre_req_layout.h index 3f4c58d..6a2c154 100644 --- a/lustre/include/lustre_req_layout.h +++ b/lustre/include/lustre_req_layout.h @@ -216,7 +216,6 @@ extern struct req_format RQF_LDLM_INTENT_LAYOUT; extern struct req_format RQF_LDLM_INTENT_GETATTR; extern struct req_format RQF_LDLM_INTENT_OPEN; extern struct req_format RQF_LDLM_INTENT_CREATE; -extern struct req_format RQF_LDLM_INTENT_UNLINK; extern struct req_format RQF_LDLM_INTENT_GETXATTR; extern struct req_format RQF_LDLM_INTENT_QUOTA; extern struct req_format RQF_LDLM_CANCEL; diff --git a/lustre/include/obd.h b/lustre/include/obd.h index f16f2ab..fa3b407 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -791,8 +791,6 @@ static inline int it_to_lock_mode(struct lookup_intent *it) return LCK_PR; else if (it->it_op & IT_GETXATTR) return LCK_PR; - else if (it->it_op & IT_SETXATTR) - return LCK_PW; LASSERTF(0, "Invalid it_op: %d\n", it->it_op); return -EINVAL; @@ -821,7 +819,7 @@ enum md_cli_flags { */ static inline bool it_has_reply_body(const struct lookup_intent *it) { - return it->it_op & (IT_OPEN | IT_UNLINK | IT_LOOKUP | IT_GETATTR); + return it->it_op & (IT_OPEN | IT_LOOKUP | IT_GETATTR); } struct md_op_data { diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 14aa8dd..d97732b 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -2415,19 +2415,19 @@ union ldlm_gl_desc { enum ldlm_intent_flags { IT_OPEN = 0x00000001, IT_CREAT = 0x00000002, - IT_OPEN_CREAT = 0x00000003, - IT_READDIR = 0x00000004, + IT_OPEN_CREAT = IT_OPEN | IT_CREAT, /* To allow case label. */ + IT_READDIR = 0x00000004, /* Used by mdc, not put on the wire. */ IT_GETATTR = 0x00000008, IT_LOOKUP = 0x00000010, - IT_UNLINK = 0x00000020, - IT_TRUNC = 0x00000040, +/* IT_UNLINK = 0x00000020, Obsolete. */ +/* IT_TRUNC = 0x00000040, Obsolete. */ IT_GETXATTR = 0x00000080, - IT_EXEC = 0x00000100, - IT_PIN = 0x00000200, +/* IT_EXEC = 0x00000100, Obsolete. */ +/* IT_PIN = 0x00000200, Obsolete. */ IT_LAYOUT = 0x00000400, IT_QUOTA_DQACQ = 0x00000800, IT_QUOTA_CONN = 0x00001000, - IT_SETXATTR = 0x00002000, +/* IT_SETXATTR = 0x00002000, Obsolete. */ IT_GLIMPSE = 0x00004000, IT_BRW = 0x00008000, }; diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 6b00671..44680dd 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -125,8 +125,6 @@ const char *ldlm_it2str(enum ldlm_intent_flags it) return "getattr"; case IT_LOOKUP: return "lookup"; - case IT_UNLINK: - return "unlink"; case IT_GETXATTR: return "getxattr"; case IT_LAYOUT: diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index d40af3b..32587cf 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -440,43 +440,6 @@ mdc_intent_getxattr_pack(struct obd_export *exp, RETURN(req); } -static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp, - struct lookup_intent *it, - struct md_op_data *op_data) -{ - struct ptlrpc_request *req; - struct obd_device *obddev = class_exp2obd(exp); - struct ldlm_intent *lit; - int rc; - ENTRY; - - req = ptlrpc_request_alloc(class_exp2cliimp(exp), - &RQF_LDLM_INTENT_UNLINK); - if (req == NULL) - RETURN(ERR_PTR(-ENOMEM)); - - req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, - op_data->op_namelen + 1); - - rc = ldlm_prep_enqueue_req(exp, req, NULL, 0); - if (rc) { - ptlrpc_request_free(req); - RETURN(ERR_PTR(rc)); - } - - /* pack the intent */ - lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); - lit->opc = (__u64)it->it_op; - - /* pack the intended request */ - mdc_unlink_pack(req, op_data); - - req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, - obddev->u.cli.cl_default_mds_easize); - ptlrpc_request_set_replen(req); - RETURN(req); -} - static struct ptlrpc_request * mdc_intent_getattr_pack(struct obd_export *exp, struct lookup_intent *it, struct md_op_data *op_data, __u32 acl_bufsize) @@ -827,18 +790,18 @@ static int mdc_enqueue_base(struct obd_export *exp, LASSERT(policy == NULL); saved_flags |= LDLM_FL_HAS_INTENT; - if (it->it_op & (IT_UNLINK | IT_GETATTR | IT_READDIR)) + if (it->it_op & (IT_GETATTR | IT_READDIR)) policy = &update_policy; else if (it->it_op & IT_LAYOUT) policy = &layout_policy; - else if (it->it_op & (IT_GETXATTR | IT_SETXATTR)) + else if (it->it_op & IT_GETXATTR) policy = &getxattr_policy; else policy = &lookup_policy; } generation = obddev->u.cli.cl_import->imp_generation; - if (!it || (it->it_op & (IT_CREAT | IT_OPEN_CREAT))) + if (!it || (it->it_op & (IT_OPEN | IT_CREAT))) acl_bufsize = imp->imp_connect_data.ocd_max_easize; else acl_bufsize = LUSTRE_POSIX_ACL_MAX_SIZE_OLD; @@ -852,8 +815,6 @@ resend: res_id.name[3] = LDLM_FLOCK; } else if (it->it_op & IT_OPEN) { req = mdc_intent_open_pack(exp, it, op_data, acl_bufsize); - } else if (it->it_op & IT_UNLINK) { - req = mdc_intent_unlink_pack(exp, it, op_data); } else if (it->it_op & (IT_GETATTR | IT_LOOKUP)) { req = mdc_intent_getattr_pack(exp, it, op_data, acl_bufsize); } else if (it->it_op & IT_READDIR) { diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 161074d..914f151 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -480,15 +480,6 @@ static const struct req_msg_field *ldlm_intent_open_client[] = { &RMF_FILE_SECCTX }; -static const struct req_msg_field *ldlm_intent_unlink_client[] = { - &RMF_PTLRPC_BODY, - &RMF_DLM_REQ, - &RMF_LDLM_INTENT, - &RMF_REC_REINT, /* coincides with mds_reint_unlink_client[] */ - &RMF_CAPA1, - &RMF_NAME -}; - static const struct req_msg_field *ldlm_intent_getxattr_client[] = { &RMF_PTLRPC_BODY, &RMF_DLM_REQ, @@ -809,7 +800,6 @@ static struct req_format *req_formats[] = { &RQF_LDLM_INTENT_GETATTR, &RQF_LDLM_INTENT_OPEN, &RQF_LDLM_INTENT_CREATE, - &RQF_LDLM_INTENT_UNLINK, &RQF_LDLM_INTENT_GETXATTR, &RQF_LDLM_INTENT_QUOTA, &RQF_QUOTA_DQACQ, @@ -1547,11 +1537,6 @@ struct req_format RQF_LDLM_INTENT_CREATE = ldlm_intent_create_client, ldlm_intent_getattr_server); EXPORT_SYMBOL(RQF_LDLM_INTENT_CREATE); -struct req_format RQF_LDLM_INTENT_UNLINK = - DEFINE_REQ_FMT0("LDLM_INTENT_UNLINK", - ldlm_intent_unlink_client, ldlm_intent_server); -EXPORT_SYMBOL(RQF_LDLM_INTENT_UNLINK); - struct req_format RQF_LDLM_INTENT_GETXATTR = DEFINE_REQ_FMT0("LDLM_INTENT_GETXATTR", ldlm_intent_getxattr_client, diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index 182515c..5ab39e1 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -1486,8 +1486,6 @@ static struct req_format *intent_req_fmt(__u32 it_opc) return &RQF_LDLM_INTENT_OPEN; else if (it_opc & (IT_GETATTR | IT_LOOKUP)) return &RQF_LDLM_INTENT_GETATTR; - else if (it_opc & IT_UNLINK) - return &RQF_LDLM_INTENT_UNLINK; else if (it_opc & IT_GETXATTR) return &RQF_LDLM_INTENT_GETXATTR; else if (it_opc & (IT_GLIMPSE | IT_BRW)) diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 7f038ba..2883dc9 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -3468,24 +3468,14 @@ void lustre_assert_wire_constants(void) (long long)IT_GETATTR); LASSERTF(IT_LOOKUP == 16, "found %lld\n", (long long)IT_LOOKUP); - LASSERTF(IT_UNLINK == 32, "found %lld\n", - (long long)IT_UNLINK); - LASSERTF(IT_TRUNC == 64, "found %lld\n", - (long long)IT_TRUNC); LASSERTF(IT_GETXATTR == 128, "found %lld\n", (long long)IT_GETXATTR); - LASSERTF(IT_EXEC == 256, "found %lld\n", - (long long)IT_EXEC); - LASSERTF(IT_PIN == 512, "found %lld\n", - (long long)IT_PIN); LASSERTF(IT_LAYOUT == 1024, "found %lld\n", (long long)IT_LAYOUT); LASSERTF(IT_QUOTA_DQACQ == 2048, "found %lld\n", (long long)IT_QUOTA_DQACQ); LASSERTF(IT_QUOTA_CONN == 4096, "found %lld\n", (long long)IT_QUOTA_CONN); - LASSERTF(IT_SETXATTR == 8192, "found %lld\n", - (long long)IT_SETXATTR); /* Checks for struct ldlm_resource_desc */ LASSERTF((int)sizeof(struct ldlm_resource_desc) == 40, "found %lld\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index c943663..91afeb5 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -1476,15 +1476,10 @@ check_ldlm_intent(void) CHECK_VALUE(IT_READDIR); CHECK_VALUE(IT_GETATTR); CHECK_VALUE(IT_LOOKUP); - CHECK_VALUE(IT_UNLINK); - CHECK_VALUE(IT_TRUNC); CHECK_VALUE(IT_GETXATTR); - CHECK_VALUE(IT_EXEC); - CHECK_VALUE(IT_PIN); CHECK_VALUE(IT_LAYOUT); CHECK_VALUE(IT_QUOTA_DQACQ); CHECK_VALUE(IT_QUOTA_CONN); - CHECK_VALUE(IT_SETXATTR); } static void diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 3b502ae..f61f37b 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -3489,24 +3489,14 @@ void lustre_assert_wire_constants(void) (long long)IT_GETATTR); LASSERTF(IT_LOOKUP == 16, "found %lld\n", (long long)IT_LOOKUP); - LASSERTF(IT_UNLINK == 32, "found %lld\n", - (long long)IT_UNLINK); - LASSERTF(IT_TRUNC == 64, "found %lld\n", - (long long)IT_TRUNC); LASSERTF(IT_GETXATTR == 128, "found %lld\n", (long long)IT_GETXATTR); - LASSERTF(IT_EXEC == 256, "found %lld\n", - (long long)IT_EXEC); - LASSERTF(IT_PIN == 512, "found %lld\n", - (long long)IT_PIN); LASSERTF(IT_LAYOUT == 1024, "found %lld\n", (long long)IT_LAYOUT); LASSERTF(IT_QUOTA_DQACQ == 2048, "found %lld\n", (long long)IT_QUOTA_DQACQ); LASSERTF(IT_QUOTA_CONN == 4096, "found %lld\n", (long long)IT_QUOTA_CONN); - LASSERTF(IT_SETXATTR == 8192, "found %lld\n", - (long long)IT_SETXATTR); /* Checks for struct ldlm_resource_desc */ LASSERTF((int)sizeof(struct ldlm_resource_desc) == 40, "found %lld\n", -- 1.8.3.1