typedef __le64 ceph_tid_t; /* transaction id */
typedef __le32 ceph_epoch_t;
-
/*
* fs id
*/
void *p = msg->front.iov_base;
void *end = p + msg->front.iov_len;
struct ceph_mdsmap *newmap, *oldmap;
- struct ceph_fsid fsid;
+ ceph_fsid_t fsid;
int err = -EINVAL;
int from;
+ __le64 major, minor;
if (le32_to_cpu(msg->hdr.src.name.type) == CEPH_ENTITY_TYPE_MDS)
from = le32_to_cpu(msg->hdr.src.name.num);
from = -1;
ceph_decode_need(&p, end, sizeof(fsid)+2*sizeof(u32), bad);
- ceph_decode_64_le(&p, fsid.major);
- ceph_decode_64_le(&p, fsid.minor);
- if (!ceph_fsid_equal(&fsid, &mdsc->client->monc.monmap->fsid)) {
+ ceph_decode_64_le(&p, major);
+ __ceph_fsid_set_major(&fsid, major);
+ ceph_decode_64_le(&p, minor);
+ __ceph_fsid_set_minor(&fsid, minor);
+ if (ceph_fsid_compare(&fsid, &mdsc->client->monc.monmap->fsid)) {
derr(0, "got mdsmap with wrong fsid\n");
return;
}
{
struct ceph_monmap *m;
int i, err = -EINVAL;
+ __le64 major, minor;
dout(30, "monmap_decode %p %p len %d\n", p, end, (int)(end-p));
return ERR_PTR(-ENOMEM);
ceph_decode_need(&p, end, 2*sizeof(u32) + 2*sizeof(u64), bad);
- ceph_decode_64_le(&p, m->fsid.major);
- ceph_decode_64_le(&p, m->fsid.minor);
+ ceph_decode_64_le(&p, major);
+ __ceph_fsid_set_major(&m->fsid, major);
+ ceph_decode_64_le(&p, minor);
+ __ceph_fsid_set_minor(&m->fsid, minor);
ceph_decode_32(&p, m->epoch);
ceph_decode_32(&p, m->num_mon);
ceph_decode_need(&p, end, m->num_mon*sizeof(m->mon_inst[0]), bad);
* ceph_monmap_decode().
*/
struct ceph_monmap {
- struct ceph_fsid fsid;
+ ceph_fsid_t fsid;
u32 epoch;
u32 num_mon;
struct ceph_entity_inst mon_inst[0];
u32 epoch;
struct ceph_osdmap *newmap = NULL, *oldmap;
int err;
- struct ceph_fsid fsid;
+ ceph_fsid_t fsid;
+ __le64 major, minor;
dout(2, "handle_map have %u\n", osdc->osdmap ? osdc->osdmap->epoch : 0);
p = msg->front.iov_base;
/* verify fsid */
ceph_decode_need(&p, end, sizeof(fsid), bad);
- ceph_decode_64_le(&p, fsid.major);
- ceph_decode_64_le(&p, fsid.minor);
- if (!ceph_fsid_equal(&fsid, &osdc->client->monc.monmap->fsid)) {
+ ceph_decode_64_le(&p, major);
+ __ceph_fsid_set_major(&fsid, major);
+ ceph_decode_64_le(&p, minor);
+ __ceph_fsid_set_minor(&fsid, minor);
+ if (ceph_fsid_compare(&fsid, &osdc->client->monc.monmap->fsid)) {
derr(0, "got map with wrong fsid, ignoring\n");
return;
}
u32 len, max, i;
int err = -EINVAL;
void *start = *p;
+ __le64 major, minor;
dout(30, "osdmap_decode %p to %p len %d\n", *p, end, (int)(end - *p));
return ERR_PTR(-ENOMEM);
ceph_decode_need(p, end, 2*sizeof(u64)+11*sizeof(u32), bad);
- ceph_decode_64_le(p, map->fsid.major);
- ceph_decode_64_le(p, map->fsid.minor);
+ ceph_decode_64_le(p, major);
+ __ceph_fsid_set_major(&map->fsid, major);
+ ceph_decode_64_le(p, minor);
+ __ceph_fsid_set_minor(&map->fsid, minor);
ceph_decode_32(p, map->epoch);
ceph_decode_32_le(p, map->ctime.tv_sec);
ceph_decode_32_le(p, map->ctime.tv_nsec);
{
struct ceph_osdmap *newmap = map;
struct crush_map *newcrush = NULL;
- struct ceph_fsid fsid;
+ ceph_fsid_t fsid;
u32 epoch = 0;
struct ceph_timespec ctime;
u32 len, x;
__s32 new_flags, max;
void *start = *p;
int err = -EINVAL;
+ __le64 major, minor;
ceph_decode_need(p, end, sizeof(fsid)+sizeof(ctime)+2*sizeof(u32),
bad);
- ceph_decode_64_le(p, fsid.major);
- ceph_decode_64_le(p, fsid.minor);
+ ceph_decode_64_le(p, major);
+ __ceph_fsid_set_major(&fsid, major);
+ ceph_decode_64_le(p, minor);
+ __ceph_fsid_set_minor(&fsid, minor);
ceph_decode_32(p, epoch);
BUG_ON(epoch != map->epoch+1);
ceph_decode_32_le(p, ctime.tv_sec);
#define _FS_CEPH_OSDMAP_H
#include "types.h"
+#include "ceph_fs.h"
#include "crush/crush.h"
/*
* the change between two successive epochs, or as a fully encoded map.
*/
struct ceph_osdmap {
- struct ceph_fsid fsid;
+ ceph_fsid_t fsid;
u32 epoch;
u32 mkfs_epoch;
struct ceph_timespec ctime, mtime;
buf->f_frsize = PAGE_CACHE_SIZE;
/* leave in little-endian, regardless of host endianness */
- fsid = monmap->fsid.major ^ monmap->fsid.minor;
+ fsid = __ceph_fsid_major(&monmap->fsid) ^ __ceph_fsid_minor(&monmap->fsid);
buf->f_fsid.val[0] = le64_to_cpu(fsid) & 0xffffffff;
buf->f_fsid.val[1] = le64_to_cpu(fsid) >> 32;
seq_printf(m, ",debug=%d", ceph_debug);
if (args->flags & CEPH_MOUNT_FSID)
seq_printf(m, ",fsidmajor=%llu,fsidminor%llu",
- args->fsid.major, args->fsid.minor);
+ __ceph_fsid_major(&args->fsid), __ceph_fsid_minor(&args->fsid));
if (args->flags & CEPH_MOUNT_NOSHARE)
seq_puts(m, ",noshare");
if (args->flags & CEPH_MOUNT_UNSAFE_WRITEBACK)
client->msgr->inst.name = msg->hdr.dst.name;
sprintf(name, "client%d", client->whoami);
dout(1, "i am %s, fsid is %llx.%llx\n", name,
- le64_to_cpu(client->monc.monmap->fsid.major),
- le64_to_cpu(client->monc.monmap->fsid.minor));
+ le64_to_cpu(__ceph_fsid_major(&client->monc.monmap->fsid)),
+ le64_to_cpu(__ceph_fsid_minor(&client->monc.monmap->fsid)));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
client->client_kobj = kobject_create_and_add(name, ceph_kobj);
}
switch (token) {
case Opt_fsidmajor:
- args->fsid.major = cpu_to_le64(intval);
+ __ceph_fsid_set_major(&args->fsid, cpu_to_le64(intval));
break;
case Opt_fsidminor:
- args->fsid.minor = cpu_to_le64(intval);
+ __ceph_fsid_set_minor(&args->fsid, cpu_to_le64(intval));
break;
case Opt_port:
args->my_addr.ipaddr.sin_port = htons(intval);
/* either compare fsid, or specified mon_hostname */
if (args->flags & CEPH_MOUNT_FSID) {
- if (!ceph_fsid_equal(&args->fsid, &other->fsid)) {
+ if (ceph_fsid_compare(&args->fsid, &other->fsid)) {
dout(30, "fsid doesn't match\n");
return 0;
}
#include "mon_client.h"
#include "mds_client.h"
#include "osd_client.h"
+#include "ceph_fs.h"
/* f_type in struct statfs */
#define CEPH_SUPER_MAGIC 0x00c36400
int sb_flags;
int flags;
int mount_timeout;
- struct ceph_fsid fsid;
+ ceph_fsid_t fsid;
struct ceph_entity_addr my_addr;
int num_mon;
struct ceph_entity_addr mon_addr[MAX_MON_MOUNT_ADDR];
struct mutex mount_mutex; /* serialize mount attempts */
struct ceph_mount_args mount_args;
- struct ceph_fsid fsid;
+ ceph_fsid_t fsid;
struct super_block *sb;
/* super.c */
extern const char *ceph_msg_type_name(int type);
+static inline __le64 __ceph_fsid_minor(ceph_fsid_t *fsid)
+{
+ return *(__le64 *)&fsid->fsid[8];
+}
+
+static inline __le64 __ceph_fsid_major(ceph_fsid_t *fsid)
+{
+ return *(__le64 *)&fsid->fsid[0];
+}
+
+static inline void __ceph_fsid_set_minor(ceph_fsid_t *fsid, __le64 val)
+{
+ *(__le64 *)&fsid->fsid[8] = val;
+}
+
+static inline void __ceph_fsid_set_major(ceph_fsid_t *fsid, __le64 val)
+{
+ *(__le64 *)&fsid->fsid[0] = val;
+}
+
/* inode.c */
extern const struct inode_operations ceph_file_iops;
extern struct kmem_cache *ceph_inode_cachep;