#define MTI_NIDS_MAX 64
#endif
+#define LDD_SIZE 4096
+
#define LDD_INCOMPAT_SUPP 0
#define LDD_ROCOMPAT_SUPP 0
lnet_nid_t ldd_mgsnid[MTI_NIDS_MAX]; /* mgs nid list; lmd can
override */
lnet_nid_t ldd_failnid[MTI_NIDS_MAX]; /* server failover nids */
+ /* 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. */
- __u8 ldd_uuid[40]; /* server UUID */
+ /* FIXME Everything should be removed from here and set via ioctls */
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];
};
#define IS_MDT(data) ((data)->ldd_flags & LDD_F_SV_TYPE_MDT)
_device_ mount options) */
};
-#define LMD_FLG_MNTCNF 0x0001 /* Mountconf compat */
#define LMD_FLG_CLIENT 0x0002 /* Mounting a client only */
#define LMD_FLG_RECOVER 0x0004 /* Allow recovery */
#define LMD_FLG_NOSVC 0x0008 /* Only start MGS/MGC for servers,
no other services */
-/* 2nd half is for old clients */
-#define lmd_is_client(x) \
- (((x)->lmd_flags & LMD_FLG_CLIENT) || \
- (!((x)->lmd_flags & LMD_FLG_MNTCNF)))
+#define lmd_is_client(x) ((x)->lmd_flags & LMD_FLG_CLIENT)
/****************** mkfs command *********************/
#error "Can't have LR_CLIENT_START < LR_SERVER_SIZE"
#endif
/* This limit is arbitrary (32k clients on x86), but it is convenient to use
- * 2^n * PAGE_SIZE * 8 for the number of bits that fit an order-n allocation. */#define LR_MAX_CLIENTS (PAGE_SIZE * 8)
+ * 2^n * PAGE_SIZE * 8 for the number of bits that fit an order-n allocation. */
#define LR_MAX_CLIENTS (PAGE_SIZE * 8)
+/* COMPAT_146 */
#define OBD_COMPAT_OST 0x00000002 /* this is an OST (temporary) */
#define OBD_COMPAT_MDT 0x00000004 /* this is an MDT (temporary) */
-#define OBD_COMPAT_COMMON_LR 0x00000008 /* common last_rvcd format */
-
+/* end COMPAT_146 */
+
#define OBD_ROCOMPAT_LOVOBJID 0x00000001 /* MDS handles LOV_OBJID file */
#define OBD_ROCOMPAT_CROW 0x00000002 /* OST will CROW create objects */
#define OBD_INCOMPAT_GROUPS 0x00000001 /* OST handles group subdirs */
-#define OBD_INCOMPAT_OST 0x00000002 /* this is an OST (permanent) */
-#define OBD_INCOMPAT_MDT 0x00000004 /* this is an MDT (permanent) */
+#define OBD_INCOMPAT_OST 0x00000002 /* this is an OST */
+#define OBD_INCOMPAT_MDT 0x00000004 /* this is an MDT */
+#define OBD_INCOMPAT_COMMON_LR 0x00000008 /* common last_rvcd format */
/* Data stored per server at the head of the last_rcvd file. In le32 order.
/* Data stored per client in the last_rcvd file. In le32 order. */
struct lsd_client_data {
- __u8 lcd_uuid[40]; /* client UUID */
+ __u8 lcd_uuid[40]; /* client UUID */
__u64 lcd_last_transno; /* last completed transaction ID */
__u64 lcd_last_xid; /* xid for the last transaction */
__u32 lcd_last_result; /* result from last RPC */
__u64 lcd_last_close_xid; /* xid for the last transaction */
__u32 lcd_last_close_result; /* result from last RPC */
__u32 lcd_last_close_data; /* per-op data */
- __u8 lcd_padding[LR_CLIENT_SIZE - 88];
+ __u8 lcd_padding[LR_CLIENT_SIZE - 88];
};
-/*
-#define MDS_ROCOMPAT_LOVOBJID 0x00000001
-#define MDS_ROCOMPAT_SUPP (MDS_ROCOMPAT_LOVOBJID)
-#define MDS_INCOMPAT_SUPP (0)
-*/
#ifdef __KERNEL__
/****************** superblock additional info *********************/
__u32 cm_step; /* aka config version */
__u32 cm_flags;
__u32 cm_timestamp;
+ char cm_svname[16];
char cm_comment[40];
};
lsd->lsd_last_transno = cpu_to_le64(mds->mds_last_transno);
- if (!(lsd->lsd_feature_compat & cpu_to_le32(OBD_COMPAT_COMMON_LR))) {
+ 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_INFO, "writing old last_rcvd format\n");
+ CDEBUG(D_WARNING, "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
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_compat = cpu_to_le32(OBD_COMPAT_COMMON_LR);
+ lsd->lsd_feature_incompat = cpu_to_le32(MDT_INCOMPAT_SUPP);
} else {
rc = fsfilt_read_record(obd, file, lsd, sizeof(*lsd), &off);
if (rc) {
GOTO(err_msd, rc = -EINVAL);
}
- if (!(lsd->lsd_feature_compat & cpu_to_le32(OBD_COMPAT_COMMON_LR))) {
+ if (!(lsd->lsd_feature_incompat & cpu_to_le32(OBD_INCOMPAT_COMMON_LR))){
CDEBUG(D_WARNING, "using old last_rcvd format\n");
lsd->lsd_mount_count = lsd->lsd_last_transno;
lsd->lsd_last_transno = lsd->lsd_unused;
/* If we update the last_rcvd, we can never go back to
an old install, so leave this in the old format for now.
- lsd->lsd_feature_compat |= cpu_to_le32(LR_COMPAT_COMMON_LR);
+ lsd->lsd_feature_incompat |= cpu_to_le32(LR_INCOMPAT_COMMON_LR);
*/
}
#include <linux/lustre_disk.h>
#define MDT_ROCOMPAT_SUPP (OBD_ROCOMPAT_LOVOBJID)
-
-#define MDT_INCOMPAT_SUPP (OBD_INCOMPAT_MDT)
+#define MDT_INCOMPAT_SUPP (OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR)
/* Data stored per client in the last_rcvd file. In le32 order. */
struct mds_client_data {
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- */
-
-#ifndef MGC_INTERNAL_H
-#define MGC_INTERNAL_H
-
-
-#endif
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001-2005 Cluster File Systems, Inc.
- * Author LinSongTao <lincent@clusterfs.com>
- *
- * This file is part of Lustre, http://www.lustre.org
- *
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * Lustre 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * For testing and management it is treated as an obd_device,
- * although * it does not export a full OBD method table (the
- * requests are coming * in over the wire, so object target modules
- * do not have a full * method table.)
- */
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
-#define DEBUG_SUBSYSTEM S_MGC
-
-#ifdef __KERNEL__
-# include <linux/module.h>
-# include <linux/pagemap.h>
-# include <linux/miscdevice.h>
-# include <linux/init.h>
-#else
-# include <liblustre.h>
-#endif
-
-#include <linux/obd_class.h>
-#include <linux/lustre_dlm.h>
-#include <linux/lustre_log.h>
-#include <linux/lustre_fsfilt.h>
-#include <linux/lustre_disk.h>
-
-#include "mgc_internal.h"
-
- //REMOVE ME
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001-2005 Cluster File Systems, Inc.
- * Author LinSongTao <lincent@clusterfs.com>
- *
- * This file is part of Lustre, http://www.lustre.org
- *
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * Lustre 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 for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * For testing and management it is treated as an obd_device,
- * although * it does not export a full OBD method table (the
- * requests are coming * in over the wire, so object target modules
- * do not have a full * method table.)
- */
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
-#define DEBUG_SUBSYSTEM S_MGC
-
-#ifdef __KERNEL__
-# include <linux/module.h>
-# include <linux/pagemap.h>
-# include <linux/miscdevice.h>
-# include <linux/init.h>
-#else
-# include <liblustre.h>
-#endif
-
-#include <linux/obd_class.h>
-#include <linux/lustre_dlm.h>
-#include <linux/lustre_log.h>
-#include <linux/lustre_fsfilt.h>
-#include <linux/lustre_disk.h>
-
-#include "mgc_internal.h"
-
#include <linux/lustre_disk.h>
#include <linux/lustre_mgs.h>
-#include "mgc_internal.h"
-
int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id)
{
}
static int record_marker(struct obd_device *obd, struct llog_handle *llh,
- struct fs_db *db, __u32 flags, char *comment)
+ struct fs_db *db, __u32 flags,
+ char *svname, char *comment)
{
struct cfg_marker marker;
struct lustre_cfg_bufs bufs;
db->fd_gen++;
marker.cm_step = db->fd_gen;
marker.cm_flags = flags;
+ strncpy(marker.cm_svname, svname, sizeof(marker.cm_svname));
strncpy(marker.cm_comment, comment, sizeof(marker.cm_comment));
lustre_cfg_bufs_reset(&bufs, NULL);
lustre_cfg_bufs_set(&bufs, 1, &marker, sizeof(marker));
return rc;
}
+static inline int record_param(struct obd_device *obd, struct llog_handle *llh,
+ char *devname,
+ char *s1, char *s2, char *s3, char *s4)
+{
+ return record_base(obd,llh,devname,0,LCFG_PARAM,s1,s2,s3,s4);
+}
+
+
static int record_start_log(struct obd_device *obd,
struct llog_handle **llh, char *name)
{
/* This should always be the first entry in a log.
rc = mgs_clear_log(obd, logname); */
rc = record_start_log(obd, &llh, logname);
- rc = record_marker(obd, llh, db, CM_START, "lov setup");
+ rc = record_marker(obd, llh, db, CM_START, mti->mti_svname,"lov setup");
rc = record_attach(obd, llh, lovname, "lov", uuid);
rc = record_lov_setup(obd, llh, lovname, lovdesc);
- rc = record_marker(obd, llh, db, CM_END, "lov setup");
+ rc = record_marker(obd, llh, db, CM_END, mti->mti_svname, "lov setup");
rc = record_end_log(obd, &llh);
OBD_FREE(lovdesc, sizeof(*lovdesc));
{
struct llog_handle *llh = NULL;
char *cliname, *mdcname, *lovname, *nodeuuid, *mdcuuid;
+ char *s1, *s2, *s3, *s4, *s5;
lnet_nid_t nid;
int rc, i, first_log = 0;
ENTRY;
setup /dev/loop2 ldiskfs mdsA errors=remount-ro,user_xattr
*/
rc = record_start_log(obd, &llh, mti->mti_svname);
- rc = record_marker(obd, llh, db, CM_START, "add mdt");
+ rc = record_marker(obd, llh, db, CM_START, mti->mti_svname, "add mdt");
+
+ /* FIXME this should just be added via a MGS ioctl
+ OBD_IOC_LOV_SETSTRIPE / LL_IOC_LOV_SETSTRIPE */
+ if (!first_log) {
+ /* Fix lov settings if they were set by something other
+ than the MDT */
+ OBD_ALLOC(s1, 256);
+ if (s1) {
+ s2 = sprintf(s1, "default_stripe_size="LPU64,
+ mti->mti_stripe_size) + s1 + 1;
+ s3 = sprintf(s2, "default_stripe_count=%u",
+ mti->mti_stripe_count) + s2 + 1;
+ s4 = sprintf(s3, "default_stripe_offset="LPU64,
+ mti->mti_stripe_offset) + s3 + 1;
+ s5 = sprintf(s4, "default_stripe_pattern=%u",
+ mti->mti_stripe_pattern) + s4 + 1;
+ LASSERT(s5 - s1 < 256);
+ record_param(obd, llh, lovname, s1, s2, s3, s4);
+ }
+ }
+
rc = record_mount_opt(obd, llh, mti->mti_svname, lovname, 0);
rc = record_attach(obd, llh, mti->mti_svname, LUSTRE_MDS_NAME,
mti->mti_uuid);
- rc = record_setup(obd,llh,mti->mti_svname,
- "dev"/*ignored*/,"type"/*ignored*/,
+ rc = record_setup(obd, llh, mti->mti_svname,
+ "dev"/*ignored*/, "type"/*ignored*/,
mti->mti_svname, 0/*options*/);
- rc = record_marker(obd, llh, db, CM_END, "add mdt");
+ rc = record_marker(obd, llh, db, CM_END, mti->mti_svname, "add mdt");
rc = record_end_log(obd, &llh);
if (mti->mti_flags & LDD_F_UPGRADE14)
#14 L mount_option 0: 1:client 2:lov1 3:MDC_uml1_mdsA_MNT_client
*/
rc = record_start_log(obd, &llh, cliname);
- rc = record_marker(obd, llh, db, CM_START, "add mdc");
+ rc = record_marker(obd, llh, db, CM_START, mti->mti_svname, "add mdc");
+ if (!first_log && s1) {
+ /* Record new lov settings */
+ record_param(obd, llh, lovname, s1, s2, s3, s4);
+ OBD_FREE(s1, 256);
+ }
for (i = 0; i < mti->mti_nid_count; i++) {
CDEBUG(D_MGS, "add nid %s\n", libcfs_nid2str(mti->mti_nids[i]));
rc = record_add_uuid(obd, llh, mti->mti_nids[i], nodeuuid);
rc = record_add_conn(obd, llh, mdcname, libcfs_nid2str(nid));
}
rc = record_mount_opt(obd, llh, cliname, lovname, mdcname);
- rc = record_marker(obd, llh, db, CM_END, "add mdc");
+ rc = record_marker(obd, llh, db, CM_END, mti->mti_svname, "add mdc");
rc = record_end_log(obd, &llh);
name_destroy(mdcuuid);
#08 L lov_modify_tgts add 0:lov1 1:ost1_UUID 2(index):0 3(gen):1
*/
rc = record_start_log(obd, &llh, logname);
- rc = record_marker(obd, llh, db, CM_START, "add osc");
+ rc = record_marker(obd, llh, db, CM_START, mti->mti_svname, "add osc");
for (i = 0; i < mti->mti_nid_count; i++) {
CDEBUG(D_MGS, "add nid %s\n", libcfs_nid2str(mti->mti_nids[i]));
rc = record_add_uuid(obd, llh, mti->mti_nids[i], nodeuuid);
}
snprintf(index, sizeof(index), "%d", mti->mti_stripe_index);
rc = record_lov_add(obd, llh, lovname, mti->mti_uuid, index, "1");
- rc = record_marker(obd, llh, db, CM_END, "add osc");
+ rc = record_marker(obd, llh, db, CM_END, mti->mti_svname, "add osc");
rc = record_end_log(obd, &llh);
name_destroy(lovuuid);
setup /dev/loop2 ldiskfs f|n errors=remount-ro,user_xattr
*/
rc = record_start_log(obd, &llh, mti->mti_svname);
- rc = record_marker(obd, llh, db, CM_START, "add ost");
+ rc = record_marker(obd, llh, db, CM_START, mti->mti_svname, "add ost");
if (*mti->mti_uuid == 0)
snprintf(mti->mti_uuid, sizeof(mti->mti_uuid),
"%s_UUID", mti->mti_svname);
rc = record_setup(obd,llh,mti->mti_svname,
"dev"/*ignored*/,"type"/*ignored*/,
"f", 0/*options*/);
- rc = record_marker(obd, llh, db, CM_END, "add ost");
+ rc = record_marker(obd, llh, db, CM_END, mti->mti_svname, "add ost");
rc = record_end_log(obd, &llh);
if (mti->mti_flags & LDD_F_UPGRADE14)
/* Mark the client log so we know we updated (fd_gen == 1) */
rc = record_start_log(obd, &llh, cliname);
- rc = record_marker(obd, llh, db, CM_START, "upgrade from 1.4");
+ rc = record_marker(obd, llh, db, CM_START, "client",
+ "upgrade from 1.4");
/* FIXME find the old lovname and mdcname */
/* old: mount_option 0: 1:client 2:lov1 3:MDC_uml1_mdsA_MNT_client */
/* new: mount_option 0: 1:lustre-client 2:lustre-clilov 3:lustre-MDT0000-mdc */
- rc = record_mount_opt(obd, llh, cliname, "lov1", "MDC_uml1_mdsA_MNT_client");
- rc = record_marker(obd, llh, db, CM_END, "upgrade to 1.6");
+ rc = record_mount_opt(obd, llh, cliname, "lov1",
+ "MDC_uml1_mdsA_MNT_client");
+ rc = record_marker(obd, llh, db, CM_END, "client",
+ "upgrade to 1.6");
rc = record_end_log(obd, &llh);
name_destroy(cliname);
}
case LCFG_MARKER: {
struct cfg_marker *marker;
marker = lustre_cfg_buf(lcfg, 1);
- CDEBUG(D_IOCTL, "marker %d (%#x) %s\n", marker->cm_step,
- marker->cm_flags, marker->cm_comment);
+ CDEBUG(D_IOCTL, "marker %d (%#x) %.16s %s\n", marker->cm_step,
+ marker->cm_flags, marker->cm_svname, marker->cm_comment);
GOTO(out, err = 0);
}
}
rc = 0;
if (ldd->ldd_magic != LDD_MAGIC) {
+ /* FIXME add swabbing support */
CERROR("Bad magic in %s: %x!=%x\n", MOUNT_DATA_FILE,
ldd->ldd_magic, LDD_MAGIC);
GOTO(out_close, rc = -EINVAL);
lmd->lmd_magic = LMD_MAGIC;
/* default flags */
- lmd->lmd_flags |= LMD_FLG_MNTCNF | LMD_FLG_RECOVER;
+ lmd->lmd_flags |= LMD_FLG_RECOVER;
s1 = options;
while(*s1) {
}
s1 = devname;
- /* Get MGS nids if client mount */
+ /* Get MGS nids if client mount: uml1@tcp:uml2@tcp:/fsname-client */
while ((s2 = strchr(s1, ':'))) {
lnet_nid_t nid;
*s2 = 0;
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_compat = cpu_to_le32(OBD_COMPAT_COMMON_LR);
+ fsd->lsd_feature_incompat = cpu_to_le32(FILTER_INCOMPAT_SUPP);
} else {
rc = fsfilt_read_record(obd, filp, fsd, sizeof(*fsd), &off);
if (rc) {
#define FILTER_RECOVERY_TIMEOUT (obd_timeout * 5 * HZ / 2) /* *waves hands* */
-#define FILTER_INCOMPAT_SUPP (OBD_INCOMPAT_GROUPS)
+#define FILTER_INCOMPAT_SUPP (OBD_INCOMPAT_GROUPS | OBD_INCOMPAT_OST | \
+ OBD_INCOMPAT_COMMON_LR)
#define FILTER_GRANT_CHUNK (2ULL * PTLRPC_MAX_BRW_SIZE)
#define GRANT_FOR_LLOG(obd) 16
}
case(LCFG_MARKER):{
struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
- printf("marker %d (flags=%#x) '%s'", marker->cm_step,
- marker->cm_flags, marker->cm_comment);
+ printf("marker %d (flags=%#x) %.16s '%s'", marker->cm_step,
+ marker->cm_flags, marker->cm_svname, marker->cm_comment);
break;
}
default:
FILE *fp;
char debugfs_cmd[256];
unsigned int inode_num;
+ int i;
/* Construct debugfs command line. */
memset(debugfs_cmd, 0, sizeof(debugfs_cmd));
- sprintf(debugfs_cmd, "debugfs -c -R 'stat %s' %s 2>&1 | egrep Inode",
+ sprintf(debugfs_cmd,
+ "debugfs -c -R 'stat %s' %s 2>&1 | egrep '(Inode|unsupported)'",
file_name, dev_name);
fp = popen(debugfs_cmd, "r");
pclose(fp);
return 1;
}
-
+ i = fread(debugfs_cmd, 1, sizeof(debugfs_cmd), fp);
+ if (i) {
+ /* Filesystem has unsupported feature */
+ vprint("%.*s", i, debugfs_cmd);
+ /* in all likelihood, the "unsupported feature" is
+ 'extents', which older debugfs does not understand.
+ Use e2fsprogs-1.38-cfs1 or later, available from
+ ftp://ftp.lustre.org/pub/lustre/other/e2fsprogs/ */
+ return -1;
+ }
pclose(fp);
return 0;
}
/* Check whether the device has already been fomatted by mkfs.lustre */
static int is_lustre_target(struct mkfs_opts *mop)
{
+ int rc;
/* Check whether there exist MOUNT_DATA_FILE,
LAST_RCVD or CATLIST in the device. */
vprint("checking for existing Lustre data\n");
- if (file_in_dev(MOUNT_DATA_FILE, mop->mo_device)
- || file_in_dev(LAST_RCVD, mop->mo_device)
- || file_in_dev(CATLIST, mop->mo_device)) {
+ if ((rc = file_in_dev(MOUNT_DATA_FILE, mop->mo_device))
+ || (rc = file_in_dev(LAST_RCVD, mop->mo_device))
+ || (rc = file_in_dev(CATLIST, mop->mo_device))) {
vprint("found Lustre data\n");
- return 1;
+ /* in the -1 case, 'extents' means this really IS a lustre
+ target */
+ return rc;
}
return 0; /* The device is not a lustre target. */