* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <limits.h>
#include <ctype.h>
-#ifdef __linux__
-/* libcfs.h is not really needed here, but on SLES10/PPC, fs.h includes idr.h
- * which requires BITS_PER_LONG to be defined */
-#include <libcfs/libcfs.h>
-#ifndef BLKGETSIZE64
-#include <linux/fs.h> /* for BLKGETSIZE64 */
-#endif
-#include <linux/version.h>
-#endif
#include <lustre_disk.h>
#include <lustre_param.h>
#include <lnet/lnetctl.h>
/* device is last arg */
strscpy(mop.mo_device, argv[argc - 1], sizeof(mop.mo_device));
+ ret = osd_init();
+ if (ret)
+ return ret;
+
#ifdef TUNEFS
/* For tunefs, we must read in the old values before parsing any
new ones. */
ret = ENODEV;
goto out;
}
+ mop.mo_ldd.ldd_mount_type = mount_type;
ret = osd_read_ldd(mop.mo_device, &mop.mo_ldd);
if (ret) {
}
mop.mo_ldd.ldd_flags &= ~(LDD_F_WRITECONF | LDD_F_VIRGIN);
+ /* svname of the form lustre:OST1234 means never registered */
+ ret = strlen(mop.mo_ldd.ldd_svname);
+ if (mop.mo_ldd.ldd_svname[ret - 8] == ':') {
+ mop.mo_ldd.ldd_svname[ret - 8] = '-';
+ mop.mo_ldd.ldd_flags |= LDD_F_VIRGIN;
+ } else if (mop.mo_ldd.ldd_svname[ret - 8] == '=') {
+ mop.mo_ldd.ldd_svname[ret - 8] = '-';
+ mop.mo_ldd.ldd_flags |= LDD_F_WRITECONF;
+ }
+
if (strstr(mop.mo_ldd.ldd_params, PARAM_MGSNODE))
mop.mo_mgs_failnodes++;
print_ldd("Read previous values", &(mop.mo_ldd));
#endif
- ret = osd_init();
- if (ret)
- return ret;
-
ret = parse_opts(argc, argv, &mop, &mountopts);
if (ret)
goto out;
goto out;
}
- if (IS_OST(ldd) && (mop.mo_ldd.ldd_flags & LDD_F_NEED_INDEX))
+ if (mop.mo_ldd.ldd_flags & LDD_F_NEED_INDEX)
fprintf(stderr, "warning: %s: for Lustre 2.4 and later, the "
"target index must be specified with --index\n",
mop.mo_device);
+ /* If no index is supplied for MDT by default set index to zero */
+ if (IS_MDT(ldd) && (ldd->ldd_svindex == INDEX_UNASSIGNED)) {
+ mop.mo_ldd.ldd_flags &= ~LDD_F_NEED_INDEX;
+ mop.mo_ldd.ldd_svindex = 0;
+ }
+
#if 0
/*
* Comment out these 2 checks temporarily, since for multi-MDSes