]) # LIBCFS_CURRENT_TIME
#
+# Kernel version 4.12-rc3 85787090a21eb749d8b347eaf9ff1a455637473c
+# changed struct super_block s_uuid into a proper uuid_t
+#
+AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
+LB_CHECK_COMPILE([if 'struct super_block' s_uuid is uuid_t],
+super_block_s_uuid, [
+ #include <linux/fs.h>
+],[
+ struct super_block sb;
+
+ uuid_parse(NULL, &sb.s_uuid);
+],[
+ AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
+])
+]) # LC_SUPER_BLOCK_S_UUID
+
+#
# LC_SUPER_SETUP_BDI_NAME
#
# Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
# 4.12
LC_CURRENT_TIME
+ LC_SUPER_BLOCK_S_UUID
LC_SUPER_SETUP_BDI_NAME
LC_BI_STATUS
struct scrub_file {
/* 128-bit uuid for volume. */
- __u8 sf_uuid[16];
+ uuid_t sf_uuid;
/* See 'enum scrub_flags'. */
__u64 sf_flags;
char liru_name[0];
};
-void scrub_file_init(struct lustre_scrub *scrub, __u8 *uuid);
-void scrub_file_reset(struct lustre_scrub *scrub, __u8 *uuid, __u64 flags);
+void scrub_file_init(struct lustre_scrub *scrub, uuid_t uuid);
+void scrub_file_reset(struct lustre_scrub *scrub, uuid_t uuid, u64 flags);
int scrub_file_load(const struct lu_env *env, struct lustre_scrub *scrub);
int scrub_file_store(const struct lu_env *env, struct lustre_scrub *scrub);
int scrub_checkpoint(const struct lu_env *env, struct lustre_scrub *scrub);
static void scrub_file_to_cpu(struct scrub_file *des, struct scrub_file *src)
{
- memcpy(des->sf_uuid, src->sf_uuid, 16);
+ uuid_copy(&des->sf_uuid, &src->sf_uuid);
des->sf_flags = le64_to_cpu(src->sf_flags);
des->sf_magic = le32_to_cpu(src->sf_magic);
des->sf_status = le16_to_cpu(src->sf_status);
static void scrub_file_to_le(struct scrub_file *des, struct scrub_file *src)
{
- memcpy(des->sf_uuid, src->sf_uuid, 16);
+ uuid_copy(&des->sf_uuid, &src->sf_uuid);
des->sf_flags = cpu_to_le64(src->sf_flags);
des->sf_magic = cpu_to_le32(src->sf_magic);
des->sf_status = cpu_to_le16(src->sf_status);
memcpy(des->sf_oi_bitmap, src->sf_oi_bitmap, SCRUB_OI_BITMAP_SIZE);
}
-void scrub_file_init(struct lustre_scrub *scrub, __u8 *uuid)
+void scrub_file_init(struct lustre_scrub *scrub, uuid_t uuid)
{
struct scrub_file *sf = &scrub->os_file;
memset(sf, 0, sizeof(*sf));
- memcpy(sf->sf_uuid, uuid, 16);
+ uuid_copy(&sf->sf_uuid, &uuid);
sf->sf_magic = SCRUB_MAGIC_V1;
sf->sf_status = SS_INIT;
}
EXPORT_SYMBOL(scrub_file_init);
-void scrub_file_reset(struct lustre_scrub *scrub, __u8 *uuid, __u64 flags)
+void scrub_file_reset(struct lustre_scrub *scrub, uuid_t uuid, u64 flags)
{
struct scrub_file *sf = &scrub->os_file;
"%#llx, add flags = %#llx\n",
scrub->os_name, sf->sf_flags, flags);
- memcpy(sf->sf_uuid, uuid, 16);
+ uuid_copy(&sf->sf_uuid, &uuid);
sf->sf_status = SS_INIT;
sf->sf_flags |= flags;
sf->sf_flags &= ~SF_AUTO;
/* service name associated with the osd device */
char od_svname[MAX_OBD_NAME];
char od_mntdev[MAX_OBD_NAME];
+ uuid_t od_uuid;
/* quota slave instance for inode */
struct qsd_instance *od_quota_slave_md;
sf->sf_oi_count = osd_oi_count;
}
- scrub_file_reset(scrub, LDISKFS_SB(osd_sb(osd))->s_es->s_uuid,
- SF_RECREATED);
+ scrub_file_reset(scrub, osd->od_uuid, SF_RECREATED);
count = sf->sf_oi_count;
goto create;
}
* and restored after former upgrading from 1.8
* to 2.x. Fortunately, the osd_fid_lookup()can
* verify the inode to decrease the risk. */
- scrub_file_reset(scrub,
- LDISKFS_SB(osd_sb(osd))->s_es->s_uuid,
- SF_UPGRADE);
+ scrub_file_reset(scrub, osd->od_uuid, SF_UPGRADE);
GOTO(out, rc = 1);
} else if (rc != -ENOENT) {
CERROR("%s: can't open %s: rc = %d\n",
memset(sf->sf_oi_bitmap, 0, SCRUB_OI_BITMAP_SIZE);
for (i = 0; i < count; i++)
ldiskfs_set_bit(i, sf->sf_oi_bitmap);
- scrub_file_reset(scrub, LDISKFS_SB(osd_sb(osd))->s_es->s_uuid,
- SF_RECREATED);
+ scrub_file_reset(scrub, osd->od_uuid, SF_RECREATED);
} else {
count = sf->sf_oi_count = osd_oi_count;
}
}
if (flags & SS_RESET)
- scrub_file_reset(scrub,
- LDISKFS_SB(osd_sb(dev))->s_es->s_uuid, 0);
+ scrub_file_reset(scrub, dev->od_uuid, 0);
if (flags & SS_AUTO_FULL) {
scrub->os_full_speed = 1;
sf->sf_param &= ~SP_DRYRUN;
if (flags & SS_RESET) {
- scrub_file_reset(scrub, LDISKFS_SB(osd_sb(dev))->s_es->s_uuid,
- inconsistent ? SF_INCONSISTENT : 0);
+ scrub_file_reset(scrub, dev->od_uuid,
+ inconsistent ? SF_INCONSISTENT : 0);
sf->sf_status = SS_SCANNING;
}
RETURN(0);
if (!(sf->sf_flags & SF_INCONSISTENT)) {
- scrub_file_reset(scrub, LDISKFS_SB(osd_sb(dev))->s_es->s_uuid,
- SF_INCONSISTENT);
+ scrub_file_reset(scrub, dev->od_uuid, SF_INCONSISTENT);
rc = scrub_file_store(info->oti_env, scrub);
if (rc != 0)
RETURN(rc);
if (rc == -ENOENT) {
/* It is 1.8 MDT device. */
if (!(sf->sf_flags & SF_UPGRADE)) {
- scrub_file_reset(scrub,
- LDISKFS_SB(osd_sb(dev))->s_es->s_uuid,
- SF_UPGRADE);
+ scrub_file_reset(scrub, dev->od_uuid,
+ SF_UPGRADE);
sf->sf_internal_flags &= ~SIF_NO_HANDLE_OLD_FID;
rc = scrub_file_store(info->oti_env, scrub);
} else {
struct lvfs_run_ctxt *ctxt = &dev->od_scrub.os_ctxt;
struct scrub_file *sf = &scrub->os_file;
struct super_block *sb = osd_sb(dev);
- struct ldiskfs_super_block *es = LDISKFS_SB(sb)->s_es;
struct lvfs_run_ctxt saved;
struct file *filp;
struct inode *inode;
if (IS_ERR_OR_NULL(obj))
RETURN(obj ? PTR_ERR(obj) : -ENOENT);
+#ifndef HAVE_S_UUID_AS_UUID_T
+ memcpy(dev->od_uuid.b, sb->s_uuid, UUID_SIZE);
+#else
+ uuid_copy(&dev->od_uuid, &sb->s_uuid);
+#endif
scrub->os_obj = obj;
rc = scrub_file_load(env, scrub);
if (rc == -ENOENT || rc == -EFAULT) {
- scrub_file_init(scrub, es->s_uuid);
+ scrub_file_init(scrub, dev->od_uuid);
/* If the "/O" dir does not exist when mount (indicated by
* osd_device::od_maybe_new), neither for the "/OI_scrub",
* then it is quite probably that the device is a new one,
} else if (rc < 0) {
GOTO(cleanup_obj, rc);
} else {
- if (memcmp(sf->sf_uuid, es->s_uuid, 16) != 0) {
- struct obd_uuid *old_uuid;
- struct obd_uuid *new_uuid;
-
- OBD_ALLOC_PTR(old_uuid);
- OBD_ALLOC_PTR(new_uuid);
- if (old_uuid == NULL || new_uuid == NULL) {
- CERROR("%s: UUID has been changed, but"
- "failed to allocate RAM for report\n",
- osd_dev2name(dev));
- } else {
- 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);
- }
- scrub_file_reset(scrub, es->s_uuid, SF_INCONSISTENT);
+ if (!uuid_equal(&sf->sf_uuid, &dev->od_uuid)) {
+ CDEBUG(D_LFSCK,
+ "%s: UUID has been changed from %pU to %pU\n",
+ osd_dev2name(dev), &sf->sf_uuid, &dev->od_uuid);
+ scrub_file_reset(scrub, dev->od_uuid, SF_INCONSISTENT);
dirty = true;
restored = true;
- if (old_uuid != NULL)
- OBD_FREE_PTR(old_uuid);
- if (new_uuid != NULL)
- OBD_FREE_PTR(new_uuid);
} else if (sf->sf_status == SS_SCANNING) {
sf->sf_status = SS_CRASHED;
dirty = true;
enum lustre_index_backup_policy od_index_backup_policy;
char od_mntdev[128];
char od_svname[128];
- char od_uuid[16];
+ uuid_t od_uuid;
int od_connects;
int od_index;
bool dirty = false;
ENTRY;
- memcpy(dev->od_uuid,
+ memcpy(dev->od_uuid.b,
&dsl_dataset_phys(dev->od_os->os_dsl_dataset)->ds_guid,
sizeof(dsl_dataset_phys(dev->od_os->os_dsl_dataset)->ds_guid));
memset(&dev->od_scrub, 0, sizeof(struct lustre_scrub));
} else if (rc < 0) {
GOTO(cleanup_obj, rc);
} else {
- if (memcmp(sf->sf_uuid, dev->od_uuid, 16) != 0) {
- struct obd_uuid *old_uuid;
- struct obd_uuid *new_uuid;
-
- OBD_ALLOC_PTR(old_uuid);
- OBD_ALLOC_PTR(new_uuid);
- if (!old_uuid || !new_uuid) {
- CERROR("%s: UUID has been changed, but"
- "failed to allocate RAM for report\n",
- osd_name(dev));
- } else {
- 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);
- }
+ if (!uuid_equal(&sf->sf_uuid, &dev->od_uuid)) {
+ CDEBUG(D_LFSCK,
+ "%s: UUID has been changed from %pU to %pU\n",
+ osd_name(dev), &sf->sf_uuid, &dev->od_uuid);
scrub_file_reset(scrub, dev->od_uuid, SF_INCONSISTENT);
dirty = true;
- if (old_uuid)
- OBD_FREE_PTR(old_uuid);
- if (new_uuid)
- OBD_FREE_PTR(new_uuid);
} else if (sf->sf_status == SS_SCANNING) {
sf->sf_status = SS_CRASHED;
dirty = true;