Whamcloud - gitweb
Branch b1_4_newconfig2
authornathan <nathan>
Wed, 3 Aug 2005 21:21:15 +0000 (21:21 +0000)
committernathan <nathan>
Wed, 3 Aug 2005 21:21:15 +0000 (21:21 +0000)
b=6663
use mgc_obd instead of mgmt_obd

lustre/include/linux/lustre_disk.h
lustre/include/linux/obd.h
lustre/mds/mds_fs.c
lustre/obdclass/obd_mount.c
lustre/utils/mkfs_lustre.c
lustre/utils/module_setup.sh

index 2ffe169..d409830 100644 (file)
@@ -174,7 +174,7 @@ struct ll_sb_info;
 struct lustre_sb_info {
         int                       lsi_flags;
         //struct lvfs_run_ctxt      lsi_ctxt;    /* mount context */
-        struct obd_device        *lsi_mgc;     /* mgmt cli obd */
+        struct obd_device        *lsi_mgc;     /* mgc obd */
         struct lustre_mount_data *lsi_lmd;     /* mount command info */
         struct lustre_disk_data  *lsi_ldd;     /* mount info on-disk */
         //struct fsfilt_operations *lsi_fsops;
index fbb9b10..5ef5d20 100644 (file)
@@ -302,44 +302,26 @@ struct client_obd {
         int                      cl_qchk_stat; /* quotacheck stat of the peer */
 };
 
-struct mgs_server_data;
-
 /*a light client obd for mount-conf */
 struct mgc_obd {
-        struct obd_import       *cl_import;
-        struct semaphore         cl_sem;
-        int                      cl_conn_count;
-        struct mgc_rpc_lock     *cl_rpc_lock;
-}
+        struct obd_import       *mgc_import;
+        struct semaphore         mgc_sem;
+        int                      mgc_conn_count;
+        struct mgc_rpc_lock     *mgc_rpc_lock;
+        struct vfsmount         *mgc_vfsmnt;     /* for local config dirs */
+        struct super_block      *mgc_sb;
+        struct file             *mgc_rcvd_filp;
+        struct dentry           *mgc_configs_dir;
+};
 
 struct mgs_obd {
         struct ptlrpc_service           *mgs_service;
         struct vfsmount                 *mgs_vfsmnt;
         struct super_block              *mgs_sb;
-        spinlock_t                       mgs_transno_lock;
-        __u64                            mgs_last_transno;
-        struct mgs_server_data          *mgs_server_data;
         struct dentry                   *mgs_configs_dir;
         struct llog_handle              *mgs_cfg_llh;
-        char                            *mgs_profile;
-        unsigned long                   *mgs_client_bitmap;
-        struct semaphore                 mgs_orphan_recovery_sem;
-};
-
-/* Like a client, with some hangers-on.  Keep mc_client_obd first so that we
- * can reuse the various client setup/connect functions. */
-struct mgmtcli_obd {
-        /* from confobd */
-        struct super_block      *mc_sb;           /* from mount */
-        struct vfsmount         *mc_vfsmnt;       /* local mount */
-        struct dentry           *mc_configs_dir;
-        struct llog_handle      *mc_cfg_llh;
-        //struct logs_info         mc_logs_info;
-        struct list_head         mc_registered;   /* chain of mgc's */
 };
 
-#define mc_import mc_client_obd.cl_import
-
 struct mds_obd {
         struct ptlrpc_service           *mds_service;
         struct ptlrpc_service           *mds_setattr_service;
@@ -588,7 +570,6 @@ struct obd_device {
                 struct lov_obd lov;
                 struct cache_obd cobd;
                 struct ptlbd_obd ptlbd;
-                struct mgmtcli_obd mgmtcli;
                 struct mgc_obd mgc;
                 struct mgs_obd mgs;
         } u;
index ae580d7..48e10c9 100644 (file)
@@ -219,7 +219,7 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file)
         LASSERT(offsetof(struct mds_client_data, mcd_padding) +
                 sizeof(mcd->mcd_padding) == MDS_LR_CLIENT_SIZE);
         LASSERT(MDS_LR_CLIENT_SIZE == LR_CLIENT_SIZE);
-        LASSERT(MDS_LR_CLIENT_START == LR_CLIENT_SIZE);
+        LASSERT(MDS_LR_CLIENT_START == LR_CLIENT_START);
 
         OBD_ALLOC_WAIT(lsd, sizeof(*lsd));
         if (!lsd)
@@ -272,12 +272,9 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file)
         }
 
         if (lsd->lsd_feature_compat & ~cpu_to_le32(LR_COMPAT_COMMON_LR)) {
-                struct mds_server_data *msd;
                 CERROR("old last_rcvd format, updating\n");
-                msd = (struct mds_server_data *)lsd;
-                /* careful ordering */
-                lsd->lsd_mount_count = msd->msd_mount_count;
-                lsd->lsd_last_transno = msd->msd_last_transno;
+                lsd->lsd_mount_count = lsd->lsd_last_transno; //msd->msd_mount_count
+                lsd->lsd_last_transno = lsd->lsd_unused; //msd->msd_last_transno;
                 lsd->lsd_feature_compat |= cpu_to_le32(LR_COMPAT_COMMON_LR);
                 GOTO(err_msd, rc = -EINVAL);
         }
@@ -301,6 +298,12 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file)
                (last_rcvd_size - le32_to_cpu(lsd->lsd_client_start)) /
                 le16_to_cpu(lsd->lsd_client_size));
 
+        if (!lsd->lsd_server_size || !lsd->lsd_client_start ||
+            !lsd->lsd_client_size) {
+                CERROR("Bad last_rcvd contents!\n");
+                GOTO(err_msd, rc = -EINVAL);
+        }
+
         /* When we do a clean MDS shutdown, we save the last_transno into
          * the header.  If we find clients with higher last_transno values
          * then those clients may need recovery done. */
index 0b8a864..d280ddc 100644 (file)
@@ -234,7 +234,7 @@ static int lustre_update_llog(struct obd_device *obd)
 
         // FIXME this should be called from lov_add_obd?
 #if 0
-        if (mcobd->cfobd_logs_info.ost_number > 0) {
+        if (mgcobd->cfobd_logs_info.ost_number > 0) {
                 struct obd_ioctl_data ioc_data = { 0 };
                 CERROR("update new logs.\n");
                 err = obd_iocontrol(OBD_IOC_UPDATE_LOG, obd->obd_self_export,
@@ -252,13 +252,13 @@ static void server_put_super(struct super_block *sb)
         struct lustre_sb_info *sbi = s2sbi(sb);
         struct l_linux_dirent *dirent, *n;
         struct obd_device *obd;
-        struct mgmtcli_obd *mcobd;
+        struct mgc_obd *mgcobd;
         char flags[2] = "";
         int err;
                                                                                        
         obd = sbi->lsi_mgc;
         CERROR("server put_super %s\n", obd->obd_name);
-        mcobd = &obd->u.mgmtcli;
+        mgcobd = &obd->u.mgc;
                                                                                        
         lustre_update_llog(obd);
                                                                                        
@@ -284,8 +284,8 @@ static void server_put_super(struct super_block *sb)
          */
         
         /* Find all the logs in the CONFIGS directory */
-        err = dentry_readdir(obd, mcobd->mc_configs_dir,
-                       mcobd->mc_vfsmnt, &dentry_list);
+        err = dentry_readdir(obd, mgcobd->mgc_configs_dir,
+                       mgcobd->mgc_vfsmnt, &dentry_list);
         if (err)
                 CERROR("Can't read LOGS dir, %d\n", err);
                                                                                        
@@ -511,14 +511,14 @@ int lustre_process_logs(struct super_block *sb,
         struct list_head dentry_list;
         struct l_linux_dirent *dirent, *n;
         struct obd_device *obd;
-        struct mgmtcli_obd *mcobd;
+        struct mgc_obd *mgcobd;
         struct lustre_sb_info *sbi = s2sbi(sb);
         int is_first_mount = 0;
         int err;
                                                                                        
         obd = sbi->lsi_mgc;
         LASSERT(obd);
-        mcobd = &obd->u.mgmtcli;
+        mgcobd = &obd->u.mgc;
                                                                                        
         err = parse_last_rcvd(obd, lr_uuid, &is_first_mount);
         if (err) {
@@ -543,13 +543,13 @@ int lustre_process_logs(struct super_block *sb,
                         CERROR("Can't read %s\n", STRIPE_FILE);
                         return(err);
                 }
-                mcobd_start_accept(obd, lmd, lr_uuid, stripe_size);
+                mgcobd_start_accept(obd, lmd, lr_uuid, stripe_size);
    #endif                                                                       
         }
                                                                                        
         /* Find all the logs in the CONFIGS directory */
-        err = dentry_readdir(obd, mcobd->mc_configs_dir,
-                       mcobd->mc_vfsmnt, &dentry_list);
+        err = dentry_readdir(obd, mgcobd->mgc_configs_dir,
+                       mgcobd->mgc_vfsmnt, &dentry_list);
         if (err) {
                 CERROR("Can't read LOGS dir\n");
                 return(err);
@@ -594,7 +594,7 @@ static int lustre_kern_mount(struct super_block *sb)
         struct lustre_disk_data *ldd;
         struct lustre_mount_data *lmd = sbi->lsi_lmd;
         struct obd_device *obd;
-        struct mgmtcli_obd *mcobd;
+        struct mgc_obd *mgcobd;
         char *options = NULL;
         struct vfsmount *mnt;
         unsigned long page;
@@ -657,10 +657,10 @@ static int lustre_kern_mount(struct super_block *sb)
         }
 
         obd = sbi->lsi_mgc;
-        mcobd = &obd->u.mgmtcli;
-        mcobd->mc_vfsmnt = mnt;
-        mcobd->mc_sb = mnt->mnt_root->d_inode->i_sb; // is this different than sb? */
-        fsfilt_setup(obd, mcobd->mc_sb);
+        mgcobd = &obd->u.mgc;
+        mgcobd->mgc_vfsmnt = mnt;
+        mgcobd->mgc_sb = mnt->mnt_root->d_inode->i_sb; // is this different than sb? */
+        fsfilt_setup(obd, mgcobd->mgc_sb);
 
         OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt);
         obd->obd_lvfs_ctxt.pwdmnt = mnt;
@@ -721,7 +721,7 @@ out_free:
         return (err);
 }
 
-/* Set up a mcobd to process startup logs */
+/* Set up a mgcobd to process startup logs */
 static int lustre_start_mgc(struct super_block *sb)
 {
         struct config_llog_instance cfg;
@@ -743,18 +743,21 @@ static int lustre_start_mgc(struct super_block *sb)
                                                                                        
         err = do_lcfg(mcname, 0, LCFG_SETUP, 0, 0, 0, 0);
         if (err) {
-                CERROR("mcobd setup error %d\n", err);
+                CERROR("mgcobd setup error %d\n", err);
                 do_lcfg(mcname, 0, LCFG_DETACH, 0, 0, 0, 0);
                 goto out_free;
         }
         
         obd = class_name2obd(mcname);
         if (!obd) {
-                CERROR("Can't find mcobd %s\n", mcname);
+                CERROR("Can't find mgcobd %s\n", mcname);
                 err = -ENOTCONN;
                 goto out_free;
         }
+        // part of mgc_setup obd->obd_fsops = fsfilt_get_ops(lustre_cfg_string(lcfg, 2));
+        
         sbi->lsi_mgc = obd;
+        
 
 out_free:
         OBD_FREE(mcname, sizeof(sb) * 2 + 1);
index 2477bbb..ec571f0 100644 (file)
@@ -552,14 +552,15 @@ static int load_modules(struct mkfs_opts *mop)
 
         //client: rc = load_module("lustre");
         vprint("Loading modules...");
-        if (IS_OST(&mop->mo_ldd)) {
+
+        /* portals, ksocknal, fsfilt, etc. in modules.conf */
+        rc = load_module("_lustre");
+        if (rc) return rc;
+
+        if (IS_OST(&mop->mo_ldd)) 
                 rc = load_module("oss");
-                if (rc) return rc;
-        }
-        if (IS_MDT(&mop->mo_ldd)) {
+        if (IS_MDT(&mop->mo_ldd)) 
                 rc = load_module("mds");
-                if (rc) return rc;
-        }
         vprint("done\n");
         return rc;
 }
@@ -885,6 +886,7 @@ void set_defaults(struct mkfs_opts *mop)
                 mop->mo_ldd.ldd_mount_type = LDD_MT_LDISKFS;
         
         strcpy(mop->mo_ldd.ldd_fsname, "lustre");
+        mop->mo_stripe_count = 1;
         mop->mo_index = -1;
 
         gethostname(hostname, sizeof(hostname));
index b524a05..92a975c 100755 (executable)
@@ -41,20 +41,21 @@ depmod -a -e
 echo "Copying mount from local build dir to "$MDIR
 cp ../utils/mount.lustre /sbin/.
 
+MP="/sbin/modprobe"
+MPI="$MP --ignore-install"
+
 [ -e $MODFILE ] || touch $MODFILE
 if [ `grep -c lustre $MODFILE` -eq 0 ]; then
     echo Modifying $MODFILE
     echo "# Lustre modules added by $0" >> $MODFILE
     if [ $KVER -eq 24 ]; then
-       echo alias lustre null >> $MODFILE
-       echo above lustre llite osc mdc >> $MODFILE
-       echo above mds llite osc $FSFLT >> $MODFILE
-       echo alias oss ost >> $MODFILE
-       echo above ost llite obdfilter $FSFLT >> $MODFILE
-       echo above portals ksocknal >> $MODFILE
+       echo alias _lustre ksocknal portals $FSFLT >> $MODFILE
+       echo below mds _lustre osc >> $MODFILE
+       echo below oss _lustre ost >> $MODFILE
+       echo below ost _lustre >> $MODFILE
+       echo below llite _lustre osc mdc >> $MODFILE
+       echo alias lustre llite >> $MODFILE
     else
-       MP="/sbin/modprobe"
-       MPI="$MP --ignore-install"
        echo "install kptlrouter $MP portals && $MPI kptlrouter" >> $MODFILE
        echo "install _lustre $MP portals && $MP lvfs && $MP obdclass && $MP ptlrpc" >> $MODFILE
        echo "install obdfilter $MP _lustre && $MP ost && $MP ldiskfs && $MP $FSFLT && $MPI obdfilter" >> $MODFILE