diff options
| author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-01-27 10:40:18 -0500 |
|---|---|---|
| committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-01-27 16:57:20 -0500 |
| commit | e8221464fc2bc8c9f7b0c2115abbd75ba23f210a (patch) | |
| tree | e1d7f33b45d84df28a74e46a4f6796a92986c003 /include/linux/ceph | |
| parent | 22116525baec1d63f4878eaa92f0b57946a78819 (diff) | |
libceph: move ceph_file_layout helpers to ceph_fs.h
Move ceph_file_layout helper macros and inline functions to ceph_fs.h.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'include/linux/ceph')
| -rw-r--r-- | include/linux/ceph/ceph_fs.h | 23 | ||||
| -rw-r--r-- | include/linux/ceph/osdmap.h | 27 |
2 files changed, 23 insertions, 27 deletions
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index 0a37b989b52f..2623cffc73a1 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h | |||
| @@ -53,6 +53,29 @@ struct ceph_file_layout { | |||
| 53 | __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ | 53 | __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */ |
| 54 | } __attribute__ ((packed)); | 54 | } __attribute__ ((packed)); |
| 55 | 55 | ||
| 56 | #define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit)) | ||
| 57 | #define ceph_file_layout_stripe_count(l) \ | ||
| 58 | ((__s32)le32_to_cpu((l).fl_stripe_count)) | ||
| 59 | #define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size)) | ||
| 60 | #define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash)) | ||
| 61 | #define ceph_file_layout_object_su(l) \ | ||
| 62 | ((__s32)le32_to_cpu((l).fl_object_stripe_unit)) | ||
| 63 | #define ceph_file_layout_pg_pool(l) \ | ||
| 64 | ((__s32)le32_to_cpu((l).fl_pg_pool)) | ||
| 65 | |||
| 66 | static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l) | ||
| 67 | { | ||
| 68 | return le32_to_cpu(l->fl_stripe_unit) * | ||
| 69 | le32_to_cpu(l->fl_stripe_count); | ||
| 70 | } | ||
| 71 | |||
| 72 | /* "period" == bytes before i start on a new set of objects */ | ||
| 73 | static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l) | ||
| 74 | { | ||
| 75 | return le32_to_cpu(l->fl_object_size) * | ||
| 76 | le32_to_cpu(l->fl_stripe_count); | ||
| 77 | } | ||
| 78 | |||
| 56 | #define CEPH_MIN_STRIPE_UNIT 65536 | 79 | #define CEPH_MIN_STRIPE_UNIT 65536 |
| 57 | 80 | ||
| 58 | int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); | 81 | int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); |
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 256134af4ad4..f2679c384625 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h | |||
| @@ -72,33 +72,6 @@ struct ceph_osdmap { | |||
| 72 | struct crush_map *crush; | 72 | struct crush_map *crush; |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | /* | ||
| 76 | * file layout helpers | ||
| 77 | */ | ||
| 78 | #define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit)) | ||
| 79 | #define ceph_file_layout_stripe_count(l) \ | ||
| 80 | ((__s32)le32_to_cpu((l).fl_stripe_count)) | ||
| 81 | #define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size)) | ||
| 82 | #define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash)) | ||
| 83 | #define ceph_file_layout_object_su(l) \ | ||
| 84 | ((__s32)le32_to_cpu((l).fl_object_stripe_unit)) | ||
| 85 | #define ceph_file_layout_pg_pool(l) \ | ||
| 86 | ((__s32)le32_to_cpu((l).fl_pg_pool)) | ||
| 87 | |||
| 88 | static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l) | ||
| 89 | { | ||
| 90 | return le32_to_cpu(l->fl_stripe_unit) * | ||
| 91 | le32_to_cpu(l->fl_stripe_count); | ||
| 92 | } | ||
| 93 | |||
| 94 | /* "period" == bytes before i start on a new set of objects */ | ||
| 95 | static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l) | ||
| 96 | { | ||
| 97 | return le32_to_cpu(l->fl_object_size) * | ||
| 98 | le32_to_cpu(l->fl_stripe_count); | ||
| 99 | } | ||
| 100 | |||
| 101 | |||
| 102 | static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) | 75 | static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) |
| 103 | { | 76 | { |
| 104 | return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP); | 77 | return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP); |
