diff options
| author | Yan, Zheng <zyan@redhat.com> | 2016-02-03 08:24:49 -0500 |
|---|---|---|
| committer | Ilya Dryomov <idryomov@gmail.com> | 2016-07-27 20:55:36 -0400 |
| commit | 7627151ea30bce2051e3cb27d7bb2c30083f86a5 (patch) | |
| tree | 8a4c9422b30c3e50eb76923c746747f4e09d0bb5 /include/linux | |
| parent | 22748f9d617b8cd0a915c3a4c656c7232645b3b5 (diff) | |
libceph: define new ceph_file_layout structure
Define new ceph_file_layout structure and rename old ceph_file_layout
to ceph_file_layout_legacy. This is preparation for adding namespace
to ceph_file_layout structure.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ceph/ceph_fs.h | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index dfce616002ad..e5a5fb9ca3f5 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h | |||
| @@ -34,9 +34,9 @@ | |||
| 34 | #define CEPH_MAX_MON 31 | 34 | #define CEPH_MAX_MON 31 |
| 35 | 35 | ||
| 36 | /* | 36 | /* |
| 37 | * ceph_file_layout - describe data layout for a file/inode | 37 | * legacy ceph_file_layoute |
| 38 | */ | 38 | */ |
| 39 | struct ceph_file_layout { | 39 | struct ceph_file_layout_legacy { |
| 40 | /* file -> object mapping */ | 40 | /* file -> object mapping */ |
| 41 | __le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple | 41 | __le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple |
| 42 | of page size. */ | 42 | of page size. */ |
| @@ -53,33 +53,25 @@ 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)) | 56 | /* |
| 57 | #define ceph_file_layout_stripe_count(l) \ | 57 | * ceph_file_layout - describe data layout for a file/inode |
| 58 | ((__s32)le32_to_cpu((l).fl_stripe_count)) | 58 | */ |
| 59 | #define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size)) | 59 | struct ceph_file_layout { |
| 60 | #define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash)) | 60 | /* file -> object mapping */ |
| 61 | #define ceph_file_layout_object_su(l) \ | 61 | u32 stripe_unit; /* stripe unit, in bytes */ |
| 62 | ((__s32)le32_to_cpu((l).fl_object_stripe_unit)) | 62 | u32 stripe_count; /* over this many objects */ |
| 63 | #define ceph_file_layout_pg_pool(l) \ | 63 | u32 object_size; /* until objects are this big */ |
| 64 | ((__s32)le32_to_cpu((l).fl_pg_pool)) | 64 | s64 pool_id; /* rados pool id */ |
| 65 | 65 | }; | |
| 66 | static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l) | 66 | |
| 67 | { | 67 | extern int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); |
| 68 | return le32_to_cpu(l->fl_stripe_unit) * | 68 | extern void ceph_file_layout_from_legacy(struct ceph_file_layout *fl, |
| 69 | le32_to_cpu(l->fl_stripe_count); | 69 | struct ceph_file_layout_legacy *legacy); |
| 70 | } | 70 | extern void ceph_file_layout_to_legacy(struct ceph_file_layout *fl, |
| 71 | 71 | struct ceph_file_layout_legacy *legacy); | |
| 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 | 72 | ||
| 79 | #define CEPH_MIN_STRIPE_UNIT 65536 | 73 | #define CEPH_MIN_STRIPE_UNIT 65536 |
| 80 | 74 | ||
| 81 | int ceph_file_layout_is_valid(const struct ceph_file_layout *layout); | ||
| 82 | |||
| 83 | struct ceph_dir_layout { | 75 | struct ceph_dir_layout { |
| 84 | __u8 dl_dir_hash; /* see ceph_hash.h for ids */ | 76 | __u8 dl_dir_hash; /* see ceph_hash.h for ids */ |
| 85 | __u8 dl_unused1; | 77 | __u8 dl_unused1; |
| @@ -399,7 +391,7 @@ union ceph_mds_request_args { | |||
| 399 | __le32 flags; | 391 | __le32 flags; |
| 400 | } __attribute__ ((packed)) setxattr; | 392 | } __attribute__ ((packed)) setxattr; |
| 401 | struct { | 393 | struct { |
| 402 | struct ceph_file_layout layout; | 394 | struct ceph_file_layout_legacy layout; |
| 403 | } __attribute__ ((packed)) setlayout; | 395 | } __attribute__ ((packed)) setlayout; |
| 404 | struct { | 396 | struct { |
| 405 | __u8 rule; /* currently fcntl or flock */ | 397 | __u8 rule; /* currently fcntl or flock */ |
| @@ -478,7 +470,7 @@ struct ceph_mds_reply_inode { | |||
| 478 | __le64 version; /* inode version */ | 470 | __le64 version; /* inode version */ |
| 479 | __le64 xattr_version; /* version for xattr blob */ | 471 | __le64 xattr_version; /* version for xattr blob */ |
| 480 | struct ceph_mds_reply_cap cap; /* caps issued for this inode */ | 472 | struct ceph_mds_reply_cap cap; /* caps issued for this inode */ |
| 481 | struct ceph_file_layout layout; | 473 | struct ceph_file_layout_legacy layout; |
| 482 | struct ceph_timespec ctime, mtime, atime; | 474 | struct ceph_timespec ctime, mtime, atime; |
| 483 | __le32 time_warp_seq; | 475 | __le32 time_warp_seq; |
| 484 | __le64 size, max_size, truncate_size; | 476 | __le64 size, max_size, truncate_size; |
| @@ -673,7 +665,7 @@ struct ceph_mds_caps { | |||
| 673 | __le64 size, max_size, truncate_size; | 665 | __le64 size, max_size, truncate_size; |
| 674 | __le32 truncate_seq; | 666 | __le32 truncate_seq; |
| 675 | struct ceph_timespec mtime, atime, ctime; | 667 | struct ceph_timespec mtime, atime, ctime; |
| 676 | struct ceph_file_layout layout; | 668 | struct ceph_file_layout_legacy layout; |
| 677 | __le32 time_warp_seq; | 669 | __le32 time_warp_seq; |
| 678 | } __attribute__ ((packed)); | 670 | } __attribute__ ((packed)); |
| 679 | 671 | ||
