From bcf4be0f95b0f2c4708eaeef2b701372325716b0 Mon Sep 17 00:00:00 2001 From: sageweil Date: Mon, 15 Oct 2007 22:00:28 +0000 Subject: [PATCH] more data types and moving bits around git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1943 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/config.cc | 8 +++++ trunk/ceph/include/ceph_fs.h | 61 ++++++++++++++++++------------------ trunk/ceph/kernel/super.h | 25 +++++++++++---- trunk/ceph/mds/MDLog.cc | 2 +- trunk/ceph/osd/OSDMap.h | 2 +- 5 files changed, 59 insertions(+), 39 deletions(-) diff --git a/trunk/ceph/config.cc b/trunk/ceph/config.cc index 185fea8b9ce00..f037fe728dfe4 100644 --- a/trunk/ceph/config.cc +++ b/trunk/ceph/config.cc @@ -45,6 +45,8 @@ struct ceph_file_layout g_OSD_FileLayout = { fl_stripe_unit: 1<<22, fl_stripe_count: 1, fl_object_size: 1<<22, + fl_object_stripe_unit: 0, + fl_pg_preferred: -1, fl_pg_type: CEPH_PG_TYPE_REP, fl_pg_size: 2 }; @@ -53,6 +55,8 @@ struct ceph_file_layout g_OSD_MDDirLayout = { fl_stripe_unit: 1<<22, fl_stripe_count: 1, fl_object_size: 1<<22, + fl_object_stripe_unit: 0, + fl_pg_preferred: -1, fl_pg_type: CEPH_PG_TYPE_REP, fl_pg_size: 2 }; @@ -61,6 +65,8 @@ struct ceph_file_layout g_OSD_MDLogLayout = { fl_stripe_unit: 1<<20, fl_stripe_count: 1, fl_object_size: 1<<20, + fl_object_stripe_unit: 0, + fl_pg_preferred: -1, fl_pg_type: CEPH_PG_TYPE_REP, fl_pg_size: 2 }; @@ -69,6 +75,8 @@ struct ceph_file_layout g_OSD_MDAnchorTableLayout = { fl_stripe_unit: 1<<20, fl_stripe_count: 1, fl_object_size: 1<<20, + fl_object_stripe_unit: 0, + fl_pg_preferred: -1, fl_pg_type: CEPH_PG_TYPE_REP, fl_pg_size: 2 }; diff --git a/trunk/ceph/include/ceph_fs.h b/trunk/ceph/include/ceph_fs.h index ffd170999233a..9b6217c5d4662 100644 --- a/trunk/ceph/include/ceph_fs.h +++ b/trunk/ceph/include/ceph_fs.h @@ -16,9 +16,9 @@ typedef __u64 ceph_ino_t; * object id */ struct ceph_object { - ceph_ino_t ino; /* inode "file" identifier */ - __u32 bno; /* "block" (object) in that "file" */ - __u32 rev; /* revision. normally ctime (as epoch). */ + ceph_ino_t ino; /* inode "file" identifier */ + __u32 bno; /* "block" (object) in that "file" */ + __u32 rev; /* revision. normally ctime (as epoch). */ }; typedef struct ceph_object ceph_object_t; @@ -45,19 +45,18 @@ typedef struct ceph_object ceph_object_t; * ceph_file_layout - describe data layout for a file/inode */ struct ceph_file_layout { - /* file -> object mapping */ - __u32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple of page size. */ - __u32 fl_stripe_count; /* over this many objects */ - __u32 fl_object_size; /* until objects are this big, then move to new objects */ - - /* object -> pg layout */ - __u8 fl_pg_type; /* pg type; see PG_TYPE_* */ - __u8 fl_pg_size; /* pg size (num replicas, raid stripe width, etc. */ - __u16 __pad; - __u32 fl_preferred; /* preferred primary for pg */ - - /* pg -> disk layout */ - __u32 fl_object_stripe_unit; /* for per-object raid */ + /* file -> object mapping */ + __u32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple of page size. */ + __u32 fl_stripe_count; /* over this many objects */ + __u32 fl_object_size; /* until objects are this big, then move to new objects */ + + /* pg -> disk layout */ + __u32 fl_object_stripe_unit; /* for per-object raid */ + + /* object -> pg layout */ + __u32 fl_pg_preferred; /* preferred primary for pg */ + __u8 fl_pg_type; /* pg type; see PG_TYPE_* */ + __u8 fl_pg_size; /* pg size (num replicas, raid stripe width, etc. */ }; #define ceph_file_layout_stripe_width(l) (l.fl_stripe_unit * l.fl_stripe_count) @@ -74,13 +73,13 @@ struct ceph_file_layout { #define CEPH_PG_TYPE_RAID4 2 union ceph_pg { - __u64 pg64; - struct { - __s32 preferred; /* preferred primary osd */ - __u16 ps; /* placement seed */ - __u8 type; - __u8 size; - } pg; + __u64 pg64; + struct { + __s32 preferred; /* preferred primary osd */ + __u16 ps; /* placement seed */ + __u8 type; + __u8 size; + } pg; }; typedef union ceph_pg ceph_pg_t; @@ -93,8 +92,8 @@ typedef union ceph_pg ceph_pg_t; * describe how a given object should be stored. */ struct ceph_object_layout { - ceph_pg_t ol_pgid; - __u32 ol_stripe_unit; + ceph_pg_t ol_pgid; + __u32 ol_stripe_unit; }; @@ -103,12 +102,12 @@ struct ceph_object_layout { * object extent */ struct ceph_object_extent { - ceph_object_t oe_oid; - __u64 oe_start; - __u64 oe_length; - struct ceph_object_layout oe_object_layout; - - /* buffer extent reverse mapping? */ + ceph_object_t oe_oid; + __u64 oe_start; + __u64 oe_length; + struct ceph_object_layout oe_object_layout; + + /* buffer extent reverse mapping? */ }; diff --git a/trunk/ceph/kernel/super.h b/trunk/ceph/kernel/super.h index f2d7417ef487a..4fb0aadd5fc74 100644 --- a/trunk/ceph/kernel/super.h +++ b/trunk/ceph/kernel/super.h @@ -9,20 +9,33 @@ #include "osd_client.h" - -/* - * CEPH file system in-core superblock info +/* + * CEPH per-filesystem client state + * + * possibly shared by multiple mount points, if they are + * mounting the same ceph filesystem/cluster. */ -struct ceph_sb_info { - __u64 s_fsid; - __u32 s_whoami; /* client number */ +struct ceph_fs_client { + __u64 s_fsid; /* hmm this should be part of the monmap? */ + + __u32 s_whoami; /* my client number */ struct ceph_kmsg *s_kmsg; /* messenger instance */ struct ceph_monmap *s_monmap; /* monitor map */ struct ceph_mds_client *s_mds_client; struct ceph_osd_client *s_osd_client; +}; + + +/* + * CEPH per-mount superblock info + */ +struct ceph_sb_info { + struct ceph_fs_client *sb_client; + /* FIXME: add my relative offset into the filesystem, + so we can appropriately mangle/adjust path names in requests, etc. */ }; /* diff --git a/trunk/ceph/mds/MDLog.cc b/trunk/ceph/mds/MDLog.cc index 5dd19ff5ee652..eeea99c721751 100644 --- a/trunk/ceph/mds/MDLog.cc +++ b/trunk/ceph/mds/MDLog.cc @@ -82,7 +82,7 @@ void MDLog::init_journaler() log_inode.layout = g_OSD_MDLogLayout; if (g_conf.mds_local_osd) - log_inode.layout.fl_preferred = mds->get_nodeid() + g_conf.mds_local_osd_offset; // hack + log_inode.layout.fl_pg_preferred = mds->get_nodeid() + g_conf.mds_local_osd_offset; // hack // log streamer if (journaler) delete journaler; diff --git a/trunk/ceph/osd/OSDMap.h b/trunk/ceph/osd/OSDMap.h index b644c42fe9cc9..fda57d73ef99e 100644 --- a/trunk/ceph/osd/OSDMap.h +++ b/trunk/ceph/osd/OSDMap.h @@ -316,7 +316,7 @@ private: // oid -> pg ObjectLayout file_to_object_layout(object_t oid, FileLayout& layout) { - return make_object_layout(oid, layout.fl_pg_type, layout.fl_pg_size, layout.fl_preferred, layout.fl_object_stripe_unit); + return make_object_layout(oid, layout.fl_pg_type, layout.fl_pg_size, layout.fl_pg_preferred, layout.fl_object_stripe_unit); } ObjectLayout make_object_layout(object_t oid, int pg_type, int pg_size, int preferred=-1, int object_stripe_unit = 0) { -- 2.39.5