From patchwork Mon Sep 30 18:55:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167083 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C37C16C1 for ; Mon, 30 Sep 2019 18:58:12 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04AB0224D5 for ; Mon, 30 Sep 2019 18:58:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04AB0224D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id BD0995C3CA3; Mon, 30 Sep 2019 11:57:39 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 1BD335C3546 for ; Mon, 30 Sep 2019 11:57:12 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id ACA1A10055F8; Mon, 30 Sep 2019 14:56:56 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id AB9E9A9; Mon, 30 Sep 2019 14:56:56 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:55:03 -0400 Message-Id: <1569869810-23848-45-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> References: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 044/151] lustre: mdt: IO request handling in MDT X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mikhal Pershin , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Mikhal Pershin Add methods to handle IO requests in MDT similar to OFD. Introduce MDS_INODEBITS_DOM bit for data on MDT, destinguish IO requests to MDT and OST and take appropriate lock in target code. WC-bug-id: https://jira.whamcloud.com/browse/LU-3285 Lustre-commit: 2bcc5ad0ed6a ("LU-3285 mdt: IO request handling in MDT") Signed-off-by: Mikhal Pershin Reviewed-on: https://review.whamcloud.com/28013 Reviewed-by: Jinshan Xiong Reviewed-by: Bobi Jam Signed-off-by: James Simmons --- fs/lustre/include/lustre_osc.h | 3 +++ fs/lustre/llite/llite_lib.c | 12 +++++++----- fs/lustre/mdc/mdc_request.c | 19 +++++++++++++++++-- fs/lustre/osc/osc_request.c | 3 ++- include/uapi/linux/lustre/lustre_idl.h | 5 +++-- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/fs/lustre/include/lustre_osc.h b/fs/lustre/include/lustre_osc.h index e91fae2..f14ae85 100644 --- a/fs/lustre/include/lustre_osc.h +++ b/fs/lustre/include/lustre_osc.h @@ -512,6 +512,9 @@ int osc_attr_update(const struct lu_env *env, struct cl_object *obj, int osc_object_glimpse(const struct lu_env *env, const struct cl_object *obj, struct ost_lvb *lvb); +/* osc_request.c */ +void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd); + /**************************************************************************** * * Accessors and type conversions. diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c index 3896dc7..418f464 100644 --- a/fs/lustre/llite/llite_lib.c +++ b/fs/lustre/llite/llite_lib.c @@ -187,7 +187,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) /* indicate MDT features supported by this client */ data->ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_NODEVOH | - OBD_CONNECT_ATTRFID | + OBD_CONNECT_ATTRFID | OBD_CONNECT_GRANT | OBD_CONNECT_VERSION | OBD_CONNECT_BRW_SIZE | OBD_CONNECT_CANCELSET | OBD_CONNECT_FID | OBD_CONNECT_AT | OBD_CONNECT_LOV_V3 | @@ -201,10 +201,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) OBD_CONNECT_FLOCK_DEAD | OBD_CONNECT_DISP_STRIPE | OBD_CONNECT_LFSCK | OBD_CONNECT_OPEN_BY_FID | - OBD_CONNECT_DIR_STRIPE | - OBD_CONNECT_BULK_MBITS | - OBD_CONNECT_SUBTREE | - OBD_CONNECT_FLAGS2 | OBD_CONNECT_MULTIMODRPCS; + OBD_CONNECT_DIR_STRIPE | + OBD_CONNECT_BULK_MBITS | OBD_CONNECT_CKSUM | + OBD_CONNECT_SUBTREE | + OBD_CONNECT_FLAGS2 | OBD_CONNECT_MULTIMODRPCS; data->ocd_connect_flags2 = 0; @@ -215,6 +215,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) OBD_CONNECT_LARGE_ACL; #endif + data->ocd_cksum_types = cksum_types_supported_client(); + if (OBD_FAIL_CHECK(OBD_FAIL_MDC_LIGHTWEIGHT)) /* flag mdc connection as lightweight, only used for test * purpose, use with care diff --git a/fs/lustre/mdc/mdc_request.c b/fs/lustre/mdc/mdc_request.c index eefaf44..96e0d0a 100644 --- a/fs/lustre/mdc/mdc_request.c +++ b/fs/lustre/mdc/mdc_request.c @@ -54,6 +54,7 @@ #include #include #include +#include #include "mdc_internal.h" @@ -2354,6 +2355,15 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp, LASSERT(imp->imp_obd == obd); switch (event) { + case IMP_EVENT_DISCON: { + struct client_obd *cli = &obd->u.cli; + + spin_lock(&cli->cl_loi_list_lock); + cli->cl_avail_grant = 0; + cli->cl_lost_grant = 0; + spin_unlock(&cli->cl_loi_list_lock); + break; + } case IMP_EVENT_INACTIVE: { struct client_obd *cli = &obd->u.cli; /* @@ -2384,10 +2394,15 @@ static int mdc_import_event(struct obd_device *obd, struct obd_import *imp, mdc_hsm_ct_reregister, (void *)imp); break; - case IMP_EVENT_OCD: + case IMP_EVENT_OCD: { + struct obd_connect_data *ocd = &imp->imp_connect_data; + + if (OCD_HAS_FLAG(ocd, GRANT)) + osc_init_grant(&obd->u.cli, ocd); + rc = obd_notify_observer(obd, obd, OBD_NOTIFY_OCD); break; - case IMP_EVENT_DISCON: + } case IMP_EVENT_DEACTIVATE: case IMP_EVENT_ACTIVATE: break; diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c index b84856d..96d2c01 100644 --- a/fs/lustre/osc/osc_request.c +++ b/fs/lustre/osc/osc_request.c @@ -897,7 +897,7 @@ static int osc_del_shrink_grant(struct client_obd *client) TIMEOUT_GRANT); } -static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) +void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) { /* * ocd_grant is the total grant amount we're expect to hold: if we've @@ -953,6 +953,7 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) list_empty(&cli->cl_grant_shrink_list)) osc_add_shrink_grant(cli); } +EXPORT_SYMBOL(osc_init_grant); /* We assume that the reason this OSC got a short read is because it read * beyond the end of a stripe file; i.e. lustre is reading a sparse file diff --git a/include/uapi/linux/lustre/lustre_idl.h b/include/uapi/linux/lustre/lustre_idl.h index ec19d31..bcbe557 100644 --- a/include/uapi/linux/lustre/lustre_idl.h +++ b/include/uapi/linux/lustre/lustre_idl.h @@ -100,7 +100,7 @@ #define MDC_REPLY_PORTAL 10 /*#define MDC_BULK_PORTAL 11 */ #define MDS_REQUEST_PORTAL 12 -/*#define MDS_REPLY_PORTAL 13 */ +#define MDS_IO_PORTAL 13 #define MDS_BULK_PORTAL 14 #define LDLM_CB_REQUEST_PORTAL 15 #define LDLM_CB_REPLY_PORTAL 16 @@ -1429,8 +1429,9 @@ enum mdt_reint_cmd { */ #define MDS_INODELOCK_PERM 0x000010 #define MDS_INODELOCK_XATTR 0x000020 /* extended attributes */ +#define MDS_INODELOCK_DOM 0x000040 /* Data for data-on-mdt files */ -#define MDS_INODELOCK_MAXSHIFT 5 +#define MDS_INODELOCK_MAXSHIFT 6 /* This FULL lock is useful to take on unlink sort of operations */ #define MDS_INODELOCK_FULL ((1 << (MDS_INODELOCK_MAXSHIFT + 1)) - 1)