From patchwork Fri Aug 17 03:10:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 10568363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 173D913B6 for ; Fri, 17 Aug 2018 03:11:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 032D72B124 for ; Fri, 17 Aug 2018 03:11:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB7542B144; Fri, 17 Aug 2018 03:11:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 77F602B176 for ; Fri, 17 Aug 2018 03:11:28 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id BCF9F4E1C83; Thu, 16 Aug 2018 20:11:08 -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 3C05621FFA8 for ; Thu, 16 Aug 2018 20:10:54 -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 1EBDF1005387; Thu, 16 Aug 2018 23:10:46 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 1A8F2464; Thu, 16 Aug 2018 23:10:46 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 16 Aug 2018 23:10:24 -0400 Message-Id: <1534475441-15543-22-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1534475441-15543-1-git-send-email-jsimmons@infradead.org> References: <1534475441-15543-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 21/38] lustre: obdclass: add light weight obd_def_uuid_attrs 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: James Simmons , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" X-Virus-Scanned: ClamAV using ClamSMTP It was assumed that all obd devices supported every attribute in obd_def_attrs but that is not true. Several obd devices only have a uuid sysfs file. Add an option to lprocfs_obd_setup() to select the proper obd_def_attrs. Signed-off-by: James Simmons WC-bug-id: https://jira.whamcloud.com/browse/LU-8066 Reviewed-on: https://review.whamcloud.com/26020 Reviewed-by: John L. Hammond Reviewed-by: Niu Yawei Reviewed-by: Fan Yong Signed-off-by: James Simmons --- .../staging/lustre/lustre/include/lprocfs_status.h | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 2 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 2 +- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- .../staging/lustre/lustre/obdclass/lprocfs_status.c | 19 ++++++++++++++++--- drivers/staging/lustre/lustre/osc/osc_request.c | 2 +- 7 files changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 358ace3..f428ce0 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -453,7 +453,7 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index, void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *var, void *data); -int lprocfs_obd_setup(struct obd_device *obd); +int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only); int lprocfs_obd_cleanup(struct obd_device *obd); /* Generic callbacks */ diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 212ca31..c36ecb7 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1255,7 +1255,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) lprocfs_lmv_init_vars(obd); - lprocfs_obd_setup(obd); + lprocfs_obd_setup(obd, true); debugfs_create_file("target_obd", 0444, obd->obd_debugfs_entry, obd, &lmv_proc_target_fops); rc = fld_client_init(&lmv->lmv_fld, obd->obd_name, diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 43ebec6..751bf64 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -769,7 +769,7 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) goto out; lprocfs_lov_init_vars(obd); - lprocfs_obd_setup(obd); + lprocfs_obd_setup(obd, false); debugfs_create_file("target_obd", 0444, obd->obd_debugfs_entry, obd, &lov_proc_target_fops); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index a3c0461f..fcba599 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2648,7 +2648,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) goto err_ptlrpcd_decref; lprocfs_mdc_init_vars(obd); - lprocfs_obd_setup(obd); + lprocfs_obd_setup(obd, false); sptlrpc_lprocfs_cliobd_attach(obd); ptlrpc_lprocfs_register_obd(obd); diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index 46b1e36..50da9cf 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -748,7 +748,7 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) } lprocfs_mgc_init_vars(obd); - lprocfs_obd_setup(obd); + lprocfs_obd_setup(obd, true); sptlrpc_lprocfs_cliobd_attach(obd); if (atomic_inc_return(&mgc_count) == 1) { diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index a5676ff..91d37fc 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -989,6 +989,11 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) } EXPORT_SYMBOL(lprocfs_rd_connect_flags); +static const struct attribute *obd_def_uuid_attrs[] = { + &lustre_attr_uuid.attr, + NULL, +}; + static const struct attribute *obd_def_attrs[] = { &lustre_attr_blocksize.attr, &lustre_attr_kbytestotal.attr, @@ -1008,7 +1013,7 @@ static void obd_sysfs_release(struct kobject *kobj) complete(&obd->obd_kobj_unregister); } -int lprocfs_obd_setup(struct obd_device *obd) +int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only) { int rc; @@ -1022,7 +1027,12 @@ int lprocfs_obd_setup(struct obd_device *obd) if (rc) return rc; - rc = sysfs_create_files(&obd->obd_kobj, obd_def_attrs); + if (uuid_only) + obd->obd_attrs = obd_def_uuid_attrs; + else + obd->obd_attrs = obd_def_attrs; + + rc = sysfs_create_files(&obd->obd_kobj, obd->obd_attrs); if (rc) { kobject_put(&obd->obd_kobj); return rc; @@ -1043,7 +1053,10 @@ int lprocfs_obd_cleanup(struct obd_device *obd) debugfs_remove_recursive(obd->obd_debugfs_entry); - sysfs_remove_files(&obd->obd_kobj, obd_def_attrs); + if (obd->obd_attrs) { + sysfs_remove_files(&obd->obd_kobj, obd->obd_attrs); + obd->obd_attrs = NULL; + } kobject_put(&obd->obd_kobj); wait_for_completion(&obd->obd_kobj_unregister); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 0472165..4f57a8e 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -2804,7 +2804,7 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) cli->cl_grant_shrink_interval = GRANT_SHRINK_INTERVAL; lprocfs_osc_init_vars(obd); - if (lprocfs_obd_setup(obd) == 0) { + if (lprocfs_obd_setup(obd, false) == 0) { lproc_osc_attach_seqstat(obd); sptlrpc_lprocfs_cliobd_attach(obd); ptlrpc_lprocfs_register_obd(obd);