lustreincludedir = /usr/include/linux/lustre
lustreinclude_HEADERS = \
- lustre_barrier_user.h \
lustre_cfg.h \
- lustre_disk.h \
lustre_fid.h \
lustre_fiemap.h \
lustre_idl.h \
lustre_ioctl.h \
lustre_kernelcomm.h \
- lustre_lfsck_user.h \
- lustre_log_user.h \
lustre_ostid.h \
lustre_param.h \
lustre_user.h \
lustre_ver.h
+if SERVER
+lustreinclude_HEADERS += \
+ lustre_barrier_user.h \
+ lustre_disk.h \
+ lustre_lfsck_user.h \
+ lustre_log_user.h
+endif
+
EXTRA_DIST = \
lustre_barrier_user.h \
lustre_cfg.h \
LDD_MT_LAST
};
-/* On-disk configuration file. In host-endian order. */
-struct lustre_disk_data {
- __u32 ldd_magic;
- __u32 ldd_feature_compat; /* compatible feature flags */
- __u32 ldd_feature_rocompat; /* read-only compatible feature flags */
- __u32 ldd_feature_incompat; /* incompatible feature flags */
-
- __u32 ldd_config_ver; /* config rewrite count - not used */
- __u32 ldd_flags; /* LDD_SV_TYPE */
- __u32 ldd_svindex; /* server index (0001), must match
- * svname
- */
- __u32 ldd_mount_type; /* target fs type LDD_MT_* */
- char ldd_fsname[64]; /* filesystem this server is part of,
- * MTI_NAME_MAXLEN
- */
- char ldd_svname[64]; /* this server's name (lustre-mdt0001)*/
- __u8 ldd_uuid[40]; /* server UUID (COMPAT_146) */
-
- char ldd_userdata[1024 - 200]; /* arbitrary user string '200' */
- __u8 ldd_padding[4096 - 1024]; /* 1024 */
- char ldd_mount_opts[4096]; /* target fs mount opts '4096' */
- char ldd_params[4096]; /* key=value pairs '8192' */
-};
-
/****************** last_rcvd file *********************/
#define LR_EXPIRE_INTERVALS 16 /**< number of intervals to track transno */
-#define ENOENT_VERSION 1 /** 'virtual' version of non-existent object */
-
#define LR_SERVER_SIZE 512
#define LR_CLIENT_START 8192
#define LR_CLIENT_SIZE 128
#define MDT_SERVICE_WATCHDOG_FACTOR (2)
#define MDT_COS_DEFAULT (0)
+#define ENOENT_VERSION 1 /** 'virtual' version of non-existent object */
+
struct mdt_object {
struct lu_object_header mot_header;
struct lu_object mot_obj;
noinst_LIBRARIES = liblustreapitmp.a
endif # UTILS
-lctl_SOURCES = lustre_lfsck.c portals.c debug.c obd.c lustre_cfg.c lctl.c obdctl.h lsnapshot.c
+lctl_SOURCES = portals.c debug.c obd.c lustre_cfg.c lctl.c obdctl.h
+if SERVER
+lctl_SOURCES += lustre_lfsck.c lsnapshot.c
+endif
lctl_LDADD := liblustreapi.a $(LIBCFS) $(LIBREADLINE) $(PTHREAD_LIBS)
lctl_DEPENDENCIES := $(LIBCFS) liblustreapi.a
"list pools and pools members\n"
"usage: pool_list <fsname>[.<poolname>] | <pathname>"},
+#ifdef HAVE_SERVER_SUPPORT
/* Barrier commands */
{"=== Barrier ==", NULL, 0, "barrier management"},
{"barrier_freeze", jt_barrier_freeze, 0,
"usage: snapshot_umount <-F | --fsname fsname> [-h | --help]\n"
" <-n | --name ssname>\n"
" [-r | --rsh remote_shell]"},
-
+#endif /* HAVE_SERVER_SUPPORT */
/* Nodemap commands */
{"=== Nodemap ===", NULL, 0, "nodemap management"},
{"nodemap_activate", jt_nodemap_activate, 0,
"get the version of an object on servers\n"
"usage: getobjversion <fid>\n"
" getobjversion -i <id> -g <group>"},
-
+#ifdef HAVE_SERVER_SUPPORT
/* LFSCK commands */
{"==== LFSCK ====", NULL, 0, "LFSCK"},
{"lfsck_start", jt_lfsck_start, 0, "start LFSCK\n"
"usage: lfsck_query [-M | --device MDT_device] [-h | --help]\n"
" [-t | --type lfsck_type[,lfsck_type...]]\n"
" [-w | --wait]"},
-
+#endif /* HAVE_SERVER_SUPPORT */
{"==== obsolete (DANGEROUS) ====", NULL, 0, "obsolete (DANGEROUS)"},
/* some test scripts still use these */
{"cfg_device", jt_obd_device, 0,
return rc;
}
+#ifdef HAVE_SERVER_SUPPORT
/* Add mgsnids from ldd params */
static int add_mgsnids(struct mount_opts *mop, char *options,
const char *params, size_t options_len)
return rc;
}
+#endif /* HAVE_SERVER_SUPPORT */
static void set_defaults(struct mount_opts *mop)
{
return 0;
}
+#ifdef HAVE_SERVER_SUPPORT
/* change label from <fsname>:<index> to
* <fsname>-<index> to indicate the device has
* been registered. only if the label is
}
}
}
+#endif /* HAVE_SERVER_SUPPORT */
int main(int argc, char *const argv[])
{
client = (strstr(mop.mo_usource, ":/") != NULL);
if (!client) {
+#ifdef HAVE_SERVER_SUPPORT
rc = osd_init();
if (rc)
goto out_options;
rc = parse_ldd(mop.mo_source, &mop, options, maxopt_len);
if (rc)
goto out_osd;
+#else
+ rc = -EINVAL;
+ goto out_options;
+#endif
}
/* In Linux 2.4, the target device doesn't get passed to any of our
printf("mounting device %s at %s, flags=%#x options=%s\n",
mop.mo_source, mop.mo_target, flags, options);
+#ifdef HAVE_SERVER_SUPPORT
if (!client && osd_tune_lustre(mop.mo_source, &mop)) {
if (verbose)
fprintf(stderr, "%s: unable to set tunables for %s"
" (may cause reduced IO performance)\n",
argv[0], mop.mo_source);
}
-
+#endif
#ifdef HAVE_GSS
if (mop.mo_skpath[0] != '\0') {
/* Treat shared key failures as fatal */
for (i = 0, rc = -EAGAIN; i <= mop.mo_retry && rc != 0; i++) {
rc = mount(mop.mo_source, mop.mo_target, "lustre",
flags, (void *)options);
- if (rc == 0) {
- if (!client)
- label_lustre(&mop);
- } else {
+ if (rc != 0) {
if (verbose) {
fprintf(stderr, "%s: mount %s at %s "
"failed: %s retries left: "
} else {
rc = errno;
}
+#ifdef HAVE_SERVER_SUPPORT
+ } else {
+ if (!client)
+ label_lustre(&mop);
+#endif
}
}
}
}
out_osd:
+#ifdef HAVE_SERVER_SUPPORT
if (!client)
osd_fini();
-
+#endif
out_options:
free(options);
#define vprint(fmt, arg...) if (verbose > 0) printf(fmt, ##arg)
#define verrprint(fmt, arg...) if (verbose >= 0) fprintf(stderr, fmt, ##arg)
+#ifdef HAVE_SERVER_SUPPORT
static struct module_backfs_ops *backfs_ops[LDD_MT_LAST];
+#endif
void fatal(void)
{
return rc;
}
+#ifdef HAVE_SERVER_SUPPORT
int add_param(char *buf, char *key, char *val)
{
int end = sizeof(((struct lustre_disk_data *)0)->ldd_params);
return add_param(buf, key, str);
}
+#endif
char *strscat(char *dst, char *src, int buflen)
{
*p-- = '\0';
}
+#ifdef HAVE_SERVER_SUPPORT
/* Setup a file in the first unused loop_device */
int loop_setup(struct mkfs_opts *mop)
{
/* return value in KB */
return size >> 10;
}
+#endif
int file_create(char *path, __u64 size)
{
return 0;
}
-
+#ifdef HAVE_SERVER_SUPPORT
struct lustre_cfg_entry {
struct list_head lce_list;
char lce_name[0];
return ret;
}
+#endif /* HAVE_SERVER_SUPPORT */
#ifdef HAVE_GSS
#ifdef HAVE_OPENSSL_SSK
#include <sys/stat.h>
#include <libcfs/util/list.h>
-#include <linux/lustre/lustre_disk.h>
#include <linux/lustre/lustre_param.h>
+#ifdef HAVE_SERVER_SUPPORT
+#include <linux/lustre/lustre_disk.h>
+#endif
extern char *progname;
extern int verbose;
/* Maximum length of on-disk parameters in the form key=<value> */
#define PARAM_MAX 4096
+#ifdef HAVE_SERVER_SUPPORT
+/* On-disk configuration file. In host-endian order. */
+struct lustre_disk_data {
+ __u32 ldd_magic;
+ __u32 ldd_feature_compat; /* compatible feature flags */
+ __u32 ldd_feature_rocompat; /* read-only compatible feature flags */
+ __u32 ldd_feature_incompat; /* incompatible feature flags */
+
+ __u32 ldd_config_ver; /* config rewrite count - not used */
+ __u32 ldd_flags; /* LDD_SV_TYPE */
+ __u32 ldd_svindex; /* server index (0001), must match
+ * svname
+ */
+ __u32 ldd_mount_type; /* target fs type LDD_MT_* */
+ char ldd_fsname[64]; /* filesystem this server is part of,
+ * MTI_NAME_MAXLEN
+ */
+ char ldd_svname[64]; /* this server's name (lustre-mdt0001)*/
+ __u8 ldd_uuid[40]; /* server UUID (COMPAT_146) */
+
+ char ldd_userdata[1024 - 200]; /* arbitrary user string '200' */
+ __u8 ldd_padding[4096 - 1024]; /* 1024 */
+ char ldd_mount_opts[4096]; /* target fs mount opts '4096' */
+ char ldd_params[4096]; /* key=value pairs '8192' */
+};
+
/* used to describe the options to format the lustre disk, not persistent */
struct mkfs_opts {
struct lustre_disk_data mo_ldd; /* to be written in MOUNT_DATA_FILE */
int mo_flags;
int mo_mgs_failnodes;
};
+#endif
/* used to describe the options to mount the lustre disk */
struct mount_opts {
+#ifdef HAVE_SERVER_SUPPORT
struct lustre_disk_data mo_ldd;
+#endif
char *mo_orig_options;
char *mo_usource; /* user-specified mount device */
char *mo_source; /* our mount device name */
int mo_max_sectors_kb;
};
+#ifdef HAVE_SERVER_SUPPORT
int get_mountdata(char *, struct lustre_disk_data *);
static inline char *mt_str(enum ldd_mount_type mt)
};
return mount_type_string[mt];
}
+#endif /* HAVE_SERVER_SUPPORT */
#define MT_STR(data) mt_str((data)->ldd_mount_type)
int update_utab_entry(struct mount_opts *mop);
int check_mountfsoptions(char *mountopts, char *wanted_mountopts);
void trim_mountfsoptions(char *s);
+#ifdef HAVE_SERVER_SUPPORT
__u64 get_device_size(char* device);
int lustre_rename_fsname(struct mkfs_opts *mop, const char *mntpt,
const char *oldname);
struct module_backfs_ops *load_backfs_module(enum ldd_mount_type mount_type);
void unload_backfs_ops(struct module_backfs_ops *ops);
+#endif
+
#ifdef HAVE_OPENSSL_SSK
int load_shared_keys(struct mount_opts *mop);
#else
return rc;
}
+#ifdef HAVE_SERVER_SUPPORT
static const char *barrier_status2name(enum barrier_status status)
{
switch (status) {
return rc;
}
+#endif /* HAVE_SERVER_SUPPORT */
int jt_get_obj_version(int argc, char **argv)
{
#ifndef _OBDCTL_H_
#define _OBDCTL_H_
+#ifdef HAVE_SERVER_SUPPORT
#include <linux/lustre/lustre_barrier_user.h>
+#endif
/* ptlctl.a */
int ptl_initialize(int argc, char **argv);
int jt_lcfg_listparam(int argc, char **argv);
int jt_pool_cmd(int argc, char **argv);
+#ifdef HAVE_SERVER_SUPPORT
int jt_barrier_freeze(int argc, char **argv);
int jt_barrier_thaw(int argc, char **argv);
int __jt_barrier_stat(const char *fsname, struct barrier_ctl *bc);
int jt_snapshot_list(int argc, char **argv);
int jt_snapshot_mount(int argc, char **argv);
int jt_snapshot_umount(int argc, char **argv);
+#endif /* HAVE_SERVER_SUPPORT */
int jt_nodemap_activate(int argc, char **argv);
int jt_nodemap_add(int argc, char **argv);
int jt_nodemap_del(int argc, char **argv);
int jt_changelog_register(int argc, char **argv);
int jt_changelog_deregister(int argc, char **argv);
+#ifdef HAVE_SERVER_SUPPORT
/* lustre_lfsck.c */
int jt_lfsck_start(int argc, char **argv);
int jt_lfsck_stop(int argc, char **argv);
int jt_lfsck_query(int argc, char **argv);
+#endif /* HAVE_SERVER_SUPPORT */
#endif
#include <string.h>
#include <linux/lustre/lustre_idl.h>
+#ifdef HAVE_SERVER_SUPPORT
#include <linux/lustre/lustre_lfsck_user.h>
#include <linux/lustre/lustre_disk.h>
+#endif
#define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__);ret = 1;}
(long long)(int)offsetof(struct lfsck_request, lr_padding_3));
LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_3) == 8, "found %lld\n",
(long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_3));
+#ifdef HAVE_SERVER_SUPPORT
LASSERTF(LFSCK_TYPE_SCRUB == 0x00000000UL, "found 0x%.8xUL\n",
(unsigned)LFSCK_TYPE_SCRUB);
LASSERTF(LFSCK_TYPE_LAYOUT == 0x00000001UL, "found 0x%.8xUL\n",
(unsigned)LFSCK_TYPE_LAYOUT);
LASSERTF(LFSCK_TYPE_NAMESPACE == 0x00000004UL, "found 0x%.8xUL\n",
(unsigned)LFSCK_TYPE_NAMESPACE);
+#endif
LASSERTF(LE_LASTID_REBUILDING == 1, "found %lld\n",
(long long)LE_LASTID_REBUILDING);
LASSERTF(LE_LASTID_REBUILT == 2, "found %lld\n",