lr_reader_SOURCES = lr_reader.c
mount_lustre_SOURCES = mount_lustre.c mount_utils.c mount_utils.h
+mount_lustre_SOURCES += mount_utils_ldiskfs.c
mount_lustre_LDADD := $(LIBPTLCTL)
mount_lustre_DEPENDENCIES := $(LIBPTLCTL)
/* device is last arg */
strscpy(mop.mo_device, argv[argc - 1], sizeof(mop.mo_device));
- /* Are we using a loop device? */
- ret = is_block(mop.mo_device);
- if (ret < 0) {
- ret = errno;
- goto out;
- }
- if (ret == 0)
- mop.mo_flags |= MO_IS_LOOP;
-
#ifdef TUNEFS
/* For tunefs, we must read in the old values before parsing any
new ones. */
#endif
/* These are the permanent mount options (always included) */
- switch (ldd->ldd_mount_type) {
- case LDD_MT_EXT3:
- case LDD_MT_LDISKFS:
- case LDD_MT_LDISKFS2:
- strscat(default_mountopts, ",errors=remount-ro",
- sizeof(default_mountopts));
- if (IS_MDT(ldd) || IS_MGS(ldd))
- strscat(always_mountopts, ",user_xattr",
- sizeof(always_mountopts));
- /* NB: Files created while extents are enabled can only be read
- * if mounted using the ext4 or ldiskfs filesystem type. */
- if (IS_OST(ldd) &&
- (ldd->ldd_mount_type == LDD_MT_LDISKFS ||
- ldd->ldd_mount_type == LDD_MT_LDISKFS2)) {
- strscat(default_mountopts, ",extents,mballoc",
- sizeof(default_mountopts));
- }
- break;
- default:
- fatal();
- fprintf(stderr, "unknown fs type %d '%s'\n",
- ldd->ldd_mount_type,
- MT_STR(ldd));
- ret = EINVAL;
- goto out;
- }
+ ret = osd_prepare_lustre(&mop,
+ default_mountopts, sizeof(default_mountopts),
+ always_mountopts, sizeof(always_mountopts));
+ if (ret) {
+ fatal();
+ fprintf(stderr, "unable to prepare backend (%d)\n", ret);
+ goto out;
+ }
if (mountopts) {
trim_mountfsoptions(mountopts);
return 0;
}
+int osd_prepare_lustre(struct mkfs_opts *mop,
+ char *default_mountopts, int default_len,
+ char *always_mountopts, int always_len)
+{
+ struct lustre_disk_data *ldd = &mop->mo_ldd;
+ int ret;
+
+ switch (ldd->ldd_mount_type) {
+ case LDD_MT_LDISKFS:
+ case LDD_MT_LDISKFS2:
+ ret = ldiskfs_prepare_lustre(mop,
+ default_mountopts, default_len,
+ always_mountopts, always_len);
+ break;
+ default:
+ fatal();
+ fprintf(stderr, "unknown fs type %d '%s'\n",
+ ldd->ldd_mount_type, MT_STR(ldd));
+ ret = EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
__u64 get_device_size(char* device)
{
int ret, fd;
int loop_setup(struct mkfs_opts *mop);
int loop_cleanup(struct mkfs_opts *mop);
+/* generic target support */
+int osd_prepare_lustre(struct mkfs_opts *mop,
+ char *default_mountopts, int default_len,
+ char *always_mountopts, int always_len);
+
+int ldiskfs_prepare_lustre(struct mkfs_opts *mop,
+ char *default_mountopts, int default_len,
+ char *always_mountopts, int always_len);
+
#endif
return ret;
}
+int ldiskfs_prepare_lustre(struct mkfs_opts *mop,
+ char *default_mountopts, int default_len,
+ char *always_mountopts, int always_len)
+{
+ struct lustre_disk_data *ldd = &mop->mo_ldd;
+ int ret;
+
+ /* Set MO_IS_LOOP to indicate a loopback device is needed */
+ ret = is_block(mop->mo_device);
+ if (ret < 0) {
+ return errno;
+ } else if (ret == 0) {
+ mop->mo_flags |= MO_IS_LOOP;
+ }
+
+ strscat(default_mountopts, ",errors=remount-ro", default_len);
+ if (IS_MDT(ldd) || IS_MGS(ldd))
+ strscat(always_mountopts, ",user_xattr", always_len);
+
+ return 0;
+}
+
/* return canonicalized absolute pathname, even if the target file does not
* exist, unlike realpath */
static char *absolute_path(char *devname)