diff options
| author | Ilya Dryomov <idryomov@gmail.com> | 2016-04-28 10:07:23 -0400 |
|---|---|---|
| committer | Ilya Dryomov <idryomov@gmail.com> | 2016-05-25 18:36:26 -0400 |
| commit | 63244fa123a755e4bbaee03022b68613c71d1332 (patch) | |
| tree | 9e8e983a7ddcd9c03e67abb56a81f90ef24fe75d /include/linux/ceph | |
| parent | 04812acf572ef41fd51c11e0bf3385f34c0e1b5b (diff) | |
libceph: introduce ceph_osd_request_target, calc_target()
Introduce ceph_osd_request_target, containing all mapping-related
fields of ceph_osd_request and calc_target() for calculating mappings
and populating it.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'include/linux/ceph')
| -rw-r--r-- | include/linux/ceph/osd_client.h | 23 | ||||
| -rw-r--r-- | include/linux/ceph/osdmap.h | 34 | ||||
| -rw-r--r-- | include/linux/ceph/rados.h | 5 |
3 files changed, 62 insertions, 0 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index 63854a8df183..48806ee4488d 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
| @@ -24,6 +24,8 @@ typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *, | |||
| 24 | struct ceph_msg *); | 24 | struct ceph_msg *); |
| 25 | typedef void (*ceph_osdc_unsafe_callback_t)(struct ceph_osd_request *, bool); | 25 | typedef void (*ceph_osdc_unsafe_callback_t)(struct ceph_osd_request *, bool); |
| 26 | 26 | ||
| 27 | #define CEPH_HOMELESS_OSD -1 | ||
| 28 | |||
| 27 | /* a given osd we're communicating with */ | 29 | /* a given osd we're communicating with */ |
| 28 | struct ceph_osd { | 30 | struct ceph_osd { |
| 29 | atomic_t o_ref; | 31 | atomic_t o_ref; |
| @@ -118,6 +120,27 @@ struct ceph_osd_req_op { | |||
| 118 | }; | 120 | }; |
| 119 | }; | 121 | }; |
| 120 | 122 | ||
| 123 | struct ceph_osd_request_target { | ||
| 124 | struct ceph_object_id base_oid; | ||
| 125 | struct ceph_object_locator base_oloc; | ||
| 126 | struct ceph_object_id target_oid; | ||
| 127 | struct ceph_object_locator target_oloc; | ||
| 128 | |||
| 129 | struct ceph_pg pgid; | ||
| 130 | u32 pg_num; | ||
| 131 | u32 pg_num_mask; | ||
| 132 | struct ceph_osds acting; | ||
| 133 | struct ceph_osds up; | ||
| 134 | int size; | ||
| 135 | int min_size; | ||
| 136 | bool sort_bitwise; | ||
| 137 | |||
| 138 | unsigned int flags; /* CEPH_OSD_FLAG_* */ | ||
| 139 | bool paused; | ||
| 140 | |||
| 141 | int osd; | ||
| 142 | }; | ||
| 143 | |||
| 121 | /* an in-flight request */ | 144 | /* an in-flight request */ |
| 122 | struct ceph_osd_request { | 145 | struct ceph_osd_request { |
| 123 | u64 r_tid; /* unique for this client */ | 146 | u64 r_tid; /* unique for this client */ |
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 989294d0b8d2..420bb7968b25 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h | |||
| @@ -28,6 +28,7 @@ int ceph_pg_compare(const struct ceph_pg *lhs, const struct ceph_pg *rhs); | |||
| 28 | 28 | ||
| 29 | #define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id | 29 | #define CEPH_POOL_FLAG_HASHPSPOOL (1ULL << 0) /* hash pg seed and pool id |
| 30 | together */ | 30 | together */ |
| 31 | #define CEPH_POOL_FLAG_FULL (1ULL << 1) /* pool is full */ | ||
| 31 | 32 | ||
| 32 | struct ceph_pg_pool_info { | 33 | struct ceph_pg_pool_info { |
| 33 | struct rb_node node; | 34 | struct rb_node node; |
| @@ -62,6 +63,22 @@ struct ceph_object_locator { | |||
| 62 | s64 pool; | 63 | s64 pool; |
| 63 | }; | 64 | }; |
| 64 | 65 | ||
| 66 | static inline void ceph_oloc_init(struct ceph_object_locator *oloc) | ||
| 67 | { | ||
| 68 | oloc->pool = -1; | ||
| 69 | } | ||
| 70 | |||
| 71 | static inline bool ceph_oloc_empty(const struct ceph_object_locator *oloc) | ||
| 72 | { | ||
| 73 | return oloc->pool == -1; | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline void ceph_oloc_copy(struct ceph_object_locator *dest, | ||
| 77 | const struct ceph_object_locator *src) | ||
| 78 | { | ||
| 79 | dest->pool = src->pool; | ||
| 80 | } | ||
| 81 | |||
| 65 | /* | 82 | /* |
| 66 | * Maximum supported by kernel client object name length | 83 | * Maximum supported by kernel client object name length |
| 67 | * | 84 | * |
| @@ -227,6 +244,23 @@ static inline void ceph_osds_init(struct ceph_osds *set) | |||
| 227 | 244 | ||
| 228 | void ceph_osds_copy(struct ceph_osds *dest, const struct ceph_osds *src); | 245 | void ceph_osds_copy(struct ceph_osds *dest, const struct ceph_osds *src); |
| 229 | 246 | ||
| 247 | bool ceph_is_new_interval(const struct ceph_osds *old_acting, | ||
| 248 | const struct ceph_osds *new_acting, | ||
| 249 | const struct ceph_osds *old_up, | ||
| 250 | const struct ceph_osds *new_up, | ||
| 251 | int old_size, | ||
| 252 | int new_size, | ||
| 253 | int old_min_size, | ||
| 254 | int new_min_size, | ||
| 255 | u32 old_pg_num, | ||
| 256 | u32 new_pg_num, | ||
| 257 | bool old_sort_bitwise, | ||
| 258 | bool new_sort_bitwise, | ||
| 259 | const struct ceph_pg *pgid); | ||
| 260 | bool ceph_osds_changed(const struct ceph_osds *old_acting, | ||
| 261 | const struct ceph_osds *new_acting, | ||
| 262 | bool any_change); | ||
| 263 | |||
| 230 | /* calculate mapping of a file extent to an object */ | 264 | /* calculate mapping of a file extent to an object */ |
| 231 | extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, | 265 | extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, |
| 232 | u64 off, u64 len, | 266 | u64 off, u64 len, |
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h index 913c87c26d33..f28ed864e682 100644 --- a/include/linux/ceph/rados.h +++ b/include/linux/ceph/rados.h | |||
| @@ -153,6 +153,11 @@ extern const char *ceph_osd_state_name(int s); | |||
| 153 | #define CEPH_OSDMAP_NOIN (1<<8) /* block osd auto mark-in */ | 153 | #define CEPH_OSDMAP_NOIN (1<<8) /* block osd auto mark-in */ |
| 154 | #define CEPH_OSDMAP_NOBACKFILL (1<<9) /* block osd backfill */ | 154 | #define CEPH_OSDMAP_NOBACKFILL (1<<9) /* block osd backfill */ |
| 155 | #define CEPH_OSDMAP_NORECOVER (1<<10) /* block osd recovery and backfill */ | 155 | #define CEPH_OSDMAP_NORECOVER (1<<10) /* block osd recovery and backfill */ |
| 156 | #define CEPH_OSDMAP_NOSCRUB (1<<11) /* block periodic scrub */ | ||
| 157 | #define CEPH_OSDMAP_NODEEP_SCRUB (1<<12) /* block periodic deep-scrub */ | ||
| 158 | #define CEPH_OSDMAP_NOTIERAGENT (1<<13) /* disable tiering agent */ | ||
| 159 | #define CEPH_OSDMAP_NOREBALANCE (1<<14) /* block osd backfill unless pg is degraded */ | ||
| 160 | #define CEPH_OSDMAP_SORTBITWISE (1<<15) /* use bitwise hobject_t sort */ | ||
| 156 | 161 | ||
| 157 | /* | 162 | /* |
| 158 | * The error code to return when an OSD can't handle a write | 163 | * The error code to return when an OSD can't handle a write |
