]) # LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
#
+# Kernel version 4.12-rc3 f9727a17db9bab71ddae91f74f11a8a2f9a0ece6
+# renamed uuid_be to uuid_t
+#
+AC_DEFUN([LIBCFS_UUID_T], [
+LB_CHECK_COMPILE([if 'uuid_t' exist],
+uuid_t, [
+ #include <linux/uuid.h>
+],[
+ uuid_t uuid;
+
+ memset(uuid.b, 0, 16);
+],[
+ AC_DEFINE(HAVE_UUID_T, 1, ['uuid_t' exist])
+])
+]) # LIBCFS_UUID_T
+
+#
# LIBCFS_WAIT_QUEUE_ENTRY
#
# Kernel version 4.13 ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f
# 4.11
LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
LIBCFS_SCHED_HEADERS
+# 4.12
+LIBCFS_UUID_T
# 4.13
LIBCFS_WAIT_QUEUE_ENTRY
# 4.14
EXTRA_DIST = linux-misc.h linux-fs.h linux-mem.h linux-time.h linux-cpu.h \
- linux-list.h linux-hash.h linux-crypto.h
+ linux-list.h linux-hash.h linux-uuid.h linux-crypto.h
--- /dev/null
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2017, Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ */
+
+#ifndef __LIBCFS_LINUX_UUID_H__
+#define __LIBCFS_LINUX_UUID_H__
+
+#include <linux/uuid.h>
+
+#define UUID_SIZE 16
+
+/*
+ * The original linux UUID code had uuid_be and uuid_le.
+ * Later uuid_le was changed to guid_t and uuid_be
+ * to uuid_t. See for details kernel commit:
+ *
+ * f9727a17db9bab71ddae91f74f11a8a2f9a0ece6
+ */
+#ifndef HAVE_UUID_T
+typedef struct {
+ __u8 b[UUID_SIZE];
+} uuid_t;
+
+static inline void uuid_copy(uuid_t *dst, uuid_t *src)
+{
+ memcpy(dst, src, sizeof(uuid_t));
+}
+
+static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
+{
+ return memcmp(u1, u2, sizeof(uuid_t)) == 0;
+}
+
+#endif
+
+#endif /* __LIBCFS_LINUX_UUID_H__ */
#ifndef _LUSTRE_SCRUB_H
# define _LUSTRE_SCRUB_H
+#include <libcfs/linux/linux-uuid.h>
#include <dt_object.h>
#include <lustre_net.h>
int lustre_unregister_fs(void);
int lustre_check_exclusion(struct super_block *sb, char *svname);
-typedef __u8 class_uuid_t[16];
-static inline void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
-{
- snprintf(out->uuid, sizeof(out->uuid), "%02x%02x%02x%02x-%02x%02x-"
- "%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- uu[14], uu[15], uu[12], uu[13], uu[10], uu[11], uu[8], uu[9],
- uu[6], uu[7], uu[4], uu[5], uu[2], uu[3], uu[0], uu[1]);
-}
-
/* lustre_peer.c */
int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index);
int class_add_uuid(const char *uuid, __u64 nid);
/* class_obd.c */
extern char obd_jobid_name[];
-/* prng.c */
-#define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t))
-
/* statfs_pack.c */
struct kstatfs;
void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs);
#define DEBUG_SUBSYSTEM S_LLITE
#include <linux/module.h>
+#include <linux/random.h>
#include <linux/statfs.h>
#include <linux/time.h>
#include <linux/types.h>
+#include <libcfs/linux/linux-uuid.h>
#include <linux/version.h>
#include <linux/mm.h>
#include <linux/user_namespace.h>
unsigned long pages;
unsigned long lru_page_max;
struct sysinfo si;
- class_uuid_t uuid;
int i;
ENTRY;
sbi->ll_ra_info.ra_max_pages = sbi->ll_ra_info.ra_max_pages_per_file;
sbi->ll_ra_info.ra_max_read_ahead_whole_pages = -1;
- ll_generate_random_uuid(uuid);
- class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
- CDEBUG(D_CONFIG, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid);
-
sbi->ll_flags |= LL_SBI_VERBOSE;
#ifdef ENABLE_CHECKSUM
sbi->ll_flags |= LL_SBI_CHECKSUM;
char name[MAX_STRING_SIZE];
int md_len = 0;
int dt_len = 0;
+ uuid_t uuid;
char *ptr;
int len;
int err;
if (err)
GOTO(out_free_cfg, err);
- err = super_setup_bdi_name(sb, "lustre-%016lx", cfg_instance);
- if (err)
- GOTO(out_free_cfg, err);
-
#ifndef HAVE_DCACHE_LOCK
/* kernel >= 2.6.38 store dentry operations in sb->s_d_op. */
sb->s_d_op = &ll_d_ops;
#endif
+ /* UUID handling */
+ generate_random_uuid(uuid.b);
+ snprintf(sbi->ll_sb_uuid.uuid, UUID_SIZE, "%pU", uuid.b);
+
+ CDEBUG(D_CONFIG, "llite sb uuid: %s\n", sbi->ll_sb_uuid.uuid);
+
/* Get fsname */
len = strlen(profilenm);
ptr = strrchr(profilenm, '-');
sbi->ll_fsname[len] = '\0';
/* Mount info */
- snprintf(name, MAX_STRING_SIZE, "%.*s-%016lx", len,
+ snprintf(name, sizeof(name), "%.*s-%016lx", len,
profilenm, cfg_instance);
+ err = super_setup_bdi_name(sb, "%s", name);
+ if (err)
+ GOTO(out_free_cfg, err);
+
/* Call ll_debugfs_register_super() before lustre_process_log()
* so that "llite.*.*" params can be processed correctly.
*/
#include <obd.h>
#include <obd_class.h>
+#include <linux/random.h>
+#include <libcfs/linux/linux-uuid.h>
#include <linux/version.h>
#include <lustre_log.h>
#include <lustre_disk.h>
struct obd_device *obd;
struct obd_export *exp;
struct obd_uuid *uuid = NULL;
- class_uuid_t uuidc;
+ uuid_t uuidc;
lnet_nid_t nid;
char nidstr[LNET_NIDSTR_SIZE];
char *mgcname = NULL, *niduuid = NULL, *mgssec = NULL;
if (uuid == NULL)
GOTO(out_free, rc = -ENOMEM);
- ll_generate_random_uuid(uuidc);
- class_uuid_unparse(uuidc, uuid);
+ generate_random_uuid(uuidc.b);
+ snprintf(uuid->uuid, UUID_SIZE, "%pU", uuidc.b);
/* Start the MGC */
rc = lustre_start_simple(mgcname, LUSTRE_MGC_NAME,
"failed to allocate RAM for report\n",
osd_dev2name(dev));
} else {
- class_uuid_unparse(sf->sf_uuid, old_uuid);
- class_uuid_unparse(es->s_uuid, new_uuid);
+ snprintf(old_uuid->uuid, UUID_SIZE, "%pU",
+ sf->sf_uuid);
+ snprintf(new_uuid->uuid, UUID_SIZE, "%pU",
+ es->s_uuid);
CDEBUG(D_LFSCK, "%s: UUID has been changed "
"from %s to %s\n", osd_dev2name(dev),
old_uuid->uuid, new_uuid->uuid);
"failed to allocate RAM for report\n",
osd_name(dev));
} else {
- class_uuid_unparse(sf->sf_uuid, old_uuid);
- class_uuid_unparse(dev->od_uuid, new_uuid);
- CDEBUG(D_LFSCK, "%s: UUID has been changed "
- "from %s to %s\n", osd_name(dev),
+ snprintf(old_uuid->uuid, UUID_SIZE, "%pU", sf->sf_uuid);
+ snprintf(new_uuid->uuid, UUID_SIZE, "%pU", dev->od_uuid);
+ CDEBUG(D_LFSCK,
+ "%s: UUID has been changed from %s to %s\n",
+ osd_name(dev),
old_uuid->uuid, new_uuid->uuid);
}
scrub_file_reset(scrub, dev->od_uuid, SF_INCONSISTENT);
struct lwp_device {
struct lu_device lpd_dev;
struct obd_device *lpd_obd; /* corresponding OBD device */
- struct obd_uuid lpd_cluuid;/* UUID of LWP */
struct obd_export *lpd_exp; /* export of LWP */
struct ptlrpc_thread lpd_notify_thread; /* notify thread */
int lpd_connects; /* use count, 0 or 1 */
char *lwp_name = lwp->lpd_obd->obd_name;
char *server_uuid = NULL;
char *ptr;
- class_uuid_t uuid;
struct obd_import *imp;
int len = strlen(lwp_name) + 1;
int rc;
imp = lwp->lpd_obd->u.cli.cl_import;
rc = ptlrpc_init_import(imp);
- if (rc)
- GOTO(out, rc);
-
- ll_generate_random_uuid(uuid);
- class_uuid_unparse(uuid, &lwp->lpd_cluuid);
out:
if (bufs != NULL)
OBD_FREE_PTR(bufs);
{
struct obd_device *obd;
struct obd_import *imp;
- class_uuid_t uuid;
char *src, *tgt, *mdt, *osdname = NULL;
int rc;
long idx;
/*
* Initiate connect to OST
*/
- ll_generate_random_uuid(uuid);
- class_uuid_unparse(uuid, &osp->opd_cluuid);
-
imp = obd->u.cli.cl_import;
rc = ptlrpc_init_import(imp);
struct osp_rpc_lock opd_rpc_lock;
struct obd_device *opd_obd;
struct obd_export *opd_exp;
- struct obd_uuid opd_cluuid;
struct obd_connect_data *opd_connect_data;
int opd_connects;
/* connection status. */