Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Tue, 7 Feb 2006 22:49:05 +0000 (22:49 +0000)
committernathan <nathan>
Tue, 7 Feb 2006 22:49:05 +0000 (22:49 +0000)
b=8007
misc cleanups

lustre/include/linux/lustre_disk.h
lustre/include/lustre/lustre_user.h
lustre/llite/llite_lib.c
lustre/lov/lov_obd.c
lustre/mds/handler.c
lustre/mds/mds_fs.c
lustre/obdclass/obd_mount.c
lustre/obdfilter/filter.c
lustre/utils/mkfs_lustre.c
lustre/utils/mount_lustre.c

index e31b78a..3483b92 100644 (file)
@@ -72,8 +72,6 @@ static inline char *mt_str(enum ldd_mount_type mt)
 #define MTI_NIDS_MAX 64
 #endif
 
-#define LDD_SIZE 4096
-
 #define LDD_INCOMPAT_SUPP 0
 #define LDD_ROCOMPAT_SUPP 0
 
@@ -99,19 +97,20 @@ struct lustre_disk_data {
         /* COMPAT_146 */
         __u8       ldd_uuid[40];        /* server UUID */
         /* end COMPAT_146 */
-        char       ldd_mount_opts[2048]; /* target fs mount opts */
-        
-        /* Below here is required for writing mdt, ost,or client logs,
-           and is ignored after that. */
-        /* FIXME Everything should be removed from here and set via ioctls */
+/*1228*/        
+        /* These are required for writing mdt, ost,or client logs,
+           and are ignored after that. */
+        /* FIXME these should be removed from here and set via ioctls or proc */
         int   ldd_stripe_sz;
         int   ldd_stripe_count;
         int   ldd_stripe_pattern;
         int   ldd_stripe_offset;
         int   ldd_timeout;               /* obd timeout */
-        __u8  ldd_padding[LDD_SIZE - 3296];
+/*1248*/       
+        __u8       ldd_padding[4096 - 1248];
+        char       ldd_mount_opts[4096]; /* target fs mount opts */
 };
-        
+
 #define IS_MDT(data)   ((data)->ldd_flags & LDD_F_SV_TYPE_MDT)
 #define IS_OST(data)   ((data)->ldd_flags & LDD_F_SV_TYPE_OST)
 #define IS_MGS(data)  ((data)->ldd_flags & LDD_F_SV_TYPE_MGS)
index 119eb73..51fb866 100644 (file)
@@ -176,6 +176,11 @@ static inline void obd_str2uuid(struct obd_uuid *uuid, char *tmp)
         uuid->uuid[sizeof(*uuid) - 1] = '\0';
 }
 
+static inline char *obd_uuid2str(struct obd_uuid *uuid)
+{
+        return (char *)uuid->uuid;
+}
+
 #define LUSTRE_Q_QUOTAON  0x800002     /* turn quotas on */
 #define LUSTRE_Q_QUOTAOFF 0x800003     /* turn quotas off */
 #define LUSTRE_Q_GETINFO  0x800005     /* get information about quota files */
index 65f24f0..d422740 100644 (file)
@@ -531,6 +531,7 @@ int ll_set_opt(const char *opt, char *data, int fl)
                 RETURN(fl);
 }
 
+/* non-client-specific mount options are parsed in lmd_parse */
 void ll_options(char *options, int *flags)
 {
         int tmp;
index c348379..443b59e 100644 (file)
@@ -312,8 +312,8 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
         RETURN(0);
 }
 
-static int lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp,
-                       int index, int gen);
+static int lov_del_target(struct obd_device *obd, struct obd_uuid *uuidp,
+                          int index, int gen);
 
 static int lov_disconnect(struct obd_export *exp)
 {
@@ -339,7 +339,7 @@ static int lov_disconnect(struct obd_export *exp)
         for (i = 0, tgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, tgt++) {
                 if (tgt->ltd_exp) {
                         /* Disconnection is the last we know about an obd */
-                        lov_del_obd(obd, &tgt->uuid, i, tgt->ltd_gen);
+                        lov_del_target(obd, &tgt->uuid, i, tgt->ltd_gen);
                 }
         }
         lov_putref(obd);
@@ -458,8 +458,8 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
         RETURN(rc);
 }
 
-static int
-lov_add_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen)
+static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
+                          int index, int gen)
 {
         struct lov_obd *lov = &obd->u.lov;
         struct lov_tgt_desc *tgt;
@@ -506,8 +506,8 @@ lov_add_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen)
 
         tgt = &lov->tgts[index];
         if (!obd_uuid_empty(&tgt->uuid)) {
-                CERROR("OBD already assigned at LOV target index %d\n",
-                       index);
+                CERROR("UUID %.40s already assigned at LOV target index %d\n",
+                       obd_uuid2str(&tgt->uuid), index);
                 RETURN(-EEXIST);
         }
 
@@ -555,14 +555,14 @@ out:
         if (rc) {
                 CERROR("add failed (%d), deleting %s\n", rc, 
                        (char *)tgt->uuid.uuid);
-                lov_del_obd(obd, &tgt->uuid, index, 0);
+                lov_del_target(obd, &tgt->uuid, index, 0);
         }
         RETURN(rc);
 }
 
 /* Schedule a target for deletion */
-static int
-lov_del_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen)
+static int lov_del_target(struct obd_device *obd, struct obd_uuid *uuidp, 
+                          int index, int gen)
 {
         struct lov_obd *lov = &obd->u.lov;
         struct lov_tgt_desc *tgt;
@@ -780,7 +780,7 @@ static int lov_cleanup(struct obd_device *obd)
                                        " deathrow=%d, lovrc=%d\n",
                                        i, lov->death_row, 
                                        atomic_read(&lov->refcount));
-                                lov_del_obd(obd, &tgt->uuid, i, 0);
+                                lov_del_target(obd, &tgt->uuid, i, 0);
                         }
                 }
                 OBD_FREE(lov->tgts, lov->bufsize);
@@ -812,9 +812,9 @@ static int lov_process_config(struct obd_device *obd, obd_count len, void *buf)
                 if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", &gen) != 1)
                         GOTO(out, rc = -EINVAL);
                 if (cmd == LCFG_LOV_ADD_OBD)
-                        rc = lov_add_obd(obd, &obd_uuid, index, gen);
+                        rc = lov_add_target(obd, &obd_uuid, index, gen);
                 else
-                        rc = lov_del_obd(obd, &obd_uuid, index, gen);
+                        rc = lov_del_target(obd, &obd_uuid, index, gen);
                 GOTO(out, rc);
         }
         case LCFG_PARAM: {
index 34ee819..f42bb2f 100644 (file)
@@ -1715,7 +1715,7 @@ int mds_update_server_data(struct obd_device *obd, int force_sync)
         if (!(lsd->lsd_feature_incompat & cpu_to_le32(OBD_INCOMPAT_COMMON_LR))){
                 /* Swap to the old mds_server_data format, in case
                    someone wants to revert to a pre-1.6 lustre */
-                CDEBUG(D_WARNING, "writing old last_rcvd format\n");
+                CDEBUG(D_CONFIG, "writing old last_rcvd format\n");
                 /* malloc new struct instead of swap in-place because 
                    we don't have a lock on the last_trasno or mount count -
                    someone may modify it while we're here, and we don't want
index 4b358a8..ce2bc6e 100644 (file)
@@ -246,7 +246,8 @@ static int mds_init_server_data(struct obd_device *obd, struct file *file)
                 lsd->lsd_client_start = cpu_to_le32(LR_CLIENT_START);
                 lsd->lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE);
                 lsd->lsd_feature_rocompat = cpu_to_le32(OBD_ROCOMPAT_LOVOBJID);
-                lsd->lsd_feature_incompat = cpu_to_le32(MDT_INCOMPAT_SUPP);
+                lsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_MDT |
+                                                        OBD_INCOMPAT_COMMON_LR);
         } else {
                 rc = fsfilt_read_record(obd, file, lsd, sizeof(*lsd), &off);
                 if (rc) {
index ac0bcd5..cda8aa4 100644 (file)
@@ -1469,19 +1469,27 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
         while(*s1) {
                 while (*s1 == ' ' || *s1 == ',')
                         s1++;
-                /* FIXME do something with the RECOVER flag - see lconf */
-                if (strncmp(s1, "recov", 5) == 0)
+                /* Client options are parsed in ll_options: eg. flock, 
+                   user_xattr, acl */
+                
+                if (strncmp(s1, "recov", 5) == 0) 
+                        /* FIXME do something with the RECOVER flag - see lconf */
                         lmd->lmd_flags |= LMD_FLG_RECOVER;
-                if (strncmp(s1, "norecov", 7) == 0)
+                else if (strncmp(s1, "norecov", 7) == 0)
                         lmd->lmd_flags &= ~LMD_FLG_RECOVER;
-                if (strncmp(s1, "nosvc", 5) == 0)
+                else if (strncmp(s1, "nosvc", 5) == 0)
                         lmd->lmd_flags |= LMD_FLG_NOSVC;
-                /* Client options are parsed in ll_options: eg. flock, 
-                   user_xattr, acl */
+
+                else if (strncmp(s1, "exclude=", 8) == 0) {
+                        CERROR("Exclude: %s\n", s1);
+                        /* FIXME implement */
+                        /* store exlusion list in lmd_exclude, mdt & client
+                         must check */
+                }
 
                 /* Linux 2.4 doesn't pass the device, so we stuck it at the 
                    end of the options. */
-                if (strncmp(s1, "device=", 7) == 0) {
+                else if (strncmp(s1, "device=", 7) == 0) {
                         devname = s1 + 7;
                         /* terminate options right before device.  device
                            must be the last one. */
index cef34da..1743e65 100644 (file)
@@ -399,7 +399,7 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp)
                 fsd->lsd_client_size = cpu_to_le16(LR_CLIENT_SIZE);
                 fsd->lsd_subdir_count = cpu_to_le16(FILTER_SUBDIR_COUNT);
                 filter->fo_subdir_count = FILTER_SUBDIR_COUNT;
-                fsd->lsd_feature_incompat = cpu_to_le32(FILTER_INCOMPAT_SUPP);
+                fsd->lsd_feature_incompat = cpu_to_le32(OBD_INCOMPAT_OST);
         } else {
                 rc = fsfilt_read_record(obd, filp, fsd, sizeof(*fsd), &off);
                 if (rc) {
index dda6968..49ba5c8 100644 (file)
@@ -60,7 +60,6 @@ static int print_only = 0;
 void usage(FILE *out)
 {
         fprintf(out, "usage: %s <target types> [options] <device>\n", progname);
-
         fprintf(out, 
                 "\t<device>:block device or file (e.g /dev/sda or /tmp/ost1)\n"
                 "\ttarget types:\n"
@@ -71,10 +70,10 @@ void usage(FILE *out)
                 "\t\t--mgsnid=<nid>[,<...>] : NID(s) of a remote mgs node\n"
                 "\t\t\trequired for all targets other than the mgs node\n"
                 "\t\t--fsname=<filesystem_name> : default is 'lustre'\n"
-#if 0 /* FIXME implement 1.6.x */
+                /* FIXME implement 1.6.x
                 "\t\t--configdev=<altdevice|file>: store configuration info\n"
                 "\t\t\tfor this device on an alternate device\n"
-#endif
+                */
                 "\t\t--failover=<nid>[,<...>] : list of NIDs for the failover\n"
                 "\t\t\tpartners for this target\n" 
                 "\t\t--backfstype=<fstype> : backing fs type (ext3, ldiskfs)\n"
index 50dcc3c..7ffd3b1 100644 (file)
@@ -46,17 +46,23 @@ static char *progname = NULL;
 void usage(FILE *out)
 {
         fprintf(out, "%s v2.0\n", progname);
-        fprintf(out, "usage: %s <mgmtnid>[:<altmgtnid>...]:/<filesystem>[/<cfgname>] <mountpt> "
-                "[-fhnv] [-o mntopt]\n", progname);
-        fprintf(out, "\t<mdsnode>: nid of MDS (config) node\n"
+        fprintf(out, "usage: %s [-fhnv] [-o <mntopt>] <device> <mountpt>\n", 
+                progname);
+        fprintf(out, 
+                "\t<device>: the disk device, or for a client:\n"
+                "\t\t<mgmtnid>[:<altmgtnid>...]:/<filesystem>-client\n"
                 "\t<filesystem>: name of the Lustre filesystem (e.g. lustre1)\n"
-                "\t<cfgname>: name of client config (e.g. client)\n"
                 "\t<mountpt>: filesystem mountpoint (e.g. /mnt/lustre)\n"
                 "\t-f|--fake: fake mount (updates /etc/mtab)\n"
                 "\t--force: force mount even if already in /etc/mtab\n"
                 "\t-h|--help: print this usage message\n"
                 "\t-n|--nomtab: do not update /etc/mtab after mount\n"
-                "\t-v|--verbose: print verbose config settings\n");
+                "\t-v|--verbose: print verbose config settings\n"
+                "\t<mntopt>: one or more comma separated of:\n"
+                "\t\t(no)flock,(no)user_xattr,(no)acl\n"
+                "\t\tnosvc: only start MGC/MGS obds\n"
+                "\t\texclude=<ost1>[:<ost2>] : colon-separated list of inactive OSTs\n"
+                );
         exit((out != stdout) ? EINVAL : 0);
 }
 
@@ -119,7 +125,7 @@ update_mtab_entry(char *spec, char *mtpt, char *type, char *opts,
         return rc;
 }
 
-/* Get rid of symbolic hostnames for tcp */
+/* Get rid of symbolic hostnames for tcp, since kernel can't do lookups */
 #define MAXNIDSTR 1024
 static char *convert_hostnames(char *s1)
 {
@@ -170,8 +176,8 @@ struct opt_map {
         int mask;               /* flag mask value */
 };
 
-/* These flags are parsed by mount, not lustre */
 static const struct opt_map opt_map[] = {
+  /* These flags are parsed by mount, not lustre */
   { "defaults", 0, 0, 0         },      /* default options */
   { "rw",       1, 1, MS_RDONLY },      /* read-write */
   { "ro",       0, 0, MS_RDONLY },      /* read-only */
@@ -183,7 +189,7 @@ static const struct opt_map opt_map[] = {
   { "nodev",    0, 0, MS_NODEV  },      /* don't interpret devices */
   { "async",    0, 1, MS_SYNCHRONOUS},  /* asynchronous I/O */
   { "auto",     0, 0, 0         },      /* Can be mounted using -a */
-  { "noauto",   0, 0, 0         },      /* Can  only be mounted explicitly */
+  { "noauto",   0, 0, 0         },      /* Can only be mounted explicitly */
   { "nousers",  0, 1, 0         },      /* Forbid ordinary user to mount */
   { "nouser",   0, 1, 0         },      /* Forbid ordinary user to mount */
   { "noowner",  0, 1, 0         },      /* Device owner has no special privs */
@@ -196,10 +202,14 @@ static const struct opt_map opt_map[] = {
   { "acl",      0, 0, 0         },      /* Enable ACL support */
   { "noacl",    1, 1, 0         },      /* Disable ACL support */
   { "nosvc",    0, 0, 0         },      /* Only start MGS/MGC, no other services */
+  { "exclude",  0, 0, 0         },      /* OST exclusion list */
   { NULL,       0, 0, 0         }
 };
 /****************************************************************************/
 
+/* 1  = found, flag set
+   0  = found, no flag set
+   -1 = not found in above list */
 static int parse_one_option(const char *check, int *flagp)
 {
         const struct opt_map *opt;
@@ -207,7 +217,7 @@ static int parse_one_option(const char *check, int *flagp)
         for (opt = &opt_map[0]; opt->opt != NULL; opt++) {
                 if (strncmp(check, opt->opt, strlen(opt->opt)) == 0) {
                         if (!opt->mask) 
-                                return -1;
+                                return 0;
                         if (opt->inv)
                                 *flagp &= ~(opt->mask);
                         else
@@ -215,9 +225,9 @@ static int parse_one_option(const char *check, int *flagp)
                         return 1;
                 }
         }
-        fprintf(stderr, "%s: unknown option '%s', continuing\n", progname,
+        fprintf(stderr, "%s: ignoring unknown option '%s'\n", progname,
                 check);
-        return 0;
+        return -1;
 }
 
 int parse_options(char *orig_options, int *flagp)
@@ -231,12 +241,12 @@ int parse_options(char *orig_options, int *flagp)
                 if (!*opt) 
                         /* empty option */
                         continue;
-                if (parse_one_option(opt, flagp) > 0)
-                        continue;
-                /* no mount flags set, so pass this on as an option */
-                if (*options)
-                        strcat(options, ",");
-                strcat(options, opt);
+                if (parse_one_option(opt, flagp) == 0) {
+                        /* no mount flags set, so pass this on as an option */
+                        if (*options)
+                                strcat(options, ",");
+                        strcat(options, opt);
+                }
         }
         /* options will always be <= orig_options */
         strcpy(orig_options, options);