Whamcloud - gitweb
LU-14291 ofd: merge ost module into ofd 93/53993/6
authorJames Simmons <jsimmons@infradead.org>
Mon, 16 Dec 2024 16:55:24 +0000 (11:55 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 2 Jan 2025 20:46:03 +0000 (20:46 +0000)
The ost module is very small and its very similar to the mds class
which is embedded in the mdt module. We can do the same thing with
the ost module. Merge it into the ofd module.

Test-Parameters: trivial
Change-Id: I1f7c44893d41ec8fc03113400a02b5076a07fbbe
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53993
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
12 files changed:
MAINTAINERS
lustre/Makefile.in
lustre/autoMakefile.am
lustre/autoconf/lustre-core.m4
lustre/obdclass/genops.c
lustre/ofd/Makefile.in
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_internal.h
lustre/ofd/ofd_oss.c [moved from lustre/ost/ost_handler.c with 91% similarity]
lustre/ost/Makefile.in [deleted file]
lustre/ost/autoMakefile.am [deleted file]
lustre/ost/ost_internal.h [deleted file]

index b8362fc..9af2aec 100644 (file)
@@ -404,7 +404,6 @@ Lustre Object Storage Target - OST
 R:     Alex Zhuravlev <bzzz@whamcloud.com>
 S:     Supported
 F:     lustre/ofd/
-F:     lustre/ost/
 
 Lustre OSD API
 R:     Alex Zhuravlev <bzzz@whamcloud.com>
index ef05062..758937f 100644 (file)
@@ -7,7 +7,7 @@ obj-m += mgc/
 obj-m += ec/
 obj-m += kunit/
 
-@SERVER_TRUE@obj-m += ost/ mgs/ mdt/ mdd/ ofd/ quota/ osp/ lod/ lfsck/ target/
+@SERVER_TRUE@obj-m += mgs/ mdt/ mdd/ ofd/ quota/ osp/ lod/ lfsck/ target/
 @CLIENT_TRUE@obj-m += lov/ osc/ mdc/ lmv/ llite/ fld/
 @LDISKFS_ENABLED_TRUE@obj-m += osd-ldiskfs/
 @ZFS_ENABLED_TRUE@obj-m += osd-zfs/
index 5d9ee36..f55fcdc 100644 (file)
@@ -37,7 +37,7 @@ AUTOMAKE_OPTIONS = foreign
 ALWAYS_SUBDIRS = include obdclass ldlm ptlrpc obdecho ec \
        mgc fid fld doc utils tests scripts autoconf conf kunit
 
-SERVER_SUBDIRS = ost mgs mdt mdd ofd osd-zfs osd-ldiskfs \
+SERVER_SUBDIRS = mgs mdt mdd ofd osd-zfs osd-ldiskfs \
        quota osp lod target lfsck
 
 CLIENT_SUBDIRS = mdc lmv llite lov osc
index 6243a4c..4dc1b75 100644 (file)
@@ -5819,8 +5819,6 @@ lustre/ofd/Makefile
 lustre/ofd/autoMakefile
 lustre/osc/Makefile
 lustre/osc/autoMakefile
-lustre/ost/Makefile
-lustre/ost/autoMakefile
 lustre/osd-ldiskfs/Makefile
 lustre/osd-ldiskfs/autoMakefile
 lustre/osd-zfs/Makefile
index 57fee51..f833de7 100644 (file)
@@ -90,7 +90,8 @@ SERVER_ONLY struct obd_type *class_get_type(const char *name)
                const char *modname = name;
 
 #ifdef HAVE_SERVER_SUPPORT
-               if (strcmp(modname, "obdfilter") == 0)
+               if (strcmp(modname, "obdfilter") == 0 ||
+                   strcmp(modname, LUSTRE_OSS_NAME) == 0)
                        modname = "ofd";
 
                if (strcmp(modname, LUSTRE_LWP_NAME) == 0)
index 186172e..98830b7 100644 (file)
@@ -1,7 +1,7 @@
 MODULES := ofd
 
 ofd-objs := ofd_dev.o ofd_obd.o ofd_fs.o ofd_trans.o ofd_objects.o ofd_io.o
-ofd-objs += lproc_ofd.o ofd_dlm.o ofd_lvb.o ofd_access_log.o
+ofd-objs += lproc_ofd.o ofd_oss.o ofd_dlm.o ofd_lvb.o ofd_access_log.o
 
 EXTRA_DIST = $(ofd-objs:%.o=%.c) ofd_internal.h
 
index 85d6ae8..f62dd6b 100644 (file)
@@ -3285,10 +3285,14 @@ static int __init ofd_init(void)
        if (rc)
                return rc;
 
-       rc = ofd_access_log_module_init();
+       rc = oss_mod_init();
        if (rc)
                goto out_caches;
 
+       rc = ofd_access_log_module_init();
+       if (rc)
+               goto out_oss_fini;
+
        rc = class_register_type(&ofd_obd_ops, NULL, true,
                                 LUSTRE_OST_NAME, &ofd_device_type);
        if (rc)
@@ -3298,6 +3302,8 @@ static int __init ofd_init(void)
 
 out_ofd_access_log:
        ofd_access_log_module_exit();
+out_oss_fini:
+       oss_mod_exit();
 out_caches:
        lu_kmem_fini(ofd_caches);
 
@@ -3314,6 +3320,7 @@ static void __exit ofd_exit(void)
 {
        class_unregister_type(LUSTRE_OST_NAME);
        ofd_access_log_module_exit();
+       oss_mod_exit();
        lu_kmem_fini(ofd_caches);
 }
 
index e8b8b7f..615f89d 100644 (file)
@@ -306,6 +306,10 @@ void ofd_access(const struct lu_env *env, struct ofd_device *m,
                const struct lu_fid *parent_fid, __u64 begin, __u64 end,
                unsigned int size, unsigned int segment_count, int rw);
 
+/* ofd_oss.c */
+int oss_mod_init(void);
+void oss_mod_exit(void);
+
 /* ofd_dev.c */
 extern struct lu_context_key ofd_thread_key;
 int ofd_postrecov(const struct lu_env *env, struct ofd_device *ofd);
similarity index 91%
rename from lustre/ost/ost_handler.c
rename to lustre/ofd/ofd_oss.c
index 530d45a..abd52a5 100644 (file)
@@ -28,7 +28,7 @@
 /*
  * This file is part of Lustre, http://www.lustre.org/
  *
- * lustre/ost/ost_handler.c
+ * lustre/ofd/ofd_oss.c
  *
  * Author: Peter J. Braam <braam@clusterfs.com>
  * Author: Phil Schwan <phil@clusterfs.com>
@@ -41,7 +41,8 @@
 #include <lprocfs_status.h>
 #include <lustre_nodemap.h>
 #include <obd_class.h>
-#include "ost_internal.h"
+
+#define OSS_SERVICE_WATCHDOG_FACTOR 2
 
 int oss_max_threads = 512;
 module_param(oss_max_threads, int, 0444);
@@ -79,7 +80,7 @@ MODULE_PARM_DESC(oss_io_cpts, "CPU partitions OSS IO threads should run on");
 static struct cfs_cpt_table *ost_io_cptable;
 
 /* Sigh - really, this is an OSS, the _server_, not the _target_ */
-static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
+static int oss_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
        static struct ptlrpc_service_conf svc_conf;
        struct ost_obd *ost = obd2ost(obd);
@@ -130,7 +131,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                                   obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_service)) {
                rc = PTR_ERR(ost->ost_service);
-               CERROR("failed to start service: %d\n", rc);
+               CERROR("oss: failed to start service: %d\n", rc);
                GOTO(out_lprocfs, rc);
        }
 
@@ -171,7 +172,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                                          );
        if (IS_ERR(ost->ost_create_service)) {
                rc = PTR_ERR(ost->ost_create_service);
-               CERROR("failed to start OST create service: %d\n", rc);
+               CERROR("oss: failed to start OST create service: %d\n", rc);
                GOTO(out_service, rc);
        }
 
@@ -186,13 +187,13 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                ost_io_cptable = cfs_cpt_table_alloc(nodes_weight(*mask));
                for_each_node_mask(i, *mask) {
                        if (!ost_io_cptable) {
-                               CWARN("OSS failed to create CPT table\n");
+                               CWARN("oss: failed to create CPT table\n");
                                break;
                        }
 
                        rc = cfs_cpt_set_node(ost_io_cptable, cpt++, i);
                        if (!rc) {
-                               CWARN("OSS Failed to set node %d for IO CPT table\n",
+                               CWARN("oss: Failed to set node %d for IO CPT table\n",
                                      i);
                                cfs_cpt_table_free(ost_io_cptable);
                                ost_io_cptable = NULL;
@@ -242,7 +243,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                                      obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_io_service)) {
                rc = PTR_ERR(ost->ost_io_service);
-               CERROR("failed to start OST I/O service: %d\n", rc);
+               CERROR("oss: failed to start OST I/O service: rc = %d\n", rc);
                ost->ost_io_service = NULL;
                GOTO(out_create, rc);
        }
@@ -285,7 +286,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                                       obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_seq_service)) {
                rc = PTR_ERR(ost->ost_seq_service);
-               CERROR("failed to start OST seq service: %d\n", rc);
+               CERROR("oss: failed to start OST seq service: %d\n", rc);
                ost->ost_seq_service = NULL;
                GOTO(out_io, rc);
        }
@@ -333,7 +334,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                                       obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_out_service)) {
                rc = PTR_ERR(ost->ost_out_service);
-               CERROR("failed to start out service: %d\n", rc);
+               CERROR("oss: failed to start out service: %d\n", rc);
                ost->ost_out_service = NULL;
                GOTO(out_seq, rc);
        }
@@ -359,7 +360,7 @@ out_lprocfs:
        RETURN(rc);
 }
 
-static int ost_cleanup(struct obd_device *obd)
+static int oss_cleanup(struct obd_device *obd)
 {
        struct ost_obd *ost = obd2ost(obd);
        int err = 0;
@@ -397,7 +398,7 @@ static int ost_cleanup(struct obd_device *obd)
        RETURN(err);
 }
 
-static int ost_health_check(const struct lu_env *env, struct obd_device *obd)
+static int oss_health_check(const struct lu_env *env, struct obd_device *obd)
 {
        struct ost_obd *ost = obd2ost(obd);
        int rc = 0;
@@ -438,15 +439,15 @@ out:
 }
 
 /* use obd ops to offer management infrastructure */
-static const struct obd_ops ost_obd_ops = {
+static const struct obd_ops oss_obd_ops = {
        .o_owner        = THIS_MODULE,
-       .o_setup        = ost_setup,
-       .o_cleanup      = ost_cleanup,
-       .o_health_check = ost_health_check,
+       .o_setup        = oss_setup,
+       .o_cleanup      = oss_cleanup,
+       .o_health_check = oss_health_check,
        .o_iocontrol    = oss_iocontrol,
 };
 
-static int __init ost_init(void)
+int oss_mod_init(void)
 {
        int rc;
 
@@ -455,21 +456,13 @@ static int __init ost_init(void)
        if (rc)
                RETURN(rc);
 
-       rc = class_register_type(&ost_obd_ops, NULL, false,
+       rc = class_register_type(&oss_obd_ops, NULL, false,
                                 LUSTRE_OSS_NAME, NULL);
 
        RETURN(rc);
 }
 
-static void __exit ost_exit(void)
+void oss_mod_exit(void)
 {
        class_unregister_type(LUSTRE_OSS_NAME);
 }
-
-MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre Object Storage Target (OST)");
-MODULE_VERSION(LUSTRE_VERSION_STRING);
-MODULE_LICENSE("GPL");
-
-module_init(ost_init);
-module_exit(ost_exit);
diff --git a/lustre/ost/Makefile.in b/lustre/ost/Makefile.in
deleted file mode 100644 (file)
index bae023e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-MODULES := ost
-ost-objs := ost_handler.o
-
-EXTRA_DIST = $(ost-objs:%.o=%.c) ost_internal.h
-
-@INCLUDE_RULES@
diff --git a/lustre/ost/autoMakefile.am b/lustre/ost/autoMakefile.am
deleted file mode 100644 (file)
index 96e1af7..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# GPL HEADER START
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 only,
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License version 2 for more details (a copy is included
-# in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU General Public License
-# version 2 along with this program; If not, see
-# http://www.gnu.org/licenses/gpl-2.0.html
-#
-# GPL HEADER END
-#
-
-#
-# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# This file is part of Lustre, http://www.lustre.org/
-#
-
-if MODULES
-modulefs_DATA = ost$(KMODEXT)
-endif
-
-MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ 
diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h
deleted file mode 100644 (file)
index 7e8cc85..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.gnu.org/licenses/gpl-2.0.html
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2013, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- */
-
-#ifndef OST_INTERNAL_H
-#define OST_INTERNAL_H
-
-#define OSS_SERVICE_WATCHDOG_FACTOR 2
-
-#endif /* OST_INTERNAL_H */