diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-01-10 08:41:53 -0500 |
---|---|---|
committer | Dave Kleikamp <dave.kleikamp@oracle.com> | 2019-01-10 11:28:56 -0500 |
commit | 2e3bc6125154c691e987e2554f2c99ec10f83b73 (patch) | |
tree | 07862dad0ce7c0e82d10d672de41aca46eae5fed | |
parent | 7ca5e8f089c2cbe79ee220b5acb4bc6cf4422818 (diff) |
fs/jfs: Switch to use new generic UUID API
There are new types and helpers that are supposed to be used in new code.
As a preparation to get rid of legacy types and API functions do
the conversion here.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
-rw-r--r-- | fs/jfs/jfs_incore.h | 6 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.c | 18 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.h | 10 | ||||
-rw-r--r-- | fs/jfs/jfs_mount.c | 4 | ||||
-rw-r--r-- | fs/jfs/jfs_superblock.h | 6 | ||||
-rw-r--r-- | fs/jfs/super.c | 8 |
6 files changed, 29 insertions, 23 deletions
diff --git a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h index 912a3af2393e..340eb8e4f716 100644 --- a/fs/jfs/jfs_incore.h +++ b/fs/jfs/jfs_incore.h | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/rwsem.h> | 23 | #include <linux/rwsem.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/bitops.h> | 25 | #include <linux/bitops.h> |
26 | #include <linux/uuid.h> | ||
27 | |||
26 | #include "jfs_types.h" | 28 | #include "jfs_types.h" |
27 | #include "jfs_xtree.h" | 29 | #include "jfs_xtree.h" |
28 | #include "jfs_dtree.h" | 30 | #include "jfs_dtree.h" |
@@ -178,8 +180,8 @@ struct jfs_sb_info { | |||
178 | pxd_t logpxd; /* pxd describing log */ | 180 | pxd_t logpxd; /* pxd describing log */ |
179 | pxd_t fsckpxd; /* pxd describing fsck wkspc */ | 181 | pxd_t fsckpxd; /* pxd describing fsck wkspc */ |
180 | pxd_t ait2; /* pxd describing AIT copy */ | 182 | pxd_t ait2; /* pxd describing AIT copy */ |
181 | char uuid[16]; /* 128-bit uuid for volume */ | 183 | uuid_t uuid; /* 128-bit uuid for volume */ |
182 | char loguuid[16]; /* 128-bit uuid for log */ | 184 | uuid_t loguuid; /* 128-bit uuid for log */ |
183 | /* | 185 | /* |
184 | * commit_state is used for synchronization of the jfs_commit | 186 | * commit_state is used for synchronization of the jfs_commit |
185 | * threads. It is protected by LAZY_LOCK(). | 187 | * threads. It is protected by LAZY_LOCK(). |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 6b68df395892..4c77b808020b 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -1092,8 +1092,7 @@ int lmLogOpen(struct super_block *sb) | |||
1092 | mutex_lock(&jfs_log_mutex); | 1092 | mutex_lock(&jfs_log_mutex); |
1093 | list_for_each_entry(log, &jfs_external_logs, journal_list) { | 1093 | list_for_each_entry(log, &jfs_external_logs, journal_list) { |
1094 | if (log->bdev->bd_dev == sbi->logdev) { | 1094 | if (log->bdev->bd_dev == sbi->logdev) { |
1095 | if (memcmp(log->uuid, sbi->loguuid, | 1095 | if (!uuid_equal(&log->uuid, &sbi->loguuid)) { |
1096 | sizeof(log->uuid))) { | ||
1097 | jfs_warn("wrong uuid on JFS journal"); | 1096 | jfs_warn("wrong uuid on JFS journal"); |
1098 | mutex_unlock(&jfs_log_mutex); | 1097 | mutex_unlock(&jfs_log_mutex); |
1099 | return -EINVAL; | 1098 | return -EINVAL; |
@@ -1130,7 +1129,7 @@ int lmLogOpen(struct super_block *sb) | |||
1130 | } | 1129 | } |
1131 | 1130 | ||
1132 | log->bdev = bdev; | 1131 | log->bdev = bdev; |
1133 | memcpy(log->uuid, sbi->loguuid, sizeof(log->uuid)); | 1132 | uuid_copy(&log->uuid, &sbi->loguuid); |
1134 | 1133 | ||
1135 | /* | 1134 | /* |
1136 | * initialize log: | 1135 | * initialize log: |
@@ -1336,7 +1335,7 @@ int lmLogInit(struct jfs_log * log) | |||
1336 | jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x", | 1335 | jfs_info("lmLogInit: inline log:0x%p base:0x%Lx size:0x%x", |
1337 | log, (unsigned long long)log->base, log->size); | 1336 | log, (unsigned long long)log->base, log->size); |
1338 | } else { | 1337 | } else { |
1339 | if (memcmp(logsuper->uuid, log->uuid, 16)) { | 1338 | if (!uuid_equal(&logsuper->uuid, &log->uuid)) { |
1340 | jfs_warn("wrong uuid on JFS log device"); | 1339 | jfs_warn("wrong uuid on JFS log device"); |
1341 | goto errout20; | 1340 | goto errout20; |
1342 | } | 1341 | } |
@@ -1732,7 +1731,7 @@ static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi, | |||
1732 | int i; | 1731 | int i; |
1733 | struct logsuper *logsuper; | 1732 | struct logsuper *logsuper; |
1734 | struct lbuf *bpsuper; | 1733 | struct lbuf *bpsuper; |
1735 | char *uuid = sbi->uuid; | 1734 | uuid_t *uuid = &sbi->uuid; |
1736 | 1735 | ||
1737 | /* | 1736 | /* |
1738 | * insert/remove file system device to log active file system list. | 1737 | * insert/remove file system device to log active file system list. |
@@ -1743,8 +1742,8 @@ static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi, | |||
1743 | logsuper = (struct logsuper *) bpsuper->l_ldata; | 1742 | logsuper = (struct logsuper *) bpsuper->l_ldata; |
1744 | if (activate) { | 1743 | if (activate) { |
1745 | for (i = 0; i < MAX_ACTIVE; i++) | 1744 | for (i = 0; i < MAX_ACTIVE; i++) |
1746 | if (!memcmp(logsuper->active[i].uuid, NULL_UUID, 16)) { | 1745 | if (uuid_is_null(&logsuper->active[i].uuid)) { |
1747 | memcpy(logsuper->active[i].uuid, uuid, 16); | 1746 | uuid_copy(&logsuper->active[i].uuid, uuid); |
1748 | sbi->aggregate = i; | 1747 | sbi->aggregate = i; |
1749 | break; | 1748 | break; |
1750 | } | 1749 | } |
@@ -1755,8 +1754,9 @@ static int lmLogFileSystem(struct jfs_log * log, struct jfs_sb_info *sbi, | |||
1755 | } | 1754 | } |
1756 | } else { | 1755 | } else { |
1757 | for (i = 0; i < MAX_ACTIVE; i++) | 1756 | for (i = 0; i < MAX_ACTIVE; i++) |
1758 | if (!memcmp(logsuper->active[i].uuid, uuid, 16)) { | 1757 | if (uuid_equal(&logsuper->active[i].uuid, uuid)) { |
1759 | memcpy(logsuper->active[i].uuid, NULL_UUID, 16); | 1758 | uuid_copy(&logsuper->active[i].uuid, |
1759 | &uuid_null); | ||
1760 | break; | 1760 | break; |
1761 | } | 1761 | } |
1762 | if (i == MAX_ACTIVE) { | 1762 | if (i == MAX_ACTIVE) { |
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h index e38c21598850..870fc22360e7 100644 --- a/fs/jfs/jfs_logmgr.h +++ b/fs/jfs/jfs_logmgr.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef _H_JFS_LOGMGR | 19 | #ifndef _H_JFS_LOGMGR |
20 | #define _H_JFS_LOGMGR | 20 | #define _H_JFS_LOGMGR |
21 | 21 | ||
22 | #include <linux/uuid.h> | ||
23 | |||
22 | #include "jfs_filsys.h" | 24 | #include "jfs_filsys.h" |
23 | #include "jfs_lock.h" | 25 | #include "jfs_lock.h" |
24 | 26 | ||
@@ -73,15 +75,13 @@ struct logsuper { | |||
73 | __le32 state; /* 4: state - see below */ | 75 | __le32 state; /* 4: state - see below */ |
74 | 76 | ||
75 | __le32 end; /* 4: addr of last log record set by logredo */ | 77 | __le32 end; /* 4: addr of last log record set by logredo */ |
76 | char uuid[16]; /* 16: 128-bit journal uuid */ | 78 | uuid_t uuid; /* 16: 128-bit journal uuid */ |
77 | char label[16]; /* 16: journal label */ | 79 | char label[16]; /* 16: journal label */ |
78 | struct { | 80 | struct { |
79 | char uuid[16]; | 81 | uuid_t uuid; |
80 | } active[MAX_ACTIVE]; /* 2048: active file systems list */ | 82 | } active[MAX_ACTIVE]; /* 2048: active file systems list */ |
81 | }; | 83 | }; |
82 | 84 | ||
83 | #define NULL_UUID "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | ||
84 | |||
85 | /* log flag: commit option (see jfs_filsys.h) */ | 85 | /* log flag: commit option (see jfs_filsys.h) */ |
86 | 86 | ||
87 | /* log state */ | 87 | /* log state */ |
@@ -410,7 +410,7 @@ struct jfs_log { | |||
410 | spinlock_t synclock; /* 4: synclist lock */ | 410 | spinlock_t synclock; /* 4: synclist lock */ |
411 | struct lbuf *wqueue; /* 4: log pageout queue */ | 411 | struct lbuf *wqueue; /* 4: log pageout queue */ |
412 | int count; /* 4: count */ | 412 | int count; /* 4: count */ |
413 | char uuid[16]; /* 16: 128-bit uuid of log device */ | 413 | uuid_t uuid; /* 16: 128-bit uuid of log device */ |
414 | 414 | ||
415 | int no_integrity; /* 3: flag to disable journaling to disk */ | 415 | int no_integrity; /* 3: flag to disable journaling to disk */ |
416 | }; | 416 | }; |
diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c index d8658607bf46..c9c1f16b93df 100644 --- a/fs/jfs/jfs_mount.c +++ b/fs/jfs/jfs_mount.c | |||
@@ -389,8 +389,8 @@ static int chkSuper(struct super_block *sb) | |||
389 | sbi->logpxd = j_sb->s_logpxd; | 389 | sbi->logpxd = j_sb->s_logpxd; |
390 | else { | 390 | else { |
391 | sbi->logdev = new_decode_dev(le32_to_cpu(j_sb->s_logdev)); | 391 | sbi->logdev = new_decode_dev(le32_to_cpu(j_sb->s_logdev)); |
392 | memcpy(sbi->uuid, j_sb->s_uuid, sizeof(sbi->uuid)); | 392 | uuid_copy(&sbi->uuid, &j_sb->s_uuid); |
393 | memcpy(sbi->loguuid, j_sb->s_loguuid, sizeof(sbi->uuid)); | 393 | uuid_copy(&sbi->loguuid, &j_sb->s_loguuid); |
394 | } | 394 | } |
395 | sbi->fsckpxd = j_sb->s_fsckpxd; | 395 | sbi->fsckpxd = j_sb->s_fsckpxd; |
396 | sbi->ait2 = j_sb->s_ait2; | 396 | sbi->ait2 = j_sb->s_ait2; |
diff --git a/fs/jfs/jfs_superblock.h b/fs/jfs/jfs_superblock.h index 302517421a8b..eb03de7fa925 100644 --- a/fs/jfs/jfs_superblock.h +++ b/fs/jfs/jfs_superblock.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #ifndef _H_JFS_SUPERBLOCK | 18 | #ifndef _H_JFS_SUPERBLOCK |
19 | #define _H_JFS_SUPERBLOCK | 19 | #define _H_JFS_SUPERBLOCK |
20 | 20 | ||
21 | #include <linux/uuid.h> | ||
22 | |||
21 | /* | 23 | /* |
22 | * make the magic number something a human could read | 24 | * make the magic number something a human could read |
23 | */ | 25 | */ |
@@ -98,9 +100,9 @@ struct jfs_superblock { | |||
98 | __le64 s_xsize; /* 8: extendfs s_size */ | 100 | __le64 s_xsize; /* 8: extendfs s_size */ |
99 | pxd_t s_xfsckpxd; /* 8: extendfs fsckpxd */ | 101 | pxd_t s_xfsckpxd; /* 8: extendfs fsckpxd */ |
100 | pxd_t s_xlogpxd; /* 8: extendfs logpxd */ | 102 | pxd_t s_xlogpxd; /* 8: extendfs logpxd */ |
101 | char s_uuid[16]; /* 16: 128-bit uuid for volume */ | 103 | uuid_t s_uuid; /* 16: 128-bit uuid for volume */ |
102 | char s_label[16]; /* 16: volume label */ | 104 | char s_label[16]; /* 16: volume label */ |
103 | char s_loguuid[16]; /* 16: 128-bit uuid for log device */ | 105 | uuid_t s_loguuid; /* 16: 128-bit uuid for log device */ |
104 | 106 | ||
105 | }; | 107 | }; |
106 | 108 | ||
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 65d8fc87ab11..c15ff56a8516 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -174,9 +174,11 @@ static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
174 | buf->f_files = maxinodes; | 174 | buf->f_files = maxinodes; |
175 | buf->f_ffree = maxinodes - (atomic_read(&imap->im_numinos) - | 175 | buf->f_ffree = maxinodes - (atomic_read(&imap->im_numinos) - |
176 | atomic_read(&imap->im_numfree)); | 176 | atomic_read(&imap->im_numfree)); |
177 | buf->f_fsid.val[0] = (u32)crc32_le(0, sbi->uuid, sizeof(sbi->uuid)/2); | 177 | buf->f_fsid.val[0] = crc32_le(0, (char *)&sbi->uuid, |
178 | buf->f_fsid.val[1] = (u32)crc32_le(0, sbi->uuid + sizeof(sbi->uuid)/2, | 178 | sizeof(sbi->uuid)/2); |
179 | sizeof(sbi->uuid)/2); | 179 | buf->f_fsid.val[1] = crc32_le(0, |
180 | (char *)&sbi->uuid + sizeof(sbi->uuid)/2, | ||
181 | sizeof(sbi->uuid)/2); | ||
180 | 182 | ||
181 | buf->f_namelen = JFS_NAME_MAX; | 183 | buf->f_namelen = JFS_NAME_MAX; |
182 | return 0; | 184 | return 0; |